source: trunk/MagicSoft/Simulation/Detector/include-MC/MCEventHeader_2.hxx@ 1674

Last change on this file since 1674 was 1674, checked in by blanch, 22 years ago
*** empty log message ***
File size: 8.9 KB
Line 
1/////////////////////////////////////////////////////////////////
2//
3// MCEventHeader_2
4//
5// Created: Sat Oct 19 12:11:43 CEST 2002
6// Author: Oscar Blanch Bigas
7// Purpose: Base class for reflector 0.6 EventHeader
8// Notes:
9//
10/////////////////////////////////////////////////////////////////
11
12// @T \newpage
13
14// @section Source code of {\tt MCEventHeader_2.hxx}
15
16/* @text
17This section shows the include file {\tt MCEventHeader_2.hxx}
18@endtext */
19
20#ifndef MCEventHeader_2_Class
21#define MCEventHeader_2_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_2 181 /* floats */
42
43// @endcode
44
45// @subsection Class {\em MCEventHeader_2}: Definition
46
47// @code
48class MCEventHeader_2 {
49
50protected:
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 Ecutoffh;
76 Float_t Ecutoffm;
77 Float_t Ecutoffe;
78 Float_t Ecutoffg;
79
80 Float_t NFLAIN;
81 Float_t NFLDIF;
82 Float_t NFLPI0;
83 Float_t NFLPIF;
84 Float_t NFLCHE;
85 Float_t NFRAGM;
86
87 Float_t Bx;
88 Float_t By;
89
90 Float_t EGS4yn;
91 Float_t NKGyn;
92 Float_t GHEISHAyn;
93 Float_t VENUSyn;
94 Float_t CERENKOVyn;
95 Float_t NEUTRINOyn;
96 Float_t HORIZONTyn;
97 Float_t COMPUTER;
98
99 Float_t ThetaMin;
100 Float_t ThetaMax;
101 Float_t PhiMin;
102 Float_t PhiMax;
103
104 Float_t CBunchSize;
105 Float_t CDetInX,CDetInY;
106 Float_t CSpacInX,CSpacInY;
107 Float_t CLenInX,CLenInY;
108 Float_t COutput;
109
110 Float_t AngleNorthX;
111 Float_t MuonInfo;
112
113 Float_t StepLength;
114 Float_t CWaveLower;
115 Float_t CWaveUpper;
116 Float_t Multipl;
117 Float_t CorePos[2][20];
118 Float_t SIBYLL[2];
119 Float_t QGSJET[2];
120 Float_t DPMJET[2];
121 Float_t VENUS_cross;
122 Float_t mu_mult_scat;
123 Float_t NKG_range;
124 Float_t EFRCTHN[2];
125 Float_t WMAX[2];
126 Float_t rthin_rmax;
127
128 Float_t viewcone_angles[2];
129 /* (degrees) Inner and outer angles in
130 * Corsika's VIEWCONE option. This is
131 * only possible with Corsika>6 versions. In
132 * that case, PhiMin=PhiMax and
133 * ThetaMin=ThetaMax (also in this header)
134 * indicate the axis of this cone.
135 */
136
137 /* ^^^ Up to here, the info from the CORSIKA event header. */
138
139 /* Telescope orientation: */
140 Float_t telescopePhi; /* rad */
141 Float_t telescopeTheta; /* rad */
142
143 /* Time of first and last photon: */
144 Float_t TimeFirst;
145 Float_t TimeLast;
146
147 /* 6 parameters and chi2 of the NKG fit to the longitudinal
148 * particle distribution (see CORSIKA manual for explanation):
149 */
150 Float_t longi_Nmax;
151 Float_t longi_t0;
152 Float_t longi_tmax;
153 Float_t longi_a;
154 Float_t longi_b;
155 Float_t longi_c;
156 Float_t longi_chi2;
157
158 Float_t CORSIKAPhs; // Original photons written by Corsika
159 Float_t AtmAbsPhs; // Photons absorved by the atmosphere
160 Float_t MirrAbsPhs; // Photons absorved by the mirrors
161 Float_t OutOfMirrPhs; // Photons outside the mirror
162 Float_t BlackSpotPhs; // Photons lost in the "black spot"
163 Float_t OutOfChamPhs; // Photons outside the chamber
164 Float_t CPhotons; // Photons reaching the chamber
165
166 Float_t dummy[10]; /* not used */
167
168public:
169 MCEventHeader_2(void) {} // default constructor
170
171 virtual ~MCEventHeader_2(void) {} // default destructor
172
173 // reads EventHeader from binary input stream
174 Int_t read ( ifstream &is ) {
175 is.read ( (char *)this, mysize() );
176 return is.gcount();
177 }
178
179 // writes EventHeader to binary output stream
180 Int_t write ( ofstream &os ) {
181 os.write ( (char *)this, mysize() );
182 return 0;
183 }
184
185 // get information about the EventHeader
186
187 // get the event number
188 inline Float_t get_evt_number (void) {return EvtNumber;}
189
190 // get the primary type (GEANT code)
191 inline Float_t get_primary ( void ) { return ( PrimaryID ); }
192
193 // get the total primary energy
194 inline Float_t get_energy ( void ) { return ( Etotal ); }
195
196 // get Thick0
197 inline Float_t get_thick0 (void) { return Thick0;}
198
199 // get First Target
200 inline Float_t get_first_target (void) {return FirstTarget;}
201
202 // get z first interaction
203 inline Float_t get_z_first_int (void) {return zFirstInt;}
204
205 // get the initial zenith angle
206 inline Float_t get_theta ( void ) { return ( Theta ); }
207
208 // get the initial phi angle
209 inline Float_t get_phi ( void ) { return ( Phi ); }
210
211 // get the telescope zenith angle
212 inline Float_t get_theta_CT ( void ) { return ( telescopeTheta ); }
213
214 // get the telescope phi angle
215 inline Float_t get_phi_CT ( void ) { return ( telescopePhi ); }
216
217 // get the spectrum slope
218 inline Float_t get_slope ( void ) { return ( SlopeSpec ); }
219
220 // get height of first interaction (in cm)
221 inline Float_t get_height ( void ) { return ( zFirstInt ); }
222
223 // get the energy range of this run
224 inline void get_energy_range ( Float_t *elow, Float_t *eup ) {
225 *elow = ELowLim;
226 *eup = EUppLim;
227 }
228
229 // get the theta range of this run
230 inline void get_theta_range ( Float_t *thlow, Float_t *thup ) {
231 *thlow = ThetaMin;
232 *thup = ThetaMax;
233 }
234
235 // get the energy range of this run
236 inline void get_phi_range ( Float_t *plow, Float_t *pup ) {
237 *plow = PhiMin;
238 *pup = PhiMax;
239 }
240
241 // get the core position
242 inline Float_t get_core ( Float_t *x, Float_t *y, Int_t ncore = 0 ) {
243 *x = CorePos[0][ncore];
244 *y = CorePos[1][ncore];
245 return ( (Float_t) sqrt ( (*x)*(*x) + (*y)*(*y) ) );
246 }
247
248 // get the core position
249 inline Float_t get_core ( Int_t ncore = 0 ) {
250 return ( (Float_t) sqrt ( ((CorePos[0][ncore])*(CorePos[0][ncore]))+
251 ((CorePos[1][ncore])*(CorePos[1][ncore])) ) );
252 }
253
254 // get the core position in X
255 inline Float_t get_coreX ( Int_t ncore = 0 ) {
256 return ( (Float_t) CorePos[0][ncore] );
257 }
258
259 // get the core position in Y
260 inline Float_t get_coreY ( Int_t ncore = 0 ) {
261 return ( (Float_t) CorePos[1][ncore] );
262 }
263
264 //get photons at different stages
265 inline Float_t get_CORSIKA (){ return CORSIKAPhs;}
266
267 inline Float_t get_AtmAbs (){ return AtmAbsPhs;}
268
269 inline Float_t get_MirrAbs (){ return MirrAbsPhs;}
270
271 inline Float_t get_OutOfMirr (){ return OutOfMirrPhs;}
272
273 inline Float_t get_BlackSpot (){ return BlackSpotPhs;}
274
275 inline Float_t get_OutOfCham (){ return OutOfChamPhs;}
276
277 inline Float_t get_CPhotons (){ return CPhotons;}
278
279 inline Float_t get_NumObsLev (){return NumObsLev;}
280
281 inline Float_t get_HeightLev (Int_t i) {return HeightLev[i];}
282
283 inline Float_t get_VersionPGM () {return VersionPGM;}
284
285 inline Float_t get_RunNumber () {return RunNumber;}
286
287 inline Float_t get_DateRun () {return DateRun;}
288
289 inline Float_t get_NumRndSeq () {return NumRndSeq;}
290
291 inline Float_t get_CWaveLower() {return CWaveLower;}
292
293 inline Float_t get_CWaveUpper() {return CWaveUpper;}
294
295 // transport from COREventHeader to MCEventHeader_2
296 void transport ( COREventHeader *e );
297
298 // write extreme times
299 inline void put_times ( Float_t t1, Float_t t2 ) {
300 TimeFirst = t1;
301 TimeLast = t2;
302 }
303
304 // get extreme times
305 inline Float_t get_times ( Float_t *t1, Float_t *t2 ) {
306 *t1 = TimeFirst;
307 *t2 = TimeLast;
308 return ( TimeLast - TimeFirst );
309 }
310
311 inline Float_t get_NKGfit(Float_t *Nmax, Float_t *t0, Float_t *tmax,
312 Float_t *a, Float_t *b, Float_t *c){
313 *Nmax=longi_Nmax; *t0=longi_t0; *tmax=longi_tmax;
314 *a=longi_a; *b=longi_b; *c=longi_c;
315
316 return longi_chi2;
317
318 }
319
320 inline int mysize(void)
321 { return ( sizeof( float ) * SIZE_OF_MCEVENTHEADER_2 ); }
322
323 // get deviations of the CT from the original shower direction
324 inline Float_t get_deviations ( Float_t *t1, Float_t *t2 ) {
325
326 float ct1,st1,cp1,sp1;
327 float ct2,st2,cp2,sp2;
328 float x1,y1,z1;
329 float x2,y2,z2;
330
331 ct1 = cos(Theta);
332 st1 = sin(Theta);
333 cp1 = cos(Phi);
334 sp1 = sin(Phi);
335
336 ct2 = cos(telescopeTheta);
337 st2 = sin(telescopeTheta);
338 cp2 = cos(telescopePhi);
339 sp2 = sin(telescopePhi);
340
341 x1 = st1*cp1; y1 = st1*sp1; z1 = ct1;
342 x2 = st2*cp2; y2 = st2*sp2; z2 = ct2;
343
344 *t1 = (telescopeTheta-Theta);
345 *t2 = (telescopePhi-Phi);
346
347 return ( acos(x1*x2 + y1*y2 + z1*z2) );
348 }
349
350 inline void print ( void ) {
351 float *ptr = (float *)this;
352 for(int i=0; i<SIZE_OF_MCEVENTHEADER_2; ++i,++ptr)
353 cerr << i << ':' << *ptr << '\n';
354 }
355
356};
357// @endcode
358
359#endif // not defined MCEventHeader_2_Class
Note: See TracBrowser for help on using the repository browser.