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

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