Index: trunk/MagicSoft/Mars/macros/calibration.C
===================================================================
--- trunk/MagicSoft/Mars/macros/calibration.C	(revision 2924)
+++ trunk/MagicSoft/Mars/macros/calibration.C	(revision 2925)
@@ -132,5 +132,5 @@
     // (This is a preliminary feature)
     //
-    // calcalc.ExcludePixelsFromAsciiFile("badpixels_all.dat");
+     calcalc.ExcludePixelsFromAsciiFile("badpixels_all.dat");
     
     //
@@ -366,7 +366,9 @@
       dgaus->SetParameters(integ,(min+mean)/2.,width/4.,
                            integ/width/2.,(max+mean)/2.,width/4.);
+      // The left-sided Gauss 
       dgaus->SetParLimits(0,integ-1.5,integ+1.5);
       dgaus->SetParLimits(1,min+(width/10.),mean);
       dgaus->SetParLimits(2,0,width/2.);
+      // The right-sided Gauss 
       dgaus->SetParLimits(3,0,integ);
       dgaus->SetParLimits(4,mean,max-(width/10.));
@@ -377,22 +379,28 @@
 
     case 2:
-      TString tgausform = "([0]-[3])/[2]*exp(-0.5*(x-[1])*(x-[1])/[2]/[2])";
-      tgausform += "+[3]/[4]*exp(-0.5*(x-[4])*(x-[4])/[5]/[5])";
-      TF1 *tgaus = new TF1("tgaus","gaus(0)+gaus(3)+gaus(6)",min,max);
+      TString tgausform = "([0]-[3]-[6])/[2]*exp(-0.5*(x-[1])*(x-[1])/[2]/[2])";
+      tgausform += "+[3]/[5]*exp(-0.5*(x-[4])*(x-[4])/[5]/[5])";
+      tgausform += "+[6]/[8]*exp(-0.5*(x-[7])*(x-[7])/[8]/[8])";
+      TF1 *tgaus = new TF1("tgaus",tgausform.Data(),min,max);
       tgaus->SetBit(kCanDelete);
-      tgaus->SetParNames("A1","#mu1","#sigma1","A2","#mu2","#sigma2","A3","#mu3","#sigma3");
-      tgaus->SetParameters(integ/width,max-width/6.,width/4.,
-                           integ/width,min+width/6.,width/4.,
-                           integ/width,min+width/6.,width/2.);
-      tgaus->SetParLimits(0,0,integ);
-      tgaus->SetParLimits(1,min,max);
-      tgaus->SetParLimits(2,0,width/4.);
-      tgaus->SetParLimits(3,0,integ);
-      tgaus->SetParLimits(4,min,max);
-      tgaus->SetParLimits(5,0,width/4.);
-      tgaus->SetParLimits(6,0,integ);
+      tgaus->SetParNames("A_{tot}","#mu_{1}","#sigma_{1}",
+                         "A_{2}","#mu_{2}","#sigma_{2}",
+                         "A_{3}","#mu_{3}","#sigma_{3}");
+      tgaus->SetParameters(integ,(min+mean)/2,width/4.,
+                           integ/width/3.,(max+mean)/2.,width/4.,
+                           integ/width/3.,mean,width/2.);
+      // The left-sided Gauss 
+      tgaus->SetParLimits(0,integ-1.5,integ+1.5);
+      tgaus->SetParLimits(1,min+(width/10.),mean);
+      tgaus->SetParLimits(2,width/15.,width/2.);
+      // The right-sided Gauss 
+      tgaus->SetParLimits(3,0.,integ);
+      tgaus->SetParLimits(4,mean,max-(width/10.));
+      tgaus->SetParLimits(5,width/15.,width/2.);
+      // The Gauss describing the outliers
+      tgaus->SetParLimits(6,0.,integ);
       tgaus->SetParLimits(7,min,max);
-      tgaus->SetParLimits(8,0,width/2.);
-      obj2->Fit("tgaus","QLR");
+      tgaus->SetParLimits(8,width/4.,width/1.5);
+      obj2->Fit("tgaus","QLRM");
       obj2->GetFunction("tgaus")->SetLineColor(kYellow);
       break;
