]>
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) | |
22 | : G4VPhysicsConstructor(name) | |
23 | { | |
24 | // | |
25 | SetVerboseLevel(1); | |
26 | } | |
27 | ||
72095f7c | 28 | //_____________________________________________________________________________ |
b94a914b | 29 | TG4PhysicsConstructorSpecialControls::~TG4PhysicsConstructorSpecialControls() { |
30 | // | |
31 | } | |
32 | ||
33 | // protected methods | |
34 | ||
72095f7c | 35 | //_____________________________________________________________________________ |
b94a914b | 36 | void TG4PhysicsConstructorSpecialControls::ConstructParticle() |
37 | { | |
38 | // The particles are constructed in the | |
39 | // TG4ModularPhysicsList. | |
40 | // --- | |
41 | } | |
42 | ||
72095f7c | 43 | //_____________________________________________________________________________ |
b94a914b | 44 | void TG4PhysicsConstructorSpecialControls::ConstructProcess() |
45 | { | |
46 | // Adds TG4SpecialControls "process" that activates | |
47 | // the control process controls defined in TG4Limits. | |
48 | // --- | |
49 | ||
50 | TG4G3PhysicsManager* g3PhysicsManager | |
51 | = TG4G3PhysicsManager::Instance(); | |
52 | ||
e5967ab3 | 53 | if (g3PhysicsManager->IsSpecialControls()) { |
b94a914b | 54 | TG4boolVector* isControlVector |
55 | = g3PhysicsManager->GetIsControlVector(); | |
56 | ||
57 | theParticleIterator->reset(); | |
58 | while ((*theParticleIterator)()) | |
59 | { | |
60 | G4ParticleDefinition* particle = theParticleIterator->value(); | |
61 | TG4G3ParticleWSP particleWSP | |
62 | = g3PhysicsManager->GetG3ParticleWSP(particle); | |
63 | //G4String name; | |
64 | //GetG3ParticleWSPName(particleWSP, name); | |
65 | ||
66 | // special process is set in case | |
67 | // the special control is set by TG4Limits | |
68 | if ((particleWSP !=kNofParticlesWSP) && | |
69 | ((*isControlVector)[particleWSP])) { | |
70 | // check if process already exists | |
71 | G4String processName = "specialControl"; | |
72 | G4VProcess* process = g3PhysicsManager->FindProcess(processName); | |
73 | if (!process) { | |
74 | process = new TG4SpecialControls(processName); | |
75 | } | |
76 | //particle->GetProcessManager()->AddProcess(process, 0, -1, 1); | |
77 | particle->GetProcessManager()->AddDiscreteProcess(process); | |
78 | } | |
79 | } | |
80 | ||
81 | if (verboseLevel>0) { | |
e5967ab3 | 82 | G4cout << "### Special Controls constructed. " << G4endl; |
83 | G4cout << " Special controls process is defined for: " << G4endl | |
84 | << " "; | |
b94a914b | 85 | for (G4int i=0; i<kNofParticlesWSP; i++) { |
e5967ab3 | 86 | if ((*isControlVector)[i]) |
87 | G4cout << g3PhysicsManager->GetG3ParticleWSPName(i) << " "; | |
b94a914b | 88 | } |
89 | G4cout << G4endl; | |
90 | } | |
91 | } | |
92 | } | |
93 |