source: trunk/Mars/mmc/MMcEvt.cxx@ 10009

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