// ESAF : Euso Simulation and Analysis Framework
// $Id: SinglePhoton.hh,v 1.33 2006/11/15 15:51:28 moreggia Exp $
// S. Moreggia created 27 October 2003
// Single photon description in atmosphere

#ifndef __SINGLEPHOTON_HH__
#define __SINGLEPHOTON_HH__

#include "EarthVector.hh"
#include "BunchOfPhotons.hh"
#include "EsafMsgSource.hh"

enum PhotonStatus {None=-1,Direct,Reflected,RaylScat,CloudScat,AeroScat,OutAtmo,ScatAbsorb,LostByCut};
// NB : OutAtmo             means  photon has gone out of atmosphere during scattering simulation
//      ScatAbsorb          means  photon has been absorbed during scattering simulation
//      LostByCut           means  nothing physical, photon is lost by cut for algo optimization (higher scat orders + TOF cut)
//

class SinglePhoton : public EsafMsgSource {
public:
    // ctors
    SinglePhoton();
    SinglePhoton(Double_t,Double_t,const EarthVector&,const EarthVector&,PhotonType, PhotonStatus status = Direct, UInt_t bid = 0, Double_t age = -1);
    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);
    SinglePhoton(const BunchOfPhotons&,Double_t,const EarthVector&,PhotonStatus = Direct);

    // cpy ctor
    SinglePhoton(const SinglePhoton&);

    // dtor
    virtual ~SinglePhoton();

    // GetMembers methods
    inline UInt_t BunchId() const {return fBunchId;}
    inline PhotonType Type() const {return fType;}
    inline PhotonStatus Status() const {return fStatus;}
    inline Double_t Date() const {return fDate;}
    inline Double_t Tof() const {return fTof;}
    inline Double_t Wl() const {return fWl;}
    inline Double_t ShowerAge() const {return fShowerAge;}
    inline const EarthVector& Pos() const {return fPos;}
    inline const EarthVector& ShowerPos() const {return fShowerPos;}
    inline const EarthVector& PosInAtmo() const {return fPosInAtmo;}
    inline const EarthVector& Dir() const {return fDir;}
    inline const EarthVector& MScatDir() const {return fMScatDir;}
    inline Bool_t IsAbsorbed() const {return fAbsorbed;}
    inline Bool_t IsCloudAbsorbed() const {return fCloudAbsorbed;}
    inline Bool_t IsOutFoV() const {return fOutFoV;}
    inline Int_t NbOfInteractions() const {return fNbInter;}
    inline Double_t GetLastTrans(string type) const;
    inline const vector<Int_t>& GetHistories() const {return fHistory;}


    // SetMember methods
    inline void SetAbsorbed(Bool_t f = true) {fAbsorbed = f;}
    inline void SetCloudAbsorbed(Bool_t f = true) {fCloudAbsorbed = f;}
    inline void SetOutFoV(Bool_t f = true) {fOutFoV = f;}
    inline void AddToPos(const EarthVector& v) {fPos += v;}
    inline void SetPosInAtmo(const EarthVector& v) {fPosInAtmo = v;}
    inline void SetShowerAge(Double_t age) {fShowerAge = age;}
    inline void AddToTof(Double_t t) {fTof += t;}
    inline void AddInteraction() {fNbInter++;}
    inline void AddHistory(PhotonStatus status) {fHistory.push_back(status);}
    inline void SetStatus(PhotonStatus st) {fStatus = st;}
    inline void SetDir(const EarthVector& dir) {fDir = dir.Unit();}
    inline void SetPos(const EarthVector& pos) {fPos = pos;}
    inline void SetMScatDir(const EarthVector& dir) {fMScatDir = dir.Unit();}
    inline void SetLastTrans(Double_t trans, string type);
    void AddToPosTof(const EarthVector&);

protected:
    UInt_t fBunchId;         // identity of the bunch giving this single photon
    PhotonType fType;        // type of photon
    PhotonStatus fStatus;    // SinglePhoton origin
    vector<Int_t> fHistory;  // [fNbInter] summary of all interactions in atmosphere
    Double_t fDate;          // date of creation
    mutable Double_t fTof;   // tof between creation and pupil
    Double_t fWl;            // wavelength
    EarthVector fShowerPos;  // position in the shower
    EarthVector fPosInAtmo;  // position of last interaction in atmosphere
    Double_t fShowerAge;     // shower age at photon creation
    mutable EarthVector fPos;// position anywhere else
    EarthVector fDir;        // direction
    EarthVector fMScatDir;   // for MScatAnalysis : direction at last scattering
    Bool_t fAbsorbed;        // true if absorbed during trans to detector
    Bool_t fCloudAbsorbed;   // true if cloud absorbed during trans to detector, only for direct fluo and reflected ckov
    Bool_t fOutFoV;          // (ONLY a flag : no simu for it) true if entering dir on pupil > FoV
    Double_t fLastTotTrans;  // total transmission over the final path to detector
    Double_t fLastRaylTrans; // Rayleigh transmission over the final path to detector
    Double_t fLastOzoneTrans;// Ozone transmission over the final path to detector
    Double_t fLastAeroTrans; // Aerosols transmission over the final path to detector
    Double_t fLastCloudTrans;// Cloud transmission over the final path to detector
    Int_t fNbInter;          // nb of undergone interactions (without considering last trans to detector)

    ClassDef(SinglePhoton,0)
};

//_________________________________________________________________________________________
inline void SinglePhoton::SetLastTrans(Double_t trans, string type) {
    //
    //
    //
    if(type == "tot")        fLastTotTrans = trans;
    else if(type == "rayl")  fLastRaylTrans = trans;
    else if(type == "ozone") fLastOzoneTrans = trans;
    else if(type == "aero")  fLastAeroTrans = trans;
    else if(type == "cloud") fLastCloudTrans = trans;
    else Msg(EsafMsg::Panic) << "<SetLastTrans> Wrong argument = "<<type<<MsgDispatch;
}

//_________________________________________________________________________________________
inline Double_t SinglePhoton::GetLastTrans(string type) const {
    //
    //
    //
    Double_t rtn(0.);
    if(type == "tot")        rtn = fLastTotTrans;
    else if(type == "rayl")  rtn = fLastRaylTrans;
    else if(type == "ozone") rtn = fLastOzoneTrans;
    else if(type == "aero")  rtn = fLastAeroTrans;
    else if(type == "cloud") rtn = fLastCloudTrans;
    else Msg(EsafMsg::Panic) << "<GetLastTrans> Wrong argument = "<<type<<MsgDispatch;
    return rtn;
}

#endif /* __SINGLEPHOTON_HH__ */


ROOT page - Class index - Class Hierarchy - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.