source: trunk/MagicSoft/Simulation/Detector/include-MC/MCEventHeader.hxx@ 770

Last change on this file since 770 was 734, checked in by magicsol, 24 years ago
It has been adapted to reflector 0.4
File size: 6.2 KB
Line 
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
17This 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
48class MCEventHeader {
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 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
99public:
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 core position
143 inline Float_t get_core ( Float_t *x, Float_t *y, Int_t ncore = 0 ) {
144 *x = CorePos[0][ncore];
145 *y = CorePos[1][ncore];
146 return ( (Float_t) sqrt ( (*x)*(*x) + (*y)*(*y) ) );
147 }
148
149 // get the core position
150 inline Float_t get_core ( Int_t ncore = 0 ) {
151 return ( (Float_t) sqrt ( ((CorePos[0][ncore])*(CorePos[0][ncore]))+
152 ((CorePos[1][ncore])*(CorePos[1][ncore])) ) );
153 }
154
155 // get the core position in X
156 inline Float_t get_coreX ( Int_t ncore = 0 ) {
157 return ( (Float_t) CorePos[0][ncore] );
158 }
159
160 // get the core position in Y
161 inline Float_t get_coreY ( Int_t ncore = 0 ) {
162 return ( (Float_t) CorePos[1][ncore] );
163 }
164
165 //get photons at different stages
166 inline Float_t get_CORSIKA (){ return CORSIKAPhs;}
167
168 inline Float_t get_AtmAbs (){ return AtmAbsPhs;}
169
170 inline Float_t get_MirrAbs (){ return MirrAbsPhs;}
171
172 inline Float_t get_OutOfMirr (){ return OutOfMirrPhs;}
173
174 inline Float_t get_BlackSpot (){ return BlackSpotPhs;}
175
176 inline Float_t get_OutOfCham (){ return OutOfChamPhs;}
177
178 inline Float_t get_CPhotons (){ return CPhotons;}
179
180
181 // transport from COREventHeader to MCEventHeader
182 void transport ( COREventHeader *e );
183
184 // write extreme times
185 inline void put_times ( Float_t t1, Float_t t2 ) {
186 TimeFirst = t1;
187 TimeLast = t2;
188 }
189
190 // get extreme times
191 inline Float_t get_times ( Float_t *t1, Float_t *t2 ) {
192 *t1 = TimeFirst;
193 *t2 = TimeLast;
194 return ( TimeLast - TimeFirst );
195 }
196
197 // get/set trigger
198 inline void set_trigger( Int_t flag ) { Trigger = (Float_t)flag; }
199 inline Int_t get_trigger( void ) { return( (Int_t)Trigger ); }
200
201 inline int mysize(void)
202 { return ( sizeof( float ) * SIZE_OF_MCEVENTHEADER ); }
203
204 // put deviations of the CT from the original shower direction
205 inline void put_deviations ( Float_t t1, Float_t t2 ) {
206 deviationTheta = t1;
207 deviationPhi = t2;
208 //cerr << '\n' << deviationTheta << ' ' << deviationPhi << '\n';
209 }
210
211 // get deviations of the CT from the original shower direction
212 inline Float_t get_deviations ( Float_t *t1, Float_t *t2 ) {
213
214 float ct1,st1,cp1,sp1;
215 float ct2,st2,cp2,sp2;
216 float x1,y1,z1;
217 float x2,y2,z2;
218
219 ct1 = cos(Theta);
220 st1 = sin(Theta);
221 cp1 = cos(Phi);
222 sp1 = sin(Phi);
223
224 ct2 = cos(Theta+deviationTheta);
225 st2 = sin(Theta+deviationTheta);
226 cp2 = cos(Phi+deviationPhi);
227 sp2 = sin(Phi+deviationPhi);
228
229 x1 = st1*cp1; y1 = st1*sp1; z1 = ct1;
230 x2 = st2*cp2; y2 = st2*sp2; z2 = ct2;
231
232 *t1 = deviationTheta;
233 *t2 = deviationPhi;
234
235 return ( acos(x1*x2 + y1*y2 + z1*z2) );
236 }
237
238 inline void print ( void ) {
239 float *ptr = (float *)this;
240 for(int i=0; i<SIZE_OF_MCEVENTHEADER; ++i,++ptr)
241 cerr << i << ':' << *ptr << '\n';
242 }
243
244};
245// @endcode
246
247#endif // not defined MCEventHeader_Class
Note: See TracBrowser for help on using the repository browser.