Changeset 710 for trunk/MagicSoft/Mars/mmontecarlo
- Timestamp:
- 03/30/01 11:30:32 (24 years ago)
- Location:
- trunk/MagicSoft/Mars/mmontecarlo
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mmontecarlo/MCollArea.cc
r689 r710 34 34 50, 0., 500. ) ; 35 35 36 fHistCol l = new TH1D("collArea", "Collection Area",37 50, 0., 5.) ; 36 fHistCol = new TH1D("collArea", "Collection Area", 37 50, 0., 5.) ; 38 38 39 39 } … … 43 43 delete fHistAll ; 44 44 delete fHistSel ; 45 delete fHistCol l ;45 delete fHistCol ; 46 46 } 47 47 … … 68 68 void MCollArea::Draw(Option_t* option) 69 69 { 70 fHistCol l->Draw(option) ;70 fHistCol->Draw(option) ; 71 71 } 72 72 73 void MCollArea::Calc ulateEffi()73 void MCollArea::CalcEfficiency() 74 74 { 75 // first of all calculate the efficency 76 // do it here by hand to get the right error of efficency 77 78 Int_t iBinx = ( (TAxis *) fHistSel->GetXaxis())->GetNbins() ; 79 Int_t iBiny = ( (TAxis *) fHistSel->GetYaxis())->GetNbins() ; 80 81 Float_t N, Nall ; 82 Double_t effi, error ; 83 for (Int_t ix=1; ix<=iBiny; ix++ ) 75 // Description! 76 77 // 78 // first of all calculate the efficency 79 // do it here by hand to get the right error of efficency 80 // 81 const Int_t iBinx = ((TAxis *)fHistSel->GetXaxis())->GetNbins(); 82 const Int_t iBiny = ((TAxis *)fHistSel->GetYaxis())->GetNbins(); 83 84 for (Int_t ix=1; ix<=iBiny; ix++ ) 84 85 { 85 for (Int_t iy=1; iy<=iBiny; iy++ ) 86 { 87 effi = error = 0. ; 86 for (Int_t iy=1; iy<=iBiny; iy++ ) 87 { 88 const Float_t N = fHistSel->GetCellContent(ix, iy); 89 const Float_t Nall = fHistAll->GetCellContent(ix, iy); 88 90 89 N = fHistSel->GetCellContent(ix, iy) ; 90 Nall = fHistAll->GetCellContent(ix, iy) ; 91 92 if ( Nall > 0 ) { 93 effi = N / Nall ; 94 error = sqrt ( Nall + Nall * N - N * N - N ) / (Nall * Nall ) ; 91 if ( Nall <= 0 ) { 92 // cout << ix << " " << iy << endl ; 93 continue; 94 } 95 95 96 cout << ix << " " << iy 97 << " N " << N 98 << " Nall " << Nall 99 << " effi " << effi 100 << " error " << error 101 << endl ; 96 const Double_t eff = N / Nall ; 97 const Double_t err = sqrt(Nall + Nall*N - N*N - N) / (Nall*Nall); 98 /* 99 cout << ix << " " << iy 100 << " N " << N 101 << " Nall " << Nall 102 << " effi " << eff 103 << " error " << err 104 << endl ; 105 */ 106 fHistSel->SetCellContent(ix, iy, eff); 107 fHistSel->SetCellError(ix, iy, err); 108 } 109 } 102 110 103 fHistSel->SetCellContent(ix, iy, effi) ; 104 fHistSel->SetCellError(ix, iy, error) ; 105 } 106 else 107 cout << ix << " " << iy << endl ; 108 109 111 // 112 // now calculate the Collection area for different 113 // energies 114 // 115 for (Int_t ix=1; ix<=iBiny; ix++ ) 116 { 117 Double_t errA = 0; 118 Double_t colA = 0; 110 119 111 112 } 113 } 114 115 // 116 // now calculate the Collection area for different 117 // energies 118 // 119 120 121 Double_t r1, r2, eff, errEff, A, errA, collA ; 120 for (Int_t iy=1; iy<=iBiny; iy++ ) 121 { 122 const Double_t r1 = ((TAxis *)fHistSel->GetYaxis())->GetBinLowEdge(iy); 123 const Double_t r2 = ((TAxis *)fHistSel->GetYaxis())->GetBinLowEdge(iy+1); 122 124 123 for (Int_t ix=1; ix<=iBiny; ix++ ) 124 { 125 A = errA = collA = errEff = 0. ; 126 127 for (Int_t iy=1; iy<=iBiny; iy++ ) 128 { 129 r1 = ( (TAxis *) fHistSel->GetYaxis())->GetBinLowEdge(iy) ; 130 r2 = ( (TAxis *) fHistSel->GetYaxis())->GetBinLowEdge(iy+1) ; 131 A = 3.141592654 * ( r2*r2 - r1*r1 ) ; 132 eff = fHistSel->GetCellContent(ix, iy) ; 133 errEff = fHistSel->GetCellError(ix, iy) ; 134 collA += eff * A ; 135 136 errA += ( A * A ) * errEff * errEff ; 137 } 125 const Double_t A = kPI * (r2*r2 - r1*r1); 138 126 139 errA = sqrt( errA ) ; 127 const Double_t eff = fHistSel->GetCellContent(ix, iy); 128 const Double_t err = fHistSel->GetCellError(ix, iy); 140 129 141 cout << ix << " --> " << A 142 << endl ; 143 144 fHistColl->SetBinContent(ix, collA ) ; 145 fHistColl->SetBinError(ix, errA ) ; 146 130 colA += eff*A; 131 errA += (A*A) * err * err; 132 } 147 133 148 } 149 } 134 fHistCol->SetBinContent(ix, colA); 135 fHistCol->SetBinError(ix, sqrt(errA)); 136 } 137 } -
trunk/MagicSoft/Mars/mmontecarlo/MCollArea.h
r686 r710 9 9 10 10 private: 11 TH2D *fHistAll ; //! all simulated showers12 TH2D *fHistSel ; //! 13 TH1D *fHistCol l ; //!the collection area11 TH2D *fHistAll ; //! all simulated showers 12 TH2D *fHistSel ; //! the selected showers 13 TH1D *fHistCol ; // the collection area 14 14 15 15 public: … … 23 23 void DrawSel() ; 24 24 void Draw(Option_t* option = "") ; 25 void Calc ulateEffi() ;25 void CalcEfficiency() ; 26 26 27 27 ClassDef(MCollArea, 1) // Data Container to calculate Collection Area
Note:
See TracChangeset
for help on using the changeset viewer.