source: trunk/MagicSoft/Simulation/Detector/include-MC/MCRunHeader.hxx

Last change on this file was 5103, checked in by moralejo, 20 years ago
Changes to adapt headers to c++ style.
File size: 3.9 KB
Line 
1/////////////////////////////////////////////////////////////////
2//
3// MCRunHeader
4//
5// Created: Wed Oct 30 17:43:14 2002
6// Author: Oscar Blanch Bigas
7// Purpose: Base class for RunHeader-classes
8// Notes:
9//
10/////////////////////////////////////////////////////////////////
11
12// @T \newpage
13
14// @section Source code of {\tt MCRunHeader.hxx}
15
16/* @text
17This section shows the include file {\tt MCRunHeader.hxx}
18@endtext */
19
20#ifndef MCRunHeader_Class
21#define MCRunHeader_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
35#define SIZE_OF_MCRUNHEADER 272 /* floats */
36
37using namespace std;
38
39// @endcode
40
41// @subsection Class {\em MCRunHeader}: Definition
42
43// @code
44class MCRunHeader {
45
46protected:
47 Float_t RunNumber;
48 Float_t date;
49 Float_t Corsika_version;
50 Float_t NumObsLev;
51 Float_t HeightLev[10];
52 Float_t SlopeSpec; /* Slope of primaries' energy spectrum */
53 Float_t ELowLim;
54 Float_t EUppLim; /* Limits of energy range for generation */
55 Float_t EGS4_flag;
56 Float_t NKG_flag;
57 Float_t Ecutoffh;
58 Float_t Ecutoffm;
59 Float_t Ecutoffe;
60 Float_t Ecutoffg;
61 /* Physical constants and interaction flags (see CORSIKA manual): */
62 Float_t C[50];
63 float wobble_mode; /* Indicates wobble mode with which
64 reflector has been run */
65 float atmospheric_model; /* Indicates atmospheric model used in
66 absorption simulation. 0 = no atmosphere,
67 1 = atm_90percent, 2 = atm_isothermal,
68 3 = atm_corsika.
69 */
70 Float_t dummy1[18]; /* not used */
71 Float_t CKA[40];
72 Float_t CETA[5];
73 Float_t CSTRBA[11];
74 Float_t dummy2[104]; /* not used */
75 Float_t AATM[5];
76 Float_t BATM[5];
77 Float_t CATM[5];
78 Float_t NFL[4];
79
80public:
81 MCRunHeader(void) {} // default constructor
82
83 virtual ~MCRunHeader(void) {} // default destructor
84
85 // Get variables
86 void get_constantC(float *c){
87 for (int i=0;i<50;i++)
88 c[i]=C[i];
89 }
90 void get_constantCKA(float *cka){
91 for (int i=0;i<40;i++)
92 cka[i]=CKA[i];
93 }
94 void get_constantCETA(float *ceta){
95 for (int i=0;i<5;i++)
96 ceta[i]=CETA[i];
97 }
98 void get_constantCSTRBA(float *cstrba){
99 for (int i=0;i<11;i++)
100 cstrba[i]=CSTRBA[i];
101 }
102 void get_constantAATM(float *aatm){
103 for (int i=0;i<5;i++)
104 aatm[i]=AATM[i];
105 }
106 void get_constantBATM(float *batm){
107 for (int i=0;i<5;i++)
108 batm[i]=BATM[i];
109 }
110 void get_constantCATM(float *catm){
111 for (int i=0;i<5;i++)
112 catm[i]=CATM[i];
113 }
114 void get_constantNFL(float *nfl){
115 for (int i=0;i<4;i++)
116 nfl[i]=NFL[i];
117 }
118
119 float get_date() { return date;}
120 float get_ELow() { return ELowLim;}
121 float get_EUpp() { return EUppLim;}
122 float get_EGS4() { return EGS4_flag;}
123 float get_NKG() { return NKG_flag;}
124 float get_Ecutoffh() {return Ecutoffh;}
125 float get_Ecutoffm() {return Ecutoffm;}
126 float get_Ecutoffe() {return Ecutoffe;}
127 float get_Ecutoffg() {return Ecutoffg;}
128 float get_wobble() {return wobble_mode;}
129 float get_atmophere() {return atmospheric_model;}
130 // reads EventHeader from binary input stream
131 Int_t read ( ifstream &is ) {
132 is.read ( (char *)this, mysize() );
133 return is.gcount();
134 }
135
136 Int_t read (FILE* f) {
137 return fread((char*)&RunNumber, (SIZE_OF_MCRUNHEADER)*sizeof(float), 1, f );
138 }
139
140
141 // writes EventHeader to binary output stream
142 Int_t write ( ofstream &os ) {
143 os.write ( (char *)this, mysize() );
144 return 0;
145 }
146
147 inline int mysize(void)
148 { return ( sizeof( float ) * SIZE_OF_MCRUNHEADER ); }
149
150 inline void print ( void ) {
151 float *ptr = (float *)this;
152 for(int i=0; i<SIZE_OF_MCRUNHEADER; ++i,++ptr)
153 cerr << i << ':' << *ptr << '\n';
154 }
155
156};
157// @endcode
158
159#endif // not defined MCRunHeader_Class
Note: See TracBrowser for help on using the repository browser.