source: trunk/MagicSoft/Mars/msim/MPhotonData.h@ 9620

Last change on this file since 9620 was 9616, checked in by rohlfs, 14 years ago
can read also EventIO files
File size: 4.3 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 // 17M
40 UShort_t fWavelength; // [nm] Wavelength
41 // 19M
42 UInt_t fNumPhotons; // Number of cherenkov photons ins bunch
43 Float_t fProductionHeight; // [cm] Height of bunch production
44 MMcEvtBasic::ParticleId_t fPrimary; // Type of emitting particle
45 // 22M
46 // gzip
47 // 25M
48 // raw
49 // 32M
50
51 Int_t fTag; //! A tag for external use
52 Float_t fWeight; //! A weight for external use
53
54public:
55 MPhotonData(/*const char *name=NULL, const char *title=NULL*/);
56 //MPhotonData(const MPhotonData &ph);
57
58 // Getter 1D
59 Float_t GetPosX() const { return fPosX; }
60 Float_t GetPosY() const { return fPosY; }
61
62 Float_t GetCosU() const { return fCosU; }
63 Float_t GetCosV() const { return fCosV; }
64 Double_t GetCosW() const;
65 Double_t GetSinW() const;
66 Double_t GetCosW2() const;
67 Double_t GetSinW2() const;
68 Double_t GetTheta() const;
69
70 Double_t GetTime() const { return fTime; }
71
72 // Getter 2D
73 TVector2 GetPos2() const { return TVector2(fPosX, fPosY); }
74 TVector2 GetDir2() const { return TVector2(fCosU, fCosV);}
75// TVector2 GetDir2() const { return TVector2(fCosU, fCosV)/(1-TMath::Hypot(fCosU, fCosV)); }
76
77 // Getter 3D
78 TVector3 GetPos3() const { return TVector3(fPosX, fPosY, 0); }
79 TVector3 GetDir3() const { return TVector3(fCosU, fCosV, -GetCosW()); }
80
81 // Getter 4D
82 TQuaternion GetPosQ() const;
83 TQuaternion GetDirQ() const;
84
85 // Getter Others
86 UShort_t GetWavelength() const { return fWavelength; }
87 Float_t GetProductionHeight() const { return fProductionHeight; }
88 MMcEvtBasic::ParticleId_t GetPrimary() const { return fPrimary; }
89
90 //virtual Float_t GetWeight() const { return 1; }
91 virtual Float_t GetWeight() const { return fWeight; }
92 void SetWeight(Float_t w=1) { fWeight=w; }
93
94 // Setter
95 void SetPosition(Float_t x, Float_t y) { fPosX=x; fPosY=y; }
96 void SetDirection(Float_t u, Float_t v) { fCosU=u; fCosV=v; }
97
98 void SetPosition(const TVector2 &p) { fPosX=p.X(); fPosY=p.Y(); }
99 void SetDirection(const TVector2 &d) { fCosU=d.X(); fCosV=d.Y(); }
100
101 void SetPosition(const TQuaternion &p) { fPosX=p.fVectorPart.X(); fPosY=p.fVectorPart.Y(); fTime=p.fRealPart; }
102 void SetDirection(const TQuaternion &d) { fCosU=d.fVectorPart.X(); fCosV=d.fVectorPart.Y(); }
103
104 void SetPrimary(MMcEvtBasic::ParticleId_t p) { fPrimary=p; }
105 void SetWavelength(UShort_t wl) { fWavelength=wl; }
106
107 void AddTime(Double_t dt) { fTime += dt; }
108 void SetTime(Double_t t) { fTime = t; }
109
110 void Copy(TObject &obj) const;
111
112 void SetTag(Int_t tag) { fTag=tag; }
113 Int_t GetTag() const { return fTag; }
114
115 // TObject
116 //void Clear(Option_t * = NULL);
117 void Print(Option_t * = NULL) const;
118 //void Draw (Option_t * = NULL);
119 Bool_t IsSortable() const { return kTRUE; }
120 Int_t Compare(const TObject *obj) const
121 {
122 const MPhotonData &d = *static_cast<const MPhotonData*>(obj);
123 if (fTime<d.fTime)
124 return -1;
125 if (fTime>d.fTime)
126 return 1;
127 return 0;
128 }
129
130 // I/O
131 Int_t ReadCorsikaEvt(istream &fin);
132 Int_t ReadRflEvt(istream &fin);
133
134 Int_t FillCorsika(Float_t f[7]);
135 Int_t FillEventIO(Float_t f[7]);
136 Int_t FillRfl(Float_t f[8]);
137
138 ClassDef(MPhotonData, 1) //Container to store a cherenkov photon bunch from a CORSUKA file
139};
140
141#endif
Note: See TracBrowser for help on using the repository browser.