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 //_____________________________________________________________________________
26 TG4ModularPhysicsList::TG4ModularPhysicsList()
27 : G4VModularPhysicsList(),
31 defaultCutValue = 1.0*mm;
36 //_____________________________________________________________________________
37 TG4ModularPhysicsList::TG4ModularPhysicsList(const TG4ModularPhysicsList& right)
40 TG4Globals::Exception("TG4ModularPhysicsList is protected from copying.");
43 //_____________________________________________________________________________
44 TG4ModularPhysicsList::~TG4ModularPhysicsList() {
47 // fExtDecayer is deleted in G4Decay destructor
52 //_____________________________________________________________________________
53 TG4ModularPhysicsList&
54 TG4ModularPhysicsList::operator=(const TG4ModularPhysicsList &right)
56 // check assignement to self
57 if (this == &right) return *this;
59 TG4Globals::Exception("TG4ModularPhysicsList is protected from assigning.");
66 //_____________________________________________________________________________
67 void TG4ModularPhysicsList::ConstructParticle()
69 // In this method, static member functions should be called
70 // for all particles which you want to use.
71 // This ensures that objects of these particle types will be
72 // created in the program.
75 // lock physics manager
76 TG4G3PhysicsManager* g3PhysicsManager = TG4G3PhysicsManager::Instance();
77 g3PhysicsManager->Lock();
79 // create all particles
81 ConstructAllLeptons();
83 ConstructAllBaryons();
85 ConstructAllShortLiveds();
87 // create particles for registered physics
88 G4VModularPhysicsList::ConstructParticle();
91 //_____________________________________________________________________________
92 void TG4ModularPhysicsList::ConstructProcess()
94 // Constructs all processes.
97 // create processes for registered physics
98 G4VModularPhysicsList::ConstructProcess();
103 if (verboseLevel>1) PrintAllProcesses();
106 //_____________________________________________________________________________
107 void TG4ModularPhysicsList::ConstructAllBosons()
109 // Construct all bosons
112 G4BosonConstructor pConstructor;
113 pConstructor.ConstructParticle();
116 //_____________________________________________________________________________
117 void TG4ModularPhysicsList::ConstructAllLeptons()
119 // Construct all leptons
122 G4LeptonConstructor pConstructor;
123 pConstructor.ConstructParticle();
126 //_____________________________________________________________________________
127 void TG4ModularPhysicsList::ConstructAllMesons()
129 // Construct all mesons
132 G4MesonConstructor pConstructor;
133 pConstructor.ConstructParticle();
136 //_____________________________________________________________________________
137 void TG4ModularPhysicsList::ConstructAllBaryons()
139 // Construct all barions
142 G4BaryonConstructor pConstructor;
143 pConstructor.ConstructParticle();
146 //_____________________________________________________________________________
147 void TG4ModularPhysicsList::ConstructAllIons()
149 // Construct light ions
152 G4IonConstructor pConstructor;
153 pConstructor.ConstructParticle();
156 //_____________________________________________________________________________
157 void TG4ModularPhysicsList::ConstructAllShortLiveds()
159 // Construct resonaces and quarks
162 G4ShortLivedConstructor pConstructor;
163 pConstructor.ConstructParticle();
166 //_____________________________________________________________________________
167 void TG4ModularPhysicsList::ConstructGeneral()
169 // Constructs general processes.
173 G4Decay* theDecayProcess = new G4Decay();
175 // Set external decayer
176 AliDecayer* aliDecayer = gMC->Decayer();
178 TG4ExtDecayer* tg4Decayer = new TG4ExtDecayer(aliDecayer);
179 // the tg4Decayer is deleted in G4Decay destructor
180 tg4Decayer->SetVerboseLevel(1);
181 theDecayProcess->SetExtDecayer(tg4Decayer);
183 if (verboseLevel>0) G4cout << "### External decayer is set" << G4endl;
186 theParticleIterator->reset();
187 while( (*theParticleIterator)() ){
188 G4ParticleDefinition* particle = theParticleIterator->value();
189 G4ProcessManager* pmanager = particle->GetProcessManager();
190 if (theDecayProcess->IsApplicable(*particle)) {
191 pmanager ->AddProcess(theDecayProcess);
192 // set ordering for PostStepDoIt and AtRestDoIt
193 pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
194 pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
201 //_____________________________________________________________________________
202 void TG4ModularPhysicsList::SetCuts()
204 // Sets the default cut value for all particle types
206 // The cut value for e-/e+ is high in oredr to supress
207 // tracking of delta electrons.
210 // SetCutsWithDefault();
211 // "G4VUserPhysicsList::SetCutsWithDefault" method sets
212 // the default cut value for all particle types.
215 G4double cut = defaultCutValue;
216 //G4double ecut = 10.*m;
220 if (verboseLevel >1){
221 G4cout << "G4VUserPhysicsList::SetCutsWithDefault:";
222 G4cout << "CutLength : " << cut/mm << " (mm)" << G4endl;
226 // set cut values for gamma at first and for e- second and next for e+,
227 // because some processes for e+/e- need cut values for gamma
228 SetCutValue(cut, "gamma");
229 SetCutValue(ecut, "e-");
230 SetCutValue(ecut, "e+");
232 // set cut values for proton and anti_proton before all other hadrons
233 // because some processes for hadrons need cut values for proton/anti_proton
234 SetCutValue(cut, "proton");
235 SetCutValue(cut, "anti_proton");
237 SetCutValueForOthers(cut);
239 if (verboseLevel>1) {
240 DumpCutValuesTable();
244 //_____________________________________________________________________________
245 void TG4ModularPhysicsList::SetProcessActivation()
247 // (In)Activates built processes according
248 // to the setup in TG4G3PhysicsManager::fControlVector.
251 TG4G3PhysicsManager* g3PhysicsManager = TG4G3PhysicsManager::Instance();
252 TG4G3ControlVector* controlVector = g3PhysicsManager->GetControlVector();
254 // uncomment following lines to print
255 // the controlVector values
256 //for (G4int i=0; i<kNoG3Controls; i++)
257 //{ cout << i << " control: " << (*controlVector)[i] << G4endl; }
260 theParticleIterator->reset();
261 while ((*theParticleIterator)())
263 G4ParticleDefinition* particle = theParticleIterator->value();
264 G4ProcessManager* processManager = particle->GetProcessManager();
265 G4ProcessVector* processVector = processManager->GetProcessList();
267 // set processes controls
268 for (G4int i=0; i<processManager->GetProcessListLength(); i++) {
269 G4int control = controlVector->GetControl((*processVector)[i]);
270 if ((control == kInActivate) &&
271 (processManager->GetProcessActivation(i))) {
272 if (verboseLevel>1) {
273 G4cout << "Set process inactivation for "
274 << (*processVector)[i]->GetProcessName() << G4endl;
276 processManager->SetProcessActivation(i,false);
278 else if (((control == kActivate) || (control == kActivate2)) &&
279 (!processManager->GetProcessActivation(i))) {
280 if (verboseLevel>1) {
281 G4cout << "Set process activation for "
282 << (*processVector)[i]->GetProcessName() << G4endl;
284 processManager->SetProcessActivation(i,true);
290 G4String text = "TG4ModularPhysicsList::SetProcessActivation: \n";
291 text = text + " Vector of processes controls is not set.";
292 TG4Globals::Warning(text);
296 //_____________________________________________________________________________
297 void TG4ModularPhysicsList::PrintAllProcesses() const
299 // Prints all processes.
302 G4cout << "TG4ModularPhysicsList processes: " << G4endl;
303 G4cout << "========================= " << G4endl;
305 G4ProcessTable* processTable = G4ProcessTable::GetProcessTable();
306 G4ProcessTable::G4ProcNameVector* processNameList
307 = processTable->GetNameList();
309 for (G4int i=0; i <processNameList->size(); i++){
310 G4cout << " " << (*processNameList)[i] << G4endl;