Index: /trunk/MagicSoft/Mars/macros/getCollArea.C
===================================================================
--- /trunk/MagicSoft/Mars/macros/getCollArea.C	(revision 688)
+++ /trunk/MagicSoft/Mars/macros/getCollArea.C	(revision 689)
@@ -1,3 +1,4 @@
-{{ 
+void getCollArea(char *filename = "/big0/Maggi/CamData/Gamma/gamma_15_on.root" ) 
+{ 
   
   MParList  *parlist  = new MParList() ; 
@@ -14,5 +15,5 @@
 
 
-  MReadTree reader("/big0/Maggi/CamData/Gamma/gamma_15_on.root","Events" ) ; 
+  MReadTree reader( filename ,"Events" ) ; 
   tasklist->AddToList( &reader ) ; 
 
@@ -34,3 +35,3 @@
   collArea->Draw() ; 
   
-}} 
+}
Index: /trunk/MagicSoft/Mars/mmontecarlo/MCollArea.cc
===================================================================
--- /trunk/MagicSoft/Mars/mmontecarlo/MCollArea.cc	(revision 688)
+++ /trunk/MagicSoft/Mars/mmontecarlo/MCollArea.cc	(revision 689)
@@ -74,5 +74,42 @@
 { 
   //  first of all calculate the efficency
-  fHistSel->Divide( fHistAll) ; 
+  //  do it here by hand to get the right error of efficency
+ 
+  Int_t iBinx = ( (TAxis *) fHistSel->GetXaxis())->GetNbins() ; 
+  Int_t iBiny = ( (TAxis *) fHistSel->GetYaxis())->GetNbins() ; 
+ 
+  Float_t N, Nall ; 
+  Double_t effi, error ; 
+  for (Int_t ix=1; ix<=iBiny; ix++ ) 
+    {
+      for (Int_t iy=1; iy<=iBiny; iy++ ) 
+	{ 
+	  effi = error = 0. ; 
+
+	  N    = fHistSel->GetCellContent(ix, iy) ; 
+	  Nall = fHistAll->GetCellContent(ix, iy) ; 
+	  
+	  if ( Nall > 0 ) { 
+	    effi   = N / Nall ; 
+	    error = sqrt ( Nall + Nall * N - N * N - N ) / (Nall * Nall ) ; 
+
+	    cout << ix << " " << iy 
+		 << " N " << N 
+		 << " Nall " << Nall
+		 << " effi  " << effi 
+		 << " error " << error 
+		 << endl ; 
+
+	    fHistSel->SetCellContent(ix, iy, effi) ; 
+	    fHistSel->SetCellError(ix, iy, error) ; 
+	  } 
+	  else 
+	    cout << ix << " " << iy << endl ; 
+	    
+	  
+
+	  
+	}
+    } 
   
   // 
@@ -81,24 +118,30 @@
   //   
   
-  Int_t iBinx = ( (TAxis *) fHistSel->GetXaxis())->GetNbins() ; 
-  Int_t iBiny = ( (TAxis *) fHistSel->GetYaxis())->GetNbins() ; 
   
-  Double_t  r1, r2, eff, A ; 
+  Double_t  r1, r2, eff, errEff, A, errA, collA ; 
 
   for (Int_t ix=1; ix<=iBiny; ix++ ) 
     {
-      A = 0. ; 
+      A = errA = collA = errEff = 0. ; 
+      
       for (Int_t iy=1; iy<=iBiny; iy++ ) 
 	{ 
 	  r1 = ( (TAxis *) fHistSel->GetYaxis())->GetBinLowEdge(iy) ; 
 	  r2 = ( (TAxis *) fHistSel->GetYaxis())->GetBinLowEdge(iy+1) ; 
-	  eff= fHistSel->GetCellContent(ix, iy) ; 
-	  A += eff * 3.141592654 * ( r2*r2 - r1*r1 ) ; 
+	  A  = 3.141592654 * ( r2*r2 - r1*r1 ) ; 
+	  eff    = fHistSel->GetCellContent(ix, iy) ;
+	  errEff = fHistSel->GetCellError(ix, iy) ; 
+	  collA += eff * A ; 
+	  
+	  errA  += ( A * A ) * errEff * errEff ; 
+	}
 
-	}
+      errA = sqrt( errA ) ; 
+
       cout << ix << " --> " << A
 	   << endl ; 
       
-      fHistColl->SetBinContent(ix, A ) ; 
+      fHistColl->SetBinContent(ix, collA ) ; 
+      fHistColl->SetBinError(ix, errA ) ; 
       
 
