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

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