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

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