WCSim
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WCSimPhysicsListFactory.cc
Go to the documentation of this file.
2 
3 #include "G4PhysicalConstants.hh"
4 #include "G4SystemOfUnits.hh"
5 
6 /* This code draws upon examples/extended/fields/field04 for inspiration */
7 
8 
9 
11 {
12  defaultCutValue = 1.0*mm;
13  SetVerboseLevel(1);
14 
15  PhysicsListName="NULL_LIST"; // default list is set in WCSimPhysicsListFactoryMessenger to FTFP_BERT
16  factory = new G4PhysListFactory();
17  // TODO create opticalPhyscics object?
18 
19  std::vector<G4String> ValidListsVector = factory->AvailablePhysLists();
20  G4int nlists = ValidListsVector.size();
21  G4cout << "There are " << nlists << " available physics lists, and they are: " << G4endl;
22  for (G4int i=0; i<nlists; i++){
23  G4cout << " " << ValidListsVector[i] << G4endl;
24  ValidListsString += ValidListsVector[i];
25  ValidListsString += " ";
26  }
27  //G4cout << "ValidListsString=" << ValidListsString << G4endl;
28 
30 
31 }
32 
34 {
35  delete PhysicsMessenger;
36  PhysicsMessenger = NULL;
37 
38 }
39 
41 {
42  G4VModularPhysicsList::ConstructParticle();
43 }
44 
46 {
47  G4VModularPhysicsList::ConstructProcess();
48 }
49 
51 {
52  if (verboseLevel >0){
53  G4cout << "WCSimPhysicsListFactory::SetCuts:";
54  G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
55  }
56 
57  // set cut values for gamma at first and for e- second and next for e+,
58  // because some processes for e+/e- need cut values for gamma
59  //
60  SetCutValue(defaultCutValue, "gamma");
61  SetCutValue(defaultCutValue, "e-");
62  SetCutValue(defaultCutValue, "e+");
63 
64  if (verboseLevel>0) DumpCutValuesTable();
65 
66 }
67 
68 void WCSimPhysicsListFactory::SetList(G4String newvalue){
69  G4cout << "Setting Physics list to " << newvalue << " and delaying initialization" << G4endl;
70  PhysicsListName = newvalue;
71 }
72 
74  G4cout << "Initializing physics list " << PhysicsListName << G4endl;
75 
76  G4VModularPhysicsList* phys = 0;
77 
78  if (factory->IsReferencePhysList(PhysicsListName)) {
79  phys=factory->GetReferencePhysList(PhysicsListName);
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  G4cout << "RegisterPhysics: OpticalPhysics" << G4endl;
88  RegisterPhysics(new G4OpticalPhysics());
89 
90  // Add Radioactive Decay:
91  G4cout << "RegisterPhysics: RadioactiveDecayPhysics" << G4endl;
92  RegisterPhysics( new G4RadioactiveDecayPhysics );
93 
94  } else {
95  G4cout << "Physics list " << PhysicsListName << " is not understood" << G4endl;
96  }
97 }
98 
100 {
102 }
void SaveOptionsToOutput(WCSimRootOptions *wcopt)
WCSimPhysicsListFactoryMessenger * PhysicsMessenger
void SetPhysicsListName(string iPhysicsListName)
void SetList(G4String newvalue)