// ESAF : Euso Simulation and Analysis Framework // $Id: BunchOfPhotons.hh,v 1.29 2005/09/04 18:30:50 moreggia Exp $ // Anne Stutz created Dec, 1 2003 #ifndef __BUNCHOFPHOTONS_HH_ #define __BUNCHOFPHOTONS_HH_ #include "EsafMsgSource.hh" #include "euso.hh" #include "EarthVector.hh" #include "EsafSpectrum.hh" #include "ParentBunch.hh" #include enum PhotonType {Fluo, Cerenkov}; class SinglePhoton; class BunchOfPhotons : public EsafMsgSource { public: // default ctor (should not be used) BunchOfPhotons(); // copy ctor BunchOfPhotons(const BunchOfPhotons&); // ctor with a ParentBunch BunchOfPhotons(const Double_t weight,const Double_t yield, const EarthVector& showerposi, const EarthVector& showerposf, const Double_t datei, const Double_t datef, const EsafSpectrum& spectrum, const EarthVector& dir, PhotonType type); // dtor virtual ~BunchOfPhotons(); // GetMembers methods inline UInt_t GetId() const {return fId;} inline UInt_t GetNbins() const {return fNbins;} inline Double_t GetWeight() const {return fWeight;} inline Double_t GetWeight(Int_t i) const {return fWeight*fWlSpectrum.GetWeight(i);} inline PhotonType GetType() const {return fType;} inline Double_t GetDate() const {return fDate;} inline Double_t GetTof() const {return fTof;} inline const EarthVector& GetPos() const {return fPos;} inline EarthVector GetDir() const {return fDir.Unit();} inline const EarthVector& GetShowerPos() const {return fShowerPos;} inline const EarthVector& GetNextImpact() const {return fNextImpact;} inline const EarthVector& GetFinalImpact() const {return fFinalImpact;} inline const EsafSpectrum& GetWlSpectrum() const {return fWlSpectrum;} inline const ParentBunch* GetParent() const {return fParent;} // SetMember methods inline void SetParent( const ParentBunch& pb ) { fParent = new ParentBunch(pb); } inline void SetParentLateral( const TF12& ld ) { fParent->SetLateralDist(ld); } inline void SetParentLateral( const TH1F& ld ) { fParent->SetHistoLateral(ld); } inline void SetParentAngular( const TF12& ld ) { fParent->SetAngularDist(ld); } inline void SetParentAngular( const TH1F& ld ) { fParent->SetHistoAngular(ld); } inline void SetPos(const EarthVector& v) {fPos = v;} inline void SetDir(const EarthVector& v) {fDir = v;} void SetNextImpact(const EarthVector& v); void SetFinalImpact(const EarthVector& v); inline void AddToTof(Double_t t) {fTof += t;} inline void AddToPos(const EarthVector& v) {fPos += v;} void AddToPosTof(const EarthVector&); // Returns a random position at creation, using lateral and longitudinal position distributions EarthVector RandomPosInShower() const; // returns a random normalized direction at creation EarthVector RandomDirection() const; // Returns a corrected position at any propagation stage, using angular distributions at creation EarthVector PosRandomAngCorrec(const EarthVector&,const EarthVector&) const; // returns 'angular distribution value' / 2pi, at theta Double_t AngularDist_OverTwoPi(Double_t) const; // Convolution of fWeight according to radiative transfer effects inline void Convolute(Double_t norm) {fWeight *= norm;} // Convolution of fWlSpectrum inline Double_t ConvoluteWl(const Double_t* tab) {return fWlSpectrum.ConvoluteAndNormalize(tab);} // Reset method void Reset(); //--------------------------------------------------------------------------- // Set and Get of bunch output data inline UChar_t GetFate() const {return fFate;} inline void SetFate(UChar_t f) {fFate = f;} //inline const EsafSpectrum& GetTransSpectrum() const {return fTransSpectrum;} //inline const EsafSpectrum& GetRaylSpectrum() const {return fRaylSpectrum;} //inline const EsafSpectrum& GetOzoneSpectrum() const {return fOzoneSpectrum;} //inline const EsafSpectrum& GetMieSpectrum() const {return fMieSpectrum;} // Convolute the transmission spectra with given coefficients //void ConvoluteTransSpectra(UInt_t numwl, const vector& coeff); protected: UInt_t fId; // bunch identity UInt_t fNbins; // spectra number of elements PhotonType fType; // type of photon Double_t fWeight; // weight of the bunch Double_t fDate; // mean date of creation Double_t fTof; // mean tof between creation and present EarthVector fPos; // mean position of the bunch EarthVector fShowerPos; // mean position in shower EarthVector fDir; // mean direction (isotropic <-> fDir.Mag() == 0) EarthVector fNextImpact; // next impact (usefull for propagation) EarthVector fFinalImpact; // final impact (ground or clear sky) EsafSpectrum fWlSpectrum; // [fNbins] wavelenght spectrum of the bunch (normalized) ParentBunch* fParent; // hold info about bunch generation // following are kind of bunch data (for outputs) UChar_t fFate; // where bunch dies in the code // 0 : initialization value // 1 : not propagated -> because fluo bunch // 2 : not propagated -> because too small weight // 3 : not propagated -> because created underground // 4 : propagated -> has reached ground // 5 : propagated -> til out of FoV //EsafSpectrum fTransSpectrum; // [fNbins] Total transmission spectrum AFTER propagation //EsafSpectrum fRaylSpectrum; // [fNbins] rayleigh spectrum AFTER propagation //EsafSpectrum fOzoneSpectrum; // [fNbins] Ozone spectrum AFTER propagation //EsafSpectrum fMieSpectrum; // [fNbins] Mie spectrum AFTER propagation static UInt_t fCounter; // to keep nb of created bunches in memory ClassDef(BunchOfPhotons,0) }; inline void BunchOfPhotons::SetFinalImpact(const EarthVector& v) { if(v.Z() == HUGE) Msg(EsafMsg::Warning) << "Bunches should always have an \"impact\"" << MsgDispatch; fFinalImpact = v; } inline void BunchOfPhotons::SetNextImpact(const EarthVector& v) { if(v.Z() == HUGE) Msg(EsafMsg::Warning) << "Bunches should always have an \"impact\"" << MsgDispatch; fNextImpact = v; } #endif /* __BUNCHOFPHOTONS_HH_ */