forked from LoickMarion/chroma
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathG4chroma.hh
More file actions
123 lines (97 loc) · 2.96 KB
/
G4chroma.hh
File metadata and controls
123 lines (97 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#ifndef __G4chroma_hh__
#define __G4chroma_hh__
#include <G4VModularPhysicsList.hh>
class ChromaPhysicsList: public G4VModularPhysicsList
{
public:
ChromaPhysicsList();
virtual ~ChromaPhysicsList();
virtual void SetCuts();
};
#include <G4UserSteppingAction.hh>
#include <G4UserTrackingAction.hh>
#include <G4ThreeVector.hh>
#include <G4Track.hh>
#include <G4Step.hh>
#include <G4StepPoint.hh>
#include <vector>
#include <map>
class Step {
public:
inline Step(const double _x, const double _y, const double _z,
const double _t,
const double _dx, const double _dy, const double _dz,
const double _ke, const double _edep, const double _qedep,
const std::string &_procname) :
x(_x), y(_y), z(_z), t(_t), dx(_dx), dy(_dy), dz(_dz),
ke(_ke), edep(_edep), qedep(_qedep), procname(_procname) {
}
inline ~Step() { }
const double x,y,z,t,dx,dy,dz,ke,edep,qedep;
const std::string procname;
};
class Track {
public:
inline Track() : id(-1) { }
inline ~Track() { }
int id, parent_id, pdg_code;
double weight;
std::string name;
void appendStepPoint(const G4StepPoint* point, const G4Step* step, double qedep, const bool initial = false);
inline const std::vector<Step>& getSteps() { return steps; };
int getNumSteps();
inline int getNumChildren() { return children.size(); }
inline int getChildTrackID(int i) { return children[i]; }
inline void addChild(int trackid) { children.push_back(trackid); }
private:
std::vector<Step> steps;
std::vector<int> children;
};
class SteppingAction : public G4UserSteppingAction
{
public:
SteppingAction();
virtual ~SteppingAction();
void EnableScint(bool enabled);
void EnableTracking(bool enabled);
void UserSteppingAction(const G4Step* aStep);
void ClearTracking();
Track& getTrack(int id);
private:
bool scint;
bool tracking;
bool children_mapped;
void mapChildren();
std::map<int,Track> trackmap;
};
class TrackingAction : public G4UserTrackingAction
{
public:
TrackingAction();
virtual ~TrackingAction();
int GetNumPhotons() const;
void Clear();
void GetX(double *x) const;
void GetY(double *y) const;
void GetZ(double *z) const;
void GetDirX(double *dir_x) const;
void GetDirY(double *dir_y) const;
void GetDirZ(double *dir_z) const;
void GetPolX(double *pol_x) const;
void GetPolY(double *pol_y) const;
void GetPolZ(double *pol_z) const;
void GetWavelength(double *wl) const;
void GetT0(double *t) const;
void GetParentTrackID(int *t) const;
void GetFlags(uint32_t *flags) const;
virtual void PreUserTrackingAction(const G4Track *);
protected:
std::vector<G4ThreeVector> pos;
std::vector<G4ThreeVector> dir;
std::vector<G4ThreeVector> pol;
std::vector<int> parentTrackID;
std::vector<uint32_t> flags;
std::vector<double> wavelength;
std::vector<double> t0;
};
#endif