]>
Commit | Line | Data |
---|---|---|
b94a914b | 1 | // $Id$ |
2 | // Category: physics | |
3 | // | |
e5967ab3 | 4 | // Author: I. Hrivnacova |
5 | // | |
6 | // Class TG4PhysicsConstructorSpecialControls | |
7 | // ------------------------------------------ | |
b94a914b | 8 | // See the class description in the header file. |
9 | ||
10 | #include "TG4PhysicsConstructorSpecialControls.h" | |
11 | #include "TG4SpecialControls.h" | |
12 | #include "TG4G3PhysicsManager.h" | |
13 | #include "TG4G3ControlVector.h" | |
14 | ||
15 | #include <G4ParticleDefinition.hh> | |
16 | #include <G4ProcessManager.hh> | |
17 | #include <G4VProcess.hh> | |
18 | ||
72095f7c | 19 | //_____________________________________________________________________________ |
b94a914b | 20 | TG4PhysicsConstructorSpecialControls::TG4PhysicsConstructorSpecialControls( |
21 | const G4String& name) | |
e7446667 | 22 | : TG4VPhysicsConstructor(name) { |
23 | // | |
24 | } | |
25 | ||
26 | //_____________________________________________________________________________ | |
27 | TG4PhysicsConstructorSpecialControls::TG4PhysicsConstructorSpecialControls( | |
28 | G4int verboseLevel, | |
29 | const G4String& name) | |
30 | : TG4VPhysicsConstructor(name, verboseLevel) { | |
b94a914b | 31 | // |
b94a914b | 32 | } |
33 | ||
72095f7c | 34 | //_____________________________________________________________________________ |
b94a914b | 35 | TG4PhysicsConstructorSpecialControls::~TG4PhysicsConstructorSpecialControls() { |
36 | // | |
37 | } | |
38 | ||
39 | // protected methods | |
40 | ||
72095f7c | 41 | //_____________________________________________________________________________ |
b94a914b | 42 | void TG4PhysicsConstructorSpecialControls::ConstructParticle() |
43 | { | |
44 | // The particles are constructed in the | |
45 | // TG4ModularPhysicsList. | |
46 | // --- | |
47 | } | |
48 | ||
72095f7c | 49 | //_____________________________________________________________________________ |
b94a914b | 50 | void TG4PhysicsConstructorSpecialControls::ConstructProcess() |
51 | { | |
52 | // Adds TG4SpecialControls "process" that activates | |
53 | // the control process controls defined in TG4Limits. | |
54 | // --- | |
55 | ||
56 | TG4G3PhysicsManager* g3PhysicsManager | |
57 | = TG4G3PhysicsManager::Instance(); | |
58 | ||
e5967ab3 | 59 | if (g3PhysicsManager->IsSpecialControls()) { |
b94a914b | 60 | TG4boolVector* isControlVector |
61 | = g3PhysicsManager->GetIsControlVector(); | |
62 | ||
63 | theParticleIterator->reset(); | |
64 | while ((*theParticleIterator)()) | |
65 | { | |
66 | G4ParticleDefinition* particle = theParticleIterator->value(); | |
67 | TG4G3ParticleWSP particleWSP | |
68 | = g3PhysicsManager->GetG3ParticleWSP(particle); | |
69 | //G4String name; | |
70 | //GetG3ParticleWSPName(particleWSP, name); | |
71 | ||
72 | // special process is set in case | |
73 | // the special control is set by TG4Limits | |
74 | if ((particleWSP !=kNofParticlesWSP) && | |
75 | ((*isControlVector)[particleWSP])) { | |
76 | // check if process already exists | |
77 | G4String processName = "specialControl"; | |
78 | G4VProcess* process = g3PhysicsManager->FindProcess(processName); | |
79 | if (!process) { | |
80 | process = new TG4SpecialControls(processName); | |
81 | } | |
82 | //particle->GetProcessManager()->AddProcess(process, 0, -1, 1); | |
83 | particle->GetProcessManager()->AddDiscreteProcess(process); | |
84 | } | |
85 | } | |
86 | ||
e7446667 | 87 | if (VerboseLevel() > 0) { |
e5967ab3 | 88 | G4cout << "### Special Controls constructed. " << G4endl; |
89 | G4cout << " Special controls process is defined for: " << G4endl | |
90 | << " "; | |
b94a914b | 91 | for (G4int i=0; i<kNofParticlesWSP; i++) { |
e5967ab3 | 92 | if ((*isControlVector)[i]) |
93 | G4cout << g3PhysicsManager->GetG3ParticleWSPName(i) << " "; | |
b94a914b | 94 | } |
95 | G4cout << G4endl; | |
96 | } | |
97 | } | |
98 | } | |
99 |