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