Index: trunk/MagicSoft/Mars/mtemp/mmpi/macros/callalphaplot.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mmpi/macros/callalphaplot.C	(revision 4100)
+++ trunk/MagicSoft/Mars/mtemp/mmpi/macros/callalphaplot.C	(revision 4102)
@@ -38,15 +38,15 @@
 
 
-#define XSOUR   0.0  // [deg]
-#define YSOUR   -0.05  // [deg]
+#define XSOUR   0.05  // [deg]
+#define YSOUR   0.6  // [deg]
 #define NUM     0
 
 
-TString sourcename = "CrabOn";
+TString sourcename = "M87On";
 
 const Bool_t ROTOPTION  = kFALSE;  // kFALSE: do not derotate, use camera coordinates
                                   // kTRUE: derotate into "quasi" sky coordinates
 
-const Bool_t USEOFFDATA = kTRUE; // kFALSE: do not use OFF data to estimate the significance
+const Bool_t USEOFFDATA = kFALSE; // kFALSE: do not use OFF data to estimate the significance
                                   // kTRUE: use in addition OFF data to estimate the significance
 
@@ -64,6 +64,6 @@
                                                                   // if USEFILE == kFALSE : not needed
 
-TString dirname  = "~/data/Crab/2004_01_27/";
-TString filename = "CrabHillasON.root"; //  NOTE in case of several subsamples (SAMPLES=kTRUE)
+TString dirname  = "~/data/M87/2004_02_17/";
+TString filename = "M87HillasON.root"; //  NOTE in case of several subsamples (SAMPLES=kTRUE)
                                          // folllowing name construction is assumed:
                                          // file = dirname + sample + <number> + / + filename
@@ -72,5 +72,5 @@
 /* ******************************************************   */
       /*  dynamical cuts  Crab 27th Jan 2004 */
-
+/*
 #define LENGTHMINParA 0.136  // deg
 #define LENGTHMINParB 0.036  //
@@ -91,8 +91,8 @@
 #define DISTMAXParB   0.059  //
 #define DISTMAXParC   0.  //
-
+*/
 
       /*  dynamical cuts  Mrk 421 and Crab 15th Feb 2004 */
-/*
+
 #define LENGTHMINParA 0.12  // deg
 #define LENGTHMINParB 0.034  //
@@ -113,5 +113,5 @@
 #define DISTMAXParB   0.059  //
 #define DISTMAXParC   0.  //
-*/
+
 
 #define SIZEMIN 2000
@@ -813,4 +813,5 @@
 // **********************************************************************  //
 //  use OFF data to estimate background   *******************************  //
+    TF1 * bgoff2 = new TF1("bgoffOFF", parabfunc, 0., 90., 3);
   if (USEOFFDATA == kTRUE)
   {
@@ -851,5 +852,4 @@
 
 
-            TF1 * bgoff2 = new TF1("bgoffOFF", parabfunc, 0., 90., 3);
             bgoff2->SetParameters(aparOff, bparOff, normf/binwidth*binwidthOff);
             bgoff2->FixParameter(0, aparOff);
Index: trunk/MagicSoft/Mars/mtemp/mmpi/macros/gridloop.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mmpi/macros/gridloop.C	(revision 4100)
+++ trunk/MagicSoft/Mars/mtemp/mmpi/macros/gridloop.C	(revision 4102)
@@ -236,7 +236,7 @@
 //    histalphagrid.Fit("fsig","NR");
 //printf("content bin 1: %4.2f\n", histalphagrid.GetBinContent(1));
-    histalphagrid.Fit(fitsig,"NR");
-    histalphagrid.Fit("fbg4","+NR");
-    histalphagrid.Fit("fbgpar","+NR");
+    histalphagrid.Fit(fitsig,"NWR");
+    histalphagrid.Fit("fbg4","+NWR");
+    histalphagrid.Fit("fbgpar","+NWR");
 
 // cout << "OK" << endl;
@@ -245,5 +245,5 @@
     for(Int_t i=1; i<=numbbinOnMax;i++) Non += histalphagrid.GetBinContent(i);
 //    Non = (fitsig->GetParameter(0)) * numbbinOnMax;
-
+//cout << "Non : " << Non << endl;
 //    histalphagrid.Draw();
 
@@ -252,4 +252,6 @@
            (fitbgpar->GetParameter(1)) * ALPHAMAX) /  binwidth1;
     
+//cout << "Noff : " << Noff << endl;
+    
     Nex = Non - Noff;
 
@@ -258,4 +260,5 @@
            fitbg4->GetParameter(2) * ALPHAMAX ) / binwidth1;
  
+//cout << "Noff4 : " << Noff4 << endl;
  
     Nex4 = Non - Noff4;
@@ -264,7 +267,12 @@
 
 //    Sign4 = Nex4 / sqrt(Nex4 + 2.* Noff4);
-    Sign4 = LiMa17(Non,Noff4,1.);
+    if (Noff4<0.) Sign4 = 0.;
+    else Sign4 = LiMa17(Non,Noff4,1.);
+
+//cout << "Sign4 : " << Sign4 << endl;
 //    Sign = Nex / sqrt(Nex + 2.* Noff);
-    Sign = LiMa17(Non,Noff,1.);
+    if (Noff<0.) Sign = 0.;
+    else Sign = LiMa17(Non,Noff,1.);
+//cout << "Sign LiMa : " << Sign << endl;
 
    /*  calculate Noff from the OFF data  */
@@ -294,5 +302,6 @@
 
 	// calculate according to Li Ma:
-	   SignLiMa = LiMa17(Non,NoffOFF*normf,1./normf);
+           if (NoffOFF<0.) SignLiMa=0.;
+	   else SignLiMa = LiMa17(Non,NoffOFF*normf,1./normf);
 
    }
