source: trunk/Mars/msim/MPhotonData.h @ 19339

Last change on this file since 19339 was 19339, checked in by tbretz, 6 months ago
Added the 8-float format as FillEvtCorsikaThin, calculate absolute wavelength (right now, I don't know what to do with the information from the negative WL, print the origin only if it is defined, added some docu from the corsika docu, removed MMCS specific stuff by a pre-compiler directive -- do we still have MMCS data?
File size: 4.7 KB
Line 
1#ifndef MARS_MPhotonData
2#define MARS_MPhotonData
3
4#ifndef MARS_MMcEvtBasic
5#include "MMcEvtBasic.h"
6#endif
7
8#ifndef ROOT_TVector2
9#include <TVector2.h>
10#endif
11
12#ifndef ROOT_TVector3
13#include <TVector3.h>
14#endif
15
16#ifndef ROOT_TQuaternion
17#include <math.h>
18//#define sqrt ::sqrt
19#include <TQuaternion.h>
20//#undef sqrt
21#endif
22
23// gcc 3.2
24//class ifstream;
25#include <iosfwd>
26
27class MCorsikaRunHeader;
28
29class MPhotonData : public TObject
30{
31private:
32    Float_t fPosX;                       // [cm] "+west"    "-east"  (both at observation level)
33    Float_t fPosY;                       // [cm] "+south"   "-north" (north denotes the magnet north which is defined to be in the geografic north!)
34
35    Float_t fCosU;                       // [cos x] U direction cosine to x-axis
36    Float_t fCosV;                       // [cos y] V direction cosine to y-axis
37
38    Float_t fTime;                       // [ns] Time since first interaction or entrance into atmosphere
39    Short_t fWavelength;                 // [nm] Wavelength
40//    UInt_t   fNumPhotons;                // Number of cherenkov photons ins bunch
41    Float_t  fProductionHeight;          // [cm] Height of bunch production
42    MMcEvtBasic::ParticleId_t fPrimary;  // Type of emitting particle
43
44    Int_t   fTag;    //! A tag for external use
45    Int_t   fMirrorTag;    // Tag for the mirror ID of the mirror which was hit by this photon
46    Float_t fWeight; //! A weight for external use
47
48public:
49    MPhotonData(/*const char *name=NULL, const char *title=NULL*/);
50    //MPhotonData(const MPhotonData &ph);
51
52    // Getter 1D
53    Float_t  GetPosX()  const { return fPosX; }
54    Float_t  GetPosY()  const { return fPosY; }
55
56    Float_t  GetCosU()  const { return fCosU; }
57    Float_t  GetCosV()  const { return fCosV; }
58    Double_t GetCosW()  const;
59    Double_t GetSinW()  const;
60    Double_t GetCosW2()  const;
61    Double_t GetSinW2()  const;
62    Double_t GetTheta() const;
63
64    Double_t GetTime()  const { return fTime; }
65
66    // Getter 2D
67    TVector2 GetPos2()  const { return TVector2(fPosX, fPosY); }
68    TVector2 GetDir2()  const { return TVector2(fCosU, fCosV);}
69//    TVector2 GetDir2() const { return TVector2(fCosU, fCosV)/(1-TMath::Hypot(fCosU, fCosV)); }
70
71    // Getter 3D
72    TVector3 GetPos3()  const { return TVector3(fPosX, fPosY, 0); }
73    TVector3 GetDir3()  const { return TVector3(fCosU, fCosV, -GetCosW()); }
74
75    // Getter 4D
76    TQuaternion GetPosQ() const;
77    TQuaternion GetDirQ() const;
78
79    // Getter Others
80    UShort_t GetWavelength() const { return TMath::Abs(fWavelength); }
81    Float_t GetProductionHeight() const { return fProductionHeight; }
82    MMcEvtBasic::ParticleId_t GetPrimary() const { return fPrimary; }
83
84    // Status of the simulation of photons
85    Bool_t IncludesEfficiencies() const { return fWavelength<0; }
86
87    //virtual Float_t GetWeight() const { return 1; }
88    virtual Float_t GetWeight() const { return fWeight; }
89    void SetWeight(Float_t w=1) { fWeight=w; }
90
91    // Setter
92    void SetPosition(Float_t x, Float_t y)  { fPosX=x; fPosY=y; }
93    void SetDirection(Float_t u, Float_t v) { fCosU=u; fCosV=v; }
94
95    void SetPosition(const TVector2 &p)     { fPosX=p.X(); fPosY=p.Y(); }
96    void SetDirection(const TVector2 &d)    { fCosU=d.X(); fCosV=d.Y(); }
97
98    void SetPosition(const TQuaternion &p)  { fPosX=p.fVectorPart.X(); fPosY=p.fVectorPart.Y(); fTime=p.fRealPart; }
99    void SetDirection(const TQuaternion &d) { fCosU=d.fVectorPart.X(); fCosV=d.fVectorPart.Y(); }
100
101    void SetPrimary(MMcEvtBasic::ParticleId_t p) { fPrimary=p; }
102    void SetWavelength(Short_t wl) { fWavelength=wl; }
103
104    void AddTime(Double_t dt) { fTime += dt; }
105    void SetTime(Double_t t)  { fTime  = t; }
106
107    void SimWavelength(Float_t wmin, Float_t wmax);
108
109    void Copy(TObject &obj) const;
110
111    void SetTag(Int_t tag) { fTag=tag; }
112    Int_t GetTag() const { return fTag; }
113
114    void SetMirrorTag(Int_t mirrorTag) { fMirrorTag=mirrorTag; }
115    Int_t GetMirrorTag() const { return fMirrorTag; }
116
117    // TObject
118    //void Clear(Option_t * = NULL);
119    void Print(Option_t * = NULL) const;
120    //void Draw (Option_t * = NULL);
121    Bool_t IsSortable() const { return kTRUE; }
122    Int_t  Compare(const TObject *obj) const
123    {
124        const MPhotonData &d = *static_cast<const MPhotonData*>(obj);
125        if (fTime<d.fTime)
126            return -1;
127        if (fTime>d.fTime)
128            return 1;
129        return 0;
130    }
131
132    // I/O
133    //Int_t ReadCorsikaEvt(istream &fin);
134    //Int_t ReadRflEvt(istream &fin);
135
136    Int_t FillCorsika(const Float_t f[7], Int_t i);
137    Int_t FillCorsikaThin(const Float_t f[8], Int_t i);
138    Int_t FillEventIO(const Short_t f[8]);
139    Int_t FillEventIO(const Float_t f[8]);
140    Int_t FillRfl(const Float_t f[8]);
141
142    ClassDef(MPhotonData, 2) //Container to store a cherenkov photon bunch from a CORSUKA file
143};
144
145#endif
Note: See TracBrowser for help on using the repository browser.