Changeset 1230 for trunk/examples/extended/field/field04
- Timestamp:
- Jan 8, 2010, 3:02:48 PM (14 years ago)
- Location:
- trunk/examples/extended/field/field04
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/extended/field/field04/field04.cc
r807 r1230 25 25 // 26 26 // 27 // $Id: field04.cc,v 1. 7 2007/11/02 10:53:41 gcosmoExp $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 $ 29 29 // 30 30 // … … 45 45 #include "G4UImanager.hh" 46 46 47 #include "G4UIterminal.hh"48 #include "G4UItcsh.hh"49 50 47 #include "Randomize.hh" 51 48 … … 65 62 #endif 66 63 64 #ifdef G4UI_USE 65 #include "G4UIExecutive.hh" 66 #endif 67 67 68 // argc holds the number of arguments (including the name) on the command line 68 69 // -> it is ONE when only the name is given !!! … … 72 73 int main(int argc,char** argv) 73 74 { 74 G4bool useUItcsh = true;75 76 75 G4String physicsList = "QGSP_BERT"; 77 76 78 G4int seed = 0;77 G4int seed = 123; 79 78 if (argc > 2) seed = atoi(argv[argc-1]); 80 79 80 // Choose the Random engine 81 82 CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine); 81 83 CLHEP::HepRandom::setTheSeed(seed); 82 84 83 85 #ifndef WIN32 84 86 G4int c = 0; 85 while ((c=getopt(argc,argv,"p :t")) != -1)87 while ((c=getopt(argc,argv,"p")) != -1) 86 88 { 87 89 switch (c) … … 90 92 physicsList = optarg; 91 93 G4cout << "Physics List used is " << physicsList << G4endl; 92 break;93 case 't': // Don't use a tcsh-style command line interface94 useUItcsh = false;95 94 break; 96 95 case ':': /* -p without operand */ … … 105 104 #endif 106 105 107 // Choose the Random engine108 109 CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);110 111 106 // My Verbose output class 112 107 … … 148 143 // Get the pointer to the User Interface manager 149 144 150 G4UImanager * UI = G4UImanager::GetUIpointer();145 G4UImanager * UImanager = G4UImanager::GetUIpointer(); 151 146 152 147 #ifndef WIN32 … … 160 155 { 161 156 G4String macroFilename = argv[optind]; 162 UI ->ApplyCommand(command+macroFilename);157 UImanager->ApplyCommand(command+macroFilename); 163 158 } 164 159 } 165 else166 {167 // Define (G)UI terminal for interactive mode168 G4UIsession * session = 0;169 if (useUItcsh)170 {171 // G4UIterminal is a terminal with tcsh-like control.172 session = new G4UIterminal(new G4UItcsh);173 }174 else175 {176 // G4UIterminal is a (dumb) terminal.177 session = new G4UIterminal();178 }179 session->SessionStart();180 delete session;181 }182 160 #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) 190 162 { 191 163 G4String command = "/control/execute "; 192 164 G4String fileName = argv[1]; 193 UI ->ApplyCommand(command+fileName);165 UImanager->ApplyCommand(command+fileName); 194 166 } 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 196 180 // job termination 197 181 -
trunk/examples/extended/field/field04/include/F04DetectorMessenger.hh
r807 r1230 26 26 // 27 27 // $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 $ 29 29 // 30 30 // -
trunk/examples/extended/field/field04/include/F04PhysicsList.hh
r807 r1230 49 49 virtual ~F04PhysicsList(); 50 50 51 void ConstructParticle();52 53 51 void SetCuts(); 54 52 void SetCutForGamma(G4double); … … 59 57 F04StepMax* GetStepMaxProcess(); 60 58 void AddStepMax(); 61 62 /// Add physics to the Physics List63 void AddPhysicsList(const G4String& name);59 /* 60 /// Remove specific physics from physics list. 61 void RemoveFromPhysicsList(const G4String&); 64 62 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(); 67 68 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 80 69 private: 81 82 typedef std::vector<G4VPhysicsConstructor*> PhysicsListVector;83 84 void SetStandardList(G4bool flagHP = false, G4bool glauber = false);85 70 86 71 G4double fCutForGamma; 87 72 G4double fCutForElectron; 88 73 G4double fCutForPositron; 89 90 G4VPhysicsConstructor* fParticleList;91 92 PhysicsListVector* fEMPhysics;93 PhysicsListVector* fHadronPhysics;94 74 95 75 G4double MaxChargedStep; … … 98 78 F04PhysicsListMessenger* fMessenger; 99 79 100 G4bool fDump;101 80 }; 81 102 82 #endif -
trunk/examples/extended/field/field04/include/F04PhysicsListMessenger.hh
r807 r1230 73 73 G4UIcmdWithADoubleAndUnit* fAllCutCMD; 74 74 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 */ 84 79 G4UIcmdWithoutParameter* fPienuCMD; 85 80 G4UIcmdWithoutParameter* fPimunuCMD; -
trunk/examples/extended/field/field04/include/F04RunAction.hh
r807 r1230 56 56 G4int GetRndmFreq() {return saveRndm;} 57 57 58 inline void SetAutoSeed (const G4bool val) {autoSeed = val;} 59 58 60 private: 59 61 … … 61 63 62 64 G4int saveRndm; 65 G4bool autoSeed; 66 63 67 }; 64 68 -
trunk/examples/extended/field/field04/include/F04RunActionMessenger.hh
r807 r1230 43 43 class G4UIcmdWithAnInteger; 44 44 class G4UIcmdWithAString; 45 class G4UIcmdWithABool; 45 46 46 47 class F04RunActionMessenger : public G4UImessenger … … 59 60 G4UIdirectory* RndmDir; 60 61 G4UIcmdWithAnInteger* RndmSaveCmd; 61 G4UIcmdWithAString* RndmReadCmd; 62 G4UIcmdWithAString* RndmReadCmd; 63 G4UIcmdWithABool* SetAutoSeedCmd; 62 64 63 65 }; -
trunk/examples/extended/field/field04/src/F04Materials.cc
r807 r1230 94 94 elements.push_back("H"); natoms.push_back(10); 95 95 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;; 101 97 102 98 Sci = nistMan-> -
trunk/examples/extended/field/field04/src/F04PhysicsList.cc
r807 r1230 31 31 32 32 #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" 77 34 78 35 #include "G4LossTableManager.hh" … … 81 38 #include "G4ParticleTypes.hh" 82 39 #include "G4ParticleTable.hh" 40 41 #include "G4PhysListFactory.hh" 83 42 84 43 #include "G4Gamma.hh" … … 105 64 fCutForElectron = defaultCutValue; 106 65 fCutForPositron = defaultCutValue; 107 fDump = false;108 66 109 67 fMessenger = new F04PhysicsListMessenger(this); 110 68 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()); 122 90 123 91 stepMaxProcess = new F04StepMax(); … … 127 95 { 128 96 delete fMessenger; 129 delete fParticleList;130 131 ClearEMPhysics();132 ClearHadronPhysics();133 134 delete fEMPhysics;135 delete fHadronPhysics;136 97 137 98 delete stepMaxProcess; 138 99 } 139 100 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 158 101 void F04PhysicsList::ConstructParticle() 159 102 { 160 fParticleList->ConstructParticle();103 G4VModularPhysicsList::ConstructParticle(); 161 104 162 105 G4DecayTable* MuonPlusDecayTable = new G4DecayTable(); … … 173 116 G4MuonRadiativeDecayChannelWithSpin("mu-",0.014)); 174 117 G4MuonMinus::MuonMinusDefinition() -> SetDecayTable(MuonMinusDecayTable); 175 176 118 } 177 119 178 120 void F04PhysicsList::ConstructProcess() 179 121 { 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(); 188 123 189 124 G4DecayWithSpin* decayWithSpin = new G4DecayWithSpin(); … … 243 178 } 244 179 245 for (PhysicsListVector::iterator p = fHadronPhysics->begin();246 p != fHadronPhysics->end();++p) {247 (*p)->ConstructProcess();248 }249 250 180 AddStepMax(); 251 252 if (fDump) G4HadronProcessStore::Instance()->Dump(1); 253 } 254 255 void F04PhysicsList::RemoveFromEMPhysicsList(const G4String& name) 181 } 182 183 /* 184 void F04PhysicsList::RemoveFromPhysicsList(const G4String& name) 256 185 { 257 186 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) { 260 189 G4VPhysicsConstructor* e = (*p); 261 190 if (e->GetPhysicsName() == name) { 262 fEMPhysics->erase(p);191 physicsVector->erase(p); 263 192 success = true; 264 193 break; … … 267 196 if (!success) { 268 197 std::ostringstream message; 269 message << "PhysicsList::RemoveFrom EMPhysicsList "<< name << "not found";198 message << "PhysicsList::RemoveFromPhysicsList "<< name << "not found"; 270 199 G4Exception(message.str().c_str()); 271 200 } 272 201 } 273 202 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 } 203 void F04PhysicsList::ClearPhysics() 204 { 205 for (G4PhysConstVector::iterator p = physicsVector->begin(); 206 p != physicsVector->end(); ++p) { 207 delete (*p); 208 } 209 physicsVector->clear(); 210 } 211 */ 547 212 548 213 void F04PhysicsList::SetCuts() … … 581 246 } 582 247 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 604 248 void F04PhysicsList::SetStepMax(G4double step) 605 249 { -
trunk/examples/extended/field/field04/src/F04PhysicsListMessenger.cc
r807 r1230 87 87 fStepMaxCMD->SetDefaultUnit("mm"); 88 88 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); 89 93 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 */ 117 99 fDecayDirectory = new G4UIdirectory("/decay/"); 118 100 fDecayDirectory->SetGuidance("Decay chain control commands."); … … 132 114 delete fPosCutCMD; 133 115 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 */ 143 120 delete fPienuCMD; 144 121 delete fPimunuCMD; … … 191 168 ->GetNewDoubleValue(newValue)); 192 169 } 193 else if (command == fAddPhysicsCMD) { 170 /* else if (command == fClearPhysicsCMD) { 171 fPhysicsList->ClearPhysics(); 172 } 173 else if (command == fRemovePhysicsCMD) { 194 174 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); 206 176 } 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 */ 224 178 } -
trunk/examples/extended/field/field04/src/F04RunAction.cc
r807 r1230 38 38 39 39 F04RunAction::F04RunAction() 40 : saveRndm(0) 40 : saveRndm(0), autoSeed(false) 41 41 { 42 42 runMessenger = new F04RunActionMessenger(this); … … 54 54 G4RunManager::GetRunManager()->SetRandomNumberStore(true); 55 55 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 } 56 71 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"); 62 73 63 74 FieldList* fields = F04GlobalField::getObject()->getFields(); … … 73 84 void F04RunAction::EndOfRunAction(const G4Run*) 74 85 { 75 if (saveRndm == 1) 76 { 86 if (saveRndm == 1) { 77 87 CLHEP::HepRandom::showEngineStatus(); 78 88 CLHEP::HepRandom::saveEngineStatus("endOfRun.rndm"); -
trunk/examples/extended/field/field04/src/F04RunActionMessenger.cc
r807 r1230 33 33 #include "G4UIcmdWithAnInteger.hh" 34 34 #include "G4UIcmdWithAString.hh" 35 #include "G4UIcmdWithABool.hh" 35 36 36 37 #include "F04RunAction.hh" … … 57 58 RndmReadCmd->SetParameterName("fileName",true); 58 59 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); 60 69 } 61 70 62 71 F04RunActionMessenger::~F04RunActionMessenger() 63 72 { 64 delete RndmDir; delete RndmSaveCmd; delete RndmReadCmd; 73 delete RndmDir; delete RndmSaveCmd; delete RndmReadCmd; delete SetAutoSeedCmd; 65 74 } 66 75 67 void F04RunActionMessenger::SetNewValue(G4UIcommand* command,G4String newValue s)76 void F04RunActionMessenger::SetNewValue(G4UIcommand* command,G4String newValue) 68 77 { 69 78 if (command == RndmSaveCmd) 70 runAction->SetRndmFreq(RndmSaveCmd->GetNewIntValue(newValue s));79 runAction->SetRndmFreq(RndmSaveCmd->GetNewIntValue(newValue)); 71 80 72 81 if (command == RndmReadCmd) 73 { G4cout << "\n---> rndm status restored from file: " << newValue s<< G4endl;74 CLHEP::HepRandom::restoreEngineStatus(newValue s);82 { G4cout << "\n---> rndm status restored from file: " << newValue << G4endl; 83 CLHEP::HepRandom::restoreEngineStatus(newValue); 75 84 CLHEP::HepRandom::showEngineStatus(); 76 } 85 } 86 87 if(command == SetAutoSeedCmd) 88 runAction->SetAutoSeed(SetAutoSeedCmd->GetNewBoolValue(newValue)); 77 89 }
Note: See TracChangeset
for help on using the changeset viewer.