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

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