| 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 |
|
|---|
| 44 | #include "MMcEvtBasic.h"
|
|---|
| 45 |
|
|---|
| 46 | #include "MLog.h"
|
|---|
| 47 | #include "MLogManip.h"
|
|---|
| 48 |
|
|---|
| 49 | ClassImp(MMcEvtBasic);
|
|---|
| 50 |
|
|---|
| 51 | using namespace std;
|
|---|
| 52 |
|
|---|
| 53 | // --------------------------------------------------------------------------
|
|---|
| 54 | // Default constructor set all values to zero
|
|---|
| 55 | //
|
|---|
| 56 | MMcEvtBasic::MMcEvtBasic()
|
|---|
| 57 | {
|
|---|
| 58 | fName = "MMcEvtBasic";
|
|---|
| 59 | fTitle = "Basic event info from Monte Carlo";
|
|---|
| 60 |
|
|---|
| 61 | Clear();
|
|---|
| 62 | }
|
|---|
| 63 |
|
|---|
| 64 | // --------------------------------------------------------------------------
|
|---|
| 65 | // constuctor II
|
|---|
| 66 | //
|
|---|
| 67 | // All datamembers are parameters.
|
|---|
| 68 | //
|
|---|
| 69 | MMcEvtBasic::MMcEvtBasic(MMcEvt::ParticleId_t usPId,
|
|---|
| 70 | Float_t fEner,
|
|---|
| 71 | Float_t fImpa,
|
|---|
| 72 | Float_t fTPhii,
|
|---|
| 73 | Float_t fTThet)
|
|---|
| 74 | {
|
|---|
| 75 | fName = "MMcEvtBasic";
|
|---|
| 76 | fTitle = "Basic event info from Monte Carlo";
|
|---|
| 77 |
|
|---|
| 78 | fPartId = usPId;
|
|---|
| 79 | fEnergy = fEner;
|
|---|
| 80 | fImpact = fImpa;
|
|---|
| 81 | fTelescopePhi = fTPhii;
|
|---|
| 82 | fTelescopeTheta = fTThet;
|
|---|
| 83 | }
|
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 | // --------------------------------------------------------------------------
|
|---|
| 87 | // default destructor
|
|---|
| 88 | //
|
|---|
| 89 | MMcEvtBasic::~MMcEvtBasic() {
|
|---|
| 90 | }
|
|---|
| 91 |
|
|---|
| 92 |
|
|---|
| 93 | // --------------------------------------------------------------------------
|
|---|
| 94 | //
|
|---|
| 95 | // Reset all values. We have no "error" value for fPartId,
|
|---|
| 96 | // we just set kGAMMA
|
|---|
| 97 | //
|
|---|
| 98 | void MMcEvtBasic::Clear(Option_t *opt)
|
|---|
| 99 | {
|
|---|
| 100 | fPartId = MMcEvt::kGAMMA;
|
|---|
| 101 | fEnergy = -1.;
|
|---|
| 102 | fImpact = -1.;
|
|---|
| 103 | fTelescopeTheta = -1.;
|
|---|
| 104 | fTelescopePhi = -1.;
|
|---|
| 105 | }
|
|---|
| 106 |
|
|---|
| 107 | // --------------------------------------------------------------------------
|
|---|
| 108 | //
|
|---|
| 109 | // Fill all data members
|
|---|
| 110 | //
|
|---|
| 111 | void MMcEvtBasic::Fill(MMcEvt::ParticleId_t usPId,
|
|---|
| 112 | Float_t fEner,
|
|---|
| 113 | Float_t fImpa,
|
|---|
| 114 | Float_t fTPhii,
|
|---|
| 115 | Float_t fTThet)
|
|---|
| 116 | {
|
|---|
| 117 | fPartId = usPId;
|
|---|
| 118 | fEnergy = fEner;
|
|---|
| 119 | fImpact = fImpa;
|
|---|
| 120 | fTelescopePhi = fTPhii;
|
|---|
| 121 | fTelescopeTheta = fTThet;
|
|---|
| 122 | }
|
|---|
| 123 |
|
|---|
| 124 | // --------------------------------------------------------------------------
|
|---|
| 125 | //
|
|---|
| 126 | // Print the contents of the container.
|
|---|
| 127 | //
|
|---|
| 128 | // if you specify an option only the requested data members are printed:
|
|---|
| 129 | // allowed options are: id, energy, impact
|
|---|
| 130 | //
|
|---|
| 131 | void MMcEvtBasic::Print(Option_t *opt) const
|
|---|
| 132 | {
|
|---|
| 133 | //
|
|---|
| 134 | // print out the data member on screen
|
|---|
| 135 | //
|
|---|
| 136 | TString str(opt);
|
|---|
| 137 | if (str.IsNull())
|
|---|
| 138 | {
|
|---|
| 139 | *fLog << all << endl;
|
|---|
| 140 | *fLog << "Monte Carlo output:" << endl;
|
|---|
| 141 | *fLog << " Particle Id: ";
|
|---|
| 142 | switch(fPartId)
|
|---|
| 143 | {
|
|---|
| 144 | case MMcEvt::kGAMMA:
|
|---|
| 145 | *fLog << "Gamma" << endl;
|
|---|
| 146 | break;
|
|---|
| 147 | case MMcEvt::kPROTON:
|
|---|
| 148 | *fLog << "Proton" << endl;
|
|---|
| 149 | break;
|
|---|
| 150 | case MMcEvt::kHELIUM:
|
|---|
| 151 | *fLog << "Helium" << endl;
|
|---|
| 152 | break;
|
|---|
| 153 | default:
|
|---|
| 154 | break;
|
|---|
| 155 | }
|
|---|
| 156 | *fLog << " Energy: " << fEnergy << "GeV" << endl;
|
|---|
| 157 | *fLog << " Impactpar.: " << fImpact/100 << "m" << endl;
|
|---|
| 158 | *fLog << endl;
|
|---|
| 159 | return;
|
|---|
| 160 | }
|
|---|
| 161 | if (str.Contains("id", TString::kIgnoreCase))
|
|---|
| 162 | switch(fPartId)
|
|---|
| 163 | {
|
|---|
| 164 | case MMcEvt::kGAMMA:
|
|---|
| 165 | *fLog << "Particle: Gamma" << endl;
|
|---|
| 166 | break;
|
|---|
| 167 | case MMcEvt::kPROTON:
|
|---|
| 168 | *fLog << "Particle: Proton" << endl;
|
|---|
| 169 | break;
|
|---|
| 170 | case MMcEvt::kHELIUM:
|
|---|
| 171 | *fLog << "Particle: Helium" << endl;
|
|---|
| 172 | break;
|
|---|
| 173 | default:
|
|---|
| 174 | break;
|
|---|
| 175 | }
|
|---|
| 176 | if (str.Contains("energy", TString::kIgnoreCase))
|
|---|
| 177 | *fLog << "Energy: " << fEnergy << "GeV" << endl;
|
|---|
| 178 | if (str.Contains("impact", TString::kIgnoreCase))
|
|---|
| 179 | *fLog << "Impact: " << fImpact << "cm" << endl;
|
|---|
| 180 | }
|
|---|