]>
Commit | Line | Data |
---|---|---|
b94a914b | 1 | // $Id$ |
2 | // Category: physics | |
3 | // | |
e5967ab3 | 4 | // Author: I. Hrivnacova |
5 | // | |
6 | // Class TG4PhysicsConstructorSpecialCuts | |
7 | // -------------------------------------- | |
b94a914b | 8 | // See the class description in the header file. |
9 | ||
10 | #include "TG4PhysicsConstructorSpecialCuts.h" | |
11 | #include "TG4G3PhysicsManager.h" | |
e5967ab3 | 12 | #include "TG4SpecialCutsForGamma.h" |
13 | #include "TG4SpecialCutsForElectron.h" | |
14 | #include "TG4SpecialCutsForEplus.h" | |
15 | #include "TG4SpecialCutsForChargedHadron.h" | |
16 | #include "TG4SpecialCutsForNeutralHadron.h" | |
17 | #include "TG4SpecialCutsForMuon.h" | |
18 | #include "TG4SpecialCutsForOther.h" | |
b94a914b | 19 | |
20 | #include <G4ParticleDefinition.hh> | |
21 | #include <G4ProcessManager.hh> | |
22 | #include <G4VProcess.hh> | |
23 | ||
24 | ||
72095f7c | 25 | //_____________________________________________________________________________ |
b94a914b | 26 | TG4PhysicsConstructorSpecialCuts::TG4PhysicsConstructorSpecialCuts( |
27 | const G4String& name) | |
28 | : G4VPhysicsConstructor(name) | |
29 | { | |
30 | // | |
31 | SetVerboseLevel(1); | |
32 | } | |
33 | ||
72095f7c | 34 | //_____________________________________________________________________________ |
b94a914b | 35 | TG4PhysicsConstructorSpecialCuts::~TG4PhysicsConstructorSpecialCuts() { |
36 | // | |
37 | } | |
38 | ||
39 | // protected methods | |
40 | ||
72095f7c | 41 | //_____________________________________________________________________________ |
b94a914b | 42 | void TG4PhysicsConstructorSpecialCuts::ConstructParticle() |
43 | { | |
44 | // The particles are constructed in the | |
45 | // TG4ModularPhysicsList. | |
46 | // --- | |
47 | } | |
48 | ||
72095f7c | 49 | //_____________________________________________________________________________ |
b94a914b | 50 | void TG4PhysicsConstructorSpecialCuts::ConstructProcess() |
51 | { | |
52 | // Adds TG4SpecialCuts "process" that activates | |
53 | // the kinetic energy cuts defined in | |
54 | // the vector of cuts (PhysicsManager::fCutVector) or in TG4Limits. | |
55 | // --- | |
56 | ||
e5967ab3 | 57 | TG4G3PhysicsManager* g3PhysicsManager = TG4G3PhysicsManager::Instance(); |
b94a914b | 58 | |
59 | if (g3PhysicsManager->IsSpecialCuts()) | |
60 | { | |
e5967ab3 | 61 | TG4boolVector* isCutVector = g3PhysicsManager->GetIsCutVector(); |
b94a914b | 62 | |
63 | theParticleIterator->reset(); | |
64 | while ((*theParticleIterator)()) | |
65 | { | |
66 | G4ParticleDefinition* particle = theParticleIterator->value(); | |
67 | TG4G3ParticleWSP particleWSP | |
68 | = g3PhysicsManager->GetG3ParticleWSP(particle); | |
e5967ab3 | 69 | G4String name = |
70 | g3PhysicsManager->GetG3ParticleWSPName(particleWSP); | |
b94a914b | 71 | |
72 | // uncomment this to see all particles "WSP" | |
73 | //G4cout << "Iterating particle: " | |
74 | // << particle->GetParticleName() << " " << particleWSP << " " | |
75 | // << name << G4endl; | |
76 | ||
b94a914b | 77 | if ((particleWSP !=kNofParticlesWSP) && |
78 | ((*isCutVector)[particleWSP])) { | |
e5967ab3 | 79 | // special process is created in case |
80 | // cutVector (vector of kinetic energy cuts) is set | |
81 | // or the special cut is set by TG4Limits | |
82 | ||
b94a914b | 83 | // check if process already exists |
e5967ab3 | 84 | G4String processName = "specialCutFor" + name; |
b94a914b | 85 | G4VProcess* process = g3PhysicsManager->FindProcess(processName); |
86 | if (!process) { | |
e5967ab3 | 87 | switch (particleWSP) { |
88 | case kGamma: | |
89 | process = new TG4SpecialCutsForGamma(processName); | |
90 | break; | |
91 | case kElectron: | |
92 | process = new TG4SpecialCutsForElectron(processName); | |
93 | break; | |
94 | case kEplus: | |
95 | process = new TG4SpecialCutsForEplus(processName); | |
96 | break; | |
97 | case kChargedHadron: | |
98 | process = new TG4SpecialCutsForChargedHadron(processName); | |
99 | break; | |
100 | case kNeutralHadron: | |
101 | process = new TG4SpecialCutsForNeutralHadron(processName); | |
102 | break; | |
103 | case kMuon: | |
104 | process = new TG4SpecialCutsForMuon(processName); | |
105 | break; | |
106 | case kAny: | |
107 | process = new TG4SpecialCutsForOther(processName); | |
108 | break; | |
109 | } | |
110 | } | |
111 | // add process to particle | |
b94a914b | 112 | particle->GetProcessManager()->AddDiscreteProcess(process); |
113 | } | |
114 | } | |
115 | ||
116 | if (verboseLevel>0) { | |
e5967ab3 | 117 | G4cout << "### Special Cuts constructed. " << G4endl; |
118 | G4cout << " Special cuts process is defined for: " << G4endl | |
119 | << " "; | |
b94a914b | 120 | for (G4int i=0; i<kAny; i++) { |
e5967ab3 | 121 | if ((*isCutVector)[i]) |
122 | G4cout << g3PhysicsManager->GetG3ParticleWSPName(i) << " "; | |
b94a914b | 123 | } |
124 | G4cout << G4endl; | |
125 | } | |
126 | } | |
127 | } | |
128 | ||
129 |