// ESAF : Euso Simulation and Analysis Framework // $Id: ListPhotonsInAtmosphere.hh,v 1.20 2005/09/12 20:50:22 moreggia Exp $ // Anne Stutz created Dec, 1 2003 // // NB: list of bunches need to ordered correctly : first created <-> first in the list // #ifndef __LISTPHOTONSINATMOSPHERE_HH_ #define __LISTPHOTONSINATMOSPHERE_HH_ #include #include "euso.hh" #include "PhotonsInAtmosphere.hh" #include "EarthVector.hh" class SinglePhoton; class BunchOfPhotons; class ListPhotonsInAtmosphere : public PhotonsInAtmosphere { public: // ctors ListPhotonsInAtmosphere(); ListPhotonsInAtmosphere(const ListPhotonsInAtmosphere&); // dtor virtual ~ListPhotonsInAtmosphere(); // Get photons following the two different "formats" inline const vector& GetListOfSingle() const {return fListSingle;} inline const vector& GetListOfBunch() const {return fListBunch;} inline size_t GetBunchEntries() const {return fListBunch.size();} inline size_t GetSingleEntries() const {return fListSingle.size();} // Extract one photon from the list SinglePhoton* GetSingle() const; // Extract one Bunch of photons from the list BunchOfPhotons* GetBunch() const; inline void ResetBunchCounter() const {fCountB = 0;} // Add new elements to the lists void Add(SinglePhoton*,Bool_t saved = false); void Add(BunchOfPhotons*); void Add(vector&,Bool_t saved = false); void Add(ListPhotonsInAtmosphere&,Bool_t saved = false); // Same as the matching Add() methods, BUT copies of SinglePhoton and BunchOfPhotons // are created, instead of storing the pointers (in)directly given in argument, // so that the lists passed in argument are not destroyed void Copy(const vector&,Bool_t saved = false); void Copy(const ListPhotonsInAtmosphere&,Bool_t saved = false); // Clear the two lists without deleting pointers they hold void Clear(); // Several options to empty the lists void Reset(Int_t t = 0); // handle the fNbNotSaved counter inline void OneSingleSaved() const {fNbNotSaved--;} inline UInt_t GetNbNotSaved() const {return fNbNotSaved;} // set fTrack steps nb and reserve corresponding memory for fTrack void SetNbTrackSteps(UInt_t); // return fTrack nb ofsteps UInt_t GetNbTrackSteps() const; // add a step void FillTrack(const EarthVector& v); // get a step inline const EarthVector& GetTrackStep(UInt_t i) const {return fTrack[i];} // clear track inline void ClearTrack() {fTrack.clear(); fTrackNbSteps = 0;} // project the given vector on the track // then return the index of the fTrack matching step UInt_t TrackStepIndex(const EarthVector&) const; UInt_t TrackStepIndex(const EarthVector&,EarthVector& rtn) const; private: vector fListSingle; vector fListBunch; vector fTrack; // set of steps adapted from shower simulation, used in propagation // elements = step entry, excepted for last = track end, and last = impact on ground UInt_t fTrackNbSteps; // nb of fTrack elements mutable Int_t fBeforeTrackstart; // check photons not correctly on the track mutable UInt_t fNbNotSaved; // nb of *last added* SinglePhotons which still need to be saved into root mutable UInt_t fCountS; // for extraction of SinglePhoton mutable UInt_t fCountB; // for extraction of BunchOfPhotons ClassDef(ListPhotonsInAtmosphere,0) }; inline void ListPhotonsInAtmosphere::SetNbTrackSteps(UInt_t nb) { fTrackNbSteps = nb; fTrack.reserve(nb); } inline void ListPhotonsInAtmosphere::FillTrack(const EarthVector& v) { if(fTrack.size() == fTrackNbSteps) { Msg(EsafMsg::Warning) << " MORE STEPS THAN FORESEEN" << MsgDispatch; fTrackNbSteps++; } fTrack.push_back(v); } inline UInt_t ListPhotonsInAtmosphere::GetNbTrackSteps() const { if(fTrack.size() < fTrackNbSteps) Msg(EsafMsg::Warning) << " fTrack is NOT WHOLLY FILLED YET" << MsgDispatch; return fTrack.size(); } #endif /* __LISTPHOTONSINATMOSPHERE_HH_ */