1 | // ESAF : Euso Simulation and Analysis Framework |
---|
2 | // $Id: BunchOfPhotons.hh 2968 2011-07-20 00:43:14Z fenu $ |
---|
3 | // Anne Stutz created Dec, 1 2003 |
---|
4 | |
---|
5 | #ifndef __BUNCHOFPHOTONS_HH_ |
---|
6 | #define __BUNCHOFPHOTONS_HH_ |
---|
7 | |
---|
8 | #include "EsafMsgSource.hh" |
---|
9 | #include "euso.hh" |
---|
10 | #include "EarthVector.hh" |
---|
11 | #include "EsafSpectrum.hh" |
---|
12 | #include "ParentBunch.hh" |
---|
13 | #include <stdexcept> |
---|
14 | #include <TMath.h> |
---|
15 | |
---|
16 | enum PhotonType {Fluo, Cerenkov}; |
---|
17 | class SinglePhoton; |
---|
18 | |
---|
19 | class BunchOfPhotons : public EsafMsgSource { |
---|
20 | public: |
---|
21 | |
---|
22 | // default ctor (should not be used) |
---|
23 | BunchOfPhotons(); |
---|
24 | |
---|
25 | // copy ctor |
---|
26 | BunchOfPhotons(const BunchOfPhotons&); |
---|
27 | |
---|
28 | // ctor with a ParentBunch |
---|
29 | BunchOfPhotons(const Double_t weight,const Double_t yield, |
---|
30 | const EarthVector& showerposi, const EarthVector& showerposf, |
---|
31 | const Double_t datei, const Double_t datef, const EsafSpectrum& spectrum, |
---|
32 | const EarthVector& dir, PhotonType type, Double_t age = -1); |
---|
33 | |
---|
34 | // dtor |
---|
35 | virtual ~BunchOfPhotons(); |
---|
36 | |
---|
37 | // GetMembers methods |
---|
38 | inline UInt_t GetId() const {return fId;} |
---|
39 | inline UInt_t GetNbins() const {return fNbins;} |
---|
40 | inline Double_t GetWeight() const {return fWeight;} |
---|
41 | inline Double_t GetWeightNocloud() const {return fWeightNocloud;} |
---|
42 | inline Double_t GetWeight(Int_t i) const {return fWeight*fWlSpectrum.GetWeight(i);} |
---|
43 | inline PhotonType GetType() const {return fType;} |
---|
44 | inline Double_t GetDate() const {return fDate;} |
---|
45 | inline Double_t GetTof() const {return fTof;} |
---|
46 | inline const EarthVector& GetPos() const {return fPos;} |
---|
47 | inline EarthVector GetDir() const {return fDir.Unit();} |
---|
48 | inline const EarthVector& GetShowerPos() const {return fShowerPos;} |
---|
49 | inline const EarthVector& GetShowerPosi() const {return fShowerPosi;} |
---|
50 | inline const EarthVector& GetShowerPosf() const {return fShowerPosf;} |
---|
51 | inline Double_t GetShowerAge() const {return fShowerAge;} |
---|
52 | inline const EarthVector& GetNextImpact() const {return fNextImpact;} |
---|
53 | inline const EarthVector& GetFinalImpact() const {return fFinalImpact;} |
---|
54 | inline const EsafSpectrum& GetWlSpectrum() const {return fWlSpectrum;} |
---|
55 | inline const ParentBunch* GetParent() const {return fParent;} |
---|
56 | |
---|
57 | // SetMember methods |
---|
58 | inline void SetParent( const ParentBunch& pb ) { fParent = new ParentBunch(pb); } |
---|
59 | inline void SetParentLateral( const TF12& ld ) { fParent->SetLateralDist(ld); } |
---|
60 | inline void SetParentLateral( const TH1F& ld ) { fParent->SetHistoLateral(ld); } |
---|
61 | inline void SetParentAngular( const TF12& ld ) { fParent->SetAngularDist(ld); } |
---|
62 | inline void SetParentAngular( const TH1F& ld ) { fParent->SetHistoAngular(ld); } |
---|
63 | inline void SetPos(const EarthVector& v) {fPos = v;} |
---|
64 | inline void SetDir(const EarthVector& v) {fDir = v;} |
---|
65 | void SetNextImpact(const EarthVector& v); |
---|
66 | void SetFinalImpact(const EarthVector& v); |
---|
67 | inline void AddToTof(Double_t t) {fTof += t;} |
---|
68 | inline void AddToPos(const EarthVector& v) {fPos += v;} |
---|
69 | void AddToPosTof(const EarthVector&); |
---|
70 | |
---|
71 | // Returns a random position at creation, using lateral and longitudinal position distributions |
---|
72 | EarthVector RandomPosInShower() const; |
---|
73 | |
---|
74 | // returns a random normalized direction at creation |
---|
75 | EarthVector RandomDirection() const; |
---|
76 | |
---|
77 | // Returns a corrected position at any propagation stage, using angular distributions at creation |
---|
78 | EarthVector PosRandomAngCorrec(const EarthVector&,const EarthVector&) const; |
---|
79 | |
---|
80 | // returns 'angular distribution value' / 2pi, at theta |
---|
81 | Double_t AngularDist_OverTwoPi(Double_t) const; |
---|
82 | |
---|
83 | // Convolution of fWeight according to radiative transfer effects |
---|
84 | inline void Convolute(Double_t norm) {fWeight *= norm;} |
---|
85 | inline void ConvoluteNocloud(Double_t norm) {fWeightNocloud *= norm;} |
---|
86 | // Convolution of fWlSpectrum |
---|
87 | inline Double_t ConvoluteWl(const Double_t* tab) {return fWlSpectrum.ConvoluteAndNormalize(tab);} |
---|
88 | |
---|
89 | // Reset method |
---|
90 | void Reset(); |
---|
91 | |
---|
92 | //--------------------------------------------------------------------------- |
---|
93 | // Set and Get of bunch output data |
---|
94 | inline UChar_t GetFate() const {return fFate;} |
---|
95 | inline void SetFate(UChar_t f) {fFate = f;} |
---|
96 | //inline const EsafSpectrum& GetTransSpectrum() const {return fTransSpectrum;} |
---|
97 | //inline const EsafSpectrum& GetRaylSpectrum() const {return fRaylSpectrum;} |
---|
98 | //inline const EsafSpectrum& GetOzoneSpectrum() const {return fOzoneSpectrum;} |
---|
99 | //inline const EsafSpectrum& GetMieSpectrum() const {return fMieSpectrum;} |
---|
100 | |
---|
101 | // Convolute the transmission spectra with given coefficients |
---|
102 | //void ConvoluteTransSpectra(UInt_t numwl, const vector<Double_t*>& coeff); |
---|
103 | |
---|
104 | protected: |
---|
105 | UInt_t fId; // bunch identity |
---|
106 | UInt_t fNbins; // spectra number of elements |
---|
107 | PhotonType fType; // type of photon |
---|
108 | Double_t fWeight; // weight of the bunch |
---|
109 | Double_t fWeightNocloud; // weight of the bunch, if there is no cloud (used only when fCloudStatus=false) |
---|
110 | Double_t fDate; // mean date of creation |
---|
111 | Double_t fTof; // mean tof between creation and present |
---|
112 | EarthVector fPos; // mean position of the bunch |
---|
113 | EarthVector fShowerPos; // mean position in shower |
---|
114 | EarthVector fShowerPosi; |
---|
115 | EarthVector fShowerPosf; |
---|
116 | Double_t fShowerAge; // shower age at bunch creation |
---|
117 | EarthVector fDir; // mean direction (isotropic <-> fDir.Mag() == 0) |
---|
118 | EarthVector fNextImpact; // next impact (usefull for propagation) |
---|
119 | EarthVector fFinalImpact; // final impact (ground or clear sky) |
---|
120 | EsafSpectrum fWlSpectrum; // [fNbins] wavelenght spectrum of the bunch (normalized) |
---|
121 | ParentBunch* fParent; // hold info about bunch generation |
---|
122 | |
---|
123 | // following are kind of bunch data (for outputs) |
---|
124 | UChar_t fFate; // where bunch dies in the code |
---|
125 | // 0 : initialization value |
---|
126 | // 1 : not propagated -> because fluo bunch |
---|
127 | // 2 : not propagated -> because too small weight |
---|
128 | // 3 : not propagated -> because created underground |
---|
129 | // 4 : propagated -> has reached ground |
---|
130 | // 5 : propagated -> til out of FoV |
---|
131 | |
---|
132 | //EsafSpectrum fTransSpectrum; // [fNbins] Total transmission spectrum AFTER propagation |
---|
133 | //EsafSpectrum fRaylSpectrum; // [fNbins] rayleigh spectrum AFTER propagation |
---|
134 | //EsafSpectrum fOzoneSpectrum; // [fNbins] Ozone spectrum AFTER propagation |
---|
135 | //EsafSpectrum fMieSpectrum; // [fNbins] Mie spectrum AFTER propagation |
---|
136 | |
---|
137 | static UInt_t fCounter; // to keep nb of created bunches in memory |
---|
138 | |
---|
139 | ClassDef(BunchOfPhotons,0) |
---|
140 | }; |
---|
141 | |
---|
142 | inline void BunchOfPhotons::SetFinalImpact(const EarthVector& v) { |
---|
143 | if(v.Z() == HUGE) Msg(EsafMsg::Warning) << "Bunches should always have an \"impact\"" << MsgDispatch; |
---|
144 | fFinalImpact = v; |
---|
145 | } |
---|
146 | |
---|
147 | inline void BunchOfPhotons::SetNextImpact(const EarthVector& v) { |
---|
148 | if(v.Z() == HUGE) Msg(EsafMsg::Warning) << "Bunches should always have an \"impact\"" << MsgDispatch; |
---|
149 | fNextImpact = v; |
---|
150 | } |
---|
151 | |
---|
152 | |
---|
153 | #endif /* __BUNCHOFPHOTONS_HH_ */ |
---|
154 | |
---|