source: trunk/MagicSoft/Simulation/Detector/include-CORSIKA/COREventHeader.hxx@ 794

Last change on this file since 794 was 792, checked in by domingo, 24 years ago
Some more functionality added to the class (get_number for getting the event number)
File size: 7.1 KB
Line 
1/////////////////////////////////////////////////////////////////
2//
3// COREventHeader
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 COREventHeader.hxx}
15
16/* @text
17This section shows the include file {\tt COREventHeader.hxx}
18@endtext */
19
20#ifndef COREventHeader_Class
21#define COREventHeader_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// @endcode
39
40// @subsection Class {\em COREventHeader}: Definition
41
42// @code
43class COREventHeader {
44
45public:
46 char EVTH[4];
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 Ecutoffh;
72 Float_t Ecutoffm;
73 Float_t Ecutoffe;
74 Float_t Ecutoffg;
75
76 Float_t NFLAIN;
77 Float_t NFLDIF;
78 Float_t NFLPI0;
79 Float_t NFLPIF;
80 Float_t NFLCHE;
81 Float_t NFRAGM;
82
83 Float_t Bx;
84 Float_t By;
85
86 Float_t EGS4yn;
87 Float_t NKGyn;
88 Float_t GHEISHAyn;
89 Float_t VENUSyn;
90 Float_t CERENKOVyn;
91 Float_t NEUTRINOyn;
92 Float_t HORIZONTyn;
93 Float_t COMPUTER;
94
95 Float_t ThetaMin;
96 Float_t ThetaMax;
97 Float_t PhiMin;
98 Float_t PhiMax;
99
100 Float_t CBunchSize;
101 Float_t CDetInX,CDetInY;
102 Float_t CSpacInX,CSpacInY;
103 Float_t CLenInX,CLenInY;
104 Float_t COutput;
105
106 Float_t AngleNorthX;
107 Float_t MuonInfo;
108
109 Float_t StepLength;
110 Float_t CWaveLower;
111 Float_t CWaveUpper;
112 Float_t Multipl;
113 Float_t CorePos[2][20];
114
115 Float_t dmmy1;
116 Float_t SpinTheta;
117 Float_t SpinPhi;
118 Float_t dmmy2[132];
119
120public:
121 COREventHeader(void) {} // default constructor
122
123 virtual ~COREventHeader(void) {} // default destructor
124
125 // reads EventHeader from binary input stream
126 Int_t read ( ifstream &is ) {
127 is.read ( (char *)this, sizeof( float ) * 273 );
128 return is.gcount();
129 }
130
131 // writes EventHeader to binary output stream
132 Int_t write ( ofstream &os ) {
133 os.write ( (char *)this, sizeof( float ) * 273 );
134 return 0;
135 }
136
137 // get information about the EventHeader
138
139 // print-out of the EVTH
140 void print(void);
141
142 // get the event number
143 inline Float_t get_number ( void ) { return ( EvtNumber ); }
144
145 // get the primary type (GEANT code)
146 inline Float_t get_primary ( void ) { return ( PrimaryID ); }
147
148 // get the total primary energy
149 inline Float_t get_energy ( void ) { return ( Etotal ); }
150
151 // get the initial zenith angle
152 inline Float_t get_theta ( void ) { return ( Theta ); }
153
154 // get the initial phi angle
155 inline Float_t get_phi ( void ) { return ( Phi ); }
156
157 // get the particle xi angle
158 inline Float_t get_xi ( void ) { return ( SpinTheta ); }
159
160 // get the particle spin-theta angle
161 inline Float_t get_stheta ( void ) { return ( SpinTheta ); }
162
163 // get the particle spin-phi angle
164 inline Float_t get_sphi ( void ) { return ( SpinPhi ); }
165
166 // get the particle real angles of the particle
167 void get_real_direct ( Float_t *theta, Float_t *phi ) {
168 *theta = acos(cos(Theta)*cos(SpinTheta)+
169 sin(Theta)*sin(SpinTheta)*cos(fabs(SpinPhi)));
170 *phi = asin(sin(SpinTheta)*sin(fabs(SpinPhi))/sin(*theta));
171 if (SpinPhi<0.0)
172 *phi = Phi - *phi;
173 else
174 *phi = Phi + *phi;
175 }
176
177 // get the spectrum slope
178 inline Float_t get_slope ( void ) { return ( SlopeSpec ); }
179
180 // get the energy range of this run
181 inline void get_energy_range ( Float_t *elow, Float_t *eup ) {
182 *elow = ELowLim;
183 *eup = EUppLim;
184 }
185
186 // get the core position
187 inline Float_t get_core ( Float_t *x, Float_t *y, Int_t ncore = 0 ) {
188 *x = CorePos[0][ncore];
189 *y = CorePos[1][ncore];
190 return ( (Float_t) sqrt ( (*x)*(*x) + (*y)*(*y) ) );
191 }
192
193 // get the core position
194 inline Float_t get_core ( Int_t ncore = 0 ) {
195 return ( (Float_t) sqrt ( ((CorePos[0][ncore])*(CorePos[0][ncore]))+
196 ((CorePos[1][ncore])*(CorePos[1][ncore])) ) );
197 }
198
199 // get the coreX position
200 inline Float_t get_coreX ( Int_t ncore = 0 ) {
201 return ( CorePos[0][ncore] ) ;
202 }
203
204 // get the coreY position
205 inline Float_t get_coreY ( Int_t ncore = 0 ) {
206 return ( CorePos[1][ncore] ) ;
207 }
208
209 // get the zFirstInteraction position
210 inline Float_t get_firstInt () {
211 return ( zFirstInt ) ;
212 }
213
214 // get the xDirection part of the normalized direction vector
215 inline Float_t get_direX () {
216 return ( (Float_t) ( p[0] / sqrt( p[0]*p[0] + p[1]*p[1] + p[2]*p[2] )) ) ;
217 }
218
219 // get the xDirection part of the normalized direction vector
220 inline Float_t get_direY () {
221 return ( (Float_t) ( p[1] / sqrt( p[0]*p[0] + p[1]*p[1] + p[2]*p[2] )) ) ;
222 }
223
224 // show the seeds in the console
225 inline void print_seeds ( void ) {
226 Int_t i;
227 cout << "Seeds status at the beginning of this shower:"
228 << setiosflags(ios::left) << setw(10) << endl;
229 for (i=0; i<NumRndSeq; ++i) {
230 cout << "SEED "
231 << RndData[i][0]
232 << RndData[i][1]
233 << RndData[i][2] << endl;
234 }
235 cout << resetiosflags(ios::left);
236 }
237
238 // fill essential information
239 inline void fill ( Float_t theEvtNumber,
240 Float_t thePrimaryID,
241 Float_t theEtotal,
242 Float_t theFirstTarget,
243 Float_t thezFirstInt,
244 Float_t thepx,
245 Float_t thepy,
246 Float_t thepz,
247 Float_t theTheta,
248 Float_t thePhi,
249 Float_t theX,
250 Float_t theY) {
251
252 strcpy(EVTH,"EVTH");
253 EvtNumber = theEvtNumber;
254 PrimaryID = thePrimaryID;
255 Etotal = theEtotal;
256 FirstTarget = theFirstTarget;
257 zFirstInt = thezFirstInt;
258 p[0] = thepx;
259 p[1] = thepy;
260 p[2] = thepz;
261 Theta = theTheta;
262 Phi = thePhi;
263 Thick0 = 0.0;
264 CorePos[0][0] = theX;
265 CorePos[1][0] = theY;
266
267 return;
268 }
269
270 void Print () {
271 //
272 // Print the important content on the screen
273 //
274
275 cout << endl ;
276 cout << " **********" << endl ;
277 cout << " EventNb: " << EvtNumber << " Particle " << PrimaryID << endl ;
278 cout << " Energy: " << Etotal
279 << " Theta: " << Theta
280 << " Phi: " << Phi
281 << endl ;
282 cout << " Core(x/y): (" << get_coreX() <<"/"<< get_coreY() << ")"
283 << endl ;
284
285 cout << endl ;
286 }
287};
288// @endcode
289
290#endif // not defined COREventHeader_Class
Note: See TracBrowser for help on using the repository browser.