4 // See the class description in the header file.
6 #include "TG4ModularPhysicsList.h"
7 #include "TG4G3PhysicsManager.h"
8 #include "TG4G3ControlVector.h"
9 #include "TG4ExtDecayer.h"
10 #include "AliDecayer.h"
13 #include <G4ParticleDefinition.hh>
14 #include <G4ProcessManager.hh>
15 #include <G4BosonConstructor.hh>
16 #include <G4LeptonConstructor.hh>
17 #include <G4MesonConstructor.hh>
18 #include <G4BaryonConstructor.hh>
19 #include <G4IonConstructor.hh>
20 #include <G4ShortLivedConstructor.hh>
21 #include <G4ProcessTable.hh>
25 TG4ModularPhysicsList::TG4ModularPhysicsList()
26 : G4VModularPhysicsList(),
30 defaultCutValue = 1.0*mm;
35 TG4ModularPhysicsList::TG4ModularPhysicsList(const TG4ModularPhysicsList& right)
38 TG4Globals::Exception("TG4ModularPhysicsList is protected from copying.");
41 TG4ModularPhysicsList::~TG4ModularPhysicsList() {
44 // fExtDecayer is deleted in G4Decay destructor
49 TG4ModularPhysicsList&
50 TG4ModularPhysicsList::operator=(const TG4ModularPhysicsList &right)
52 // check assignement to self
53 if (this == &right) return *this;
55 TG4Globals::Exception("TG4ModularPhysicsList is protected from assigning.");
62 void TG4ModularPhysicsList::ConstructParticle()
64 // In this method, static member functions should be called
65 // for all particles which you want to use.
66 // This ensures that objects of these particle types will be
67 // created in the program.
70 // lock physics manager
71 TG4G3PhysicsManager* g3PhysicsManager = TG4G3PhysicsManager::Instance();
72 g3PhysicsManager->Lock();
74 // create all particles
76 ConstructAllLeptons();
78 ConstructAllBaryons();
80 ConstructAllShortLiveds();
82 // create particles for registered physics
83 G4VModularPhysicsList::ConstructParticle();
86 void TG4ModularPhysicsList::ConstructProcess()
88 // Constructs all processes.
91 // create processes for registered physics
92 G4VModularPhysicsList::ConstructProcess();
97 if (verboseLevel>1) PrintAllProcesses();
101 void TG4ModularPhysicsList::ConstructAllBosons()
103 // Construct all bosons
106 G4BosonConstructor pConstructor;
107 pConstructor.ConstructParticle();
110 void TG4ModularPhysicsList::ConstructAllLeptons()
112 // Construct all leptons
115 G4LeptonConstructor pConstructor;
116 pConstructor.ConstructParticle();
119 void TG4ModularPhysicsList::ConstructAllMesons()
121 // Construct all mesons
124 G4MesonConstructor pConstructor;
125 pConstructor.ConstructParticle();
128 void TG4ModularPhysicsList::ConstructAllBaryons()
130 // Construct all barions
133 G4BaryonConstructor pConstructor;
134 pConstructor.ConstructParticle();
137 void TG4ModularPhysicsList::ConstructAllIons()
139 // Construct light ions
142 G4IonConstructor pConstructor;
143 pConstructor.ConstructParticle();
146 void TG4ModularPhysicsList::ConstructAllShortLiveds()
148 // Construct resonaces and quarks
151 G4ShortLivedConstructor pConstructor;
152 pConstructor.ConstructParticle();
155 void TG4ModularPhysicsList::ConstructGeneral()
157 // Constructs general processes.
161 G4Decay* theDecayProcess = new G4Decay();
163 // Set external decayer
164 AliDecayer* aliDecayer = gMC->Decayer();
166 TG4ExtDecayer* tg4Decayer = new TG4ExtDecayer(aliDecayer);
167 // the tg4Decayer is deleted in G4Decay destructor
168 tg4Decayer->SetVerboseLevel(1);
169 theDecayProcess->SetExtDecayer(tg4Decayer);
171 if (verboseLevel>0) G4cout << "### External decayer is set" << G4endl;
174 theParticleIterator->reset();
175 while( (*theParticleIterator)() ){
176 G4ParticleDefinition* particle = theParticleIterator->value();
177 G4ProcessManager* pmanager = particle->GetProcessManager();
178 if (theDecayProcess->IsApplicable(*particle)) {
179 pmanager ->AddProcess(theDecayProcess);
180 // set ordering for PostStepDoIt and AtRestDoIt
181 pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
182 pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
189 void TG4ModularPhysicsList::SetCuts()
191 // Sets the default cut value for all particle types
193 // The cut value for e-/e+ is high in oredr to supress
194 // tracking of delta electrons.
197 // SetCutsWithDefault();
198 // "G4VUserPhysicsList::SetCutsWithDefault" method sets
199 // the default cut value for all particle types.
202 G4double cut = defaultCutValue;
203 //G4double ecut = 10.*m;
207 if (verboseLevel >1){
208 G4cout << "G4VUserPhysicsList::SetCutsWithDefault:";
209 G4cout << "CutLength : " << cut/mm << " (mm)" << G4endl;
213 // set cut values for gamma at first and for e- second and next for e+,
214 // because some processes for e+/e- need cut values for gamma
215 SetCutValue(cut, "gamma");
216 SetCutValue(ecut, "e-");
217 SetCutValue(ecut, "e+");
219 // set cut values for proton and anti_proton before all other hadrons
220 // because some processes for hadrons need cut values for proton/anti_proton
221 SetCutValue(cut, "proton");
222 SetCutValue(cut, "anti_proton");
224 SetCutValueForOthers(cut);
226 if (verboseLevel>1) {
227 DumpCutValuesTable();
231 void TG4ModularPhysicsList::SetProcessActivation()
233 // (In)Activates built processes according
234 // to the setup in TG4G3PhysicsManager::fControlVector.
237 TG4G3PhysicsManager* g3PhysicsManager = TG4G3PhysicsManager::Instance();
238 TG4G3ControlVector* controlVector = g3PhysicsManager->GetControlVector();
240 // uncomment following lines to print
241 // the controlVector values
242 //for (G4int i=0; i<kNoG3Controls; i++)
243 //{ cout << i << " control: " << (*controlVector)[i] << G4endl; }
246 theParticleIterator->reset();
247 while ((*theParticleIterator)())
249 G4ParticleDefinition* particle = theParticleIterator->value();
250 G4ProcessManager* processManager = particle->GetProcessManager();
251 G4ProcessVector* processVector = processManager->GetProcessList();
253 // set processes controls
254 for (G4int i=0; i<processManager->GetProcessListLength(); i++) {
255 G4int control = controlVector->GetControl((*processVector)[i]);
256 if ((control == kInActivate) &&
257 (processManager->GetProcessActivation(i))) {
258 if (verboseLevel>1) {
259 G4cout << "Set process inactivation for "
260 << (*processVector)[i]->GetProcessName() << G4endl;
262 processManager->SetProcessActivation(i,false);
264 else if (((control == kActivate) || (control == kActivate2)) &&
265 (!processManager->GetProcessActivation(i))) {
266 if (verboseLevel>1) {
267 G4cout << "Set process activation for "
268 << (*processVector)[i]->GetProcessName() << G4endl;
270 processManager->SetProcessActivation(i,true);
276 G4String text = "TG4ModularPhysicsList::SetProcessActivation: \n";
277 text = text + " Vector of processes controls is not set.";
278 TG4Globals::Warning(text);
282 void TG4ModularPhysicsList::PrintAllProcesses() const
284 // Prints all processes.
287 G4cout << "TG4ModularPhysicsList processes: " << G4endl;
288 G4cout << "========================= " << G4endl;
290 G4ProcessTable* processTable = G4ProcessTable::GetProcessTable();
291 G4ProcessTable::G4ProcNameVector* processNameList
292 = processTable->GetNameList();
294 for (G4int i=0; i <processNameList->size(); i++){
295 G4cout << " " << (*processNameList)[i] << G4endl;