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

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