source: tags/Mars-V2.2/mmc/MMcEvt.cxx

Last change on this file was 8907, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 7.6 KB
Line 
1/* ======================================================================== *\
2!
3! *
4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
5! * Software. It is distributed to you in the hope that it can be a useful
6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
7! * It is distributed WITHOUT ANY WARRANTY.
8! *
9! * Permission to use, copy, modify and distribute this software and its
10! * documentation for any purpose is hereby granted without fee,
11! * provided that the above copyright notice appear in all copies and
12! * that both that copyright notice and this permission notice appear
13! * in supporting documentation. It is provided "as is" without express
14! * or implied warranty.
15! *
16!
17!
18! Author(s):
19!
20! Copyright: MAGIC Software Development, 2000-2007
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MMcEvt
28//
29// This class handles and contains the MonteCarlo information
30// with which the events have been generated
31// This information exists for each event.
32//
33// Note: All the azimuth Phi angles in this and other MC classes follow
34// the convention in the Corsika program (see Corsika manual). There, phi
35// is the azimuth of the momentum vector of particles, and is measured
36// from the north direction, anticlockwise (i.e, west is phi=90 degrees).
37// When it refers to the telescope orientation, it is the azimuth of a
38// vector along the telescope axis, going from the camera to the mirror.
39// So, fTelescopeTheta=90, fTelescopePhi = 0 means the telescope is
40// pointing horizontally towards South. For an explanation, see also
41// TDAS 02-11.
42//
43// Version 4:
44// - Added member fFadcTimeJitter
45//
46// Version 5:
47// - removed fPartId, fEnergy, fImpact, fTelescopeTheta, fTelescopePhi
48// - derives now from MMcEvtBasic which contains all these values
49// - moved ParticleId_t to base class MMcEvtBasic
50//
51// Version 6:
52// - added fEventReuse
53//
54/////////////////////////////////////////////////////////////////////////////
55#include "MMcEvt.hxx"
56
57#include <TMath.h>
58
59#include "MLog.h"
60#include "MLogManip.h"
61
62#include "MString.h"
63
64ClassImp(MMcEvt);
65
66using namespace std;
67
68// --------------------------------------------------------------------------
69//
70// Default constructor. Calls Clear()
71//
72MMcEvt::MMcEvt()
73{
74 fName = "MMcEvt";
75 fTitle = "Event info from Monte Carlo";
76
77 Clear();
78}
79
80// --------------------------------------------------------------------------
81//
82// Constructor. Use this to set all data members
83//
84// THIS FUNCTION IS FOR THE SIMULATION OLNY.
85// DON'T USE THIS MEMBERFUNCTION IN THE ANALYSIS.
86//
87MMcEvt::MMcEvt(UInt_t fEvtNum, ParticleId_t usPId, Float_t fEner,
88 Float_t fThi0, Float_t fFirTar, Float_t fzFirInt,
89 Float_t fThet, Float_t fPhii, Float_t fCorD,
90 Float_t fCorX, Float_t fCorY, Float_t fImpa,
91 Float_t fTPhii, Float_t fTThet, Float_t fTFirst,
92 Float_t fTLast, Float_t fL_Nmax, Float_t fL_t0,
93 Float_t fL_tmax, Float_t fL_a, Float_t fL_b,
94 Float_t fL_c, Float_t fL_chi2, UInt_t uiPin,
95 UInt_t uiPat, UInt_t uiPre, UInt_t uiPco,
96 UInt_t uiPelS, UInt_t uiPelC, Float_t elec,
97 Float_t muon, Float_t other, Float_t fadc_jitter,
98 Int_t reuse)
99{
100 fName = "MMcEvt";
101 fTitle = "Event info from Monte Carlo";
102
103 Fill(fEvtNum, usPId, fEner, fThi0, fFirTar, fzFirInt, fThet,
104 fPhii, fCorD, fCorX, fCorY, fImpa, fTPhii, fTThet, fTFirst,
105 fTLast, fL_Nmax, fL_t0, fL_tmax, fL_a, fL_b, fL_c, fL_chi2,
106 uiPin, uiPat, uiPre, uiPco, uiPelS, uiPelC, elec, muon, other,
107 fadc_jitter, reuse);
108}
109
110// --------------------------------------------------------------------------
111//
112// reset all values to values as nonsense as possible
113//
114void MMcEvt::Clear(Option_t *opt)
115{
116 fPartId = kUNDEFINED;
117 fEnergy = -1;
118
119 fTheta = 0;
120 fPhi = 0;
121
122 fCoreD = 0;
123 fCoreX = 0;
124 fCoreY = 0;
125 fImpact = -1;
126
127 fPhotIni = 0;
128 fPassPhotAtm = 0;
129 fPassPhotRef = 0;
130 fPassPhotCone = 0;
131 fPhotElfromShower = 0;
132 fPhotElinCamera = 0;
133
134 fElecCphFraction=0;
135 fMuonCphFraction=0;
136 fOtherCphFraction=0;
137
138 fEventReuse = 0;
139}
140
141// --------------------------------------------------------------------------
142//
143// Use this to set all data members
144//
145// THIS FUNCTION IS FOR THE SIMULATION OLNY.
146// DON'T USE THIS MEMBERFUNCTION IN THE ANALYSIS.
147//
148void MMcEvt::Fill( UInt_t fEvtNum, ParticleId_t usPId, Float_t fEner,
149 Float_t fThi0, Float_t fFirTar, Float_t fzFirInt,
150 Float_t fThet, Float_t fPhii, Float_t fCorD,
151 Float_t fCorX, Float_t fCorY, Float_t fImpa,
152 Float_t fTPhii, Float_t fTThet, Float_t fTFirst,
153 Float_t fTLast, Float_t fL_Nmax, Float_t fL_t0,
154 Float_t fL_tmax, Float_t fL_a, Float_t fL_b,
155 Float_t fL_c, Float_t fL_chi2, UInt_t uiPin,
156 UInt_t uiPat, UInt_t uiPre, UInt_t uiPco,
157 UInt_t uiPelS, UInt_t uiPelC, Float_t elec,
158 Float_t muon, Float_t other, Float_t fadc_jitter,
159 Int_t reuse)
160{
161 //
162 // All datamembers are filled with the correspondin parameters.
163 //
164 // Don't use this memberfunction in analysis
165 //
166 fEvtNumber = fEvtNum;
167 fPartId = usPId ;
168 fEnergy = fEner ;
169 fThick0 = fThi0;
170 fFirstTarget = fFirTar;
171 fZFirstInteraction = fzFirInt;
172
173 fTheta = fThet ;
174 fPhi = fPhii ;
175
176 fCoreD = fCorD ;
177 fCoreX = fCorX ;
178 fCoreY = fCorY ;
179 fImpact = fImpa ;
180
181 fTelescopePhi = fTPhii;
182 fTelescopeTheta = fTThet;
183 fTimeFirst = fTFirst;
184 fTimeLast = fTLast;
185 fLongiNmax = fL_Nmax;
186 fLongit0 = fL_t0;
187 fLongitmax = fL_tmax;
188 fLongia = fL_a;
189 fLongib = fL_b;
190 fLongic = fL_c;
191 fLongichi2 = fL_chi2;
192
193 fPhotIni = uiPin ;
194 fPassPhotAtm = fPhotIni-uiPat ;
195 fPassPhotRef = fPassPhotAtm-uiPre ;
196 fPassPhotCone = uiPco ;
197 fPhotElfromShower = uiPelS ;
198 fPhotElinCamera = uiPelC ;
199
200 fElecCphFraction=elec;
201 fMuonCphFraction=muon;
202 fOtherCphFraction=other;
203
204 fFadcTimeJitter = fadc_jitter;
205
206 fEventReuse = reuse;
207}
208
209// --------------------------------------------------------------------------
210//
211// Print the contents of the container.
212//
213// if you specify an option only the requested data members are printed:
214// allowed options are:
215// id, energy, impact
216//
217void MMcEvt::Print(Option_t *opt) const
218{
219 MMcEvtBasic::Print(opt);
220
221 TString str(opt);
222 if (str.IsNull())
223 *fLog << " Photoelectrons: " << fPhotElfromShower << endl;
224}
225
226// --------------------------------------------------------------------------
227//
228// Return a proper description of the monte carlo event
229//
230TString MMcEvt::GetDescription(const TString &s) const
231{
232 TString txt("#splitline{");
233
234 txt += GetParticleName();
235 txt += " ";
236 txt += s;
237 txt += "}{ E=";
238 txt += GetEnergyStr();
239 txt += " r=";
240 txt += TMath::Nint(GetImpact()/100);
241 txt += "m Zd=";
242 txt += MString::Format("%.1f", GetTelescopeTheta()*TMath::RadToDeg());
243 txt += "\\circ ";
244 if (GetPhotElfromShower()>=10000)
245 txt += MString::Format("%dk", TMath::Nint(GetPhotElfromShower()/1000.));
246 else
247 if (GetPhotElfromShower()>=1000)
248 txt += MString::Format("%.1fk", GetPhotElfromShower()/1000.);
249 else
250 txt += GetPhotElfromShower();
251 txt += "PhEl}";
252
253 return txt;
254}
Note: See TracBrowser for help on using the repository browser.