1 | // ESAF : Euso Simulation and Analysis Framework |
---|
2 | // $Id: SinglePhoton.hh 2994 2011-10-05 04:01:59Z fenu $ |
---|
3 | // S. Moreggia created 27 October 2003 |
---|
4 | // Single photon description in atmosphere |
---|
5 | |
---|
6 | #ifndef __SINGLEPHOTON_HH__ |
---|
7 | #define __SINGLEPHOTON_HH__ |
---|
8 | |
---|
9 | #include "EarthVector.hh" |
---|
10 | #include "BunchOfPhotons.hh" |
---|
11 | #include "EsafMsgSource.hh" |
---|
12 | |
---|
13 | enum PhotonStatus {None=-1,Direct,Reflected,RaylScat,CloudScat,AeroScat,OutAtmo,ScatAbsorb,LostByCut}; |
---|
14 | // NB : OutAtmo means photon has gone out of atmosphere during scattering simulation |
---|
15 | // ScatAbsorb means photon has been absorbed during scattering simulation |
---|
16 | // LostByCut means nothing physical, photon is lost by cut for algo optimization (higher scat orders + TOF cut) |
---|
17 | // |
---|
18 | |
---|
19 | class SinglePhoton : public EsafMsgSource { |
---|
20 | public: |
---|
21 | // ctors |
---|
22 | SinglePhoton(); |
---|
23 | SinglePhoton(Double_t,Double_t,const EarthVector&,const EarthVector&,PhotonType, PhotonStatus status = Direct, UInt_t bid = 0, Double_t age = -1); |
---|
24 | SinglePhoton(PhotonType,Double_t,Double_t,Double_t,const EarthVector&,const EarthVector&,const EarthVector&,PhotonStatus status = Direct, UInt_t bid = 0, Double_t age = -1); |
---|
25 | SinglePhoton(const BunchOfPhotons&,Double_t,const EarthVector&,PhotonStatus = Direct); |
---|
26 | |
---|
27 | // cpy ctor |
---|
28 | SinglePhoton(const SinglePhoton&); |
---|
29 | |
---|
30 | // dtor |
---|
31 | virtual ~SinglePhoton(); |
---|
32 | |
---|
33 | // GetMembers methods |
---|
34 | inline UInt_t BunchId() const {return fBunchId;} |
---|
35 | inline PhotonType Type() const {return fType;} |
---|
36 | inline PhotonStatus Status() const {return fStatus;} |
---|
37 | inline Double_t Date() const {return fDate;} |
---|
38 | inline Double_t Tof() const {return fTof;} |
---|
39 | inline Double_t Wl() const {return fWl;} |
---|
40 | inline Double_t ShowerAge() const {return fShowerAge;} |
---|
41 | inline const EarthVector& Pos() const {return fPos;} |
---|
42 | inline const EarthVector& ShowerPos() const {return fShowerPos;} |
---|
43 | inline const EarthVector& PosInAtmo() const {return fPosInAtmo;} |
---|
44 | inline const EarthVector& Dir() const {return fDir;} |
---|
45 | inline const EarthVector& MScatDir() const {return fMScatDir;} |
---|
46 | inline Bool_t IsAbsorbed() const {return fAbsorbed;} |
---|
47 | inline Bool_t IsCloudAbsorbed() const {return fCloudAbsorbed;} |
---|
48 | inline Bool_t IsOutFoV() const {return fOutFoV;} |
---|
49 | inline Int_t NbOfInteractions() const {return fNbInter;} |
---|
50 | inline Double_t GetLastTrans(string type) const; |
---|
51 | inline const vector<Int_t>& GetHistories() const {return fHistory;} |
---|
52 | |
---|
53 | |
---|
54 | // SetMember methods |
---|
55 | inline void SetAbsorbed(Bool_t f = true) {fAbsorbed = f;} |
---|
56 | inline void SetCloudAbsorbed(Bool_t f = true) {fCloudAbsorbed = f;} |
---|
57 | inline void SetOutFoV(Bool_t f = true) {fOutFoV = f;} |
---|
58 | inline void AddToPos(const EarthVector& v) {fPos += v;} |
---|
59 | inline void SetPosInAtmo(const EarthVector& v) {fPosInAtmo = v;} |
---|
60 | inline void SetShowerAge(Double_t age) {fShowerAge = age;} |
---|
61 | inline void AddToTof(Double_t t) {fTof += t;} |
---|
62 | inline void AddInteraction() {fNbInter++;} |
---|
63 | inline void AddHistory(PhotonStatus status) {fHistory.push_back(status);} |
---|
64 | inline void SetStatus(PhotonStatus st) {fStatus = st;} |
---|
65 | inline void SetDir(const EarthVector& dir) {fDir = dir.Unit();} |
---|
66 | inline void SetPos(const EarthVector& pos) {fPos = pos;} |
---|
67 | inline void SetMScatDir(const EarthVector& dir) {fMScatDir = dir.Unit();} |
---|
68 | inline void SetLastTrans(Double_t trans, string type); |
---|
69 | inline void SetWL(Double_t wl) {fWl = wl;} |
---|
70 | void AddToPosTof(const EarthVector&); |
---|
71 | |
---|
72 | protected: |
---|
73 | UInt_t fBunchId; // identity of the bunch giving this single photon |
---|
74 | PhotonType fType; // type of photon |
---|
75 | PhotonStatus fStatus; // SinglePhoton origin |
---|
76 | vector<Int_t> fHistory; // [fNbInter] summary of all interactions in atmosphere |
---|
77 | Double_t fDate; // date of creation |
---|
78 | mutable Double_t fTof; // tof between creation and pupil |
---|
79 | Double_t fWl; // wavelength |
---|
80 | EarthVector fShowerPos; // position in the shower |
---|
81 | EarthVector fPosInAtmo; // position of last interaction in atmosphere |
---|
82 | Double_t fShowerAge; // shower age at photon creation |
---|
83 | mutable EarthVector fPos;// position anywhere else |
---|
84 | EarthVector fDir; // direction |
---|
85 | EarthVector fMScatDir; // for MScatAnalysis : direction at last scattering |
---|
86 | Bool_t fAbsorbed; // true if absorbed during trans to detector |
---|
87 | Bool_t fCloudAbsorbed; // true if cloud absorbed during trans to detector, only for direct fluo and reflected ckov |
---|
88 | Bool_t fOutFoV; // (ONLY a flag : no simu for it) true if entering dir on pupil > FoV |
---|
89 | Double_t fLastTotTrans; // total transmission over the final path to detector |
---|
90 | Double_t fLastRaylTrans; // Rayleigh transmission over the final path to detector |
---|
91 | Double_t fLastOzoneTrans;// Ozone transmission over the final path to detector |
---|
92 | Double_t fLastAeroTrans; // Aerosols transmission over the final path to detector |
---|
93 | Double_t fLastCloudTrans;// Cloud transmission over the final path to detector |
---|
94 | Int_t fNbInter; // nb of undergone interactions (without considering last trans to detector) |
---|
95 | |
---|
96 | ClassDef(SinglePhoton,0) |
---|
97 | }; |
---|
98 | |
---|
99 | //_________________________________________________________________________________________ |
---|
100 | inline void SinglePhoton::SetLastTrans(Double_t trans, string type) { |
---|
101 | // |
---|
102 | // |
---|
103 | // |
---|
104 | if(type == "tot") fLastTotTrans = trans; |
---|
105 | else if(type == "rayl") fLastRaylTrans = trans; |
---|
106 | else if(type == "ozone") fLastOzoneTrans = trans; |
---|
107 | else if(type == "aero") fLastAeroTrans = trans; |
---|
108 | else if(type == "cloud") fLastCloudTrans = trans; |
---|
109 | else Msg(EsafMsg::Panic) << "<SetLastTrans> Wrong argument = "<<type<<MsgDispatch; |
---|
110 | } |
---|
111 | |
---|
112 | //_________________________________________________________________________________________ |
---|
113 | inline Double_t SinglePhoton::GetLastTrans(string type) const { |
---|
114 | // |
---|
115 | // |
---|
116 | // |
---|
117 | Double_t rtn(0.); |
---|
118 | if(type == "tot") rtn = fLastTotTrans; |
---|
119 | else if(type == "rayl") rtn = fLastRaylTrans; |
---|
120 | else if(type == "ozone") rtn = fLastOzoneTrans; |
---|
121 | else if(type == "aero") rtn = fLastAeroTrans; |
---|
122 | else if(type == "cloud") rtn = fLastCloudTrans; |
---|
123 | else Msg(EsafMsg::Panic) << "<GetLastTrans> Wrong argument = "<<type<<MsgDispatch; |
---|
124 | return rtn; |
---|
125 | } |
---|
126 | |
---|
127 | #endif /* __SINGLEPHOTON_HH__ */ |
---|