source: tags/Mars-V0.9.5/mmc/MMcEvtBasic.cc

Last change on this file was 7094, checked in by tbretz, 19 years ago
*** empty log message ***
File size: 4.4 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): Abelardo Moralejo, 02/2005 <mailto:moralejo@pd.infn.it>
19!
20! Copyright: MAGIC Software Development, 2000-2005
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MMcEvtBasic
28//
29// This class contains the most basic MonteCarlo information
30// with which an event has been generated
31//
32// Note: The azimuth fTelescopePhi angle in this and other MC classes
33// follow the convention in the Corsika program (see Corsika manual and
34// TDAS 02-11). There, phi is the azimuth of the momentum vector of
35// particles, and is measured from the north direction, anticlockwise
36// (i.e, west is phi=90 degrees). When it refers to the telescope
37// orientation, it is the azimuth of a vector along the telescope axis,
38// going from the camera to the mirror. So, fTelescopeTheta=90,
39// fTelescopePhi = 0 means the telescope is pointing horizontally towards
40// South.
41//
42//
43// Version 1:
44// New container to keep the very basic informations on the
45// original MC events produced by Corsika
46//
47// Version 2:
48// - added typedef for ParticleId_t from MMcEvt
49// - replaced MMcEvt::ParticleId_t by ParticleId_t
50//
51/////////////////////////////////////////////////////////////////////////////
52#include "MMcEvtBasic.h"
53
54#include "MLog.h"
55#include "MLogManip.h"
56
57ClassImp(MMcEvtBasic);
58
59using namespace std;
60
61// --------------------------------------------------------------------------
62//
63// Default constructor. Calls Clear()
64//
65MMcEvtBasic::MMcEvtBasic()
66{
67 fName = "MMcEvtBasic";
68 fTitle = "Basic event info from Monte Carlo";
69
70 Clear();
71}
72
73// --------------------------------------------------------------------------
74//
75// Constructor. Use this to set all data members
76//
77// THIS FUNCTION IS FOR THE SIMULATION OLNY.
78// DON'T USE THIS MEMBERFUNCTION IN THE ANALYSIS.
79//
80MMcEvtBasic::MMcEvtBasic(ParticleId_t usPId, Float_t fEner,
81 Float_t fImpa, Float_t fTPhii, Float_t fTThet)
82{
83 fName = "MMcEvtBasic";
84 fTitle = "Basic event info from Monte Carlo";
85
86 Fill(usPId, fEner, fImpa, fTPhii, fTThet);
87}
88
89// --------------------------------------------------------------------------
90//
91// Reset all values: Fill(kUNDEFINED, -1, -1, 0, 0)
92//
93void MMcEvtBasic::Clear(Option_t *opt)
94{
95 Fill(kUNDEFINED, -1, -1, 0, 0);
96}
97
98// --------------------------------------------------------------------------
99//
100// Fill all data members
101//
102void MMcEvtBasic::Fill(ParticleId_t usPId, Float_t fEner,
103 Float_t fImpa, Float_t fTPhii, Float_t fTThet)
104{
105 fPartId = usPId;
106
107 fEnergy = fEner;
108 fImpact = fImpa;
109
110 fTelescopePhi = fTPhii;
111 fTelescopeTheta = fTThet;
112}
113
114// --------------------------------------------------------------------------
115//
116// Print the contents of the container.
117//
118// if you specify an option only the requested data members are printed:
119// allowed options are: id, energy, impact
120//
121void MMcEvtBasic::Print(Option_t *opt) const
122{
123 //
124 // print out the data member on screen
125 //
126 TString str(opt);
127 if (str.IsNull())
128 {
129 *fLog << all << endl;
130 *fLog << "Monte Carlo output:" << endl;
131 *fLog << " Particle Id: " << GetParticleName() << endl;
132 *fLog << " Energy: " << fEnergy << "GeV" << endl;
133 *fLog << " Impactparam.: " << fImpact/100 << "m" << endl;
134 *fLog << endl;
135 return;
136 }
137 if (str.Contains("id", TString::kIgnoreCase))
138 *fLog << "Particle: " << GetParticleName() << endl;
139 if (str.Contains("energy", TString::kIgnoreCase))
140 *fLog << "Energy: " << fEnergy << "GeV" << endl;
141 if (str.Contains("impact", TString::kIgnoreCase))
142 *fLog << "Impact: " << fImpact << "cm" << endl;
143}
Note: See TracBrowser for help on using the repository browser.