- Timestamp:
- 03/01/02 15:40:22 (23 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 8 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1227 r1228 1 1 -*-*- END -*-*- 2 3 2002/03/01: Thomas Bretz 4 5 * mhist/MHMcEfficiencyEnergy.[h,cc], mhist/MHMcEfficiencyImpact.[h,cc], 6 mhist/MHMcDifRate.[h,cc], mhist/MHMcIntRate.[h,cc]: 7 - added 8 9 * mhist/Makefile, mhist/HistLinkDef.h: 10 - added MHMcEfficiencyEnergy and MHMcEfficiencyImpact 11 - added MHMcDifRate and MHMcIntRate 12 13 * mhist/MHMcCollectionArea.[h,cc]: 14 - changed instantiation of collection area histogram 15 - added settings for the binning 16 - replaced division by root function 17 - added Calc-functions 18 - added GetHist 19 20 * mhist/MHMcEfficiency.[h,cc]: 21 - changed pointers in Calc functions to references 22 23 2 24 3 25 2002/02/28: Thomas Bretz -
trunk/MagicSoft/Mars/mhist/HistLinkDef.h
r1227 r1228 25 25 26 26 #pragma link C++ class MHMcRate+; 27 #pragma link C++ class MHMcDifRate+; 28 #pragma link C++ class MHMcIntRate+; 27 29 #pragma link C++ class MHMcEfficiency+; 30 #pragma link C++ class MHMcEfficiencyImpact+; 31 #pragma link C++ class MHMcEfficiencyEnergy+; 28 32 #pragma link C++ class MHMcEnergy+; 29 33 #pragma link C++ class MHMcEnergyImpact+; -
trunk/MagicSoft/Mars/mhist/MHMcCollectionArea.cc
r1227 r1228 31 31 #include "MH.h" 32 32 #include "MHMcEfficiency.h" 33 #include "MHMcEnergyImpact.h" 33 34 34 35 ClassImp(MHMcCollectionArea); … … 52 53 53 54 fName = name ? name : "MHMcCollectionArea"; 54 fTitle = title ? title : " Data to Calculate Collection Area";55 fTitle = title ? title : "Collection Area vs. Energy"; 55 56 56 57 const Int_t nbins = 50; … … 70 71 fHistSel = new TH2D("SelectedEvents", "Selected showers - Radius vs Energy distribution", 71 72 nbins, binsx, nbins, binsy); 72 fHistCol = new TH1D("CollectionArea", "Collection Area vs. Energy",73 nbins, binsx);74 73 75 74 delete binsx; 76 75 delete binsy; 76 77 fHistCol = new TH1D; 78 fHistCol->SetName(fName); 79 fHistCol->SetTitle(fTitle); 77 80 78 81 fHistAll->SetDirectory(NULL); … … 193 196 } 194 197 195 void MHMcCollectionArea::Calc( MHMcEfficiency *heff)198 void MHMcCollectionArea::Calc(const MHMcEfficiency &heff) 196 199 { 197 200 // … … 199 202 // energies 200 203 // 201 TH2D &h = (TH2D&)*heff->GetHist(); 204 TH2D &h = (TH2D&)*heff.GetHist(); 205 206 MH::SetBinning(fHistCol, h.GetXaxis()); 202 207 203 208 const Int_t nbinx = h.GetXaxis()->GetNbins(); … … 228 233 fHistCol->SetBinError(ix, sqrt(errA)); 229 234 } 235 236 SetReadyToSave(); 230 237 } 231 238 … … 237 244 void MHMcCollectionArea::CalcEfficiency() 238 245 { 239 // Description!240 241 /*242 //243 // first of all calculate the efficency244 // do it here by hand to get the right error of efficency245 //246 const Int_t nbinx = fHistSel->GetXaxis()->GetNbins();247 const Int_t nbiny = fHistSel->GetYaxis()->GetNbins();248 249 for (Int_t ix=1; ix<=nbinx; ix++)250 {251 for (Int_t iy=1; iy<=nbiny; iy++)252 {253 const Float_t Na = fHistAll->GetCellContent(ix, iy);254 255 if (Na <= 0)256 continue;257 258 const Float_t Ns = fHistSel->GetCellContent(ix, iy);259 260 const Double_t eff = Ns/Na;261 const Double_t err = sqrt((1.-eff)*Ns)/Na;262 263 // old calculation from Harald:264 // const Double_t eff = Ns/Na;265 // const Double_t err = sqrt(Na + Na*Ns - Ns*Ns - Ns) / (Na*Na);266 267 fHistSel->SetCellContent(ix, iy, eff);268 fHistSel->SetCellError(ix, iy, err);269 }270 }271 272 //273 // now calculate the Collection area for different274 // energies275 //276 for (Int_t ix=1; ix<=nbinx; ix++)277 {278 Double_t errA = 0;279 Double_t colA = 0;280 281 for (Int_t iy=1; iy<=nbiny; iy++)282 {283 TAxis *yaxis = fHistSel->GetYaxis();284 285 const Double_t r1 = yaxis->GetBinLowEdge(iy);286 const Double_t r2 = yaxis->GetBinLowEdge(iy+1);287 288 const Double_t A = TMath::Pi() * (r2*r2 - r1*r1);289 290 const Double_t eff = fHistSel->GetCellContent(ix, iy);291 const Double_t err = fHistSel->GetCellError(ix, iy);292 293 colA += eff*A;294 errA += A*A * err*err;295 }296 297 fHistCol->SetBinContent(ix, colA);298 fHistCol->SetBinError(ix, sqrt(errA));299 }300 */301 246 MHMcEfficiency heff; 302 heff.Calc(fHistSel, fHistAll); 303 304 Calc(&heff); 305 306 SetReadyToSave(); 307 } 247 heff.Calc(*fHistSel, *fHistAll); 248 249 Calc(heff); 250 } 251 252 void MHMcCollectionArea::Calc(const MHMcEnergyImpact &mcsel, const MHMcEnergyImpact &mcall) 253 { 254 MHMcEfficiency heff; 255 heff.Calc(*mcsel.GetHist(), *mcall.GetHist()); 256 257 Calc(heff); 258 } -
trunk/MagicSoft/Mars/mhist/MHMcCollectionArea.h
r1227 r1228 10 10 11 11 class MHMcEfficiency; 12 class MHMcEnergyImpact; 12 13 13 14 class MHMcCollectionArea : public MParContainer … … 30 31 void DrawSel(Option_t *option=""); 31 32 33 const TH1D *GetHist() { return fHistCol; } 34 const TH1D *GetHist() const { return fHistCol; } 35 32 36 void Draw(Option_t *option=""); 33 37 TObject *DrawClone(Option_t *option="") const; … … 35 39 void CalcEfficiency(); 36 40 37 void Calc(MHMcEfficiency *eff); 41 void Calc(const MHMcEnergyImpact &mcsel, const MHMcEnergyImpact &mcall); 42 void Calc(const MHMcEfficiency &heff); 38 43 39 44 ClassDef(MHMcCollectionArea, 1) // Data Container to calculate Collection Area -
trunk/MagicSoft/Mars/mhist/MHMcEfficiency.cc
r1227 r1228 41 41 #include "MH.h" 42 42 #include "MBinning.h" 43 44 #include "MHMcEnergyImpact.h" 43 45 44 46 ClassImp(MHMcEfficiency); … … 133 135 } 134 136 135 136 // -------------------------------------------------------------------------- 137 // 138 // Calculate the Efficiency and set the 'ReadyToSave' flag. 139 // The Efficiency is calculated as the number of selected showers 140 // (eg. triggered ones) divided by the number of all showers. 141 // For error calculation Binomial errors are computed. 142 // 143 void MHMcEfficiency::Calc(TH2D *hsel, TH2D *hall) 137 void MHMcEfficiency::Calc(const TH2D &hsel, const TH2D &hall) 144 138 { 145 139 // 146 140 // Set the binning from the two axis of one of the two histograms 147 141 // 148 MH::SetBinning(&fHist, hsel->GetXaxis(), hsel->GetYaxis());142 MH::SetBinning(&fHist, ((TH2D&)hsel).GetXaxis(), ((TH2D&)hsel).GetYaxis()); 149 143 150 144 // … … 161 155 // calculation we assume a binomial error calculation. 162 156 // 163 fHist.Divide( hsel,hall, 1, 1, "B");157 fHist.Divide((TH2D*)&hsel, (TH2D*)&hall, 1, 1, "B"); 164 158 165 159 SetReadyToSave(); 166 160 } 161 162 // -------------------------------------------------------------------------- 163 // 164 // Calculate the Efficiency and set the 'ReadyToSave' flag. 165 // The Efficiency is calculated as the number of selected showers 166 // (eg. triggered ones) divided by the number of all showers. 167 // For error calculation Binomial errors are computed. 168 // 169 void MHMcEfficiency::Calc(const MHMcEnergyImpact &mcsel, const MHMcEnergyImpact &mcall) 170 { 171 Calc(*mcsel.GetHist(), *mcall.GetHist()); 172 173 } -
trunk/MagicSoft/Mars/mhist/MHMcEfficiency.h
r1227 r1228 10 10 11 11 class MMcEvt; 12 class MHMcEnergyImpact; 12 13 13 14 class MHMcEfficiency : public MParContainer … … 32 33 TObject *DrawClone(Option_t* option = "") const; 33 34 34 void Calc(TH2D *hsel, TH2D *hall); 35 void Calc(const TH2D &hsel, const TH2D &hall); 36 void Calc(const MHMcEnergyImpact &mcsel, const MHMcEnergyImpact &mcall); 35 37 36 38 ClassDef(MHMcEfficiency, 1) // Histogram container for montecarlo energy threshold -
trunk/MagicSoft/Mars/mhist/Makefile
r1227 r1228 47 47 MHMcEnergy.cc \ 48 48 MHMcEfficiency.cc \ 49 MHMcEfficiencyImpact.cc \ 50 MHMcEfficiencyEnergy.cc \ 49 51 MHMcEnergyImpact.cc \ 50 MHMcRate.cc 52 MHMcRate.cc \ 53 MHMcIntRate.cc \ 54 MHMcDifRate.cc 51 55 52 56 SRCS = $(SRCFILES)
Note:
See TracChangeset
for help on using the changeset viewer.