Ignore:
Timestamp:
Jan 8, 2010, 3:02:48 PM (14 years ago)
Author:
garnier
Message:

update to geant4.9.3

Location:
trunk/examples/extended/field/field04
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/extended/field/field04/field04.cc

    r807 r1230  
    2525//
    2626//
    27 // $Id: field04.cc,v 1.7 2007/11/02 10:53:41 gcosmo Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: field04.cc,v 1.11 2009/10/30 10:17:43 allison Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
     
    4545#include "G4UImanager.hh"
    4646
    47 #include "G4UIterminal.hh"
    48 #include "G4UItcsh.hh"
    49 
    5047#include "Randomize.hh"
    5148
     
    6562#endif
    6663
     64#ifdef G4UI_USE
     65#include "G4UIExecutive.hh"
     66#endif
     67
    6768// argc holds the number of arguments (including the name) on the command line
    6869// -> it is ONE when only the name is  given !!!
     
    7273int main(int argc,char** argv)
    7374{
    74   G4bool useUItcsh = true;
    75 
    7675  G4String physicsList = "QGSP_BERT";
    7776
    78   G4int seed = 0;
     77  G4int seed = 123;
    7978  if (argc  > 2) seed = atoi(argv[argc-1]);
    8079
     80  // Choose the Random engine
     81
     82  CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
    8183  CLHEP::HepRandom::setTheSeed(seed);
    8284
    8385#ifndef WIN32
    8486  G4int c = 0;
    85   while ((c=getopt(argc,argv,"p:t")) != -1)
     87  while ((c=getopt(argc,argv,"p")) != -1)
    8688  {
    8789     switch (c)
     
    9092         physicsList = optarg;
    9193         G4cout << "Physics List used is " <<  physicsList << G4endl;
    92          break;
    93        case 't': // Don't use a tcsh-style command line interface
    94          useUItcsh = false;
    9594         break;
    9695       case ':':       /* -p without operand */
     
    105104#endif
    106105
    107   // Choose the Random engine
    108 
    109   CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
    110  
    111106  // My Verbose output class
    112107
     
    148143  // Get the pointer to the User Interface manager
    149144
    150   G4UImanager * UI = G4UImanager::GetUIpointer(); 
     145  G4UImanager * UImanager = G4UImanager::GetUIpointer(); 
    151146
    152147#ifndef WIN32
     
    160155     {
    161156         G4String macroFilename = argv[optind];
    162          UI->ApplyCommand(command+macroFilename);
     157         UImanager->ApplyCommand(command+macroFilename);
    163158     }
    164159  }
    165   else
    166   {
    167      // Define (G)UI terminal for interactive mode
    168      G4UIsession * session = 0;
    169      if (useUItcsh)
    170      {
    171         // G4UIterminal is a terminal with tcsh-like control.
    172         session = new G4UIterminal(new G4UItcsh);
    173      }
    174      else
    175      {
    176         // G4UIterminal is a (dumb) terminal.
    177         session = new G4UIterminal();
    178      }
    179      session->SessionStart();
    180      delete session;
    181   }
    182160#else  // Simple UI for Windows runs, no possibility of additional arguments
    183   if (argc==1)   // Define UI terminal for interactive mode 
    184   {
    185      G4UIsession * session = new G4UIterminal;
    186      session->SessionStart();
    187      delete session;
    188   }
    189   else           // Batch mode
     161  if (argc!=1)
    190162  {
    191163     G4String command = "/control/execute ";
    192164     G4String fileName = argv[1];
    193      UI->ApplyCommand(command+fileName);
     165     UImanager->ApplyCommand(command+fileName);
    194166  }
    195 #endif     
     167#endif
     168  else  {
     169     // Define (G)UI terminal for interactive mode
     170#ifdef G4UI_USE
     171     G4UIExecutive * ui = new G4UIExecutive(argc,argv);
     172#ifdef G4VIS_USE
     173     UImanager->ApplyCommand("/control/execute vis.mac");     
     174#endif
     175     ui->SessionStart();
     176     delete ui;
     177#endif
     178  }
     179
    196180  // job termination
    197181
  • trunk/examples/extended/field/field04/include/F04DetectorMessenger.hh

    r807 r1230  
    2626//
    2727// $Id: F04DetectorMessenger.hh,v 1.1 2007/10/30 02:01:47 gum Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/examples/extended/field/field04/include/F04PhysicsList.hh

    r807 r1230  
    4949    virtual ~F04PhysicsList();
    5050
    51     void ConstructParticle();
    52    
    5351    void SetCuts();
    5452    void SetCutForGamma(G4double);
     
    5957    F04StepMax* GetStepMaxProcess();
    6058    void AddStepMax();
    61    
    62     /// Add physics to the Physics List   
    63     void AddPhysicsList(const G4String& name);
     59/*   
     60    /// Remove specific physics from physics list.
     61    void RemoveFromPhysicsList(const G4String&);
    6462
    65     /// Remove specific EM physics from EM physics list.
    66     void RemoveFromEMPhysicsList(const G4String&);
     63    /// Make sure that the physics list is empty.
     64    void ClearPhysics();
     65*/
     66    void ConstructParticle();
     67    void ConstructProcess();
    6768
    68     /// Remove specific Hadron physics from Hadron physics list.
    69     void RemoveFromHadronPhysicsList(const G4String&);
    70 
    71     /// Make sure that the EM physics list is empty.
    72     void ClearEMPhysics();
    73 
    74     /// Make sure that the hadron physics list is empty.
    75     void ClearHadronPhysics();
    76 
    77     void ConstructProcess();
    78     void List();
    79  
    8069private:
    81 
    82     typedef std::vector<G4VPhysicsConstructor*>  PhysicsListVector;
    83 
    84     void SetStandardList(G4bool flagHP = false, G4bool glauber = false);
    8570
    8671    G4double fCutForGamma;
    8772    G4double fCutForElectron;
    8873    G4double fCutForPositron;
    89 
    90     G4VPhysicsConstructor*  fParticleList;
    91 
    92     PhysicsListVector* fEMPhysics;
    93     PhysicsListVector* fHadronPhysics;
    9474
    9575    G4double MaxChargedStep;
     
    9878    F04PhysicsListMessenger* fMessenger;
    9979
    100     G4bool fDump;
    10180};
     81
    10282#endif
  • trunk/examples/extended/field/field04/include/F04PhysicsListMessenger.hh

    r807 r1230  
    7373    G4UIcmdWithADoubleAndUnit* fAllCutCMD;
    7474    G4UIcmdWithADoubleAndUnit* fStepMaxCMD;
    75 
    76     G4UIcmdWithAString*        fAddPhysicsCMD;
    77     G4UIcmdWithAString*        fRemoveEMPhysicsCMD;
    78     G4UIcmdWithAString*        fRemoveHadronPhysicsCMD;
    79     G4UIcmdWithoutParameter*   fClearEMPhysicsCMD;
    80     G4UIcmdWithoutParameter*   fClearHadronPhysicsCMD;
    81 
    82     G4UIcmdWithoutParameter*   fListCMD;
    83 
     75/*
     76    G4UIcmdWithAString*        fRemovePhysicsCMD;
     77    G4UIcmdWithoutParameter*   fClearPhysicsCMD;
     78*/
    8479    G4UIcmdWithoutParameter* fPienuCMD;
    8580    G4UIcmdWithoutParameter* fPimunuCMD;
  • trunk/examples/extended/field/field04/include/F04RunAction.hh

    r807 r1230  
    5656    G4int GetRndmFreq()          {return saveRndm;}
    5757
     58    inline void SetAutoSeed (const G4bool val) {autoSeed = val;}
     59
    5860  private:
    5961 
     
    6163
    6264    G4int saveRndm;
     65    G4bool autoSeed;
     66
    6367};
    6468
  • trunk/examples/extended/field/field04/include/F04RunActionMessenger.hh

    r807 r1230  
    4343class G4UIcmdWithAnInteger;
    4444class G4UIcmdWithAString;
     45class G4UIcmdWithABool;
    4546
    4647class F04RunActionMessenger : public G4UImessenger
     
    5960    G4UIdirectory*             RndmDir;
    6061    G4UIcmdWithAnInteger*      RndmSaveCmd;   
    61     G4UIcmdWithAString*        RndmReadCmd;   
     62    G4UIcmdWithAString*        RndmReadCmd;
     63    G4UIcmdWithABool*          SetAutoSeedCmd;
    6264 
    6365};
  • trunk/examples/extended/field/field04/src/F04Materials.cc

    r807 r1230  
    9494  elements.push_back("H");     natoms.push_back(10);
    9595
    96   // density = 1.032*g/cm3;
    97   // ==> when using ConstructNewMaterial give the density in g/cm3
    98   // ==> but do NOT multiply by the unit!!!
    99 
    100   density = 1.032;
     96  density = 1.032*g/cm3;;
    10197
    10298  Sci = nistMan->
  • trunk/examples/extended/field/field04/src/F04PhysicsList.cc

    r807 r1230  
    3131
    3232#include "F04ExtraPhysics.hh"
    33 //#include "F04OpticalPhysics.hh"
    34 
    35 #include "G4DecayPhysics.hh"
    36 
    37 #include "G4EmStandardPhysics_option1.hh"
    38 #include "G4EmStandardPhysics_option2.hh"
    39 #include "G4EmStandardPhysics.hh"
    40 
    41 #include "G4EmExtraPhysics.hh"
    42 #include "G4EmProcessOptions.hh"
    43 
    44 #include "G4HadronElasticPhysics.hh"
    45 #include "G4HadronQElasticPhysics.hh"
    46 #include "G4HadronHElasticPhysics.hh"
    47 #include "G4NeutronTrackingCut.hh"
    48 #include "G4QStoppingPhysics.hh"
    49 #include "G4LHEPStoppingPhysics.hh"
    50 #include "G4IonBinaryCascadePhysics.hh"
    51 #include "G4IonPhysics.hh"
    52 
    53 #include "HadronPhysicsFTFP.hh"
    54 #include "HadronPhysicsFTFC.hh"
    55 
    56 #include "HadronPhysicsLHEP.hh"
    57 #include "HadronPhysicsLHEP_BERT.hh"
    58 #include "HadronPhysicsLHEP_EMV.hh"
    59 #include "HadronPhysicsLHEP_PRECO_HP.hh"
    60 
    61 #include "HadronPhysicsQGSC.hh"
    62 #include "HadronPhysicsQGSC_EFLOW.hh"
    63 
    64 #include "HadronPhysicsQGSP.hh"
    65 #include "HadronPhysicsQGSP_BERT.hh"
    66 #include "HadronPhysicsQGSP_BERT_HP.hh"
    67 #include "HadronPhysicsQGSP_BERT_TRV.hh"
    68 #include "HadronPhysicsQGSP_BIC.hh"
    69 #include "HadronPhysicsQGSP_BIC_HP.hh"
    70 
    71 #include "G4HadronInelasticQBBC.hh"
    72 #include "G4HadronInelasticQLHEP.hh"
    73 
    74 #include "G4IonPhysics.hh"
    75 
    76 #include "G4HadronProcessStore.hh"
     33#include "G4OpticalPhysics.hh"
    7734
    7835#include "G4LossTableManager.hh"
     
    8138#include "G4ParticleTypes.hh"
    8239#include "G4ParticleTable.hh"
     40
     41#include "G4PhysListFactory.hh"
    8342
    8443#include "G4Gamma.hh"
     
    10564    fCutForElectron  = defaultCutValue;
    10665    fCutForPositron  = defaultCutValue;
    107     fDump            = false;
    10866
    10967    fMessenger = new F04PhysicsListMessenger(this);
    11068
    111     fEMPhysics     = new PhysicsListVector();
    112     fHadronPhysics = new PhysicsListVector();
    113 
    114     // Particles
    115     fParticleList = new G4DecayPhysics("decays");
    116 
    117     // EM physics
    118     AddPhysicsList("emstandard_opt1");
    119 
    120     // Set the default hadronic physics.
    121     AddPhysicsList(physicsList);
     69    SetVerboseLevel(1);
     70
     71    G4PhysListFactory factory;
     72    G4VModularPhysicsList* phys = 0;
     73
     74    if(factory.IsReferencePhysList(physicsList))
     75      phys =factory.GetReferencePhysList(physicsList);
     76
     77    // Physics List is defined via environment variable PHYSLIST
     78    if(!phys) phys = factory.ReferencePhysList();
     79
     80    for (G4int i = 0; ; ++i) {
     81       G4VPhysicsConstructor* elem =
     82                  const_cast<G4VPhysicsConstructor*> (phys->GetPhysics(i));
     83       if (elem == NULL) break;
     84       G4cout << "RegisterPhysics: " << elem->GetPhysicsName() << G4endl;
     85       RegisterPhysics(elem);
     86    }
     87
     88    RegisterPhysics(new F04ExtraPhysics());
     89    RegisterPhysics(new G4OpticalPhysics());
    12290
    12391    stepMaxProcess = new F04StepMax();
     
    12795{
    12896    delete fMessenger;
    129     delete fParticleList;
    130 
    131     ClearEMPhysics();
    132     ClearHadronPhysics();
    133 
    134     delete fEMPhysics;
    135     delete fHadronPhysics;
    13697
    13798    delete stepMaxProcess;
    13899}
    139100
    140 void F04PhysicsList::ClearEMPhysics()
    141 {
    142     for (PhysicsListVector::iterator p  = fEMPhysics->begin();
    143                                      p != fEMPhysics->end(); ++p) {
    144         delete (*p);
    145     }
    146     fEMPhysics->clear();
    147 }
    148 
    149 void F04PhysicsList::ClearHadronPhysics()
    150 {
    151     for (PhysicsListVector::iterator p  = fHadronPhysics->begin();
    152                                      p != fHadronPhysics->end(); ++p) {
    153         delete (*p);
    154     }
    155     fHadronPhysics->clear();
    156 }
    157 
    158101void F04PhysicsList::ConstructParticle()
    159102{
    160     fParticleList->ConstructParticle();
     103    G4VModularPhysicsList::ConstructParticle();
    161104
    162105    G4DecayTable* MuonPlusDecayTable = new G4DecayTable();
     
    173116                            G4MuonRadiativeDecayChannelWithSpin("mu-",0.014));
    174117    G4MuonMinus::MuonMinusDefinition() -> SetDecayTable(MuonMinusDecayTable);
    175 
    176118}
    177119
    178120void F04PhysicsList::ConstructProcess()
    179121{
    180     AddTransportation();
    181 
    182     for (PhysicsListVector::iterator p  = fEMPhysics->begin();
    183                                      p != fEMPhysics->end(); ++p) {
    184         (*p)->ConstructProcess();
    185     }
    186 
    187     fParticleList->ConstructProcess();
     122    G4VModularPhysicsList::ConstructProcess();
    188123
    189124    G4DecayWithSpin* decayWithSpin = new G4DecayWithSpin();
     
    243178    }
    244179
    245     for (PhysicsListVector::iterator p  = fHadronPhysics->begin();
    246                                      p != fHadronPhysics->end();++p) {
    247         (*p)->ConstructProcess();
    248     }
    249 
    250180    AddStepMax();
    251 
    252     if (fDump) G4HadronProcessStore::Instance()->Dump(1);
    253 }
    254 
    255 void F04PhysicsList::RemoveFromEMPhysicsList(const G4String& name)
     181}
     182
     183/*
     184void F04PhysicsList::RemoveFromPhysicsList(const G4String& name)
    256185{
    257186    G4bool success = false;
    258     for (PhysicsListVector::iterator p  = fEMPhysics->begin();
    259                                      p != fEMPhysics->end(); ++p) {
     187    for (G4PhysConstVector::iterator p  = physicsVector->begin();
     188                                     p != physicsVector->end(); ++p) {
    260189        G4VPhysicsConstructor* e = (*p);
    261190        if (e->GetPhysicsName() == name) {
    262            fEMPhysics->erase(p);
     191           physicsVector->erase(p);
    263192           success = true;
    264193           break;
     
    267196    if (!success) {
    268197       std::ostringstream message;
    269        message << "PhysicsList::RemoveFromEMPhysicsList "<< name << "not found";
     198       message << "PhysicsList::RemoveFromPhysicsList "<< name << "not found";
    270199       G4Exception(message.str().c_str());
    271200    }
    272201}
    273202
    274 void F04PhysicsList::RemoveFromHadronPhysicsList(const G4String& name)
    275 {
    276     G4bool success = false;
    277     for (PhysicsListVector::iterator p  = fHadronPhysics->begin();
    278                                      p != fHadronPhysics->end(); ++p) {
    279         G4VPhysicsConstructor* e = (*p);
    280         if (e->GetPhysicsName() == name) {
    281            fHadronPhysics->erase(p);
    282            success = true;
    283            break;
    284         }
    285     }
    286     if (!success) {
    287        G4String message("F04PhysicsList::RemoveFromHadronPhysicsList \"");
    288        message += name;
    289        message += " not found \"";
    290        G4Exception(message);
    291     }
    292 }
    293 
    294 void F04PhysicsList::AddPhysicsList(const G4String& name)
    295 {
    296     if (verboseLevel>0) {
    297         G4cout << "F04PhysicsList::AddPhysicsList: <" << name
    298                << ">" << G4endl;
    299     }
    300 
    301     if (name == "emstandard_opt1") {
    302 
    303        ClearEMPhysics();
    304        fEMPhysics->push_back(new G4EmStandardPhysics_option1());
    305        fEMPhysics->push_back(new F04ExtraPhysics());
    306 //       fEMPhysics->push_back(new F04OpticalPhysics());
    307 
    308     } else if (name == "emstandard_opt2") {
    309 
    310        ClearEMPhysics();
    311        fEMPhysics->push_back(new G4EmStandardPhysics_option2());
    312        fEMPhysics->push_back(new F04ExtraPhysics());
    313 //       fEMPhysics->push_back(new F04OpticalPhysics());
    314 
    315    } else if (name == "FTFC") {
    316 
    317        SetStandardList(false, false);
    318        fHadronPhysics->push_back(new HadronPhysicsFTFC("hadron",true));
    319 
    320     } else if (name == "FTFP") {
    321 
    322        SetStandardList(false, false);
    323        fHadronPhysics->push_back(new HadronPhysicsFTFP("hadron",true));
    324 
    325     } else if (name == "FTFP_EMV") {
    326 
    327        AddPhysicsList("emstandard_opt1");
    328        AddPhysicsList("FTFP");
    329 
    330     } else if (name == "LHEP") {
    331 
    332        ClearHadronPhysics();
    333        fHadronPhysics->push_back(new G4EmExtraPhysics("gamma_nuc"));
    334        fHadronPhysics->push_back(new G4HadronElasticPhysics("LElastic",
    335                                                            verboseLevel,
    336                                                            false));
    337        fHadronPhysics->push_back(new HadronPhysicsLHEP("hadron"));
    338        fHadronPhysics->push_back(new G4IonPhysics("ion"));
    339        fDump = true;
    340  
    341     } else if (name == "LHEP_BERT") {
    342 
    343        ClearHadronPhysics();
    344        fHadronPhysics->push_back(new G4EmExtraPhysics("gamma_nuc"));
    345        fHadronPhysics->push_back(new G4HadronElasticPhysics("LElastic",
    346                                                            verboseLevel,
    347                                                            false));
    348        fHadronPhysics->push_back(new HadronPhysicsLHEP_BERT("hadron"));
    349        fHadronPhysics->push_back(new G4QStoppingPhysics("stopping",
    350                                                        verboseLevel));
    351        fHadronPhysics->push_back(new G4IonPhysics("ion"));
    352        fDump = true;
    353 
    354     } else if (name == "LHEP_EMV") {
    355 
    356        ClearHadronPhysics();
    357        AddPhysicsList("emstandard_opt1");
    358        fHadronPhysics->push_back(new G4EmExtraPhysics("gamma_nuc"));
    359        fHadronPhysics->push_back(new G4HadronElasticPhysics("LElastic",
    360                                                            verboseLevel,
    361                                                            false));
    362        fHadronPhysics->push_back(new HadronPhysicsLHEP_EMV("hadron"));
    363        fHadronPhysics->push_back(new G4QStoppingPhysics("stopping",
    364                                                         verboseLevel));
    365        fHadronPhysics->push_back(new G4IonPhysics("ion"));
    366        fDump = true;
    367 
    368     } else if (name == "LHEP_PRECO_HP") {
    369 
    370        ClearHadronPhysics();
    371        fHadronPhysics->push_back(new G4EmExtraPhysics("gamma_nuc"));
    372        fHadronPhysics->push_back(new G4HadronElasticPhysics("LElastic",
    373                                                            verboseLevel,
    374                                                            false));
    375        fHadronPhysics->push_back(new HadronPhysicsLHEP_PRECO_HP("hadron"));
    376        fHadronPhysics->push_back(new G4QStoppingPhysics("stopping",
    377                                                        verboseLevel));
    378        fHadronPhysics->push_back(new G4IonPhysics("ion"));
    379        fDump = true;
    380 
    381     } else if (name == "QBBC") {
    382 
    383        SetStandardList(false,true);
    384        fHadronPhysics->push_back(new G4HadronInelasticQBBC("QBBC",
    385                                                           verboseLevel,
    386                                                           false,false,
    387                                                           false,false,true));
    388 
    389     } else if (name == "QBBCG") {
    390 
    391        SetStandardList(false, false);
    392        fHadronPhysics->push_back(new G4HadronInelasticQBBC("QBBC",
    393                                                           verboseLevel,
    394                                                           false,false,
    395                                                           false,false,false));
    396 
    397     } else if (name == "QBEC") {
    398 
    399        SetStandardList(false,true);
    400        fHadronPhysics->push_back(new G4HadronInelasticQBBC("QBBC",
    401                                                           verboseLevel,
    402                                                           false,true,
    403                                                           false,false,true));
    404 
    405     } else if (name == "QBBC_HP") {
    406 
    407        SetStandardList(true,true);
    408        fHadronPhysics->push_back(new G4HadronInelasticQBBC("QBBC",
    409                                                           verboseLevel,
    410                                                           false,false,
    411                                                           false,true,true));
    412 
    413     } else if (name == "QBEC_HP") {
    414 
    415        SetStandardList(true,true);
    416        fHadronPhysics->push_back(new G4HadronInelasticQBBC("QBBC",
    417                                                           verboseLevel,
    418                                                           false,true,
    419                                                           false,true,true));
    420 
    421     } else if (name == "QGSC") {
    422 
    423        ClearHadronPhysics();
    424        fHadronPhysics->push_back(new G4EmExtraPhysics("gamma_nuc"));
    425        fHadronPhysics->push_back(new G4HadronQElasticPhysics("QElastic",
    426                                                             verboseLevel));
    427        fHadronPhysics->push_back(new HadronPhysicsQGSC("hadron",true));
    428        fHadronPhysics->push_back(new G4QStoppingPhysics("stopping",
    429                                                        verboseLevel,false));
    430        fHadronPhysics->push_back(new G4IonPhysics("ion"));
    431        fHadronPhysics->push_back(new G4NeutronTrackingCut());
    432        fDump = true;
    433 
    434     } else if (name == "QGSC_EFLOW") {
    435 
    436        ClearHadronPhysics();
    437        fHadronPhysics->push_back(new G4EmExtraPhysics("gamma_nuc"));
    438        fHadronPhysics->push_back(new G4HadronQElasticPhysics("QElastic",
    439                                                             verboseLevel));
    440        fHadronPhysics->push_back(new HadronPhysicsQGSC_EFLOW("hadron",true));
    441        fHadronPhysics->push_back(new G4QStoppingPhysics("stopping",
    442                                                        verboseLevel,false));
    443        fHadronPhysics->push_back(new G4IonPhysics("ion"));
    444        fHadronPhysics->push_back(new G4NeutronTrackingCut());
    445        fDump = true;
    446 
    447     } else if (name == "QGSC_EMV") {
    448 
    449        AddPhysicsList("emstandard_opt1");
    450        AddPhysicsList("QGSC");
    451 
    452     } else if (name == "QGSP") {
    453 
    454        SetStandardList(false, false);
    455        fHadronPhysics->push_back(new HadronPhysicsQGSP("hadron",true));
    456 
    457     } else if (name == "QGSP_BERT") {
    458 
    459        SetStandardList(false, false);
    460        fHadronPhysics->push_back(new HadronPhysicsQGSP_BERT("hadron",true));
    461 
    462     } else if (name == "QGSP_BERT_EMV") {
    463 
    464        AddPhysicsList("emstandard_opt1");
    465        AddPhysicsList("QGSP_BERT");
    466 
    467     } else if (name == "QGSP_BERT_HP") {
    468 
    469        SetStandardList(true, false);
    470        fHadronPhysics->push_back(new HadronPhysicsQGSP_BERT_HP("hadron",true));
    471 
    472     } else if (name == "QGSP_BERT_NQE") {
    473 
    474        SetStandardList(false, false);
    475        fHadronPhysics->push_back(new HadronPhysicsQGSP_BERT("hadron",false));
    476 
    477     } else if (name == "QGSP_BERT_TRV") {
    478 
    479        SetStandardList(false, false);
    480        fHadronPhysics->push_back(new HadronPhysicsQGSP_BERT_TRV("hadron",true));
    481 
    482     } else if (name == "QGSP_BIC") {
    483 
    484        SetStandardList(false, false);
    485        fHadronPhysics->push_back(new HadronPhysicsQGSP_BIC("hadron",true));
    486 
    487     } else if (name == "QGSP_BIC_HP") {
    488 
    489        SetStandardList(true, false);
    490        fHadronPhysics->push_back(new HadronPhysicsQGSP_BIC_HP("hadron",true));
    491 
    492     } else if (name == "QGSP_EMV") {
    493 
    494        AddPhysicsList("emstandard_opt1");
    495        AddPhysicsList("QGSP");
    496 
    497     } else if (name == "QGSP_EMV_NQE") {
    498 
    499        AddPhysicsList("emstandard_opt1");
    500        AddPhysicsList("QGSP_NQE");
    501 
    502     } else if (name == "QGSP_EMX") {
    503 
    504        AddPhysicsList("emstandard_opt2");
    505        AddPhysicsList("QGSP");
    506 
    507     } else if (name == "QGSP_NQE") {
    508 
    509        SetStandardList(false, false);
    510        fHadronPhysics->push_back(new HadronPhysicsQGSP("hadron",false));
    511 
    512     } else if (name == "QGSP_QEL") {
    513 
    514        ClearHadronPhysics();
    515        fHadronPhysics->push_back(new G4EmExtraPhysics("gamma_nuc"));
    516        fHadronPhysics->push_back(new G4HadronQElasticPhysics("QElastic",
    517                                                             verboseLevel));
    518        fHadronPhysics->push_back(new HadronPhysicsQGSP("hadron",true));
    519        fHadronPhysics->push_back(new G4QStoppingPhysics("stopping",
    520                                                        verboseLevel));
    521        fHadronPhysics->push_back(new G4IonPhysics("ion"));
    522        fHadronPhysics->push_back(new G4NeutronTrackingCut());
    523        fDump = true;
    524 
    525     } else {
    526 
    527        G4cout << "F04PhysicsList::AddPhysicsList: <" << name << ">"
    528               << " is not defined" << G4endl;
    529     }
    530 }
    531 
    532 void F04PhysicsList::SetStandardList(G4bool flagHP, G4bool glauber)
    533 {
    534     ClearHadronPhysics();
    535 
    536     fHadronPhysics->push_back(new G4EmExtraPhysics("gamma_nuc"));
    537     fHadronPhysics->push_back(new G4HadronElasticPhysics("elastic",
    538                                                         verboseLevel,
    539                                                         flagHP,glauber));
    540     fHadronPhysics->push_back(new  G4QStoppingPhysics("stopping",
    541                                                      verboseLevel));
    542     fHadronPhysics->push_back(new G4IonBinaryCascadePhysics("binary_ion"));
    543     fHadronPhysics->push_back(new G4NeutronTrackingCut());
    544 
    545     fDump = true;
    546 }
     203void F04PhysicsList::ClearPhysics()
     204{
     205    for (G4PhysConstVector::iterator p  = physicsVector->begin();
     206                                     p != physicsVector->end(); ++p) {
     207        delete (*p);
     208    }
     209    physicsVector->clear();
     210}
     211*/
    547212
    548213void F04PhysicsList::SetCuts()
     
    581246}
    582247
    583 void F04PhysicsList::List()
    584 {
    585     G4cout << "### PhysicsLists available: FTFC FTFP FTFP_EMV"
    586            << " LHEP LHEP_BERT LHEP_EMV"
    587            << G4endl;
    588     G4cout << "                            LHEP_PRECO_HP QBBC QBBCG"
    589            << " QBEC QBBC_HP QBEC_HP"
    590            << G4endl;
    591     G4cout << "                            QGSC QGSC_EFLOW QGSC_EMV"
    592            << " QGSP QGSP_BERT QGSP_BER_EMV"
    593            << G4endl;
    594     G4cout << "                            QGSP_BERT_HP QGSP_BERT_NQE"
    595            << " QGSP_BERT_TRV"
    596            << G4endl;
    597     G4cout << "                            QGSP_BIC QGSP_BIC_HP QGSP_EMV"
    598            << " QGSP_EMV_NQE"
    599            << G4endl;
    600     G4cout << "                            QGSC_EMX QGSP_NQE QGSP_QEL"
    601            << G4endl;
    602 }
    603 
    604248void F04PhysicsList::SetStepMax(G4double step)
    605249{
  • trunk/examples/extended/field/field04/src/F04PhysicsListMessenger.cc

    r807 r1230  
    8787    fStepMaxCMD->SetDefaultUnit("mm");
    8888    fStepMaxCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
     89/*
     90    fClearPhysicsCMD = new G4UIcmdWithoutParameter("/exp/phys/clearPhysics",this);
     91    fClearPhysicsCMD->SetGuidance("Clear the physics list");
     92    fClearPhysicsCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
    8993
    90     fAddPhysicsCMD = new G4UIcmdWithAString("/exp/phys/addPhysics",this);
    91     fAddPhysicsCMD->SetGuidance("Add to modular physics list");
    92     fAddPhysicsCMD->SetParameterName("PList",false);
    93     fAddPhysicsCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
    94 
    95     fClearEMPhysicsCMD = new G4UIcmdWithoutParameter("/exp/phys/clearEMPhysics",this);
    96     fClearEMPhysicsCMD->SetGuidance("Clear the EM physics list");
    97     fClearEMPhysicsCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
    98 
    99     fClearHadronPhysicsCMD = new G4UIcmdWithoutParameter("/exp/phys/clearHadronPhysics",this);
    100     fClearHadronPhysicsCMD->SetGuidance("Clear the Hadron physics list");
    101     fClearHadronPhysicsCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
    102 
    103     fRemoveEMPhysicsCMD = new G4UIcmdWithAString("/exp/phys/removeEMPhysics",this);
    104     fRemoveEMPhysicsCMD->SetGuidance("Remove a physics process from EM Physics List");
    105     fRemoveEMPhysicsCMD->SetParameterName("PList",false);
    106     fRemoveEMPhysicsCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
    107 
    108     fRemoveHadronPhysicsCMD = new G4UIcmdWithAString("/exp/phys/removeHadronPhysics",this);
    109     fRemoveHadronPhysicsCMD->SetGuidance("Remove a physics process from Hadron Physics List");
    110     fRemoveHadronPhysicsCMD->SetParameterName("PList",false);
    111     fRemoveHadronPhysicsCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
    112 
    113     fListCMD = new G4UIcmdWithoutParameter("/exp/phys/list",this);
    114     fListCMD->SetGuidance("Available Physics Lists");
    115     fListCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
    116 
     94    fRemovePhysicsCMD = new G4UIcmdWithAString("/exp/phys/removePhysics",this);
     95    fRemovePhysicsCMD->SetGuidance("Remove a physics process from Physics List");
     96    fRemovePhysicsCMD->SetParameterName("PList",false);
     97    fRemovePhysicsCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
     98*/
    11799    fDecayDirectory = new G4UIdirectory("/decay/");
    118100    fDecayDirectory->SetGuidance("Decay chain control commands.");
     
    132114    delete fPosCutCMD;
    133115    delete fAllCutCMD;
    134 
    135     delete fAddPhysicsCMD;
    136     delete fClearEMPhysicsCMD;
    137     delete fClearHadronPhysicsCMD;
    138     delete fRemoveEMPhysicsCMD;
    139     delete fRemoveHadronPhysicsCMD;
    140 
    141     delete fListCMD;
    142 
     116/*
     117    delete fClearPhysicsCMD;
     118    delete fRemovePhysicsCMD;
     119*/
    143120    delete fPienuCMD;
    144121    delete fPimunuCMD;
     
    191168                                     ->GetNewDoubleValue(newValue));
    192169    }
    193     else if (command == fAddPhysicsCMD) {
     170/*  else if (command == fClearPhysicsCMD) {
     171        fPhysicsList->ClearPhysics();
     172    }
     173    else if (command == fRemovePhysicsCMD) {
    194174        G4String name = newValue;
    195         if (name == "PHYSLIST") {
    196             char* path = getenv(name);
    197             if (path) name = G4String(path);
    198             else {
    199                 G4cout << "### F04PhysicsListMessenger WARNING: "
    200                        << " environment variable PHYSLIST is not defined"
    201                        << G4endl;
    202                 return;
    203             }
    204         }
    205         fPhysicsList->AddPhysicsList(name);
     175        fPhysicsList->RemoveFromPhysicsList(name);
    206176    }
    207     else if (command == fClearEMPhysicsCMD) {
    208         fPhysicsList->ClearEMPhysics();
    209     }
    210     else if (command == fClearHadronPhysicsCMD) {
    211         fPhysicsList->ClearHadronPhysics();
    212     }
    213     else if (command == fRemoveEMPhysicsCMD) {
    214         G4String name = newValue;
    215         fPhysicsList->RemoveFromEMPhysicsList(name);
    216     }
    217     else if (command == fRemoveHadronPhysicsCMD) {
    218         G4String name = newValue;
    219         fPhysicsList->RemoveFromHadronPhysicsList(name);
    220     }
    221     else if (command == fListCMD) {
    222         fPhysicsList->List();
    223     }
     177*/
    224178}
  • trunk/examples/extended/field/field04/src/F04RunAction.cc

    r807 r1230  
    3838
    3939F04RunAction::F04RunAction()
    40   : saveRndm(0)
     40  : saveRndm(0), autoSeed(false)
    4141{
    4242  runMessenger = new F04RunActionMessenger(this);
     
    5454  G4RunManager::GetRunManager()->SetRandomNumberStore(true);
    5555  G4RunManager::GetRunManager()->SetRandomNumberStoreDir("random/");
     56
     57  if (autoSeed) {
     58     // automatic (time-based) random seeds for each run
     59     G4cout << "*******************" << G4endl;
     60     G4cout << "*** AUTOSEED ON ***" << G4endl;
     61     G4cout << "*******************" << G4endl;
     62     long seeds[2];
     63     time_t systime = time(NULL);
     64     seeds[0] = (long) systime;
     65     seeds[1] = (long) (systime*G4UniformRand());
     66     CLHEP::HepRandom::setTheSeeds(seeds);
     67     CLHEP::HepRandom::showEngineStatus();
     68  } else {
     69     CLHEP::HepRandom::showEngineStatus();
     70  }
    5671 
    57   if (saveRndm > 0)
    58   {
    59       CLHEP::HepRandom::showEngineStatus();
    60       CLHEP::HepRandom::saveEngineStatus("BeginOfRun.rndm");
    61   }
     72  if (saveRndm > 0) CLHEP::HepRandom::saveEngineStatus("BeginOfRun.rndm");
    6273
    6374  FieldList* fields = F04GlobalField::getObject()->getFields();
     
    7384void F04RunAction::EndOfRunAction(const G4Run*)
    7485{
    75   if (saveRndm == 1)
    76   {
     86  if (saveRndm == 1) {
    7787     CLHEP::HepRandom::showEngineStatus();
    7888     CLHEP::HepRandom::saveEngineStatus("endOfRun.rndm");
  • trunk/examples/extended/field/field04/src/F04RunActionMessenger.cc

    r807 r1230  
    3333#include "G4UIcmdWithAnInteger.hh"
    3434#include "G4UIcmdWithAString.hh"
     35#include "G4UIcmdWithABool.hh"
    3536
    3637#include "F04RunAction.hh"
     
    5758  RndmReadCmd->SetParameterName("fileName",true);
    5859  RndmReadCmd->SetDefaultValue ("beginOfRun.rndm");
    59   RndmReadCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 
     60  RndmReadCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
     61
     62  SetAutoSeedCmd = new G4UIcmdWithABool("/rndm/autoSeed",this);
     63  SetAutoSeedCmd->SetGuidance("Switch on/off time-based random seeds");
     64  SetAutoSeedCmd->SetGuidance(" true: run seeds determined by system time");
     65  SetAutoSeedCmd->SetGuidance("false: use command 'random/resetEngineFrom'");
     66  SetAutoSeedCmd->SetGuidance("Default = false");
     67  SetAutoSeedCmd->SetParameterName("autoSeed", false);
     68  SetAutoSeedCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
    6069}
    6170
    6271F04RunActionMessenger::~F04RunActionMessenger()
    6372{
    64   delete RndmDir; delete RndmSaveCmd; delete RndmReadCmd;
     73  delete RndmDir; delete RndmSaveCmd; delete RndmReadCmd; delete SetAutoSeedCmd;
    6574}
    6675
    67 void F04RunActionMessenger::SetNewValue(G4UIcommand* command,G4String newValues)
     76void F04RunActionMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
    6877{
    6978  if (command == RndmSaveCmd)
    70       runAction->SetRndmFreq(RndmSaveCmd->GetNewIntValue(newValues));
     79      runAction->SetRndmFreq(RndmSaveCmd->GetNewIntValue(newValue));
    7180                 
    7281  if (command == RndmReadCmd)
    73   {  G4cout << "\n---> rndm status restored from file: " << newValues << G4endl;
    74      CLHEP::HepRandom::restoreEngineStatus(newValues);
     82  {  G4cout << "\n---> rndm status restored from file: " << newValue << G4endl;
     83     CLHEP::HepRandom::restoreEngineStatus(newValue);
    7584     CLHEP::HepRandom::showEngineStatus();
    76   }   
     85  }
     86
     87  if(command == SetAutoSeedCmd)
     88      runAction->SetAutoSeed(SetAutoSeedCmd->GetNewBoolValue(newValue));
    7789}
Note: See TracChangeset for help on using the changeset viewer.