]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TGeant4/TG4StepManager.h
Initialize decayer before generation. Important if run inside cocktail.
[u/mrichter/AliRoot.git] / TGeant4 / TG4StepManager.h
1 // $Id$
2 // Category: event
3 //
4 // Geant4 implementation of the MonteCarlo interface methods                    
5 // for access to Geant4 at step level
6 //
7 // The public methods that do not implement AliMC methods
8 // are commented as G4 specific
9
10 #ifndef TG4_STEP_MANAGER_H
11 #define TG4_STEP_MANAGER_H
12
13 #include <Rtypes.h>
14 #include "AliMCProcess.h"
15
16 #include "TG4StepStatus.h"
17
18 #include <G4Step.hh>
19 #include <G4ThreeVector.hh>
20 #include <globals.hh>
21
22 #include <TArrayI.h>
23
24 class G4Track;
25 class G4SteppingManager;
26 class G4VPhysicalVolume;
27
28 class TLorentzVector;
29
30 class TG4StepManager
31 {
32   public:
33     TG4StepManager();
34     // --> protected
35     // TG4StepManager(const TG4StepManager& right);
36     virtual ~TG4StepManager();
37
38     // static access method
39     static TG4StepManager* Instance();
40         
41     // methods
42     void StopTrack();
43     void StopEvent();
44     
45     // set methods
46     void SetStep(G4Step* step, TG4StepStatus status);    // G4 specific
47     void SetStep(G4Track* track, TG4StepStatus status);  // G4 specific
48     void SetSteppingManager(G4SteppingManager* manager); // G4 specific
49     void SetMaxStep(Float_t step);
50     void SetMaxNStep(Int_t maxNofSteps);  //??
51     void SetUserDecay(Int_t pdg);  //NEW
52     
53     // get methods
54     G4Track* GetTrack() const;                            // G4 specific
55     G4Step*  GetStep() const;                             // G4 specific
56     TG4StepStatus GetStepStatus() const;                  // G4 specific
57         
58         // tracking volume(s) 
59     G4VPhysicalVolume* GetCurrentPhysicalVolume() const;  // G4 specific
60     Int_t CurrentVolID(Int_t& copyNo) const;
61     Int_t CurrentVolOffID(Int_t off, Int_t& copyNo) const;
62     const char* CurrentVolName() const;
63     const char* CurrentVolOffName(Int_t off) const;
64     Int_t CurrentMaterial(Float_t &a, Float_t &z, Float_t &dens, 
65                     Float_t &radl, Float_t &absl) const;
66     void Gmtod(Float_t* xm, Float_t* xd, Int_t iflag);
67     void Gdtom(Float_t* xd, Float_t* xm, Int_t iflag);
68     Float_t MaxStep() const;
69     Int_t GetMaxNStep() const;  //??                       
70     Int_t GetMedium() const;
71
72         // tracking particle 
73         // dynamic properties
74     void TrackPosition(TLorentzVector& position) const;
75     void TrackMomentum(TLorentzVector& momentum) const;
76     void TrackVertexPosition(TLorentzVector& position) const;
77     void TrackVertexMomentum(TLorentzVector& momentum) const;
78     Float_t TrackStep() const;  
79     Float_t TrackLength() const;   
80     Float_t TrackTime() const;  
81     Float_t Edep() const;
82         // static properties
83     Int_t TrackPid() const;
84     Float_t TrackCharge() const;
85     Float_t TrackMass() const;
86     Float_t Etot() const;
87
88         // track status
89     Bool_t IsTrackInside() const;
90     Bool_t IsTrackEntering() const;
91     Bool_t IsTrackExiting() const;
92     Bool_t IsTrackOut() const;
93     Bool_t IsTrackDisappeared() const;
94     Bool_t IsTrackStop() const;
95     Bool_t IsTrackAlive() const;
96     Bool_t IsNewTrack() const;
97
98         // secondaries
99     Int_t NSecondaries() const;
100     void GetSecondary(Int_t isec, Int_t& particleId,
101                       TLorentzVector& position, TLorentzVector& momentum);      
102     AliMCProcess ProdProcess(Int_t isec) const; 
103     Int_t StepProcesses(TArrayI &proc) const;
104
105   protected:
106     TG4StepManager(const TG4StepManager& right);
107
108     // operators
109     TG4StepManager& operator=(const TG4StepManager& right);
110
111   private:
112     // methods
113     void CheckTrack() const;
114     void CheckStep(const G4String& method) const;
115     void CheckSteppingManager() const;
116     void SetTLorentzVector(G4ThreeVector xyz, G4double t, 
117                            TLorentzVector& lv) const;    
118     G4VPhysicalVolume* GetCurrentOffPhysicalVolume(G4int off) const;
119
120     // static data members
121     static TG4StepManager*  fgInstance;   //this instance
122     
123     // data members
124     G4Track*            fTrack;           //current track
125     G4Step*             fStep;            //current step
126     TG4StepStatus       fStepStatus;      //step status that decides whether
127                                           //track properties will be returned
128                                           //from PreStepPoint or PostStepPoint
129     G4SteppingManager*  fSteppingManager; //G4SteppingManager
130 };
131
132 // inline methods
133
134 inline TG4StepManager* TG4StepManager::Instance() 
135 { return fgInstance; }
136
137 inline void TG4StepManager::SetStep(G4Step* step, TG4StepStatus status)
138 { fTrack = step->GetTrack(); fStep = step; fStepStatus = status; }
139
140 inline void TG4StepManager::SetStep(G4Track* track, TG4StepStatus status)
141 { fTrack = track; fStep = 0; fStepStatus = status; }
142
143 inline void TG4StepManager::SetSteppingManager(G4SteppingManager* manager)
144 { fSteppingManager = manager; }
145
146 inline G4Track* TG4StepManager::GetTrack() const
147 { return fTrack; }
148
149 inline G4Step* TG4StepManager::GetStep() const
150 { return fStep; }
151
152 inline TG4StepStatus TG4StepManager::GetStepStatus() const
153 { return fStepStatus; }
154
155 #endif //TG4_STEP_MANAGER_H
156