Index: trunk/MagicSoft/Mars/macros/calibration.C
===================================================================
--- trunk/MagicSoft/Mars/macros/calibration.C	(revision 3024)
+++ trunk/MagicSoft/Mars/macros/calibration.C	(revision 3039)
@@ -23,6 +23,10 @@
 \* ======================================================================== */
 
-const TString pedfile = "/mnt/Data/rootdata/CrabNebula/2004_01_27/20040126_12149_P_Cab-On_E.root";
+//const TString pedfile = "/mnt/users/mdoro/Mars/Data/20040201_14418_P_OffMrk421-1_E.root";
+//const TString calfile = "/mnt/users/mdoro/Mars/Data/20040201_1441*_C_OffMrk421-1_E.root";
+
+const TString pedfile = "/mnt/Data/rootdata/CrabNebula/2004_01_27/20040126_12386_P_Cab-On_E.root";
 const TString calfile = "/mnt/Data/rootdata/CrabNebula/2004_01_27/20040126_12525_C_Cab-On_E.root";
+
 
 //const TString pedfile = "/mnt/Data/rootdata/Miscellaneous/2003_12_19/20031218_03522_P_Park_E.root";
@@ -51,14 +55,13 @@
 
     MGeomApply      geomapl;
-    MExtractSignal2 sigcalc;
+    MExtractSignal  sigcalc;
     //
     // We saw that the signal jumps between slices, 
     // thus set the extraction range as high as possible
-    // Sliding window will be implemented asap.
     //		
-    //    sigcalc.SetRange(1,14,1,14);
+    sigcalc.SetRange(1,14,1,14);
 
     MPedCalcPedRun pedcalc;
-    //    MFillH fill("MPedestalCam", "MExtractedSignalCam");
+    MFillH fill("MPedestalCam", "MExtractedSignalCam");
 
     tlist.AddToList(&read);
@@ -66,5 +69,5 @@
     tlist.AddToList(&sigcalc);
     tlist.AddToList(&pedcalc);
-    //    tlist.AddToList(&fill);
+    tlist.AddToList(&fill);
 
     MGeomCamMagic  geomcam;
@@ -87,5 +90,5 @@
     tlist.PrintStatistics();
 
-    //    pedcam[17].DrawClone();
+    //    pedcam(17).DrawClone();
 
     MStatusDisplay *d1 = new MStatusDisplay;
@@ -148,7 +151,7 @@
 
     CamDraw(b1,dispped0,pedcam,1,4,0);
-    CamDraw(b1,dispped1,pedcam,2,4,2);
-    CamDraw(b1,dispped2,pedcam,3,4,2);
-    CamDraw(b1,dispped3,pedcam,4,4,2);
+    CamDraw(b1,dispped1,pedcam,2,4,1);
+    CamDraw(b1,dispped2,pedcam,3,4,1);
+    CamDraw(b1,dispped3,pedcam,4,4,1);
 
     // Fitted values 
@@ -158,5 +161,5 @@
     CamDraw(b2,dispped4,pedcam,1,4,0);
     CamDraw(b2,dispped5,pedcam,2,4,1);
-    CamDraw(b2,dispped6,pedcam,3,4,0);
+    CamDraw(b2,dispped6,pedcam,3,4,1);
     CamDraw(b2,dispped7,pedcam,4,4,1);
 
@@ -207,7 +210,16 @@
     read2.DisableAutoScheme();
 
-    //    MExtractSignal       sigcalc;
+    //
+    // We saw that the signal jumps between slices, 
+    // thus take the sliding window
+    //		
+    MExtractSignal2      sigcalc2;
     MArrivalTimeCalc     timecalc;
     MCalibrationCalc     calcalc;
+
+    //
+    // Skip the HiGain vs. LoGain calibration
+    // 
+    calcalc.SkipHiLoGainCalibration();
 
     //
@@ -215,5 +227,5 @@
     // faster results
     // 
-    timecalc.SetStepSize(0.05);
+    //    timecalc.SetStepSize(0.05);
 
     //
@@ -253,8 +265,8 @@
     MCalibrationBlindPix *bp = calcam.GetBlindPixel();
 //    bp->ChangeFitFunc(MHCalibrationBlindPixel::kEPolya);
-    //    bp->ChangeFitFunc(MHCalibrationBlindPixel::kEPoisson4);
+//    bp->ChangeFitFunc(MHCalibrationBlindPixel::kEPoisson4);
 
     tlist2.AddToList(&read2);
-    tlist2.AddToList(&sigcalc);
+    tlist2.AddToList(&sigcalc2);
     //
     // In case, you want to skip the somewhat lengthy calculation
@@ -270,4 +282,7 @@
     evtloop2.SetParList(&plist2);
     
+    MProgressBar bar;
+    evtloop2.SetProgressBar(&bar);
+    
     //
     // Execute second analysis
@@ -286,5 +301,5 @@
     // just one example how to get the plots of individual pixels
     //
-    calcam[17].DrawClone();
+    //    calcam[18].DrawClone();
 
     MHCamera disp1   (geomcam, "MCalibrationPix;Charge", "Fitted Mean Charges");
@@ -441,6 +456,8 @@
   gPad->SetBorderMode(0);
   TH1D *obj2 = (TH1D*)obj1->Projection();
+  
   obj2->Draw();
   obj2->SetBit(kCanDelete);
+
 
   const Double_t min   = obj2->GetBinCenter(obj2->GetXaxis()->GetFirst());
@@ -526,4 +543,19 @@
       break;
     }
-  
+
+  gPad->Modified();
+  gPad->Update();
+
+  /*
+  TPaveStats *st = (TPaveStats*)gPad->GetPrimitive("stats");
+  st->SetName("Projection");
+  st->SetX1NDC(0.7);
+  st->SetX2NDC(1.2);
+  st->SetY1NDC(0.4);
+  st->SetY2NDC(1.2);
+
+  gPad->Modified();
+  gPad->Update();
+
+  */
 }
