source: JEM-EUSO/esaf_lal/tags/v1_r0/esaf/packages/common/root/include/EBunchPhotons.hh @ 117

Last change on this file since 117 was 117, checked in by moretto, 11 years ago

ESAF version compilable on mac OS

File size: 9.6 KB
Line 
1// ESAF : Euso Simulation and Analysis Framework
2// $Id: EBunchPhotons.hh 2922 2011-06-12 14:21:23Z mabl $
3// A.Thea created Jun, 13 2004
4
5#ifndef __EBUNCHPHOTONS_HH_
6#define __EBUNCHPHOTONS_HH_
7
8#include "TObject.h"
9#include "TRefArray.h"
10#include "TVector3.h"
11#include "TString.h"
12
13#include "EFillable.hh"
14#include "ESinglePhoton.hh"
15
16#include <stdexcept>
17#include <iostream>
18
19class EBunchPhotons : public TObject {
20public:
21    // ctor
22    EBunchPhotons();
23    EBunchPhotons( const EBunchPhotons& );
24
25    // dtor
26    virtual ~EBunchPhotons();
27
28    virtual void Copy( TObject& ) const;
29    virtual void Clear(Option_t* ="" );
30
31    inline void AddSingleRef( ESinglePhoton* );
32    inline TRefArray *GetSinglesArray() const {return fSingles;}
33
34    // getters
35    inline UChar_t GetType() const {return fType;}
36    inline UInt_t GetId() const {return fId;}
37    inline Float_t GetWeight() const {return fWeight;}
38    inline Float_t GetDatei() const {return fDatei;}
39    inline Float_t GetDatef() const {return fDatef;}
40    inline Float_t GetShowerAge() const {return fShowerAge;}
41    inline TVector3 GetShowerPosi() const;
42    inline TVector3 GetShowerPosf() const;
43    inline TVector3 GetFinalPos() const;
44    inline TVector3 GetMeanDir() const;
45    inline Float_t GetYield() const {return fYield;}
46    inline Int_t GetNumWavelengths() const {return fNumWavelengths;}
47    inline const Float_t* GetTable(const char*) const;
48    inline UChar_t GetFate() const {return fFate;}
49   
50    inline Int_t GetNumAll(TString opt = "all") const;
51    inline Int_t GetNumDirect(TString opt = "all") const;
52    inline Int_t GetNumAirScat(TString opt = "all") const;
53    inline Int_t GetNumAeroScat(TString opt = "all") const;
54    inline Int_t GetNumCloudScat(TString opt = "all") const;
55    inline Int_t GetNumReflected(TString opt = "all") const;
56
57    //setters
58    inline void SetType ( UInt_t type ) { fType = type; }
59    inline void SetId(UInt_t id) {fId = id;}
60    inline void SetDatei( Float_t date) { fDatei = date; }
61    inline void SetDatef( Float_t date) { fDatef = date; }
62    inline void SetShowerAge( Float_t age) { fShowerAge = age; }
63    inline void SetShowerPosi( const TVector3& v );
64    inline void SetShowerPosf( const TVector3& v );
65    inline void SetFinalPos( const TVector3& v );
66    inline void SetMeanDir( const TVector3& v );
67    inline void SetWeight( Float_t w) { fWeight = w; }
68    inline void SetYield( Float_t y) { fYield = y; }
69    inline void SetFate(UChar_t f) {fFate = f;}
70
71//DELETE : for BunchRT simulation only
72//inline void SetFinalWeight(Float_t w) {fFinalWeight = w;}
73
74    void SetSpectrum ( Int_t n, const Float_t* lambda, const Float_t* weight );
75
76private:
77
78    UChar_t fType;                                  // Bunch Type
79    UInt_t fId;                                     // bunch identity
80    Float_t fWeight;                                // bunch weight
81
82//DELETE : for BunchRT simulation only
83//Float_t fFinalWeight;
84
85    Float_t fDatei;                                 // date of creation of the first point
86    Float_t fDatef;                                 // date of creation of the last point
87    Float_t fShowerAge;                             // mean shower age at creation
88   
89    Float_t fShowerPosiX,fShowerPosiY,fShowerPosiZ; // first point of the bunch at creation
90    Float_t fShowerPosfX,fShowerPosfY,fShowerPosfZ; // last point of the bunch at creation
91    Float_t fFinalPosX,fFinalPosY,fFinalPosZ;       // where bunch simulation has stopped
92    Float_t fMeanDirX,fMeanDirY,fMeanDirZ;          // mean direction
93   
94    Float_t fYield;                                 // light yield associated with this bunch
95   
96    Int_t fNumWavelengths;   // nb of bins in the following spectra
97    Float_t *fWlLambda;      // [fNumWavelengths] array of wavelength (for spectrum X-axis bin CENTER) -> fNumWavelengths values
98    Float_t *fWlWeight;      // [fNumWavelengths] number of photons at bunch creation
99   
100    UChar_t fFate;           // fate of the bunch (where it dies in the code)
101                             // 0 : initialization value
102                             // 1 : not propagated ->    because fluo bunch
103                             // 2 : not propagated ->    because too small weight
104                             // 3 : not propagated ->    because created underground
105                             // 4 : propagated     ->    has reached ground
106                             // 5 : propagated     ->    til out of FoV
107
108    TRefArray *fSingles;     // reference to singlephotons coming from this bunch
109   
110    Int_t fNumFluoDirect;    // nb of direct fluo singles 
111    Int_t fNumCkovDirect;    // nb of direct ckov singles 
112    Int_t fNumFluoAirScat;   // nb of air scattered fluo singles   
113    Int_t fNumCkovAirScat;   // nb of air scattered ckov singles   
114    Int_t fNumFluoAeroScat;  // nb of aerosol scattered fluo singles 
115    Int_t fNumCkovAeroScat;  // nb of aerosol scattered ckov singles 
116    Int_t fNumFluoCloudScat; // nb of cloud scattered fluo singles 
117    Int_t fNumCkovCloudScat; // nb of cloud scattered ckov singles   
118    Int_t fNumFluoReflected; // nb of ground reflected fluo singles 
119    Int_t fNumCkovReflected; // nb of ground reflected ckov singles   
120   
121    SetEVisitable()
122
123    ClassDef(EBunchPhotons,1)
124};
125
126
127
128
129inline TVector3 EBunchPhotons::GetShowerPosi() const {
130    TVector3 rtn(fShowerPosiX,fShowerPosiY,fShowerPosiZ);
131    return rtn;
132}
133
134inline TVector3 EBunchPhotons::GetShowerPosf() const {
135    TVector3 rtn(fShowerPosfX,fShowerPosfY,fShowerPosfZ);
136    return rtn;
137}
138
139inline TVector3 EBunchPhotons::GetFinalPos() const {
140    TVector3 rtn(fFinalPosX,fFinalPosY,fFinalPosZ);
141    return rtn;
142}
143
144inline TVector3 EBunchPhotons::GetMeanDir() const {
145    TVector3 rtn(fMeanDirX,fMeanDirY,fMeanDirZ);
146    return rtn;
147}
148
149inline const Float_t* EBunchPhotons::GetTable(const char* s) const {
150    Float_t* rtn = 0;
151   
152    if(strncmp(s,"lambda",6) == 0) rtn = fWlLambda;
153    else if(strncmp(s,"weight",6) == 0) rtn = fWlWeight;
154    else Fatal("GetTable(char*)","wrong type of table required");
155   
156    return rtn;
157}
158
159inline void EBunchPhotons::AddSingleRef( ESinglePhoton* ph ) {
160    if(ph->GetType() == 0) {
161        if(ph->GetHistory() == 0) fNumFluoDirect++;
162        else if (ph->GetHistory() == 1) fNumFluoReflected++;
163        else if (ph->GetHistory() == 2) fNumFluoAirScat++;
164        else if (ph->GetHistory() == 3) fNumFluoCloudScat++;
165        else if (ph->GetHistory() == 4) fNumFluoAeroScat++;
166    }
167    else if(ph->GetType() == 1) {
168        if(ph->GetHistory() == 0) fNumCkovDirect++;
169        else if (ph->GetHistory() == 1) fNumCkovReflected++;
170        else if (ph->GetHistory() == 2) fNumCkovAirScat++;
171        else if (ph->GetHistory() == 3) fNumCkovCloudScat++;
172        else if (ph->GetHistory() == 4) fNumCkovAeroScat++;
173    }
174    else Warning("EBunchPhotons::AddSingleRef","Wrong photon type");
175   
176    fSingles->Add( ph );
177}
178
179inline void EBunchPhotons::SetShowerPosi( const TVector3& v ){
180    fShowerPosiX = v.X();
181    fShowerPosiY = v.Y();
182    fShowerPosiZ = v.Z();
183} 
184
185inline void EBunchPhotons::SetShowerPosf( const TVector3& v ){
186    fShowerPosfX = v.X();
187    fShowerPosfY = v.Y();
188    fShowerPosfZ = v.Z();
189} 
190
191inline void EBunchPhotons::SetFinalPos( const TVector3& v ){
192    fFinalPosX = v.X();
193    fFinalPosY = v.Y();
194    fFinalPosZ = v.Z();
195}
196
197inline void EBunchPhotons::SetMeanDir( const TVector3& v ){
198    fMeanDirX = v.X();
199    fMeanDirY = v.Y();
200    fMeanDirZ = v.Z();
201}
202
203inline Int_t EBunchPhotons::GetNumAll(TString type) const {
204    Int_t rtn = 0;
205    if(type == "fluo") rtn = fNumFluoDirect + fNumFluoReflected + fNumFluoAirScat + fNumFluoCloudScat + fNumFluoAeroScat;
206    else if(type == "ckov") rtn = fNumCkovDirect + fNumCkovReflected + fNumCkovAirScat + fNumCkovCloudScat + fNumCkovAeroScat;
207    else if(type == "all")
208        rtn = fNumCkovDirect + fNumFluoDirect + fNumFluoReflected + fNumCkovReflected + fNumFluoAirScat + fNumCkovAirScat + fNumFluoCloudScat + fNumCkovCloudScat + fNumFluoAeroScat + fNumCkovAeroScat;
209    else Warning("EBunchPhotons::GetNumAll","Wrong \'type\' argument");
210   
211    return rtn;
212}
213
214inline Int_t EBunchPhotons::GetNumDirect(TString type) const {
215    Int_t rtn = 0;
216    if(type == "fluo") rtn = fNumFluoDirect;
217    else if(type == "ckov") rtn = fNumCkovDirect;
218    else if(type == "all") rtn = fNumCkovDirect + fNumFluoDirect;
219    else Warning("EBunchPhotons::GetNumDirect","Wrong \'type\' argument");
220   
221    return rtn;
222}
223
224inline Int_t EBunchPhotons::GetNumAirScat(TString type) const {
225    Int_t rtn = 0;
226    if(type == "fluo") rtn = fNumFluoAirScat;
227    else if(type == "ckov") rtn = fNumCkovAirScat;
228    else if(type == "all") rtn = fNumCkovAirScat + fNumFluoAirScat;
229    else Warning("EBunchPhotons::GetNumAirScat","Wrong \'type\' argument");
230   
231    return rtn;
232}
233
234inline Int_t EBunchPhotons::GetNumAeroScat(TString type) const {
235    Int_t rtn = 0;
236    if(type == "fluo") rtn = fNumFluoAeroScat;
237    else if(type == "ckov") rtn = fNumCkovAeroScat;
238    else if(type == "all") rtn = fNumCkovAeroScat + fNumFluoAeroScat;
239    else Warning("EBunchPhotons::GetNumAeroScat","Wrong \'type\' argument");
240   
241    return rtn;
242}
243
244inline Int_t EBunchPhotons::GetNumCloudScat(TString type) const {
245    Int_t rtn = 0;
246    if(type == "fluo") rtn = fNumFluoCloudScat;
247    else if(type == "ckov") rtn = fNumCkovCloudScat;
248    else if(type == "all") rtn = fNumCkovCloudScat + fNumFluoCloudScat;
249    else Warning("EBunchPhotons::GetNumCloudScat","Wrong \'type\' argument");
250   
251    return rtn;
252}
253
254inline Int_t EBunchPhotons::GetNumReflected(TString type) const {
255    Int_t rtn = 0;
256    if(type == "fluo") rtn = fNumFluoReflected;
257    else if(type == "ckov") rtn = fNumCkovReflected;
258    else if(type == "all") rtn = fNumCkovReflected + fNumFluoReflected;
259    else Warning("EBunchPhotons::GetNumReflected","Wrong \'type\' argument");
260   
261    return rtn;
262}
263
264
265#endif  /* __EBUNCHPHOTONS_HH_ */
266
Note: See TracBrowser for help on using the repository browser.