source: trunk/MagicSoft/include-Classes/MMcFormat/MMcEvt.cxx@ 2399

Last change on this file since 2399 was 2173, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 6.4 KB
Line 
1#include "MMcEvt.hxx"
2
3#include "MLog.h"
4#include "MLogManip.h"
5
6//==========
7// MMcEvt
8//
9// This class handles and contains the MonteCarlo information
10// with which the events have been generated
11// This information exists for each event.
12//
13// Note: All the azimuth Phi angles in this and other MC classes follow
14// the convention in the Corsika program (see Corsika manual). There, phi
15// is the azimuth of the momentum vector of particles, and is measured
16// from the north direction, anticlockwise (i.e, west is phi=90 degrees).
17// When it refers to the telescope orientation, it is the azimuth of a
18// vector along the telescope axis, going from the camera to the mirror.
19// So, fTelescopeTheta=90, fTelescopePhi = 0 means the telescope is
20// pointing horizontally towards South. For an explanation, see also
21// TDAS 02-11.
22//
23ClassImp(MMcEvt);
24
25using namespace std;
26
27
28MMcEvt::MMcEvt()
29{
30 //
31 // default constructor
32 // set all values to zero
33 fName = "MMcEvt";
34 fTitle = "Event info from Monte Carlo";
35
36 Clear();
37}
38
39MMcEvt::MMcEvt( UInt_t fEvtNum,
40 UShort_t usPId,
41 Float_t fEner,
42 Float_t fThi0,
43 Float_t fFirTar,
44 Float_t fzFirInt,
45 Float_t fThet,
46 Float_t fPhii,
47 Float_t fCorD,
48 Float_t fCorX,
49 Float_t fCorY,
50 Float_t fImpa,
51 Float_t fTPhii,
52 Float_t fTThet,
53 Float_t fTFirst,
54 Float_t fTLast,
55 Float_t fL_Nmax,
56 Float_t fL_t0,
57 Float_t fL_tmax,
58 Float_t fL_a,
59 Float_t fL_b,
60 Float_t fL_c,
61 Float_t fL_chi2,
62 UInt_t uiPin,
63 UInt_t uiPat,
64 UInt_t uiPre,
65 UInt_t uiPco,
66 UInt_t uiPelS,
67 UInt_t uiPelC,
68 Float_t elec,
69 Float_t muon,
70 Float_t other) {
71
72 fName = "MMcEvt";
73 fTitle = "Event info from Monte Carlo";
74 //
75 // constuctor II
76 //
77 // All datamembers are parameters.
78 //
79 // Don't use this memberfunction in analysis
80 //
81
82 fEvtNumber = fEvtNum;
83 fPartId = usPId ;
84 fEnergy = fEner ;
85 fThick0 = fThi0;
86 fFirstTarget = fFirTar;
87 fZFirstInteraction = fzFirInt;
88
89 fTheta = fThet ;
90 fPhi = fPhii ;
91
92 fCoreD = fCorD ;
93 fCoreX = fCorX ;
94 fCoreY = fCorY ;
95 fImpact = fImpa ;
96
97 fTelescopePhi = fTPhii;
98 fTelescopeTheta = fTThet;
99 fTimeFirst = fTFirst;
100 fTimeLast = fTLast;
101 fLongiNmax = fL_Nmax;
102 fLongit0 = fL_t0;
103 fLongia = fL_a;
104 fLongib = fL_b;
105 fLongic = fL_c;
106 fLongichi2 = fL_chi2;
107
108
109 fPhotIni = uiPin ;
110 fPassPhotAtm = uiPat ;
111 fPassPhotRef = uiPre ;
112 fPassPhotCone = uiPco ;
113 fPhotElfromShower = uiPelS ;
114 fPhotElinCamera = uiPelC ;
115
116 fElecCphFraction=elec;
117 fMuonCphFraction=muon;
118 fOtherCphFraction=other;
119}
120
121
122
123MMcEvt::~MMcEvt() {
124 //
125 // default destructor
126 //
127}
128
129
130
131
132void MMcEvt::Clear(Option_t *opt)
133{
134 //
135 // reset all values to values as nonsense as possible
136 //
137 fPartId = 0;
138 fEnergy = -1;
139
140 fTheta = 0;
141 fPhi = 0;
142
143 fCoreD = 0;
144 fCoreX = 0;
145 fCoreY = 0;
146 fImpact = -1;
147
148 fPhotIni = 0;
149 fPassPhotAtm = 0;
150 fPassPhotRef = 0;
151 fPassPhotCone = 0;
152 fPhotElfromShower = 0;
153 fPhotElinCamera = 0;
154
155 fElecCphFraction=0;
156 fMuonCphFraction=0;
157 fOtherCphFraction=0;
158}
159
160void MMcEvt::Fill( UInt_t fEvtNum,
161 UShort_t usPId,
162 Float_t fEner,
163 Float_t fThi0,
164 Float_t fFirTar,
165 Float_t fzFirInt,
166 Float_t fThet,
167 Float_t fPhii,
168 Float_t fCorD,
169 Float_t fCorX,
170 Float_t fCorY,
171 Float_t fImpa,
172 Float_t fTPhii,
173 Float_t fTThet,
174 Float_t fTFirst,
175 Float_t fTLast,
176 Float_t fL_Nmax,
177 Float_t fL_t0,
178 Float_t fL_tmax,
179 Float_t fL_a,
180 Float_t fL_b,
181 Float_t fL_c,
182 Float_t fL_chi2,
183 UInt_t uiPin,
184 UInt_t uiPat,
185 UInt_t uiPre,
186 UInt_t uiPco,
187 UInt_t uiPelS,
188 UInt_t uiPelC,
189 Float_t elec,
190 Float_t muon,
191 Float_t other ) {
192 //
193 // All datamembers are filled with the correspondin parameters.
194 //
195 // Don't use this memberfunction in analysis
196 //
197
198 fEvtNumber = fEvtNum;
199 fPartId = usPId ;
200 fEnergy = fEner ;
201 fThick0 = fThi0;
202 fFirstTarget = fFirTar;
203 fZFirstInteraction = fzFirInt;
204
205 fTheta = fThet ;
206 fPhi = fPhii ;
207
208 fCoreD = fCorD ;
209 fCoreX = fCorX ;
210 fCoreY = fCorY ;
211 fImpact = fImpa ;
212
213 fTelescopePhi = fTPhii;
214 fTelescopeTheta = fTThet;
215 fTimeFirst = fTFirst;
216 fTimeLast = fTLast;
217 fLongiNmax = fL_Nmax;
218 fLongit0 = fL_t0;
219 fLongia = fL_a;
220 fLongib = fL_b;
221 fLongic = fL_c;
222 fLongichi2 = fL_chi2;
223
224 fPhotIni = uiPin ;
225 fPassPhotAtm = fPhotIni-uiPat ;
226 fPassPhotRef = fPassPhotAtm-uiPre ;
227 fPassPhotCone = uiPco ;
228 fPhotElfromShower = uiPelS ;
229 fPhotElinCamera = uiPelC ;
230
231 fElecCphFraction=elec;
232 fMuonCphFraction=muon;
233 fOtherCphFraction=other;
234
235}
236
237/*
238void MMcEvt::AsciiWrite(ofstream &fout) const
239{
240 fout << fEnergy << " ";
241 fout << fTheta ;
242}
243*/
244
245// --------------------------------------------------------------------------
246//
247// Print the contents of the container.
248//
249// if you specify an option only the requested data members are printed:
250// allowed options are:
251// id, energy, impact
252//
253void MMcEvt::Print(Option_t *opt) const
254{
255 //
256 // print out the data member on screen
257 //
258 TString str(opt);
259 if (str.IsNull())
260 {
261 *fLog << all << endl;
262 *fLog << "Monte Carlo output:" << endl;
263 *fLog << " Particle Id: ";
264 switch(fPartId)
265 {
266 case kGAMMA:
267 *fLog << "Gamma" << endl;
268 break;
269 case kPROTON:
270 *fLog << "Proton" << endl;
271 break;
272 case kHELIUM:
273 *fLog << "Helium" << endl;
274 break;
275 }
276 *fLog << " Energy: " << fEnergy << "GeV" << endl;
277 *fLog << " Impactpar.: " << fImpact/100 << "m" << endl;
278 *fLog << " Photoelectrons: " << fPhotElfromShower << endl;
279 *fLog << endl;
280 return;
281 }
282 if (str.Contains("id", TString::kIgnoreCase))
283 switch(fPartId)
284 {
285 case kGAMMA:
286 *fLog << "Particle: Gamma" << endl;
287 break;
288 case kPROTON:
289 *fLog << "Particle: Proton" << endl;
290 break;
291 case kHELIUM:
292 *fLog << "Particle: Helium" << endl;
293 break;
294 }
295 if (str.Contains("energy", TString::kIgnoreCase))
296 *fLog << "Energy: " << fEnergy << "GeV" << endl;
297 if (str.Contains("impact", TString::kIgnoreCase))
298 *fLog << "Impact: " << fImpact << "cm" << endl;
299}
Note: See TracBrowser for help on using the repository browser.