Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 2905)
+++ trunk/MagicSoft/Mars/Changelog	(revision 2906)
@@ -34,4 +34,8 @@
      - do not fill &val when return kFALSE
 
+   * macros/calibration.C
+     - include functions to exclude the blind pixel, 
+       calculation of times and quality checks
+
 
  2004/01/23: Abelardo Moralejo
Index: trunk/MagicSoft/Mars/macros/calibration.C
===================================================================
--- trunk/MagicSoft/Mars/macros/calibration.C	(revision 2905)
+++ trunk/MagicSoft/Mars/macros/calibration.C	(revision 2906)
@@ -23,7 +23,4 @@
 \* ======================================================================== */
 
-// const TString pedfile = "/mnt/Data/rootdata/DarkPatch4/2003_11_27/20031126_03030_P_DarkPatch4_E.root";
-// const TString calfile = "/mnt/Data/rootdata/DarkPatch4/2004_01_17/20040116_*_C_DarkPatch2_E.root";
-
 const TString pedfile = "/mnt/Data/rootdata/Miscellaneous/2003_12_19/20031218_03522_P_Park_E.root";
 const TString calfile = "/mnt/Data/rootdata/Miscellaneous/2003_12_19/20031218_03527_C_Park_E.root";
@@ -68,9 +65,4 @@
     tlist.AddToList(&fill);
 
-    MStatusDisplay *d1 = new MStatusDisplay;
-
-    //Set update time to 3s
-    d1->SetUpdateTime(3000);
- 
     //
     // Create and setup the eventloop
@@ -78,5 +70,4 @@
     MEvtLoop evtloop;
     evtloop.SetParList(&plist);
-    evtloop.SetDisplay(d1);  	
 
     //
@@ -118,6 +109,13 @@
     read2.DisableAutoScheme();
 
-    MExtractSignal       sigsig;
+    MExtractSignal       sigcalc;
+    MArrivalTimeCalc     timecalc;
     MCalibrationCalc     calcalc;
+
+    //
+    // As long, as we don't have digital modules, 
+    // we have to set the color of the pulser LED by hand
+    //
+    calcalc.SetPulserColor(MCalibrationCalc::kECT1);
 
     //
@@ -125,11 +123,23 @@
     // (This is a preliminary feature)
     //
-    //    calcalc.ExcludePixelsFromAsciiFile("badpixels.dat");
+    // calcalc.ExcludePixelsFromAsciiFile("badpixels_all.dat");
     
     //
-    // As long, as we don't have digital modules, 
-    // we have to set the color of the pulser LED by hand
-    //
-    calcalc.SetPulserColor(MCalibrationCalc::kECT1);
+    // In case, you want to skip the blind pixel method: 
+    // (NOT RECOMMENDED!!!)
+    //
+    // calcalc.SkipBlindPixelFit();
+
+    //
+    // In case, you want to skip the cosmics rejection
+    // (NOT RECOMMENDED!!!)
+    //
+    // calcalc.SkipCosmicsRejection();
+
+    //
+    // In case, you want to skip the quality checks
+    // (NOT RECOMMENDED!!!)
+    //
+    // calcalc.SkipQualityChecks();
 
     //
@@ -141,5 +151,10 @@
 
     tlist2.AddToList(&read2);
-    tlist2.AddToList(&sigsig);
+    tlist2.AddToList(&sigcalc);
+    //
+    // In case, you want to skip the somewhat lengthy calculation
+    // of the arrival times using a spline, uncomment the next line
+    //
+    // tlist2.AddToList(&timecalc);
     tlist2.AddToList(&calcalc);
 
@@ -159,8 +174,12 @@
 
     //
+    // print the most important results of all pixels
+    //
+    calcam.Print();
+
+    //
     // just one example how to get the plots of individual pixels
     //
-    MCalibrationCam *cam = plist2.FindObject("MCalibrationCam");
-    cam.Print();
+    calcam[17].DrawClone();
 
     MHCamEvent camevt;
@@ -183,32 +202,32 @@
     MHCamera disp16  (geomcam, "MCalibrationPix;RSigma/Charge", "Reduced Sigma per Charge");
 
-    disp1.SetCamContent(*cam, 0);
-    disp1.SetCamError(*cam,1);
-
-    disp3.SetCamContent(*cam, 2);
-    disp3.SetCamError(*cam,3);
-
-    disp5.SetCamContent(*cam, 4);
-
-    disp6.SetCamContent(*cam, 5);
-    disp6.SetCamError(*cam, 6);
-    disp7.SetCamContent(*cam, 6);
-    disp8.SetCamContent(*cam, 7);
-
-    disp9.SetCamContent(*cam, 8);
-    disp9.SetCamError(*cam, 9);
-
-    disp10.SetCamContent(*cam, 9);
-    disp11.SetCamContent(*cam, 10);
-
-    disp12.SetCamContent(*cam, 11);
-    disp12.SetCamError(*cam, 12);
-
-    disp13.SetCamContent(*cam, 13);
-    disp13.SetCamError(*cam, 14);
-
-    disp14.SetCamContent(*cam, 15);
-    disp15.SetCamContent(*cam, 16);
-    disp16.SetCamContent(*cam, 17);
+    disp1.SetCamContent(calcam, 0);
+    disp1.SetCamError(calcam,1);
+
+    disp3.SetCamContent(calcam, 2);
+    disp3.SetCamError(calcam,3);
+
+    disp5.SetCamContent(calcam, 4);
+
+    disp6.SetCamContent(calcam, 5);
+    disp6.SetCamError(calcam, 6);
+    disp7.SetCamContent(calcam, 6);
+    disp8.SetCamContent(calcam, 7);
+
+    disp9.SetCamContent(calcam, 8);
+    disp9.SetCamError(calcam, 9);
+
+    disp10.SetCamContent(calcam, 9);
+    disp11.SetCamContent(calcam, 10);
+
+    disp12.SetCamContent(calcam, 11);
+    disp12.SetCamError(calcam, 12);
+
+    disp13.SetCamContent(calcam, 13);
+    disp13.SetCamError(calcam, 14);
+
+    disp14.SetCamContent(calcam, 15);
+    disp15.SetCamContent(calcam, 16);
+    disp16.SetCamContent(calcam, 17);
 
 
@@ -239,6 +258,6 @@
     c1.Divide(2,3);
 
-    CamDraw(c1,disp1,cam,1,2,1);
-    CamDraw(c1,disp3,cam,2,2,2);
+    CamDraw(c1,disp1,&calcam,1,2,1);
+    CamDraw(c1,disp3,&calcam,2,2,2);
 
     // Fit Probability
@@ -246,5 +265,5 @@
     c2.Divide(1,3);
 
-    CamDraw(c2,disp5,cam,1,1,3);
+    CamDraw(c2,disp5,&calcam,1,1,3);
 
     // Times
@@ -252,7 +271,7 @@
     c3.Divide(3,3);
 
-    CamDraw(c3,disp6,cam,1,3,1);
-    CamDraw(c3,disp7,cam,2,3,0);
-    CamDraw(c3,disp8,cam,3,3,0);
+    CamDraw(c3,disp6,&calcam,1,3,1);
+    CamDraw(c3,disp7,&calcam,2,3,0);
+    CamDraw(c3,disp8,&calcam,3,3,0);
 
     // Pedestals
@@ -260,6 +279,6 @@
     c4.Divide(2,3);
 
-    CamDraw(c4,disp9,cam,1,2,0);
-    CamDraw(c4,disp10,cam,2,2,1);
+    CamDraw(c4,disp9,&calcam,1,2,0);
+    CamDraw(c4,disp10,&calcam,2,2,1);
 
     // Reduced Sigmas
@@ -267,6 +286,6 @@
     c5.Divide(2,3);
 
-    CamDraw(c5,disp11,cam,1,2,2);
-    CamDraw(c5,disp16,cam,2,2,2);
+    CamDraw(c5,disp11,&calcam,1,2,2);
+    CamDraw(c5,disp16,&calcam,2,2,2);
 
     // F-Factor Method
@@ -274,6 +293,6 @@
     c6.Divide(2,3);
 
-    CamDraw(c6,disp12,cam,1,2,1);
-    CamDraw(c6,disp13,cam,2,2,1);
+    CamDraw(c6,disp12,&calcam,1,2,1);
+    CamDraw(c6,disp13,&calcam,2,2,2);
 
     // Blind Pixel Method
@@ -281,6 +300,6 @@
     c7.Divide(2, 3);
 
-    CamDraw(c7,disp14,cam,1,2,9);
-    CamDraw(c7,disp15,cam,2,2,1);
+    CamDraw(c7,disp14,&calcam,1,2,9);
+    CamDraw(c7,disp15,&calcam,2,2,2);
 
 }
@@ -301,9 +320,4 @@
   c.cd(i+2*j);
   gPad->SetBorderMode(0);
-  Float_t he = gStyle->GetStatH();
-  Float_t wi = gStyle->GetStatH();
-  gStyle->SetStatH(0.4);
-  gStyle->SetStatW(0.25);
-    
   TH1D *obj2 = (TH1D*)obj1->Projection();
   obj2->Draw();
@@ -317,8 +331,12 @@
   const Double_t width = max-min;
   
+  if (rms == 0. || width == 0. )
+    return;
+
   switch (fit)
     {
     case 0:
       TF1 *sgaus = new TF1("sgaus","gaus(0)",min,max);
+      sgaus->SetBit(kCanDelete);
       sgaus->SetParNames("Area","#mu","#sigma");
       sgaus->SetParameters(integ/rms,mean,rms);
@@ -332,4 +350,5 @@
     case 1:
       TF1 *dgaus = new TF1("dgaus","gaus(0)+gaus(3)",min,max);
+      dgaus->SetBit(kCanDelete);
       dgaus->SetParNames("A1","#mu1","#sigma1","A2","#mu2","#sigma2");
       dgaus->SetParameters(integ/width,max-width/6.,width/4.,
@@ -347,4 +366,5 @@
     case 2:
       TF1 *tgaus = new TF1("tgaus","gaus(0)+gaus(3)+gaus(6)",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.,
@@ -375,6 +395,3 @@
     }
   
-  gStyle->SetStatH(he);      
-  gStyle->SetStatW(wi);
-
 }
