source: branches/removing_cpp11_features/msim/MPhotonData.h@ 18195

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