Changeset 7094 for trunk/MagicSoft/include-Classes/MMcFormat
- Timestamp:
- 05/27/05 09:46:22 (20 years ago)
- Location:
- trunk/MagicSoft/include-Classes/MMcFormat
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/include-Classes/MMcFormat/MMcEvt.cxx
r5321 r7094 1 #include "MMcEvt.hxx" 2 3 #include "MLog.h" 4 #include "MLogManip.h" 5 6 //========== 7 // MMcEvt 8 // 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-2005 21 ! 22 ! 23 \* ======================================================================== */ 24 25 ///////////////////////////////////////////////////////////////////////////// 26 // 27 // MMcEvt 28 // 9 29 // This class handles and contains the MonteCarlo information 10 30 // with which the events have been generated … … 19 39 // So, fTelescopeTheta=90, fTelescopePhi = 0 means the telescope is 20 40 // pointing horizontally towards South. For an explanation, see also 21 // TDAS 02-11. 22 // 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 ///////////////////////////////////////////////////////////////////////////// 52 #include "MMcEvt.hxx" 53 54 #include "MLog.h" 55 #include "MLogManip.h" 56 23 57 ClassImp(MMcEvt); 24 58 … … 26 60 27 61 62 // -------------------------------------------------------------------------- 63 // 64 // Default constructor. Calls Clear() 65 // 28 66 MMcEvt::MMcEvt() 29 67 { 30 //31 // default constructor32 // set all values to zero33 68 fName = "MMcEvt"; 34 69 fTitle = "Event info from Monte Carlo"; … … 37 72 } 38 73 39 MMcEvt::MMcEvt( UInt_t fEvtNum, 40 UShort_t usPId, 41 Float_t fEner, 42 Float_t fThi0, 43 Float_t fFirTar, 44 Float_t fzFirInt, 45 Float_t fThet, 46 Float_t fPhii, 47 Float_t fCorD, 48 Float_t fCorX, 49 Float_t fCorY, 50 Float_t fImpa, 51 Float_t fTPhii, 52 Float_t fTThet, 53 Float_t fTFirst, 54 Float_t fTLast, 55 Float_t fL_Nmax, 56 Float_t fL_t0, 57 Float_t fL_tmax, 58 Float_t fL_a, 59 Float_t fL_b, 60 Float_t fL_c, 61 Float_t fL_chi2, 62 UInt_t uiPin, 63 UInt_t uiPat, 64 UInt_t uiPre, 65 UInt_t uiPco, 66 UInt_t uiPelS, 67 UInt_t uiPelC, 68 Float_t elec, 69 Float_t muon, 70 Float_t other, 71 Float_t fadc_jitter) { 72 74 // -------------------------------------------------------------------------- 75 // 76 // Constructor. Use this to set all data members 77 // 78 // THIS FUNCTION IS FOR THE SIMULATION OLNY. 79 // DON'T USE THIS MEMBERFUNCTION IN THE ANALYSIS. 80 // 81 MMcEvt::MMcEvt(UInt_t fEvtNum, ParticleId_t usPId, Float_t fEner, 82 Float_t fThi0, Float_t fFirTar, Float_t fzFirInt, 83 Float_t fThet, Float_t fPhii, Float_t fCorD, 84 Float_t fCorX, Float_t fCorY, Float_t fImpa, 85 Float_t fTPhii, Float_t fTThet, Float_t fTFirst, 86 Float_t fTLast, Float_t fL_Nmax, Float_t fL_t0, 87 Float_t fL_tmax, Float_t fL_a, Float_t fL_b, 88 Float_t fL_c, Float_t fL_chi2, UInt_t uiPin, 89 UInt_t uiPat, UInt_t uiPre, UInt_t uiPco, 90 UInt_t uiPelS, UInt_t uiPelC, Float_t elec, 91 Float_t muon, Float_t other, Float_t fadc_jitter) 92 { 73 93 fName = "MMcEvt"; 74 94 fTitle = "Event info from Monte Carlo"; 75 // 76 // constuctor II 77 // 78 // All datamembers are parameters. 79 // 80 // Don't use this memberfunction in analysis 81 // 82 83 fEvtNumber = fEvtNum; 84 fPartId = usPId ; 85 fEnergy = fEner ; 86 fThick0 = fThi0; 87 fFirstTarget = fFirTar; 88 fZFirstInteraction = fzFirInt; 89 90 fTheta = fThet ; 91 fPhi = fPhii ; 92 93 fCoreD = fCorD ; 94 fCoreX = fCorX ; 95 fCoreY = fCorY ; 96 fImpact = fImpa ; 97 98 fTelescopePhi = fTPhii; 99 fTelescopeTheta = fTThet; 100 fTimeFirst = fTFirst; 101 fTimeLast = fTLast; 102 fLongiNmax = fL_Nmax; 103 fLongit0 = fL_t0; 104 fLongitmax = fL_tmax; 105 fLongia = fL_a; 106 fLongib = fL_b; 107 fLongic = fL_c; 108 fLongichi2 = fL_chi2; 109 110 111 fPhotIni = uiPin ; 112 fPassPhotAtm = uiPat ; 113 fPassPhotRef = uiPre ; 114 fPassPhotCone = uiPco ; 115 fPhotElfromShower = uiPelS ; 116 fPhotElinCamera = uiPelC ; 117 118 fElecCphFraction=elec; 119 fMuonCphFraction=muon; 120 fOtherCphFraction=other; 121 122 fFadcTimeJitter = fadc_jitter; 123 } 124 125 126 127 MMcEvt::~MMcEvt() { 128 // 129 // default destructor 130 // 131 } 132 133 134 135 95 96 Fill(fEvtNum, usPId, fEner, fThi0, fFirTar, fzFirInt, fThet, 97 fPhii, fCorD, fCorX, fCorY, fImpa, fTPhii, fTThet, fTFirst, 98 fTLast, fL_Nmax, fL_t0, fL_tmax, fL_a, fL_b, fL_c, fL_chi2, 99 uiPin, uiPat, uiPre, uiPco, uiPelS, uiPelC, elec, muon, other, 100 fadc_jitter); 101 } 102 103 // -------------------------------------------------------------------------- 104 // 105 // reset all values to values as nonsense as possible 106 // 136 107 void MMcEvt::Clear(Option_t *opt) 137 108 { 138 // 139 // reset all values to values as nonsense as possible 140 // 141 fPartId = 0; 109 fPartId = kUNDEFINED; 142 110 fEnergy = -1; 143 111 … … 162 130 } 163 131 164 void MMcEvt::Fill( UInt_t fEvtNum, 165 UShort_t usPId, 166 Float_t fEner, 167 Float_t fThi0, 168 Float_t fFirTar, 169 Float_t fzFirInt, 170 Float_t fThet, 171 Float_t fPhii, 172 Float_t fCorD, 173 Float_t fCorX, 174 Float_t fCorY, 175 Float_t fImpa, 176 Float_t fTPhii, 177 Float_t fTThet, 178 Float_t fTFirst, 179 Float_t fTLast, 180 Float_t fL_Nmax, 181 Float_t fL_t0, 182 Float_t fL_tmax, 183 Float_t fL_a, 184 Float_t fL_b, 185 Float_t fL_c, 186 Float_t fL_chi2, 187 UInt_t uiPin, 188 UInt_t uiPat, 189 UInt_t uiPre, 190 UInt_t uiPco, 191 UInt_t uiPelS, 192 UInt_t uiPelC, 193 Float_t elec, 194 Float_t muon, 195 Float_t other, 196 Float_t fadc_jitter) { 197 // 198 // All datamembers are filled with the correspondin parameters. 199 // 200 // Don't use this memberfunction in analysis 201 // 202 203 fEvtNumber = fEvtNum; 204 fPartId = usPId ; 205 fEnergy = fEner ; 206 fThick0 = fThi0; 207 fFirstTarget = fFirTar; 208 fZFirstInteraction = fzFirInt; 209 210 fTheta = fThet ; 211 fPhi = fPhii ; 212 213 fCoreD = fCorD ; 214 fCoreX = fCorX ; 215 fCoreY = fCorY ; 216 fImpact = fImpa ; 217 218 fTelescopePhi = fTPhii; 219 fTelescopeTheta = fTThet; 220 fTimeFirst = fTFirst; 221 fTimeLast = fTLast; 222 fLongiNmax = fL_Nmax; 223 fLongit0 = fL_t0; 224 fLongitmax = fL_tmax; 225 fLongia = fL_a; 226 fLongib = fL_b; 227 fLongic = fL_c; 228 fLongichi2 = fL_chi2; 229 230 fPhotIni = uiPin ; 231 fPassPhotAtm = fPhotIni-uiPat ; 232 fPassPhotRef = fPassPhotAtm-uiPre ; 233 fPassPhotCone = uiPco ; 234 fPhotElfromShower = uiPelS ; 235 fPhotElinCamera = uiPelC ; 236 237 fElecCphFraction=elec; 238 fMuonCphFraction=muon; 239 fOtherCphFraction=other; 240 241 fFadcTimeJitter = fadc_jitter; 242 } 243 244 /* 245 void MMcEvt::AsciiWrite(ofstream &fout) const 246 { 247 fout << fEnergy << " "; 248 fout << fTheta ; 249 } 250 */ 132 // -------------------------------------------------------------------------- 133 // 134 // Use this to set all data members 135 // 136 // THIS FUNCTION IS FOR THE SIMULATION OLNY. 137 // DON'T USE THIS MEMBERFUNCTION IN THE ANALYSIS. 138 // 139 void MMcEvt::Fill( UInt_t fEvtNum, ParticleId_t usPId, Float_t fEner, 140 Float_t fThi0, Float_t fFirTar, Float_t fzFirInt, 141 Float_t fThet, Float_t fPhii, Float_t fCorD, 142 Float_t fCorX, Float_t fCorY, Float_t fImpa, 143 Float_t fTPhii, Float_t fTThet, Float_t fTFirst, 144 Float_t fTLast, Float_t fL_Nmax, Float_t fL_t0, 145 Float_t fL_tmax, Float_t fL_a, Float_t fL_b, 146 Float_t fL_c, Float_t fL_chi2, UInt_t uiPin, 147 UInt_t uiPat, UInt_t uiPre, UInt_t uiPco, 148 UInt_t uiPelS, UInt_t uiPelC, Float_t elec, 149 Float_t muon, Float_t other, Float_t fadc_jitter) 150 { 151 // 152 // All datamembers are filled with the correspondin parameters. 153 // 154 // Don't use this memberfunction in analysis 155 // 156 fEvtNumber = fEvtNum; 157 fPartId = usPId ; 158 fEnergy = fEner ; 159 fThick0 = fThi0; 160 fFirstTarget = fFirTar; 161 fZFirstInteraction = fzFirInt; 162 163 fTheta = fThet ; 164 fPhi = fPhii ; 165 166 fCoreD = fCorD ; 167 fCoreX = fCorX ; 168 fCoreY = fCorY ; 169 fImpact = fImpa ; 170 171 fTelescopePhi = fTPhii; 172 fTelescopeTheta = fTThet; 173 fTimeFirst = fTFirst; 174 fTimeLast = fTLast; 175 fLongiNmax = fL_Nmax; 176 fLongit0 = fL_t0; 177 fLongitmax = fL_tmax; 178 fLongia = fL_a; 179 fLongib = fL_b; 180 fLongic = fL_c; 181 fLongichi2 = fL_chi2; 182 183 fPhotIni = uiPin ; 184 fPassPhotAtm = fPhotIni-uiPat ; 185 fPassPhotRef = fPassPhotAtm-uiPre ; 186 fPassPhotCone = uiPco ; 187 fPhotElfromShower = uiPelS ; 188 fPhotElinCamera = uiPelC ; 189 190 fElecCphFraction=elec; 191 fMuonCphFraction=muon; 192 fOtherCphFraction=other; 193 194 fFadcTimeJitter = fadc_jitter; 195 } 251 196 252 197 // -------------------------------------------------------------------------- … … 260 205 void MMcEvt::Print(Option_t *opt) const 261 206 { 262 // 263 // print out the data member on screen 264 // 207 MMcEvtBasic::Print(opt); 208 265 209 TString str(opt); 266 210 if (str.IsNull()) 267 211 { 268 *fLog << all << endl;269 *fLog << "Monte Carlo output:" << endl;270 *fLog << " Particle Id: ";271 switch(fPartId)272 {273 case kGAMMA:274 *fLog << "Gamma" << endl;275 break;276 case kPROTON:277 *fLog << "Proton" << endl;278 break;279 case kHELIUM:280 *fLog << "Helium" << endl;281 break;282 }283 *fLog << " Energy: " << fEnergy << "GeV" << endl;284 *fLog << " Impactpar.: " << fImpact/100 << "m" << endl;285 212 *fLog << " Photoelectrons: " << fPhotElfromShower << endl; 286 *fLog << endl;287 213 return; 288 214 } 289 if (str.Contains("id", TString::kIgnoreCase)) 290 switch(fPartId) 291 { 292 case kGAMMA: 293 *fLog << "Particle: Gamma" << endl; 294 break; 295 case kPROTON: 296 *fLog << "Particle: Proton" << endl; 297 break; 298 case kHELIUM: 299 *fLog << "Particle: Helium" << endl; 300 break; 301 } 302 if (str.Contains("energy", TString::kIgnoreCase)) 303 *fLog << "Energy: " << fEnergy << "GeV" << endl; 304 if (str.Contains("impact", TString::kIgnoreCase)) 305 *fLog << "Impact: " << fImpact << "cm" << endl; 306 } 215 } -
trunk/MagicSoft/include-Classes/MMcFormat/MMcEvt.hxx
r5423 r7094 1 #ifndef __MMcEvt__2 #define __MMcEvt__1 #ifndef MARS_MMcEvt 2 #define MARS_MMcEvt 3 3 4 #ifndef MARS_M ParContainer5 #include "M ParContainer.h"4 #ifndef MARS_MMcEvtBasic 5 #include "MMcEvtBasic.h" 6 6 #endif 7 7 8 //9 // Version 4:10 // Added member fFadcTimeJitter11 //12 8 13 class MMcEvt : public M ParContainer9 class MMcEvt : public MMcEvtBasic 14 10 { 11 private: 12 UInt_t fEvtNumber; 13 Float_t fThick0; // [g/cm2] 14 Float_t fFirstTarget; // [] 15 Float_t fZFirstInteraction; // [cm] 16 17 Float_t fTheta; // [rad] Theta angle of event 18 Float_t fPhi; // [rad] Phi angle of event (see class description) 19 20 Float_t fCoreD; // [cm] Core d pos 21 Float_t fCoreX; // [cm] Core x pos 22 Float_t fCoreY; // [cm] Core y pos 23 24 // Up to here, the info from the CORSIKA event header. 25 26 // Time of first and last photon: 27 Float_t fTimeFirst; // [ns] 28 Float_t fTimeLast; // [ns] 29 30 // 6 parameters and chi2 of the NKG fit to the longitudinal 31 // particle distribution. See CORSIKA manual for explanation, 32 // section 4.42 "Longitudinal shower development": 33 // 34 Float_t fLongiNmax; // [particles] 35 Float_t fLongit0; // [g/cm2] 36 Float_t fLongitmax; // [g/cm2] 37 Float_t fLongia; // [g/cm2] 38 Float_t fLongib; // [] 39 Float_t fLongic; // [cm2/g] 40 Float_t fLongichi2; 41 42 UInt_t fPhotIni; // [ph] Initial number of photons 43 UInt_t fPassPhotAtm; // [ph] Passed atmosphere 44 UInt_t fPassPhotRef; // [ph] Passed reflector(reflectivity + effective area) 45 UInt_t fPassPhotCone; // [ph] Within any valid pixel, before plexiglas 46 UInt_t fPhotElfromShower; // [phe] Passed qe, coming from the shower 47 UInt_t fPhotElinCamera; // [phe] usPhotElfromShower + mean of phe from NSB 48 49 // Now follow the fraction of photons reaching the camera produced by 50 // electrons, muons and other particles respectively: 51 52 Float_t fElecCphFraction; 53 Float_t fMuonCphFraction; 54 Float_t fOtherCphFraction; 55 56 Float_t fFadcTimeJitter; 57 15 58 public: 16 // 17 // ParticleId for Monte Carlo simulation 18 // 19 enum ParticleId_t 20 { 21 kGAMMA = 1, 22 kPOSITRON = 2, 23 kELECTRON = 3, 24 kANTIMUON = 5, 25 kMUON = 6, 26 kPI0 = 7, 27 kNEUTRON = 13, 28 kPROTON = 14, 29 kHELIUM = 402, 30 kOXYGEN = 1608, 31 kIRON = 5626 32 }; 59 MMcEvt(); 60 MMcEvt(UInt_t, ParticleId_t, Float_t, Float_t, Float_t, 61 Float_t, Float_t, Float_t, Float_t, Float_t, Float_t, 62 Float_t, Float_t, Float_t, Float_t, Float_t, Float_t, 63 Float_t, Float_t, Float_t, Float_t, Float_t, Float_t, 64 UInt_t, UInt_t, UInt_t, UInt_t, UInt_t, UInt_t, 65 Float_t, Float_t, Float_t, Float_t) ; 33 66 34 private: 35 UInt_t fEvtNumber; 36 UShort_t fPartId; // Type of particle 37 Float_t fEnergy; // [GeV] Energy 38 Float_t fThick0; // [g/cm2] 39 Float_t fFirstTarget; // [] 40 Float_t fZFirstInteraction; // [cm] 67 // Getter 68 UInt_t GetEvtNumber() const { return fEvtNumber; } //Get Event Number 69 Float_t GetTheta() const { return fTheta; } //Get Theta angle 70 Float_t GetPhi() const { return fPhi ; } //Get Phi angle 41 71 42 Float_t fTheta; // [rad] Theta angle of event43 Float_t fPhi; // [rad] Phi angle of event (see class description)72 Float_t GetCoreX() const { return fCoreX; } //Get Core x pos 73 Float_t GetCoreY() const { return fCoreY; } //Get Core y pos 44 74 45 Float_t fCoreD; // [cm] Core d pos 46 Float_t fCoreX; // [cm] Core x pos 47 Float_t fCoreY; // [cm] Core y pos 48 Float_t fImpact; // [cm] impact parameter 75 UInt_t GetPhotIni() const { return fPhotIni; } //Get Initial photons 76 UInt_t GetPassPhotAtm() const { return fPassPhotAtm;} //Get Passed atmosphere 77 UInt_t GetPassPhotRef() const { return fPassPhotRef; } //Get Passed reflector 78 UInt_t GetPassPhotCone() const { return fPassPhotCone; } //Get Passed glas 79 UInt_t GetPhotElfromShower() const { return fPhotElfromShower; } //Get Passed qe from shower 80 UInt_t GetPhotElinCamera() const { return fPhotElinCamera; } //Get Passed qe total 81 Float_t GetZFirstInteraction() const { return fZFirstInteraction; } 49 82 50 // Up to here, the info from the CORSIKA event header.83 Float_t GetOtherCphFraction() const { return fOtherCphFraction; } 51 84 52 // Telescope orientation: 53 Float_t fTelescopePhi; // [rad] (see class description) 54 Float_t fTelescopeTheta; // [rad] 85 Float_t GetLongiNmax() const { return fLongiNmax; } 86 Float_t GetLongia() const { return fLongia; } 87 Float_t GetLongib() const { return fLongib; } 88 Float_t GetLongic() const { return fLongic; } 89 Float_t GetLongichi2() const { return fLongichi2; } 90 Float_t GetLongit0() const { return fLongit0; } 91 Float_t GetLongitmax() const { return fLongitmax; } 55 92 56 // Time of first and last photon: 57 Float_t fTimeFirst; // [ns] 58 Float_t fTimeLast; // [ns] 93 Float_t GetFadcTimeJitter() const { return fFadcTimeJitter; } 59 94 60 // 6 parameters and chi2 of the NKG fit to the longitudinal 61 // particle distribution. See CORSIKA manual for explanation, 62 // section 4.42 "Longitudinal shower development": 63 // 64 Float_t fLongiNmax; // [particles] 65 Float_t fLongit0; // [g/cm2] 66 Float_t fLongitmax; // [g/cm2] 67 Float_t fLongia; // [g/cm2] 68 Float_t fLongib; // [] 69 Float_t fLongic; // [cm2/g] 70 Float_t fLongichi2; 95 Float_t GetMuonCphFraction() const { return fMuonCphFraction; } 71 96 72 UInt_t fPhotIni; // [ph] Initial number of photons 73 UInt_t fPassPhotAtm; // [ph] Passed atmosphere 74 UInt_t fPassPhotRef; // [ph] Passed reflector(reflectivity + effective area) 75 UInt_t fPassPhotCone; // [ph] Within any valid pixel, before plexiglas 76 UInt_t fPhotElfromShower; // [phe] Passed qe, coming from the shower 77 UInt_t fPhotElinCamera; // [phe] usPhotElfromShower + mean of phe 78 // from NSB 97 // Setter 98 void SetTheta(Float_t Theta) { fTheta=Theta; } //Set Theta angle 99 void SetPhi(Float_t Phi) { fPhi=Phi; } //Set Phi angle 100 void SetCoreD(Float_t CoreD) { fCoreD=CoreD; } //Set Core d pos 101 void SetCoreX(Float_t CoreX) { fCoreX=CoreX; } //Set Core x pos 102 void SetCoreY(Float_t CoreY) { fCoreY=CoreY; } //Set Core y pos 79 103 80 // Now follow the fraction of photons reaching the camera produced by 81 // electrons, muons and other particles respectively: 104 void Fill( UInt_t, ParticleId_t, Float_t, Float_t, Float_t, 105 Float_t, Float_t, Float_t, Float_t, Float_t, Float_t, 106 Float_t, Float_t, Float_t, Float_t, Float_t, Float_t, 107 Float_t, Float_t, Float_t, Float_t, Float_t, Float_t, 108 UInt_t, UInt_t, UInt_t, UInt_t, UInt_t, UInt_t, 109 Float_t, Float_t, Float_t, Float_t) ; 82 110 83 Float_t fElecCphFraction; 84 Float_t fMuonCphFraction; 85 Float_t fOtherCphFraction; 86 87 Float_t fFadcTimeJitter; 111 // TObject 112 void Print(Option_t *opt=NULL) const; 113 void Clear(Option_t *opt=NULL); 88 114 89 public: 90 MMcEvt() ; 91 92 MMcEvt( UInt_t, UShort_t, Float_t, Float_t, Float_t, 93 Float_t, Float_t, Float_t, Float_t, Float_t, Float_t, 94 Float_t, Float_t, Float_t, Float_t, Float_t, Float_t, 95 Float_t, Float_t, Float_t, Float_t, Float_t, Float_t, 96 UInt_t, UInt_t, UInt_t, UInt_t, UInt_t, UInt_t, 97 Float_t, Float_t, Float_t, Float_t) ; 98 99 ~MMcEvt(); 100 101 void Clear(Option_t *opt=NULL); 102 103 void Fill( UInt_t, UShort_t, Float_t, Float_t, Float_t, 104 Float_t, Float_t, Float_t, Float_t, Float_t, Float_t, 105 Float_t, Float_t, Float_t, Float_t, Float_t, Float_t, 106 Float_t, Float_t, Float_t, Float_t, Float_t, Float_t, 107 UInt_t, UInt_t, UInt_t, UInt_t, UInt_t, UInt_t, 108 Float_t, Float_t, Float_t, Float_t) ; 109 110 //virtual void AsciiWrite(ofstream &fout) const; 111 112 void Print(Option_t *opt=NULL) const; 113 114 UInt_t GetEvtNumber() const { return fEvtNumber; } //Get Event Number 115 Short_t GetPartId() const { return fPartId; } //Get Type of particle 116 Float_t GetEnergy() const { return fEnergy; } //Get Energy 117 118 Float_t GetTheta() const { return fTheta; } //Get Theta angle 119 Float_t GetPhi() const { return fPhi ; } //Get Phi angle 120 121 /* Float_t GetCoreD() { return fCoreD; } //Get Core d pos */ 122 Float_t GetCoreX() { return fCoreX; } //Get Core x pos 123 Float_t GetCoreY() { return fCoreY; } //Get Core y pos 124 Float_t GetImpact() const { return fImpact;} //Get impact parameter 125 126 UInt_t GetPhotIni() { return fPhotIni; } //Get Initial photons 127 UInt_t GetPassPhotAtm() { return fPassPhotAtm;} //Get Passed atmosphere 128 UInt_t GetPassPhotRef() { return fPassPhotRef; } //Get Passed reflector 129 UInt_t GetPassPhotCone() { return fPassPhotCone; } //Get Passed glas 130 UInt_t GetPhotElfromShower() { return fPhotElfromShower; } //Get Passed qe from shower 131 UInt_t GetPhotElinCamera() { return fPhotElinCamera; } //Get Passed qe total 132 Float_t GetZFirstInteraction() const { return fZFirstInteraction; } 133 134 Float_t GetTelescopePhi() const { return fTelescopePhi; } 135 Float_t GetTelescopeTheta() const { return fTelescopeTheta; } 136 Float_t GetOtherCphFraction() const { return fOtherCphFraction; } 137 138 Float_t GetLongiNmax() const { return fLongiNmax; } 139 Float_t GetLongia() const { return fLongia; } 140 Float_t GetLongib() const { return fLongib; } 141 Float_t GetLongic() const { return fLongic; } 142 Float_t GetLongichi2() const { return fLongichi2; } 143 Float_t GetLongit0() const { return fLongit0; } 144 Float_t GetLongitmax() const { return fLongitmax; } 145 146 Float_t GetFadcTimeJitter() const { return fFadcTimeJitter; } 147 148 Float_t GetMuonCphFraction() const { return fMuonCphFraction; } 149 150 void SetPartId(Short_t PartId) 151 {fPartId=PartId;} //Set Type of particle 152 153 TString GetParticleName() const 154 { 155 switch (fPartId) 156 { 157 case kGAMMA: return "Gamma"; 158 case kPOSITRON: return "Positron"; 159 case kELECTRON: return "Electron"; 160 case kANTIMUON: return "Anti-Muon"; 161 case kMUON: return "Muon"; 162 case kPI0: return "Pi-0"; 163 case kNEUTRON: return "Neutron"; 164 case kPROTON: return "Proton"; 165 case kHELIUM: return "Helium"; 166 case kOXYGEN: return "Oxygen"; 167 case kIRON: return "Iron"; 168 } 169 170 return Form("Id:%d", fPartId); 171 } 172 TString GetParticleSymbol() const 173 { 174 switch (fPartId) 175 { 176 case kGAMMA: return "\\gamma"; 177 case kPOSITRON: return "e^{+}"; 178 case kELECTRON: return "e^{-}"; 179 case kANTIMUON: return "\\mu^{+}"; 180 case kMUON: return "\\mu^{-}"; 181 case kPI0: return "\\pi^{0}"; 182 case kNEUTRON: return "n"; 183 case kPROTON: return "p"; 184 case kHELIUM: return "He"; 185 case kOXYGEN: return "O"; 186 case kIRON: return "Fe"; 187 } 188 189 return Form("Id:%d", fPartId); 190 } 191 TString GetEnergyStr() const 192 { 193 if (fEnergy>1000) 194 return Form("%.1fTeV", fEnergy/1000); 195 196 if (fEnergy>10) 197 return Form("%dGeV", (Int_t)(fEnergy+.5)); 198 199 if (fEnergy>1) 200 return Form("%.1fGeV", fEnergy); 201 202 return Form("%dMeV", (Int_t)(fEnergy*1000+.5)); 203 } 204 205 void SetEnergy(Float_t Energy) 206 { fEnergy=Energy; } //Set Energy 207 208 void SetTheta(Float_t Theta) 209 { fTheta=Theta; } //Set Theta angle 210 211 void SetPhi(Float_t Phi) 212 { fPhi=Phi; } //Set Phi angle 213 214 void SetCoreD(Float_t CoreD) 215 { fCoreD=CoreD; } //Set Core d pos 216 217 void SetCoreX(Float_t CoreX) 218 { fCoreX=CoreX; } //Set Core x pos 219 220 void SetCoreY(Float_t CoreY ) 221 { fCoreY=CoreY; } //Set Core y pos 222 223 void SetImpact(Float_t Impact) 224 { fImpact=Impact;} //Set impact parameter 225 226 // DO NOT USE THIS IS A WORKAROUND! 227 void SetTelescopeTheta(Float_t Theta) { fTelescopeTheta=Theta; } 228 void SetTelescopePhi(Float_t Phi) { fTelescopePhi=Phi; } 229 230 231 /* void SetPhotIni(Short_t PhotIni) */ 232 /* { fPhotIni=PhotIni; } //Set Initial photons */ 233 /* void SetPassPhotAtm(Short_t PassPhotAtm) */ 234 /* { fPassPhotAtm=PassPhotAtm;} //Set Passed atmosphere */ 235 /* void SetPassPhotRef(Short_t PassPhotRef) */ 236 /* { fPassPhotRef=PassPhotRef ; } //Set Passed reflector */ 237 /* void SetPassPhotCone(Short_t PhotCon) */ 238 /* { fPassPhotCone=PhotCon; } //Set Passed glas */ 239 240 241 ClassDef(MMcEvt, 4) //Stores Montecarlo Information of one event (eg. the energy) 242 115 ClassDef(MMcEvt, 5) //Stores Montecarlo Information of one event (eg. the energy) 243 116 }; 244 117 -
trunk/MagicSoft/include-Classes/MMcFormat/MMcEvtBasic.cc
r6375 r7094 40 40 // South. 41 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 // 42 51 ///////////////////////////////////////////////////////////////////////////// 43 44 52 #include "MMcEvtBasic.h" 45 53 … … 52 60 53 61 // -------------------------------------------------------------------------- 54 // Default constructor set all values to zero 62 // 63 // Default constructor. Calls Clear() 55 64 // 56 65 MMcEvtBasic::MMcEvtBasic() 57 { 58 fName = "MMcEvtBasic";59 fTitle = "Basic event info from Monte Carlo";66 { 67 fName = "MMcEvtBasic"; 68 fTitle = "Basic event info from Monte Carlo"; 60 69 61 Clear();70 Clear(); 62 71 } 63 72 64 73 // -------------------------------------------------------------------------- 65 // constuctor II66 74 // 67 // All datamembers are parameters.75 // Constructor. Use this to set all data members 68 76 // 69 MMcEvtBasic::MMcEvtBasic(MMcEvt::ParticleId_t usPId, 70 Float_t fEner, 71 Float_t fImpa, 72 Float_t fTPhii,73 Float_t 77 // THIS FUNCTION IS FOR THE SIMULATION OLNY. 78 // DON'T USE THIS MEMBERFUNCTION IN THE ANALYSIS. 79 // 80 MMcEvtBasic::MMcEvtBasic(ParticleId_t usPId, Float_t fEner, 81 Float_t fImpa, Float_t fTPhii, Float_t fTThet) 74 82 { 75 fName = "MMcEvtBasic";76 fTitle = "Basic event info from Monte Carlo";83 fName = "MMcEvtBasic"; 84 fTitle = "Basic event info from Monte Carlo"; 77 85 78 fPartId = usPId; 79 fEnergy = fEner; 80 fImpact = fImpa; 81 fTelescopePhi = fTPhii; 82 fTelescopeTheta = fTThet; 86 Fill(usPId, fEner, fImpa, fTPhii, fTThet); 83 87 } 84 85 86 // --------------------------------------------------------------------------87 // default destructor88 //89 MMcEvtBasic::~MMcEvtBasic() {90 }91 92 88 93 89 // -------------------------------------------------------------------------- 94 90 // 95 // Reset all values. We have no "error" value for fPartId, 96 // we just set kGAMMA 91 // Reset all values: Fill(kUNDEFINED, -1, -1, 0, 0) 97 92 // 98 93 void MMcEvtBasic::Clear(Option_t *opt) 99 94 { 100 fPartId = MMcEvt::kGAMMA; 101 fEnergy = -1.; 102 fImpact = -1.; 103 fTelescopeTheta = -1.; 104 fTelescopePhi = -1.; 95 Fill(kUNDEFINED, -1, -1, 0, 0); 105 96 } 106 97 … … 109 100 // Fill all data members 110 101 // 111 void MMcEvtBasic::Fill(MMcEvt::ParticleId_t usPId, 112 Float_t fEner, 113 Float_t fImpa, 114 Float_t fTPhii, 115 Float_t fTThet) 102 void MMcEvtBasic::Fill(ParticleId_t usPId, Float_t fEner, 103 Float_t fImpa, Float_t fTPhii, Float_t fTThet) 116 104 { 117 fPartId = usPId; 118 fEnergy = fEner; 119 fImpact = fImpa; 120 fTelescopePhi = fTPhii; 121 fTelescopeTheta = fTThet; 105 fPartId = usPId; 106 107 fEnergy = fEner; 108 fImpact = fImpa; 109 110 fTelescopePhi = fTPhii; 111 fTelescopeTheta = fTThet; 122 112 } 123 113 … … 131 121 void MMcEvtBasic::Print(Option_t *opt) const 132 122 { 133 //134 // print out the data member on screen135 //136 TString str(opt);137 if (str.IsNull())123 // 124 // print out the data member on screen 125 // 126 TString str(opt); 127 if (str.IsNull()) 138 128 { 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; 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; 160 136 } 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; 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; 180 143 } -
trunk/MagicSoft/include-Classes/MMcFormat/MMcEvtBasic.h
r6375 r7094 1 #ifndef __MMcEvtBasic__2 #define __MMcEvtBasic__1 #ifndef MARS_MMcEvtBasic 2 #define MARS_MMcEvtBasic 3 3 4 4 #ifndef MARS_MParContainer … … 6 6 #endif 7 7 8 #include "MMcEvt.hxx"9 10 //11 // Version 1:12 // New container to keep the very basic informations on the13 // original MC events produced by Corsika14 //15 8 16 9 class MMcEvtBasic : public MParContainer 17 10 { 11 public: 12 enum ParticleId_t 13 { 14 kUNDEFINED = -1, 15 kGAMMA = 1, 16 kPOSITRON = 2, 17 kELECTRON = 3, 18 kANTIMUON = 5, 19 kMUON = 6, 20 kPI0 = 7, 21 kNEUTRON = 13, 22 kPROTON = 14, 23 kHELIUM = 402, 24 kOXYGEN = 1608, 25 kIRON = 5626 26 }; 18 27 19 28 private: 20 MMcEvt::ParticleId_t fPartId; // Type of particle21 Float_t 22 Float_t 29 ParticleId_t fPartId; // Type of particle 30 Float_t fEnergy; // [GeV] Energy 31 Float_t fImpact; // [cm] impact parameter 23 32 24 33 // Telescope orientation (see TDAS 02-11 regarding the 25 34 // precise meaning of these angles): 26 Float_t fTelescopePhi; // [rad] 27 Float_t fTelescopeTheta; // [rad] 28 35 Float_t fTelescopePhi; // [rad] 36 Float_t fTelescopeTheta; // [rad] 29 37 30 38 public: 31 39 MMcEvtBasic(); 32 33 MMcEvtBasic(MMcEvt::ParticleId_t, Float_t, Float_t, Float_t, Float_t); 34 ~MMcEvtBasic(); 40 MMcEvtBasic(ParticleId_t, Float_t, Float_t, Float_t, Float_t); 35 41 36 void Clear(Option_t *opt=NULL); 42 // Getter 43 ParticleId_t GetPartId() const { return fPartId; } 37 44 38 void Fill(MMcEvt::ParticleId_t, Float_t, Float_t, Float_t, Float_t);39 40 void Print(Option_t *opt=NULL) const;41 42 MMcEvt::ParticleId_t GetPartId() const { return fPartId; }43 45 Float_t GetEnergy() const { return fEnergy; } 44 46 Float_t GetImpact() const { return fImpact; } 47 45 48 Float_t GetTelescopePhi() const { return fTelescopePhi; } 46 49 Float_t GetTelescopeTheta() const { return fTelescopeTheta; } … … 50 53 switch (fPartId) 51 54 { 52 case MMcEvt::kGAMMA: return "Gamma"; 53 case MMcEvt::kPOSITRON: return "Positron"; 54 case MMcEvt::kELECTRON: return "Electron"; 55 case MMcEvt::kANTIMUON: return "Anti-Muon"; 56 case MMcEvt::kMUON: return "Muon"; 57 case MMcEvt::kPI0: return "Pi-0"; 58 case MMcEvt::kNEUTRON: return "Neutron"; 59 case MMcEvt::kPROTON: return "Proton"; 60 case MMcEvt::kHELIUM: return "Helium"; 61 case MMcEvt::kOXYGEN: return "Oxygen"; 62 case MMcEvt::kIRON: return "Iron"; 55 case kUNDEFINED:return "Undefined"; 56 case kGAMMA: return "Gamma"; 57 case kPOSITRON: return "Positron"; 58 case kELECTRON: return "Electron"; 59 case kANTIMUON: return "Anti-Muon"; 60 case kMUON: return "Muon"; 61 case kPI0: return "Pi-0"; 62 case kNEUTRON: return "Neutron"; 63 case kPROTON: return "Proton"; 64 case kHELIUM: return "Helium"; 65 case kOXYGEN: return "Oxygen"; 66 case kIRON: return "Iron"; 63 67 } 64 68 … … 70 74 switch (fPartId) 71 75 { 72 case MMcEvt::kGAMMA: return "\\gamma"; 73 case MMcEvt::kPOSITRON: return "e^{+}"; 74 case MMcEvt::kELECTRON: return "e^{-}"; 75 case MMcEvt::kANTIMUON: return "\\mu^{+}"; 76 case MMcEvt::kMUON: return "\\mu^{-}"; 77 case MMcEvt::kPI0: return "\\pi^{0}"; 78 case MMcEvt::kNEUTRON: return "n"; 79 case MMcEvt::kPROTON: return "p"; 80 case MMcEvt::kHELIUM: return "He"; 81 case MMcEvt::kOXYGEN: return "O"; 82 case MMcEvt::kIRON: return "Fe"; 76 case kUNDEFINED:return "N/A"; 77 case kGAMMA: return "\\gamma"; 78 case kPOSITRON: return "e^{+}"; 79 case kELECTRON: return "e^{-}"; 80 case kANTIMUON: return "\\mu^{+}"; 81 case kMUON: return "\\mu^{-}"; 82 case kPI0: return "\\pi^{0}"; 83 case kNEUTRON: return "n"; 84 case kPROTON: return "p"; 85 case kHELIUM: return "He"; 86 case kOXYGEN: return "O"; 87 case kIRON: return "Fe"; 83 88 } 84 89 … … 101 106 102 107 103 void SetPartId(MMcEvt::ParticleId_t id) 104 { fPartId = id; } 105 106 void SetEnergy(Float_t Energy) 107 { fEnergy=Energy; } //Set Energy 108 109 void SetImpact(Float_t Impact) 110 { fImpact=Impact;} //Set impact parameter 108 // Setter 109 void SetPartId(ParticleId_t id) { fPartId = id; } 110 void SetEnergy(Float_t Energy) { fEnergy=Energy; } //Set Energy 111 void SetImpact(Float_t Impact) { fImpact=Impact;} //Set impact parameter 111 112 112 113 void SetTelescopeTheta(Float_t Theta) { fTelescopeTheta=Theta; } 113 114 114 void SetTelescopePhi (Float_t Phi) { fTelescopePhi=Phi; } 115 115 116 ClassDef(MMcEvtBasic, 1) //Stores Basic Montecarlo Information of one event 116 void Fill(ParticleId_t, Float_t, Float_t, Float_t, Float_t); 117 118 // TObject 119 void Clear(Option_t *opt=NULL); 120 void Print(Option_t *opt=NULL) const; 121 122 ClassDef(MMcEvtBasic, 2) //Stores Basic Montecarlo Information of one event 117 123 118 124 };
Note:
See TracChangeset
for help on using the changeset viewer.