Changeset 2250 for trunk/MagicSoft/Mars/mmontecarlo
- Timestamp:
- 06/27/03 17:29:49 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/mmontecarlo
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mmontecarlo/MMcCollectionAreaCalc.cc
r2237 r2250 63 63 AddToBranchList("MMcEvt.fEnergy"); 64 64 AddToBranchList("MMcEvt.fImpact"); 65 66 fCorsikaVersion = 0; 67 fAllEvtsTriggered = kFALSE; 68 fTotalNumSimulatedShowers = 0; 69 fTheta = -1.; 70 65 71 } 66 72 … … 76 82 } 77 83 78 fCollArea = (MHMcCollectionArea*)pList->FindCreateObj("MHMcCollectionArea");79 if (!fCollArea)80 return kFALSE;81 82 fTheta = -1;83 fEmin = -1;84 fEmax = -1;85 fSlope = 0;86 fTotalNumSimulatedShowers = 0;87 fCorsikaVersion = 0;88 fAllEvtsTriggered = kFALSE;89 90 84 return kTRUE; 91 85 } … … 108 102 109 103 fTotalNumSimulatedShowers += runheader->GetNumSimulatedShowers(); 110 111 104 *fLog << inf << "Total Number of Simulated showers: " << fTotalNumSimulatedShowers << endl; 105 112 106 113 107 if (fTheta>=0 && fTheta!=runheader->GetTelesTheta()) … … 116 110 *fLog << fTheta << ", " << runheader->GetTelesTheta() << ")..." << endl; 117 111 } 118 119 112 fTheta = runheader->GetTelesTheta(); 113 120 114 121 115 if (fCorsikaVersion!=0 && fCorsikaVersion!=runheader->GetCorsikaVersion()) 122 116 *fLog << warn << dbginf << "Warning - Read files have different Corsika versions..." << endl; 123 124 117 fCorsikaVersion = runheader->GetCorsikaVersion(); 125 118 126 if ( fEmin > 0 &&127 (fEmin != corrunheader->GetELowLim() ||128 fEmax != corrunheader->GetEUppLim() ||129 fSlope != corrunheader->GetSlopeSpec()) )130 *fLog << warn << dbginf << "Warning - Read files have different energy distribution..." << endl;131 132 fEmin = corrunheader->GetELowLim();133 fEmax = corrunheader->GetEUppLim();134 fSlope = corrunheader->GetSlopeSpec();135 119 136 120 fAllEvtsTriggered |= runheader->GetAllEvtsTriggered(); 137 138 121 *fLog << inf << "Only triggered events avail: " << (fAllEvtsTriggered?"yes":"no") << endl; 139 122 123 124 fCollArea = (MHMcCollectionArea*)plist->FindCreateObj("MHMcCollectionArea"); 125 if (!fCollArea) 126 return kFALSE; 127 140 128 if (fAllEvtsTriggered) 129 { 130 // 131 // Calculate approximately the original number of events in each 132 // energy bin: 133 // 134 135 const Float_t emin = corrunheader->GetELowLim(); 136 const Float_t emax = corrunheader->GetEUppLim(); 137 const Float_t expo = 1 + corrunheader->GetSlopeSpec(); 138 const Float_t k = runheader->GetNumSimulatedShowers() / 139 (pow(emax,expo) - pow(emin,expo)) ; 140 141 const Int_t nbinx = fCollArea->GetHistAll()->GetNbinsX(); 142 143 for (Int_t i = 1; i <= nbinx; i++) 144 { 145 const Float_t e1 = fCollArea->GetHistAll()->GetXaxis()->GetBinLowEdge(i); 146 const Float_t e2 = fCollArea->GetHistAll()->GetXaxis()->GetBinLowEdge(i+1); 147 148 if (e1 < emin || e2 > emax) 149 continue; 150 151 const Float_t events = k * (pow(e2, expo) - pow(e1, expo)); 152 // 153 // We fill the ith energy bin, with the total number of events 154 // Second argument of Fill would be impact parameter of each 155 // event, but we don't really need it for the collection area, 156 // so we just put a dummy value (1.) 157 // 158 159 const Float_t energy = (e1+e2)/2.; 160 fCollArea->GetHistAll()->Fill(energy, 1., events); 161 } 162 141 163 return kTRUE; 164 } 142 165 143 166 fMcTrig = (MMcTrig*)plist->FindObject(fObjName); … … 190 213 { 191 214 *fLog << inf << "Total number of showers: " << fTotalNumSimulatedShowers << endl; 192 fCollArea->CalcEfficiency (fTotalNumSimulatedShowers, fEmin, fEmax, fSlope);193 } 194 195 return kTRUE; 196 } 197 215 fCollArea->CalcEfficiency2(); 216 } 217 218 return kTRUE; 219 } 220 -
trunk/MagicSoft/Mars/mmontecarlo/MMcCollectionAreaCalc.h
r2207 r2250 5 5 #include "MTask.h" 6 6 #endif 7 8 #include <TH2.h> 7 9 8 10 class MParList; … … 23 25 UInt_t fTotalNumSimulatedShowers; 24 26 UInt_t fCorsikaVersion; 27 Bool_t fAllEvtsTriggered; 25 28 Float_t fTheta; 26 Float_t fEmin;27 Float_t fEmax;28 Float_t fSlope;29 30 Bool_t fAllEvtsTriggered;31 29 32 30 Bool_t ReInit(MParList *plist);
Note:
See TracChangeset
for help on using the changeset viewer.