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

Last change on this file since 9322 was 9308, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 4.5 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 <TQuaternion.h>
18#endif
19
20// gcc 3.2
21//class ifstream;
22#include <iosfwd>
23
24class MCorsikaRunHeader;
25
26class MPhotonData : public TObject //MParContainer
27{
28private:
29 Float_t fPosX; // [cm] X (north) at observation level
30 Float_t fPosY; // [cm] Y (west) at observation level
31
32 Float_t fCosU; // [cos x] U direction cosine to x-axis
33 Float_t fCosV; // [cos y] V direction cosine to y-axis
34
35 Float_t fTime; // [ns] Time since first interaction or entrance into atmosphere
36 // 17M
37 UShort_t fWavelength; // [nm] Wavelength
38 // 19M
39 UInt_t fNumPhotons; // Number of cherenkov photons ins bunch
40 Float_t fProductionHeight; // [cm] Height of bunch production
41 MMcEvtBasic::ParticleId_t fPrimary; // Type of emitting particle
42 // 22M
43 // gzip
44 // 25M
45 // raw
46 // 32M
47
48 Int_t fTag; //! A tag for external use
49 Float_t fWeight; //! A weight for external use
50
51protected:
52 virtual Int_t FillCorsika(Float_t f[7]);
53 virtual Int_t FillRfl(Float_t f[8]);
54
55public:
56 MPhotonData(/*const char *name=NULL, const char *title=NULL*/);
57 //MPhotonData(const MPhotonData &ph);
58
59 // Getter 1D
60 Float_t GetPosX() const { return fPosX; }
61 Float_t GetPosY() const { return fPosY; }
62
63 Float_t GetCosU() const { return fCosU; }
64 Float_t GetCosV() const { return fCosV; }
65 Double_t GetCosW() const;
66 Double_t GetTheta() const;
67
68 Double_t GetTime() const { return fTime; }
69
70 // Getter 2D
71 TVector2 GetPos2() const { return TVector2(fPosX, fPosY); }
72 TVector2 GetDir2() const { return TVector2(fCosU, fCosV);}
73// TVector2 GetDir2() const { return TVector2(fCosU, fCosV)/(1-TMath::Hypot(fCosU, fCosV)); }
74
75 // Getter 3D
76 TVector3 GetPos3() const { return TVector3(fPosX, fPosY, 0); }
77 TVector3 GetDir3() const { return TVector3(fCosU, fCosV, -GetCosW()); }
78
79 // Getter 4D
80 TQuaternion GetPosQ() const;
81 TQuaternion GetDirQ() const;
82
83 // Getter Others
84 UShort_t GetWavelength() const { return fWavelength; }
85 Float_t GetProductionHeight() const { return fProductionHeight; }
86 MMcEvtBasic::ParticleId_t GetPrimary() const { return fPrimary; }
87
88 //virtual Float_t GetWeight() const { return 1; }
89 virtual Float_t GetWeight() const { return fWeight; }
90 void SetWeight(Float_t w=1) { fWeight=w; }
91
92 // Setter
93 void SetPosition(Float_t x, Float_t y) { fPosX=x; fPosY=y; }
94 void SetDirection(Float_t u, Float_t v) { fCosU=u; fCosV=v; }
95
96 void SetPosition(const TVector2 &p) { fPosX=p.X(); fPosY=p.Y(); }
97 void SetDirection(const TVector2 &d) { fCosU=d.X(); fCosV=d.Y(); }
98
99 void SetPosition(const TQuaternion &p) { fPosX=p.fVectorPart.X(); fPosY=p.fVectorPart.Y(); fTime=p.fRealPart; }
100 void SetDirection(const TQuaternion &d) { fCosU=d.fVectorPart.X(); fCosV=d.fVectorPart.Y(); }
101
102 void SetPrimary(MMcEvtBasic::ParticleId_t p) { fPrimary=p; }
103 void SetWavelength(UShort_t wl) { fWavelength=wl; }
104
105 void AddTime(Double_t dt) { fTime += dt; }
106 void SetTime(Double_t t) { fTime = t; }
107
108 void Copy(TObject &obj) const;
109
110 void SetTag(Int_t tag) { fTag=tag; }
111 Int_t GetTag() const { return fTag; }
112
113 //void Clear(Option_t * = NULL);
114 void Print(Option_t * = NULL) const;
115 //void Draw (Option_t * = NULL);
116 Bool_t IsSortable() const { return kTRUE; }
117 Int_t Compare(const TObject *obj) const
118 {
119 const MPhotonData &d = *static_cast<const MPhotonData*>(obj);
120 if (fTime<d.fTime)
121 return -1;
122 if (fTime>d.fTime)
123 return 1;
124 return 0;
125 }
126/*
127 void FillRad(TH1 &hist, Float_t scale=1) const;
128 void FillRad(TH2 &hist, Double_t x, Float_t scale=1) const;
129 void Fill(TH2 &hist, Float_t scale=1) const;
130 void Fill(TH3 &hist, Double_t z, Float_t scale=1) const;
131 */
132 Int_t ReadCorsikaEvt(istream &fin);
133 Int_t ReadRflEvt(istream &fin);
134
135 ClassDef(MPhotonData, 1) //Container to store a cherenkov photon bunch from a CORSUKA file
136};
137/*
138class MPhotonDataWeighted : public MPhotonData
139{
140private:
141 Float_t fWeight; // A weight for external use
142
143public:
144 Float_t GetWeight() const { return fWeight; }
145
146 ClassDef(MPhotonData, 1)
147};
148*/
149#endif
Note: See TracBrowser for help on using the repository browser.