Index: /esaf_lal/branches/camille/packages/analysis/analysis.C
===================================================================
--- /esaf_lal/branches/camille/packages/analysis/analysis.C	(revision 184)
+++ /esaf_lal/branches/camille/packages/analysis/analysis.C	(revision 185)
@@ -71,5 +71,8 @@
     
     double x[200], ratio_1[200], ratio_2[200], ratio_3[200], ratio_4[200], ratio_5[200];
+    double error_ratio_1[200], error_ratio_2[200], error_ratio_3[200], error_ratio_4[200], error_ratio_5[200];
     double ratio_1_min = 1, ratio_2_min = 1, ratio_3_min = 1, ratio_4_min = 1, ratio_5_min = 1;
+    double error_ratio_1_min, error_ratio_2_min, error_ratio_3_min, error_ratio_4_min, error_ratio_5_min;
+
     
     for (int j= 0; j<200; j++)
@@ -108,4 +111,10 @@
         double bin6 = h6->GetBinContent(i);
         
+        double error1 = h1->GetBinError(i);
+        double error2 = h2->GetBinError(i);
+        double error3 = h3->GetBinError(i);
+        double error4 = h4->GetBinError(i);
+        double error5 = h5->GetBinError(i);
+        double error6 = h6->GetBinError(i);
         
         x[i] = i;
@@ -120,4 +129,10 @@
             ratio_4[i] = 0;
             ratio_5[i] = 0;
+            
+            error_ratio_1[i] = 0;
+            error_ratio_2[i] = 0;
+            error_ratio_3[i] = 0;
+            error_ratio_4[i] = 0;
+            error_ratio_5[i] = 0;
         }
         
@@ -129,20 +144,42 @@
             ratio_4[i] = bin5/bin4;
             ratio_5[i] = bin6/bin4;
+            
+            error_ratio_1[i] = error1/bin4 + bin1/(bin4*bin4) * error4;
+            error_ratio_2[i] = error2/bin4 + bin2/(bin4*bin4) * error4;
+            error_ratio_3[i] = error3/bin4 + bin3/(bin4*bin4) * error4;
+            error_ratio_4[i] = error5/bin4 + bin5/(bin4*bin4) * error4;
+            error_ratio_5[i] = error6/bin4 + bin6/(bin4*bin4) * error4;
+
         }
         
         if (ratio_1[i] < ratio_1_min && ratio_1[i] != 0)
+        {
             ratio_1_min = ratio_1[i];
+            error_ratio_1_min = error_ratio_1[i];
+        }
         
         if (ratio_2[i] < ratio_2_min && ratio_2[i] != 0)
+        {
             ratio_2_min = ratio_2[i];
+            error_ratio_2_min = error_ratio_2[i];
+        }
         
         if (ratio_3[i] < ratio_3_min && ratio_3[i] != 0)
+        {
             ratio_3_min = ratio_3[i];
+            error_ratio_3_min = error_ratio_3[i];
+        }
         
         if (ratio_4[i] < ratio_4_min && ratio_4[i] != 0)
+        {
             ratio_4_min = ratio_4[i];
+            error_ratio_4_min = error_ratio_4[i];
+        }
         
         if (ratio_5[i] < ratio_5_min && ratio_5[i] != 0)
+        {
             ratio_5_min = ratio_5[i];
+            error_ratio_5_min = error_ratio_5[i];
+        }
     }
     
@@ -153,5 +190,5 @@
     TCanvas *c1 = new TCanvas("c1","efficiency: 30/1ns");
     c1->cd();
-    TGraph *g_efficiency1 = new TGraph(128, x, ratio_1);
+    TGraphErrors *g_efficiency1 = new TGraphErrors(128, x, ratio_1, 0, error_ratio_1);
     //g_efficiency->SetLineColor(2);
     //g_efficiency->SetLineWidth(2);
@@ -162,5 +199,5 @@
     TCanvas *c2 = new TCanvas("c2","efficiency: 10/1ns");
     c2->cd();
-    TGraph *g_efficiency2 = new TGraph(128, x, ratio_2);
+    TGraphErrors *g_efficiency2 = new TGraphErrors(128, x, ratio_2, 0, error_ratio_2);
     //g_efficiency->SetLineColor(2);
     //g_efficiency->SetLineWidth(2);
@@ -171,5 +208,5 @@
     TCanvas *c3 = new TCanvas("c3","efficiency: 5/1ns");
     c3->cd();
-    TGraph *g_efficiency3 = new TGraph(128, x, ratio_3);
+    TGraphErrors *g_efficiency3 = new TGraphErrors(128, x, ratio_3, 0, error_ratio_3);
     //g_efficiency->SetLineColor(2);
     //g_efficiency->SetLineWidth(2);
@@ -180,5 +217,5 @@
     TCanvas *c4 = new TCanvas("c4","efficiency: 20/1ns");
     c4->cd();
-    TGraph *g_efficiency4 = new TGraph(128, x, ratio_4);
+    TGraphErrors *g_efficiency4 = new TGraphErrors(128, x, ratio_4, 0, error_ratio_4);
     //g_efficiency->SetLineColor(2);
     //g_efficiency->SetLineWidth(2);
@@ -189,5 +226,5 @@
     TCanvas *c6 = new TCanvas("c6","efficiency: 60/1ns");
     c6->cd();
-    TGraph *g_efficiency6 = new TGraph(128, x, ratio_5);
+    TGraphErrors *g_efficiency6 = new TGraphErrors(128, x, ratio_5, 0, error_ratio_5);
     //g_efficiency->SetLineColor(2);
     //g_efficiency->SetLineWidth(2);
@@ -198,5 +235,5 @@
     //Efficiency vs time resolution curve
     
-    double abs[10], ord[10];
+    double abs[10], ord[10], err[10];
     
     abs[0] = 5;
@@ -210,8 +247,13 @@
     ord[3] = ratio_1_min;
     ord[4] = ratio_5_min;
+    err[0] = error_ratio_3_min;
+    err[1] = error_ratio_2_min;
+    err[2] = error_ratio_4_min;
+    err[3] = error_ratio_1_min;
+    err[4] = error_ratio_5_min;
     
     TCanvas *c5 = new TCanvas("c5", "efficiency vs time resolution");
     c5->cd();
-    TGraph* efficiency_vs_time = new TGraph(5, abs, ord);
+    TGraphErrors* efficiency_vs_time = new TGraphErrors(5, abs, ord, 0, err);
     efficiency_vs_time->SetMarkerStyle(21);
     efficiency_vs_time->Draw("AP");
