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

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