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

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