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

Last change on this file since 8709 was 8438, checked in by tbretz, 18 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 "MLog.h"
58#include "MLogManip.h"
59
60#include "MString.h"
61
62ClassImp(MMcEvt);
63
64using namespace std;
65
66// --------------------------------------------------------------------------
67//
68// Default constructor. Calls Clear()
69//
70MMcEvt::MMcEvt()
71{
72 fName = "MMcEvt";
73 fTitle = "Event info from Monte Carlo";
74
75 Clear();
76}
77
78// --------------------------------------------------------------------------
79//
80// Constructor. Use this to set all data members
81//
82// THIS FUNCTION IS FOR THE SIMULATION OLNY.
83// DON'T USE THIS MEMBERFUNCTION IN THE ANALYSIS.
84//
85MMcEvt::MMcEvt(UInt_t fEvtNum, ParticleId_t usPId, Float_t fEner,
86 Float_t fThi0, Float_t fFirTar, Float_t fzFirInt,
87 Float_t fThet, Float_t fPhii, Float_t fCorD,
88 Float_t fCorX, Float_t fCorY, Float_t fImpa,
89 Float_t fTPhii, Float_t fTThet, Float_t fTFirst,
90 Float_t fTLast, Float_t fL_Nmax, Float_t fL_t0,
91 Float_t fL_tmax, Float_t fL_a, Float_t fL_b,
92 Float_t fL_c, Float_t fL_chi2, UInt_t uiPin,
93 UInt_t uiPat, UInt_t uiPre, UInt_t uiPco,
94 UInt_t uiPelS, UInt_t uiPelC, Float_t elec,
95 Float_t muon, Float_t other, Float_t fadc_jitter,
96 Int_t reuse)
97{
98 fName = "MMcEvt";
99 fTitle = "Event info from Monte Carlo";
100
101 Fill(fEvtNum, usPId, fEner, fThi0, fFirTar, fzFirInt, fThet,
102 fPhii, fCorD, fCorX, fCorY, fImpa, fTPhii, fTThet, fTFirst,
103 fTLast, fL_Nmax, fL_t0, fL_tmax, fL_a, fL_b, fL_c, fL_chi2,
104 uiPin, uiPat, uiPre, uiPco, uiPelS, uiPelC, elec, muon, other,
105 fadc_jitter, reuse);
106}
107
108// --------------------------------------------------------------------------
109//
110// reset all values to values as nonsense as possible
111//
112void MMcEvt::Clear(Option_t *opt)
113{
114 fPartId = kUNDEFINED;
115 fEnergy = -1;
116
117 fTheta = 0;
118 fPhi = 0;
119
120 fCoreD = 0;
121 fCoreX = 0;
122 fCoreY = 0;
123 fImpact = -1;
124
125 fPhotIni = 0;
126 fPassPhotAtm = 0;
127 fPassPhotRef = 0;
128 fPassPhotCone = 0;
129 fPhotElfromShower = 0;
130 fPhotElinCamera = 0;
131
132 fElecCphFraction=0;
133 fMuonCphFraction=0;
134 fOtherCphFraction=0;
135
136 fEventReuse = 0;
137}
138
139// --------------------------------------------------------------------------
140//
141// Use this to set all data members
142//
143// THIS FUNCTION IS FOR THE SIMULATION OLNY.
144// DON'T USE THIS MEMBERFUNCTION IN THE ANALYSIS.
145//
146void MMcEvt::Fill( UInt_t fEvtNum, ParticleId_t usPId, Float_t fEner,
147 Float_t fThi0, Float_t fFirTar, Float_t fzFirInt,
148 Float_t fThet, Float_t fPhii, Float_t fCorD,
149 Float_t fCorX, Float_t fCorY, Float_t fImpa,
150 Float_t fTPhii, Float_t fTThet, Float_t fTFirst,
151 Float_t fTLast, Float_t fL_Nmax, Float_t fL_t0,
152 Float_t fL_tmax, Float_t fL_a, Float_t fL_b,
153 Float_t fL_c, Float_t fL_chi2, UInt_t uiPin,
154 UInt_t uiPat, UInt_t uiPre, UInt_t uiPco,
155 UInt_t uiPelS, UInt_t uiPelC, Float_t elec,
156 Float_t muon, Float_t other, Float_t fadc_jitter,
157 Int_t reuse)
158{
159 //
160 // All datamembers are filled with the correspondin parameters.
161 //
162 // Don't use this memberfunction in analysis
163 //
164 fEvtNumber = fEvtNum;
165 fPartId = usPId ;
166 fEnergy = fEner ;
167 fThick0 = fThi0;
168 fFirstTarget = fFirTar;
169 fZFirstInteraction = fzFirInt;
170
171 fTheta = fThet ;
172 fPhi = fPhii ;
173
174 fCoreD = fCorD ;
175 fCoreX = fCorX ;
176 fCoreY = fCorY ;
177 fImpact = fImpa ;
178
179 fTelescopePhi = fTPhii;
180 fTelescopeTheta = fTThet;
181 fTimeFirst = fTFirst;
182 fTimeLast = fTLast;
183 fLongiNmax = fL_Nmax;
184 fLongit0 = fL_t0;
185 fLongitmax = fL_tmax;
186 fLongia = fL_a;
187 fLongib = fL_b;
188 fLongic = fL_c;
189 fLongichi2 = fL_chi2;
190
191 fPhotIni = uiPin ;
192 fPassPhotAtm = fPhotIni-uiPat ;
193 fPassPhotRef = fPassPhotAtm-uiPre ;
194 fPassPhotCone = uiPco ;
195 fPhotElfromShower = uiPelS ;
196 fPhotElinCamera = uiPelC ;
197
198 fElecCphFraction=elec;
199 fMuonCphFraction=muon;
200 fOtherCphFraction=other;
201
202 fFadcTimeJitter = fadc_jitter;
203
204 fEventReuse = reuse;
205}
206
207// --------------------------------------------------------------------------
208//
209// Print the contents of the container.
210//
211// if you specify an option only the requested data members are printed:
212// allowed options are:
213// id, energy, impact
214//
215void MMcEvt::Print(Option_t *opt) const
216{
217 MMcEvtBasic::Print(opt);
218
219 TString str(opt);
220 if (str.IsNull())
221 *fLog << " Photoelectrons: " << fPhotElfromShower << endl;
222}
223
224// --------------------------------------------------------------------------
225//
226// Return a proper description of the monte carlo event
227//
228TString MMcEvt::GetDescription(const TString &s) const
229{
230 TString txt("#splitline{");
231
232 txt += GetParticleName();
233 txt += " ";
234 txt += s;
235 txt += "}{ E=";
236 txt += GetEnergyStr();
237 txt += " r=";
238 txt += TMath::Nint(GetImpact()/100);
239 txt += "m Zd=";
240 txt += MString::Format("%.1f", GetTelescopeTheta()*TMath::RadToDeg());
241 txt += "\\circ ";
242 if (GetPhotElfromShower()>=10000)
243 txt += MString::Format("%dk", TMath::Nint(GetPhotElfromShower()/1000.));
244 else
245 if (GetPhotElfromShower()>=1000)
246 txt += MString::Format("%.1fk", GetPhotElfromShower()/1000.);
247 else
248 txt += GetPhotElfromShower();
249 txt += "PhEl}";
250
251 return txt;
252}
Note: See TracBrowser for help on using the repository browser.