Index: /fact/tools/rootmacros/gainfit2.C
===================================================================
--- /fact/tools/rootmacros/gainfit2.C	(revision 12753)
+++ /fact/tools/rootmacros/gainfit2.C	(revision 12754)
@@ -44,5 +44,5 @@
 //-----------------------------------------------------------------------------
 UInt_t NumberOfPixels;
-
+#define MAX_SIGMA 4
   typedef struct{
   UInt_t PID;
@@ -101,7 +101,7 @@
         const char * OutTextFileName = "../analysis/fpeak/20111110_005/20111110_005_gainfit.txt",
         const char * RootOutFileName = "../analysis/fpeak/20111110_005/20111110_005_gainfit.root",
-        bool showHistos = true,
-        bool debug = true,
-        int verbosityLevel = 2)
+        bool showHistos = false,
+        bool debug = false,
+        int verbosityLevel = 4)
 {
 
@@ -274,5 +274,5 @@
         hPixelAmplSpek[ pixel ]->Fit(fspek_fit2,verbos[fitverb]+"R+");
         channel[ pixel ].ampl_fspek_fit2 = fspek_fit2->GetParameter(1);
-        
+
         if( showHistos ){
         hPixelAmplSpek[ pixel ]->Draw();
@@ -325,5 +325,4 @@
         gr2->SetPoint(pixel, channel[pixel].PID, channel[pixel].ampl_fspek_fit2);
 
-
     if( showHistos ){
         if (pixel%60==0){
@@ -379,4 +378,6 @@
     cGraphs->cd(2);
     gr1->Draw("APL");
+    hList.Add(gr1);
+    hList.Add(gr2);
     cGraphs->Modified();
     cGraphs->Update();
@@ -416,5 +417,5 @@
 
     //check if pixel gain is compareable to gain of the others and save result to logfile
-            channel[ pixel ].crazy = SearchAnormal(pixel, 4, verbosityLevel);
+            channel[ pixel ].crazy = SearchAnormal(pixel, MAX_SIGMA, verbosityLevel);
             if (channel[ pixel ].crazy) hListCrazy.Add(hPixelAmplSpek[ pixel ]);
             out << channel[ pixel ].crazy << "\t" ;
@@ -540,10 +541,11 @@
 bool SearchAnormal(UInt_t pixel, Double_t distance, int verbosityLevel){
   Double_t check = channel[ pixel ].ampl_fspek_fit;
-  check = TMath::Sqrt(check*check);
-  if (check < (distance * distribution.sigma + distribution.mean)){
+  // check = TMath::Sqrt(check*check);
+  if ( check > ( distribution.mean - distance * distribution.sigma )
+    && check < ( distribution.mean + distance * distribution.sigma )){
     return false;
     }
   else{
-    if (verbosityLevel > 2) cout << "Not normal behaviour in Pixel: " << pixel +1 << endl;
+    if (verbosityLevel > 2) cout << "Not normal behaviour in Pixel: " << pixel << endl;
     return true;
   }
