Index: trunk/MagicSoft/Mars/macros/calibration.C
===================================================================
--- trunk/MagicSoft/Mars/macros/calibration.C	(revision 2578)
+++ trunk/MagicSoft/Mars/macros/calibration.C	(revision 2581)
@@ -23,6 +23,6 @@
 \* ======================================================================== */
 
-void calibration(TString pedname="./20031102_02399_P_Unavailable_E.root", 
-                 TString calname="./20031102_02400_D_Flip500Hz_E.root")
+void calibration(TString pedname="../../Mars-0.8.2/20031102_02399_P_Unavailable_E.root", 
+                 TString calname="../../Mars-0.8.2/20031102_02400_D_Flip500Hz_E.root")
 {
 
@@ -45,7 +45,6 @@
 
     MGeomApply     geomapl;
+    MPedCalcPedRun pedcalc;
     MGeomCamMagic  geomcam;
-    MGeomCam       geom;
-    MPedCalcPedRun pedcalc;
     MPedestalCam   pedcam;
 
@@ -57,5 +56,5 @@
 
     MHCamEvent hist("Pedestal");
-    hist.SetType(1);
+    hist.SetType(0);
     plist.AddToList(&hist);
     MFillH fill(&hist, "MPedestalCam");
@@ -63,11 +62,8 @@
     tlist.AddToList(&fill);
 
-    //
-    // Update frequency by default = 1Hz
-    //
-    MStatusDisplay *d = new MStatusDisplay;
+    MStatusDisplay *d1 = new MStatusDisplay;
  
     // Set update time to 3s
-    d->SetUpdateTime(3000);
+    d1->SetUpdateTime(3000);
  
     //
@@ -76,5 +72,5 @@
     MEvtLoop evtloop;
     evtloop.SetParList(&plist);
-    evtloop.SetDisplay(d);  	
+    evtloop.SetDisplay(d1);  	
 
     //
@@ -86,4 +82,7 @@
     tlist.PrintStatistics();
 
+    MPedestalCam *ped = plist.FindObject("MPedestalCam");
+    ped.Print();
+
     //
     // Create a empty Parameter List and an empty Task List
@@ -94,7 +93,8 @@
     plist2.AddToList(&tlist2);
 
+
     plist2.AddToList((MPedestalCam*)plist.FindObject("MPedestalCam"));
 
-    MGeomApply geomapl2;
+//    MGeomApply geomapl2;
     tlist2.AddToList(&geomapl);
 
@@ -108,5 +108,5 @@
 
     MCalibrationCalc calcalc;
-    calcalc.SetSkipTFits();
+//    calcalc.SetSkipTFits();
 
     plist2.AddToList(&geomcam);
@@ -114,5 +114,5 @@
     //
     // As long, as we don't have digital modules, 
-    // we have to set the color by hand
+    // we have to set the color of the pulser LED by hand
     //
     calcalc.SetPulserColor(MCalibrationCalc::kEBlue);
@@ -141,6 +141,4 @@
     tlist2.PrintStatistics();
 
- //   plist2.FindObject("MCalibrationCam")->Print();
-
     //
     // just one example how to get the plots of individual pixels
@@ -148,6 +146,12 @@
     MCalibrationCam *cam = plist2.FindObject("MCalibrationCam");
     MCalibrationPix *pix = cam->GetCalibrationPix(523);
-    //pix->Draw();
-
+    pix->Draw();
+
+    //
+    // Here we are confronted to a serious bug in ROOT:
+    // If we do not apply the next command, gPad will get
+    // screwed up completely: (Thanks to tbretz for finding out
+    // the reason during several hours!!!)
+    //
     gROOT->GetListOfCanvases()->Delete();
 
@@ -193,8 +197,10 @@
     disp12.SetYTitle("\\Delta_{Q} [FADC counts]");
 
-//    TText text(0.1, 0.5, &fname[fname.Last('/')+1]);
-//    text.SetTextSize(0.015);
-//    text.DrawClone();
-    TCanvas *c1 = &d->AddTab("Cal1");//MH::MakeDefCanvas("Calibration1","Plots of FADC Charges",700,900);
+    MStatusDisplay *d2 = new MStatusDisplay;
+ 
+    // Set update time to 1s
+    d2->SetUpdateTime(1000);
+
+    TCanvas *c1 = &d2->AddTab("Fitted Charges"); 
     c1->Divide(5, 2);
 
@@ -241,5 +247,5 @@
     obj->Draw();
 
-    TCanvas *c2 = &d->AddTab("Cal2");//MH::MakeDefCanvas("Calibration2","Plots of Arrival Times",700,900);
+    TCanvas *c2 = &d2->AddTab("Fitted Times");
     c2->Divide(3, 2);
 
@@ -265,5 +271,5 @@
     obj->Draw();
 
-    TCanvas *c3 = &d->AddTab("Cal3");//MH::MakeDefCanvas("Calibration3","Plots of Pedestals",700,900);
+    TCanvas *c3 = &d2->AddTab("Pedestals");
     c3->Divide(2, 2);
 
@@ -282,5 +288,5 @@
     obj->Draw();
 
-    TCanvas *c4 = &d->AddTab("Cal4");//MH::MakeDefCanvas("Calibration4","Plots of Reduced Charges",700,900);
+    TCanvas *c4 = &d2->AddTab("Reduced Charges");
     c4->Divide(2, 2);
 
@@ -299,6 +305,5 @@
     obj->Draw();
 
-//    c->SaveAs(fname(0, fname.Last('.')+1) + "ps");
-    //c->SaveAs(fname(0, fname.Last('.')+1) + "root");
+#endif
 
 }
