source: tags/Mars-V0.8.6/mmc/MMcEvt.cxx

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