]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TGeant4/TG4PhysicsConstructorSpecialCuts.cxx
Rotation matrix in BuildGeometry has been changed to rotx999
[u/mrichter/AliRoot.git] / TGeant4 / TG4PhysicsConstructorSpecialCuts.cxx
1 // $Id$
2 // Category: physics
3 //
4 // See the class description in the header file.
5
6 #include "TG4PhysicsConstructorSpecialCuts.h"
7 #include "TG4G3PhysicsManager.h"
8 #include "TG4SpecialCuts.h"
9
10 #include <G4ParticleDefinition.hh>
11 #include <G4ProcessManager.hh>
12 #include <G4VProcess.hh>
13
14
15 TG4PhysicsConstructorSpecialCuts::TG4PhysicsConstructorSpecialCuts(
16                                      const G4String& name)
17   : G4VPhysicsConstructor(name)
18 {
19 //
20   SetVerboseLevel(1);
21 }
22
23 TG4PhysicsConstructorSpecialCuts::~TG4PhysicsConstructorSpecialCuts() {
24 //
25 }
26
27 // protected methods
28
29 void TG4PhysicsConstructorSpecialCuts::ConstructParticle()
30 {
31 // The particles are constructed in the 
32 // TG4ModularPhysicsList.
33 // ---
34 }
35
36 void TG4PhysicsConstructorSpecialCuts::ConstructProcess()
37 {
38 // Adds TG4SpecialCuts "process" that activates
39 // the kinetic energy cuts defined in 
40 // the vector of cuts (PhysicsManager::fCutVector) or in TG4Limits.
41 // ---
42
43   TG4G3PhysicsManager* g3PhysicsManager 
44     = TG4G3PhysicsManager::Instance();
45
46   if (g3PhysicsManager->IsSpecialCuts())
47   {
48     TG4G3CutVector* cutVector
49       = g3PhysicsManager->GetCutVector(); 
50     TG4boolVector* isCutVector 
51       = g3PhysicsManager->GetIsCutVector(); 
52
53     theParticleIterator->reset();
54     while ((*theParticleIterator)())
55     {
56       G4ParticleDefinition* particle = theParticleIterator->value();
57       TG4G3ParticleWSP particleWSP 
58         = g3PhysicsManager->GetG3ParticleWSP(particle);
59       G4String name;
60       g3PhysicsManager->GetG3ParticleWSPName(particleWSP, name);
61       
62       // uncomment this to see all particles "WSP"
63       //G4cout << "Iterating particle: " 
64       //       << particle->GetParticleName() << " " << particleWSP << " "
65       //       << name << G4endl;
66
67       // special process is created in case
68       // cutVector (vector of kinetic energy cuts) is set
69       // or the special cut is set by TG4Limits
70       if ((particleWSP !=kNofParticlesWSP) && 
71           ((*isCutVector)[particleWSP])) {
72         // check if process already exists
73         G4String processName = "specialCutFor" + name;
74         G4VProcess* process = g3PhysicsManager->FindProcess(processName);
75         if (!process) {
76           process = new TG4SpecialCuts(particleWSP, cutVector, processName);
77         }  
78         //particle->GetProcessManager()->AddProcess(process, 0, -1, 1);
79         particle->GetProcessManager()->AddDiscreteProcess(process);
80       }
81     }
82
83     if (verboseLevel>0) {
84       G4cout << "TG4PhysicsList::ConstructSpecialCuts: " << G4endl;
85       if (cutVector)
86         G4cout << "   Global kinetic energy cuts are set." << G4endl;
87       G4cout << "   Special cuts process is defined for: " << G4endl 
88              << "   ";
89       for (G4int i=0; i<kAny; i++) {
90         G4String name;
91         g3PhysicsManager->GetG3ParticleWSPName(i, name);
92         if ((*isCutVector)[i]) G4cout << name << " ";
93       }  
94       G4cout << G4endl;
95     }  
96   }
97 }
98
99