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

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