]>
Commit | Line | Data |
---|---|---|
f04eb3a5 | 1 | // $Id$ |
2 | // Category: physics | |
3 | // | |
4 | // See the class description in the header file. | |
5 | ||
6 | #include "TG4ModularPhysicsList.h" | |
7 | #include "TG4G3PhysicsManager.h" | |
8 | #include "TG4G3ControlVector.h" | |
8496e315 | 9 | #include "TG4ExtDecayer.h" |
10 | #include "AliDecayer.h" | |
11 | #include "AliMC.h" | |
f04eb3a5 | 12 | |
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> | |
22 | #include <G4Decay.hh> | |
23 | ||
24 | ||
25 | TG4ModularPhysicsList::TG4ModularPhysicsList() | |
8496e315 | 26 | : G4VModularPhysicsList(), |
27 | fExtDecayer(0) | |
f04eb3a5 | 28 | { |
8496e315 | 29 | // |
f04eb3a5 | 30 | defaultCutValue = 1.0*mm; |
31 | ||
32 | SetVerboseLevel(1); | |
33 | } | |
34 | ||
8496e315 | 35 | TG4ModularPhysicsList::TG4ModularPhysicsList(const TG4ModularPhysicsList& right) |
36 | { | |
37 | // | |
38 | TG4Globals::Exception("TG4ModularPhysicsList is protected from copying."); | |
39 | } | |
40 | ||
f04eb3a5 | 41 | TG4ModularPhysicsList::~TG4ModularPhysicsList() { |
42 | // | |
8496e315 | 43 | //delete fExtDecayer; |
44 | // fExtDecayer is deleted in G4Decay destructor | |
45 | } | |
46 | ||
47 | // operators | |
48 | ||
49 | TG4ModularPhysicsList& | |
50 | TG4ModularPhysicsList::operator=(const TG4ModularPhysicsList &right) | |
51 | { | |
52 | // check assignement to self | |
53 | if (this == &right) return *this; | |
54 | ||
55 | TG4Globals::Exception("TG4ModularPhysicsList is protected from assigning."); | |
56 | ||
57 | return *this; | |
f04eb3a5 | 58 | } |
59 | ||
60 | // protected methods | |
61 | ||
62 | void TG4ModularPhysicsList::ConstructParticle() | |
63 | { | |
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. | |
68 | // --- | |
69 | ||
f04eb3a5 | 70 | // lock physics manager |
71 | TG4G3PhysicsManager* g3PhysicsManager = TG4G3PhysicsManager::Instance(); | |
72 | g3PhysicsManager->Lock(); | |
73 | ||
74 | // create all particles | |
75 | ConstructAllBosons(); | |
76 | ConstructAllLeptons(); | |
77 | ConstructAllMesons(); | |
78 | ConstructAllBaryons(); | |
79 | ConstructAllIons(); | |
80 | ConstructAllShortLiveds(); | |
81 | ||
82 | // create particles for registered physics | |
83 | G4VModularPhysicsList::ConstructParticle(); | |
84 | } | |
85 | ||
86 | void TG4ModularPhysicsList::ConstructProcess() | |
87 | { | |
88 | // Constructs all processes. | |
89 | // --- | |
90 | ||
f04eb3a5 | 91 | // create processes for registered physics |
92 | G4VModularPhysicsList::ConstructProcess(); | |
93 | ||
94 | ConstructGeneral(); | |
95 | ||
96 | // verbose | |
97 | if (verboseLevel>1) PrintAllProcesses(); | |
98 | } | |
99 | ||
100 | ||
101 | void TG4ModularPhysicsList::ConstructAllBosons() | |
102 | { | |
103 | // Construct all bosons | |
104 | // --- | |
105 | ||
106 | G4BosonConstructor pConstructor; | |
107 | pConstructor.ConstructParticle(); | |
108 | } | |
109 | ||
110 | void TG4ModularPhysicsList::ConstructAllLeptons() | |
111 | { | |
112 | // Construct all leptons | |
113 | // --- | |
114 | ||
115 | G4LeptonConstructor pConstructor; | |
116 | pConstructor.ConstructParticle(); | |
117 | } | |
118 | ||
119 | void TG4ModularPhysicsList::ConstructAllMesons() | |
120 | { | |
121 | // Construct all mesons | |
122 | // --- | |
123 | ||
124 | G4MesonConstructor pConstructor; | |
125 | pConstructor.ConstructParticle(); | |
126 | } | |
127 | ||
128 | void TG4ModularPhysicsList::ConstructAllBaryons() | |
129 | { | |
130 | // Construct all barions | |
131 | // --- | |
132 | ||
133 | G4BaryonConstructor pConstructor; | |
134 | pConstructor.ConstructParticle(); | |
135 | } | |
136 | ||
137 | void TG4ModularPhysicsList::ConstructAllIons() | |
138 | { | |
139 | // Construct light ions | |
140 | // --- | |
141 | ||
142 | G4IonConstructor pConstructor; | |
143 | pConstructor.ConstructParticle(); | |
144 | } | |
145 | ||
146 | void TG4ModularPhysicsList::ConstructAllShortLiveds() | |
147 | { | |
148 | // Construct resonaces and quarks | |
149 | // --- | |
150 | ||
151 | G4ShortLivedConstructor pConstructor; | |
152 | pConstructor.ConstructParticle(); | |
153 | } | |
154 | ||
155 | void TG4ModularPhysicsList::ConstructGeneral() | |
156 | { | |
157 | // Constructs general processes. | |
158 | // --- | |
159 | ||
160 | // Add Decay Process | |
161 | G4Decay* theDecayProcess = new G4Decay(); | |
8496e315 | 162 | |
163 | // Set external decayer | |
164 | AliDecayer* aliDecayer = gMC->Decayer(); | |
165 | if (aliDecayer) { | |
166 | TG4ExtDecayer* tg4Decayer = new TG4ExtDecayer(aliDecayer); | |
167 | // the tg4Decayer is deleted in G4Decay destructor | |
168 | tg4Decayer->SetVerboseLevel(1); | |
169 | theDecayProcess->SetExtDecayer(tg4Decayer); | |
170 | ||
171 | if (verboseLevel>0) G4cout << "### External decayer is set" << G4endl; | |
172 | } | |
173 | ||
f04eb3a5 | 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); | |
183 | } | |
184 | } | |
185 | } | |
186 | ||
187 | // public methods | |
188 | ||
189 | void TG4ModularPhysicsList::SetCuts() | |
190 | { | |
191 | // Sets the default cut value for all particle types | |
192 | // other then e-/e+. | |
193 | // The cut value for e-/e+ is high in oredr to supress | |
194 | // tracking of delta electrons. | |
195 | // --- | |
196 | ||
197 | // SetCutsWithDefault(); | |
198 | // "G4VUserPhysicsList::SetCutsWithDefault" method sets | |
199 | // the default cut value for all particle types. | |
200 | ||
201 | // default cut value | |
202 | G4double cut = defaultCutValue; | |
8496e315 | 203 | //G4double ecut = 10.*m; |
204 | G4double ecut = cut; | |
f04eb3a5 | 205 | |
206 | #ifdef G4VERBOSE | |
207 | if (verboseLevel >1){ | |
208 | G4cout << "G4VUserPhysicsList::SetCutsWithDefault:"; | |
209 | G4cout << "CutLength : " << cut/mm << " (mm)" << G4endl; | |
210 | } | |
211 | #endif | |
212 | ||
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+"); | |
218 | ||
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"); | |
223 | ||
224 | SetCutValueForOthers(cut); | |
225 | ||
226 | if (verboseLevel>1) { | |
227 | DumpCutValuesTable(); | |
228 | } | |
229 | } | |
230 | ||
231 | void TG4ModularPhysicsList::SetProcessActivation() | |
232 | { | |
233 | // (In)Activates built processes according | |
234 | // to the setup in TG4G3PhysicsManager::fControlVector. | |
235 | // --- | |
236 | ||
f04eb3a5 | 237 | TG4G3PhysicsManager* g3PhysicsManager = TG4G3PhysicsManager::Instance(); |
238 | TG4G3ControlVector* controlVector = g3PhysicsManager->GetControlVector(); | |
239 | ||
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; } | |
244 | ||
245 | if (controlVector) { | |
246 | theParticleIterator->reset(); | |
247 | while ((*theParticleIterator)()) | |
248 | { | |
249 | G4ParticleDefinition* particle = theParticleIterator->value(); | |
250 | G4ProcessManager* processManager = particle->GetProcessManager(); | |
251 | G4ProcessVector* processVector = processManager->GetProcessList(); | |
252 | ||
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; | |
261 | } | |
262 | processManager->SetProcessActivation(i,false); | |
263 | } | |
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; | |
269 | } | |
270 | processManager->SetProcessActivation(i,true); | |
271 | } | |
272 | } | |
273 | } | |
274 | } | |
275 | else { | |
276 | G4String text = "TG4ModularPhysicsList::SetProcessActivation: \n"; | |
277 | text = text + " Vector of processes controls is not set."; | |
278 | TG4Globals::Warning(text); | |
279 | } | |
f04eb3a5 | 280 | } |
281 | ||
282 | void TG4ModularPhysicsList::PrintAllProcesses() const | |
283 | { | |
284 | // Prints all processes. | |
285 | // --- | |
286 | ||
287 | G4cout << "TG4ModularPhysicsList processes: " << G4endl; | |
288 | G4cout << "========================= " << G4endl; | |
289 | ||
290 | G4ProcessTable* processTable = G4ProcessTable::GetProcessTable(); | |
291 | G4ProcessTable::G4ProcNameVector* processNameList | |
292 | = processTable->GetNameList(); | |
293 | ||
294 | for (G4int i=0; i <processNameList->size(); i++){ | |
295 | G4cout << " " << (*processNameList)[i] << G4endl; | |
296 | } | |
297 | } | |
298 |