- Timestamp:
- 03/07/01 11:20:28 (24 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/macros/getCollArea.C
r686 r689 1 {{ 1 void getCollArea(char *filename = "/big0/Maggi/CamData/Gamma/gamma_15_on.root" ) 2 { 2 3 3 4 MParList *parlist = new MParList() ; … … 14 15 15 16 16 MReadTree reader( "/big0/Maggi/CamData/Gamma/gamma_15_on.root","Events" ) ;17 MReadTree reader( filename ,"Events" ) ; 17 18 tasklist->AddToList( &reader ) ; 18 19 … … 34 35 collArea->Draw() ; 35 36 36 } }37 } -
trunk/MagicSoft/Mars/mmontecarlo/MCollArea.cc
r686 r689 74 74 { 75 75 // first of all calculate the efficency 76 fHistSel->Divide( fHistAll) ; 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++ ) 84 { 85 for (Int_t iy=1; iy<=iBiny; iy++ ) 86 { 87 effi = error = 0. ; 88 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 ) ; 95 96 cout << ix << " " << iy 97 << " N " << N 98 << " Nall " << Nall 99 << " effi " << effi 100 << " error " << error 101 << endl ; 102 103 fHistSel->SetCellContent(ix, iy, effi) ; 104 fHistSel->SetCellError(ix, iy, error) ; 105 } 106 else 107 cout << ix << " " << iy << endl ; 108 109 110 111 112 } 113 } 77 114 78 115 // … … 81 118 // 82 119 83 Int_t iBinx = ( (TAxis *) fHistSel->GetXaxis())->GetNbins() ;84 Int_t iBiny = ( (TAxis *) fHistSel->GetYaxis())->GetNbins() ;85 120 86 Double_t r1, r2, eff, A ;121 Double_t r1, r2, eff, errEff, A, errA, collA ; 87 122 88 123 for (Int_t ix=1; ix<=iBiny; ix++ ) 89 124 { 90 A = 0. ; 125 A = errA = collA = errEff = 0. ; 126 91 127 for (Int_t iy=1; iy<=iBiny; iy++ ) 92 128 { 93 129 r1 = ( (TAxis *) fHistSel->GetYaxis())->GetBinLowEdge(iy) ; 94 130 r2 = ( (TAxis *) fHistSel->GetYaxis())->GetBinLowEdge(iy+1) ; 95 eff= fHistSel->GetCellContent(ix, iy) ; 96 A += eff * 3.141592654 * ( r2*r2 - r1*r1 ) ; 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 } 97 138 98 } 139 errA = sqrt( errA ) ; 140 99 141 cout << ix << " --> " << A 100 142 << endl ; 101 143 102 fHistColl->SetBinContent(ix, A ) ; 144 fHistColl->SetBinContent(ix, collA ) ; 145 fHistColl->SetBinError(ix, errA ) ; 103 146 104 147
Note:
See TracChangeset
for help on using the changeset viewer.