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