Index: trunk/MagicSoft/Mars/macros/calibration.C
===================================================================
--- trunk/MagicSoft/Mars/macros/calibration.C	(revision 3141)
+++ trunk/MagicSoft/Mars/macros/calibration.C	(revision 3169)
@@ -39,4 +39,7 @@
 {
 
+    gStyle->SetOptStat(1111);
+    gStyle->SetOptFit();
+
     MStatusDisplay *display = new MStatusDisplay;
     display->SetUpdateTime(3000);
@@ -63,12 +66,15 @@
     MExtractSignal  sigcalc;
     //
-    // We saw that the signal jumps between slices, 
-    // thus set the extraction range as high as possible
+    // Set the extraction range higher:
     //		
-    sigcalc.SetRange(1,14,1,14);
+    //sigcalc.SetRange(1,14,1,14);
 
     MPedCalcPedRun pedcalc;
-//    pedcalc.SetNumHiGainSamples(14);
-    MFillH fill("MPedestalCam", "MExtractedSignalCam");
+
+    //
+    // Additionally to calculating the pedestals, 
+    // you can fill histograms and look at them
+    //
+    MFillH fill("MHPedestalCam", "MExtractedSignalCam");
 
     tlist.AddToList(&read);
@@ -80,6 +86,8 @@
     MGeomCamMagic  geomcam;
     MPedestalCam   pedcam;
+    MHPedestalCam  hpedcam;
     plist.AddToList(&geomcam);
     plist.AddToList(&pedcam);
+    plist.AddToList(&hpedcam);
 
     //
@@ -98,5 +106,8 @@
     tlist.PrintStatistics();
 
-    //    pedcam(17).DrawClone();
+    // 
+    // Look at one specific pixel, after all the histogram manipulations:
+    //
+    // hpedcam[17].DrawClone("fourierevents");
 
     MHCamera dispped0  (geomcam, "Ped;Pedestal",               "Mean per Slice");
@@ -104,4 +115,5 @@
     MHCamera dispped2  (geomcam, "Ped;PedestalRms",            "RMS per Slice");
     MHCamera dispped3  (geomcam, "Ped;PedestalRmsErr",         "RMS Error per Slice");
+
     MHCamera dispped4  (geomcam, "Ped;Mean",                   "Fitted Mean per Slice");
     MHCamera dispped5  (geomcam, "Ped;MeanErr",                "Fitted Error of Mean per Slice");
@@ -110,27 +122,32 @@
     MHCamera dispped8  (geomcam, "Ped;Prob",                   "Probability of Fit");
     MHCamera dispped9  (geomcam, "Ped;DeltaPedestalMean",      "Rel. Diff. Mean per Slice (Calc.-Fitte)");
-    MHCamera dispped11 (geomcam, "Ped;DeltaPedestalMeanError", "Rel. Diff. Mean Error per Slice (Calc.-Fitted)");
-    MHCamera dispped12  (geomcam, "Ped;DeltaRmsSigma", "Rel. Diff. RMS per Slice (Calc.-Fitted)");
-    MHCamera dispped14  (geomcam, "Ped;DeltaRmsSigmaError", "Rel. Diff. RMS Error per Slice (Calc.-Fitted)");
-
-    dispped0.SetCamContent(pedcam, 0);
-    dispped0.SetCamError(pedcam, 1);
-    dispped1.SetCamContent(pedcam, 1);
-    dispped2.SetCamContent(pedcam, 2);
-    dispped2.SetCamError(pedcam,3);
-    dispped3.SetCamContent(pedcam, 3);
-    dispped4.SetCamContent(pedcam, 4);
-    dispped4.SetCamError(pedcam, 5);
-    dispped5.SetCamContent(pedcam, 5);
-    dispped6.SetCamContent(pedcam, 6);
-    dispped6.SetCamError(pedcam, 7);
-    dispped7.SetCamContent(pedcam, 7);
-    dispped8.SetCamContent(pedcam, 8);
-    dispped9.SetCamContent(pedcam, 9);
-    dispped9.SetCamError(pedcam, 10);
-    dispped11.SetCamContent(pedcam, 11);
-    dispped12.SetCamContent(pedcam, 12);
-    dispped12.SetCamError(pedcam, 13);
-    dispped14.SetCamContent(pedcam, 14);
+    MHCamera dispped10 (geomcam, "Ped;DeltaPedestalMeanError", "Rel. Diff. Mean Error per Slice (Calc.-Fitted)");
+    MHCamera dispped11  (geomcam, "Ped;DeltaRmsSigma",         "Rel. Diff. RMS per Slice (Calc.-Fitted)");
+    MHCamera dispped12  (geomcam, "Ped;DeltaRmsSigmaError",    "Rel. Diff. RMS Error per Slice (Calc.-Fitted)");
+    MHCamera dispped13  (geomcam, "Ped;FitOK",                 "Gaus Fit not OK");
+    MHCamera dispped14  (geomcam, "Ped;FourierOK",             "Fourier Analysis not OK");
+
+    dispped0.SetCamContent(  pedcam, 0);
+    dispped0.SetCamError(    pedcam, 1);
+    dispped1.SetCamContent(  pedcam, 1);
+    dispped2.SetCamContent(  pedcam, 2);
+    dispped2.SetCamError(    pedcam, 3);
+    dispped3.SetCamContent(  pedcam, 3);
+
+    dispped4.SetCamContent( hpedcam, 0);
+    dispped4.SetCamError(   hpedcam, 1);
+    dispped5.SetCamContent( hpedcam, 1);
+    dispped6.SetCamContent( hpedcam, 2);
+    dispped6.SetCamError(   hpedcam, 3);
+    dispped7.SetCamContent( hpedcam, 3);
+    dispped8.SetCamContent( hpedcam, 4);
+    dispped9.SetCamContent( hpedcam, 5);
+    dispped9.SetCamError(   hpedcam, 6);
+    dispped10.SetCamContent(hpedcam, 7);
+    dispped11.SetCamContent(hpedcam, 8);
+    dispped11.SetCamError(  hpedcam, 9);
+    dispped12.SetCamContent(hpedcam, 10);
+    dispped13.SetCamContent(hpedcam, 11);
+    dispped14.SetCamContent(hpedcam, 12);
 
     dispped0.SetYTitle("Calc. Pedestal per slice [FADC counts]");
@@ -144,10 +161,9 @@
     dispped8.SetYTitle("Fit Probability [1]");
     dispped9.SetYTitle("Rel. Diff. Pedestal Calc.-Fitted per slice [1]");
-    dispped11.SetYTitle("Rel. Diff. Pedestal Error Calc.-Fitted per slice [1]");
-    dispped12.SetYTitle("Rel. Diff. Pedestal RMS Calc.-Fitted per slice [1]");
-    dispped14.SetYTitle("Rel. Diff. Pedestal RMS Error Calc.-Fitted per slice [1]");
-
-    gStyle->SetOptStat(1111);
-    gStyle->SetOptFit();
+    dispped10.SetYTitle("Rel. Diff. Pedestal Error Calc.-Fitted per slice [1]");
+    dispped11.SetYTitle("Rel. Diff. Pedestal RMS Calc.-Fitted per slice [1]");
+    dispped12.SetYTitle("Rel. Diff. Pedestal RMS Error Calc.-Fitted per slice [1]");
+    dispped13.SetYTitle("[1]");
+    dispped14.SetYTitle("[1]");
     
     // Histogram values
@@ -155,8 +171,8 @@
     b1.Divide(4,3);
 
-    CamDraw(b1,dispped0,pedcam,1,4,0);
-    CamDraw(b1,dispped1,pedcam,2,4,1);
-    CamDraw(b1,dispped2,pedcam,3,4,1);
-    CamDraw(b1,dispped3,pedcam,4,4,1);
+    CamDraw(b1,dispped0,pedcam,1,4,1);
+    CamDraw(b1,dispped1,pedcam,2,4,2);
+    CamDraw(b1,dispped2,pedcam,3,4,2);
+    CamDraw(b1,dispped3,pedcam,4,4,2);
 
     // Fitted values 
@@ -164,8 +180,8 @@
     b2.Divide(4,3);
 
-    CamDraw(b2,dispped4,pedcam,1,4,0);
-    CamDraw(b2,dispped5,pedcam,2,4,1);
-    CamDraw(b2,dispped6,pedcam,3,4,1);
-    CamDraw(b2,dispped7,pedcam,4,4,1);
+    CamDraw(b2,dispped4,hpedcam,1,4,1);
+    CamDraw(b2,dispped5,hpedcam,2,4,2);
+    CamDraw(b2,dispped6,hpedcam,3,4,2);
+    CamDraw(b2,dispped7,hpedcam,4,4,2);
 
 
@@ -174,5 +190,5 @@
     b3.Divide(1,3);
 
-    CamDraw(b3,dispped8,pedcam,1,1,3);
+    CamDraw(b3,dispped8,hpedcam,1,1,3);
 
     // Differences
@@ -180,9 +196,15 @@
     c4.Divide(4,3);
 
-    CamDraw(c4,dispped9,pedcam,1,4,1);
-    CamDraw(c4,dispped11,pedcam,2,4,1);
-    CamDraw(c4,dispped12,pedcam,3,4,1);
-    CamDraw(c4,dispped14,pedcam,4,4,1);
-
+    CamDraw(c4,dispped9,hpedcam,1,4,1);
+    CamDraw(c4,dispped10,hpedcam,2,4,1);
+    CamDraw(c4,dispped11,hpedcam,3,4,1);
+    CamDraw(c4,dispped12,hpedcam,4,4,1);
+
+    // Defects
+    TCanvas &c5 = display->AddTab("Defects");
+    c5.Divide(2,2);
+
+    CamDraw(c5,dispped13,hpedcam,1,2,0);
+    CamDraw(c5,dispped14,hpedcam,2,2,0);
 
     //
@@ -269,6 +291,5 @@
     //
     MCalibrationBlindPix *bp = calcam.GetBlindPixel();
-//    bp->ChangeFitFunc(MHCalibrationBlindPixel::kEPolya);
-    bp->ChangeFitFunc(MHCalibrationBlindPixel::kEPoisson5);
+    //  bp->ChangeFitFunc(MHCalibrationBlindPixel::kEPoisson5);
 
     // 
@@ -285,5 +306,5 @@
     // of the arrival times using a spline, uncomment the next line
     //
-    //    tlist2.AddToList(&timecalc);
+    // tlist2.AddToList(&timecalc);
     tlist2.AddToList(&cont);
     tlist2.AddToList(&calcalc);
@@ -312,6 +333,6 @@
     // just one example how to get the plots of individual pixels
     //
-    //    calcam[563].DrawClone();
-    //    calcam[564].DrawClone();
+    //  calcam[563].DrawClone();
+    //  calcam[564].DrawClone();
 
     // Create histograms to display
@@ -353,4 +374,5 @@
     disp2.SetCamContent(calcam,  2);
     disp2.SetCamError(  calcam,  3);
+
     // Fit probabilities
     disp3.SetCamContent(calcam,  4);
@@ -547,5 +569,5 @@
   gPad->SetBorderMode(0);
   MHCamera *obj1=(MHCamera*)cam.DrawCopy("hist");
-  obj1->AddNotify(evt);
+  //  obj1->AddNotify(evt);
   
   c.cd(i+j);
