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