Changeset 689 for trunk/MagicSoft


Ignore:
Timestamp:
03/07/01 11:20:28 (24 years ago)
Author:
harald
Message:
calculation of errors for collection area included!
Location:
trunk/MagicSoft/Mars
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/macros/getCollArea.C

    r686 r689  
    1 {{
     1void getCollArea(char *filename = "/big0/Maggi/CamData/Gamma/gamma_15_on.root" )
     2{
    23 
    34  MParList  *parlist  = new MParList() ;
     
    1415
    1516
    16   MReadTree reader("/big0/Maggi/CamData/Gamma/gamma_15_on.root","Events" ) ;
     17  MReadTree reader( filename ,"Events" ) ;
    1718  tasklist->AddToList( &reader ) ;
    1819
     
    3435  collArea->Draw() ;
    3536 
    36 }}
     37}
  • trunk/MagicSoft/Mars/mmontecarlo/MCollArea.cc

    r686 r689  
    7474{
    7575  //  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    }
    77114 
    78115  //
     
    81118  //   
    82119 
    83   Int_t iBinx = ( (TAxis *) fHistSel->GetXaxis())->GetNbins() ;
    84   Int_t iBiny = ( (TAxis *) fHistSel->GetYaxis())->GetNbins() ;
    85120 
    86   Double_t  r1, r2, eff, A ;
     121  Double_t  r1, r2, eff, errEff, A, errA, collA ;
    87122
    88123  for (Int_t ix=1; ix<=iBiny; ix++ )
    89124    {
    90       A = 0. ;
     125      A = errA = collA = errEff = 0. ;
     126     
    91127      for (Int_t iy=1; iy<=iBiny; iy++ )
    92128        {
    93129          r1 = ( (TAxis *) fHistSel->GetYaxis())->GetBinLowEdge(iy) ;
    94130          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        }
    97138
    98         }
     139      errA = sqrt( errA ) ;
     140
    99141      cout << ix << " --> " << A
    100142           << endl ;
    101143     
    102       fHistColl->SetBinContent(ix, A ) ;
     144      fHistColl->SetBinContent(ix, collA ) ;
     145      fHistColl->SetBinError(ix, errA ) ;
    103146     
    104147
Note: See TracChangeset for help on using the changeset viewer.