1 | /////////////////////////////////////////////////////////////////
|
---|
2 | //
|
---|
3 | // MCEventHeader
|
---|
4 | //
|
---|
5 | // Created: Tue Apr 28 16:27:14 1998
|
---|
6 | // Author: Jose Carlos Gonzales
|
---|
7 | // Purpose: Base class for EventHeader-classes
|
---|
8 | // Notes:
|
---|
9 | //
|
---|
10 | /////////////////////////////////////////////////////////////////
|
---|
11 |
|
---|
12 | // @T \newpage
|
---|
13 |
|
---|
14 | // @section Source code of {\tt MCEventHeader.hxx}
|
---|
15 |
|
---|
16 | /* @text
|
---|
17 | This section shows the include file {\tt MCEventHeader.hxx}
|
---|
18 | @endtext */
|
---|
19 |
|
---|
20 | #ifndef MCEventHeader_Class
|
---|
21 | #define MCEventHeader_Class
|
---|
22 |
|
---|
23 | // @subsection Include files
|
---|
24 |
|
---|
25 | // @code
|
---|
26 | #include <MAGIC.h>
|
---|
27 | #include <TObject.h>
|
---|
28 |
|
---|
29 | #include <iostream.h>
|
---|
30 | #include <iomanip.h>
|
---|
31 | #include <fstream.h>
|
---|
32 | #include <stdlib.h>
|
---|
33 | #include <math.h>
|
---|
34 |
|
---|
35 | #include "COREventHeader.hxx"
|
---|
36 |
|
---|
37 | #define SIZE_OF_MCEVENTHEADER 117 /* floats */
|
---|
38 |
|
---|
39 | // @endcode
|
---|
40 |
|
---|
41 | // @subsection Class {\em MCEventHeader}: Definition
|
---|
42 |
|
---|
43 | // @code
|
---|
44 | class MCEventHeader {
|
---|
45 |
|
---|
46 | protected:
|
---|
47 | Float_t EvtNumber;
|
---|
48 | Float_t PrimaryID;
|
---|
49 | Float_t Etotal;
|
---|
50 | Float_t Thick0;
|
---|
51 | Float_t FirstTarget;
|
---|
52 | Float_t zFirstInt;
|
---|
53 | Float_t p[3];
|
---|
54 | Float_t Theta;
|
---|
55 | Float_t Phi;
|
---|
56 |
|
---|
57 | Float_t NumRndSeq;
|
---|
58 | Float_t RndData[10][3];
|
---|
59 |
|
---|
60 | Float_t RunNumber;
|
---|
61 | Float_t DateRun;
|
---|
62 | Float_t VersionPGM;
|
---|
63 |
|
---|
64 | Float_t NumObsLev;
|
---|
65 | Float_t HeightLev[10];
|
---|
66 |
|
---|
67 | Float_t SlopeSpec;
|
---|
68 | Float_t ELowLim;
|
---|
69 | Float_t EUppLim;
|
---|
70 |
|
---|
71 | Float_t ThetaMin;
|
---|
72 | Float_t ThetaMax;
|
---|
73 | Float_t PhiMin;
|
---|
74 | Float_t PhiMax;
|
---|
75 |
|
---|
76 | Float_t CWaveLower;
|
---|
77 | Float_t CWaveUpper;
|
---|
78 | Float_t CorePos[2][20];
|
---|
79 | Float_t TimeFirst;
|
---|
80 | Float_t TimeLast;
|
---|
81 |
|
---|
82 | Float_t deviationPhi;
|
---|
83 | Float_t deviationTheta;
|
---|
84 |
|
---|
85 | Float_t Trigger; // 110 floats
|
---|
86 |
|
---|
87 | Float_t CORSIKAPhs; // Original photons written by Corsika
|
---|
88 | Float_t AtmAbsPhs; // Photons absorved by the atmosphere
|
---|
89 | Float_t MirrAbsPhs; // Photons absorved by the mirrors
|
---|
90 | Float_t OutOfMirrPhs; // Photons outside the mirror
|
---|
91 | Float_t BlackSpotPhs; // Photons lost in the "black spot"
|
---|
92 | Float_t OutOfChamPhs; // Photons outside the chamber
|
---|
93 | Float_t CPhotons; // Photons reaching the chamber
|
---|
94 |
|
---|
95 | public:
|
---|
96 | MCEventHeader(void) {} // default constructor
|
---|
97 |
|
---|
98 | virtual ~MCEventHeader(void) {} // default destructor
|
---|
99 |
|
---|
100 | // reads EventHeader from binary input stream
|
---|
101 | Int_t read ( ifstream &is ) {
|
---|
102 | is.read ( (char *)this, mysize() );
|
---|
103 | return is.gcount();
|
---|
104 | }
|
---|
105 |
|
---|
106 | // writes EventHeader to binary output stream
|
---|
107 | Int_t write ( ofstream &os ) {
|
---|
108 | os.write ( (char *)this, mysize() );
|
---|
109 | return 0;
|
---|
110 | }
|
---|
111 |
|
---|
112 | // get information about the EventHeader
|
---|
113 |
|
---|
114 | // get the primary type (GEANT code)
|
---|
115 | inline Float_t get_primary ( void ) { return ( PrimaryID ); }
|
---|
116 |
|
---|
117 | // get the total primary energy
|
---|
118 | inline Float_t get_energy ( void ) { return ( Etotal ); }
|
---|
119 |
|
---|
120 | // get the initial zenith angle
|
---|
121 | inline Float_t get_theta ( void ) { return ( Theta ); }
|
---|
122 |
|
---|
123 | // get the initial phi angle
|
---|
124 | inline Float_t get_phi ( void ) { return ( Phi ); }
|
---|
125 |
|
---|
126 | // get the spectrum slope
|
---|
127 | inline Float_t get_slope ( void ) { return ( SlopeSpec ); }
|
---|
128 |
|
---|
129 | // get height of first interaction (in cm)
|
---|
130 | inline Float_t get_height ( void ) { return ( zFirstInt ); }
|
---|
131 |
|
---|
132 | // get the energy range of this run
|
---|
133 | inline void get_energy_range ( Float_t *elow, Float_t *eup ) {
|
---|
134 | *elow = ELowLim;
|
---|
135 | *eup = EUppLim;
|
---|
136 | }
|
---|
137 |
|
---|
138 | // get the theta range of this run
|
---|
139 | inline void get_theta_range ( Float_t *thlow, Float_t *thup ) {
|
---|
140 | *thlow = ThetaMin;
|
---|
141 | *thup = ThetaMax;
|
---|
142 | }
|
---|
143 |
|
---|
144 | // get the energy range of this run
|
---|
145 | inline void get_phi_range ( Float_t *plow, Float_t *pup ) {
|
---|
146 | *plow = PhiMin;
|
---|
147 | *pup = PhiMax;
|
---|
148 | }
|
---|
149 |
|
---|
150 | // get the core position
|
---|
151 | inline Float_t get_core ( Float_t *x, Float_t *y, Int_t ncore = 0 ) {
|
---|
152 | *x = CorePos[0][ncore];
|
---|
153 | *y = CorePos[1][ncore];
|
---|
154 | return ( (Float_t) sqrt ( (*x)*(*x) + (*y)*(*y) ) );
|
---|
155 | }
|
---|
156 |
|
---|
157 | // get the core position
|
---|
158 | inline Float_t get_core ( Int_t ncore = 0 ) {
|
---|
159 | return ( (Float_t) sqrt ( ((CorePos[0][ncore])*(CorePos[0][ncore]))+
|
---|
160 | ((CorePos[1][ncore])*(CorePos[1][ncore])) ) );
|
---|
161 | }
|
---|
162 |
|
---|
163 | // get the core position in X
|
---|
164 | inline Float_t get_coreX ( Int_t ncore = 0 ) {
|
---|
165 | return ( (Float_t) CorePos[0][ncore] );
|
---|
166 | }
|
---|
167 |
|
---|
168 | // get the core position in Y
|
---|
169 | inline Float_t get_coreY ( Int_t ncore = 0 ) {
|
---|
170 | return ( (Float_t) CorePos[1][ncore] );
|
---|
171 | }
|
---|
172 |
|
---|
173 | //get photons at different stages
|
---|
174 | inline Float_t get_CORSIKA (){ return CORSIKAPhs;}
|
---|
175 |
|
---|
176 | inline Float_t get_AtmAbs (){ return AtmAbsPhs;}
|
---|
177 |
|
---|
178 | inline Float_t get_MirrAbs (){ return MirrAbsPhs;}
|
---|
179 |
|
---|
180 | inline Float_t get_OutOfMirr (){ return OutOfMirrPhs;}
|
---|
181 |
|
---|
182 | inline Float_t get_BlackSpot (){ return BlackSpotPhs;}
|
---|
183 |
|
---|
184 | inline Float_t get_OutOfCham (){ return OutOfChamPhs;}
|
---|
185 |
|
---|
186 | inline Float_t get_CPhotons (){ return CPhotons;}
|
---|
187 |
|
---|
188 | inline Float_t get_NumObsLev (){return NumObsLev;}
|
---|
189 |
|
---|
190 | inline Float_t get_HeightLev (Int_t i) {return HeightLev[i];}
|
---|
191 |
|
---|
192 | inline Float_t get_VersionPGM () {return VersionPGM;}
|
---|
193 |
|
---|
194 | inline Float_t get_RunNumber () {return RunNumber;}
|
---|
195 |
|
---|
196 | inline Float_t get_DateRun () {return DateRun;}
|
---|
197 |
|
---|
198 | inline Float_t get_NumRndSeq () {return NumRndSeq;}
|
---|
199 |
|
---|
200 | inline Float_t get_CWaveLower() {return CWaveLower;}
|
---|
201 |
|
---|
202 | inline Float_t get_CWaveUpper() {return CWaveUpper;}
|
---|
203 |
|
---|
204 | // transport from COREventHeader to MCEventHeader
|
---|
205 | void transport ( COREventHeader *e );
|
---|
206 |
|
---|
207 | // write extreme times
|
---|
208 | inline void put_times ( Float_t t1, Float_t t2 ) {
|
---|
209 | TimeFirst = t1;
|
---|
210 | TimeLast = t2;
|
---|
211 | }
|
---|
212 |
|
---|
213 | // get extreme times
|
---|
214 | inline Float_t get_times ( Float_t *t1, Float_t *t2 ) {
|
---|
215 | *t1 = TimeFirst;
|
---|
216 | *t2 = TimeLast;
|
---|
217 | return ( TimeLast - TimeFirst );
|
---|
218 | }
|
---|
219 |
|
---|
220 | // get/set trigger
|
---|
221 | inline void set_trigger( Int_t flag ) { Trigger = (Float_t)flag; }
|
---|
222 | inline Int_t get_trigger( void ) { return( (Int_t)Trigger ); }
|
---|
223 |
|
---|
224 | inline int mysize(void)
|
---|
225 | { return ( sizeof( float ) * SIZE_OF_MCEVENTHEADER ); }
|
---|
226 |
|
---|
227 | // put deviations of the CT from the original shower direction
|
---|
228 | inline void put_deviations ( Float_t t1, Float_t t2 ) {
|
---|
229 | deviationTheta = t1;
|
---|
230 | deviationPhi = t2;
|
---|
231 | //cerr << '\n' << deviationTheta << ' ' << deviationPhi << '\n';
|
---|
232 | }
|
---|
233 |
|
---|
234 | // get deviations of the CT from the original shower direction
|
---|
235 | inline Float_t get_deviations ( Float_t *t1, Float_t *t2 ) {
|
---|
236 |
|
---|
237 | float ct1,st1,cp1,sp1;
|
---|
238 | float ct2,st2,cp2,sp2;
|
---|
239 | float x1,y1,z1;
|
---|
240 | float x2,y2,z2;
|
---|
241 |
|
---|
242 | ct1 = cos(Theta);
|
---|
243 | st1 = sin(Theta);
|
---|
244 | cp1 = cos(Phi);
|
---|
245 | sp1 = sin(Phi);
|
---|
246 |
|
---|
247 | ct2 = cos(Theta+deviationTheta);
|
---|
248 | st2 = sin(Theta+deviationTheta);
|
---|
249 | cp2 = cos(Phi+deviationPhi);
|
---|
250 | sp2 = sin(Phi+deviationPhi);
|
---|
251 |
|
---|
252 | x1 = st1*cp1; y1 = st1*sp1; z1 = ct1;
|
---|
253 | x2 = st2*cp2; y2 = st2*sp2; z2 = ct2;
|
---|
254 |
|
---|
255 | *t1 = deviationTheta;
|
---|
256 | *t2 = deviationPhi;
|
---|
257 |
|
---|
258 | return ( acos(x1*x2 + y1*y2 + z1*z2) );
|
---|
259 | }
|
---|
260 |
|
---|
261 | inline void print ( void ) {
|
---|
262 | float *ptr = (float *)this;
|
---|
263 | for(int i=0; i<SIZE_OF_MCEVENTHEADER; ++i,++ptr)
|
---|
264 | cerr << i << ':' << *ptr << '\n';
|
---|
265 | }
|
---|
266 |
|
---|
267 | };
|
---|
268 | // @endcode
|
---|
269 |
|
---|
270 | #endif // not defined MCEventHeader_Class
|
---|