Index: trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 3501)
+++ trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 3524)
@@ -70,4 +70,5 @@
 
 ClassImp(MJCalibration);
+
 using namespace std;
 
@@ -80,127 +81,127 @@
 void MJCalibration::DrawProjection(MHCamera *obj1, Int_t fit) const
 {
-
-  TH1D *obj2 = (TH1D*)obj1->Projection(obj1->GetName());
-  obj2->Draw();
-  obj2->SetBit(kCanDelete);
-  
-  if (obj1->GetGeomCam().InheritsFrom("MGeomCamMagic"))
-    {
-      TArrayI s0(3);
-      s0[0] = 6;
-      s0[1] = 1;
-      s0[2] = 2;
-      
-      TArrayI s1(3);
-      s1[0] = 3;
-      s1[1] = 4;
-      s1[2] = 5;
-      
-      TArrayI inner(1);
-      inner[0] = 0;
-      
-      TArrayI outer(1);
-      outer[0] = 1;
-      
-      // Just to get the right (maximum) binning
-      TH1D *half[4];
-      half[0] = obj1->ProjectionS(s0, inner, "Sector 6-1-2 Inner");
-      half[1] = obj1->ProjectionS(s1, inner, "Sector 3-4-5 Inner");
-      half[2] = obj1->ProjectionS(s0, outer, "Sector 6-1-2 Outer");
-      half[3] = obj1->ProjectionS(s1, outer, "Sector 3-4-5 Outer");
-      
-      for (int i=0; i<4; i++)
+    TH1D *obj2 = (TH1D*)obj1->Projection(obj1->GetName());
+    obj2->SetDirectory(0);
+    obj2->Draw();
+    obj2->SetBit(kCanDelete);
+
+    if (obj1->GetGeomCam().InheritsFrom("MGeomCamMagic"))
+    {
+        TArrayI s0(3);
+        s0[0] = 6;
+        s0[1] = 1;
+        s0[2] = 2;
+
+        TArrayI s1(3);
+        s1[0] = 3;
+        s1[1] = 4;
+        s1[2] = 5;
+
+        TArrayI inner(1);
+        inner[0] = 0;
+
+        TArrayI outer(1);
+        outer[0] = 1;
+
+        // Just to get the right (maximum) binning
+        TH1D *half[4];
+        half[0] = obj1->ProjectionS(s0, inner, "Sector 6-1-2 Inner");
+        half[1] = obj1->ProjectionS(s1, inner, "Sector 3-4-5 Inner");
+        half[2] = obj1->ProjectionS(s0, outer, "Sector 6-1-2 Outer");
+        half[3] = obj1->ProjectionS(s1, outer, "Sector 3-4-5 Outer");
+
+        for (int i=0; i<4; i++)
         {
-          half[i]->SetLineColor(kRed+i);
-          half[i]->SetDirectory(0);
-          half[i]->SetBit(kCanDelete);
-          half[i]->Draw("same");
+            half[i]->SetLineColor(kRed+i);
+            half[i]->SetDirectory(0);
+            half[i]->SetBit(kCanDelete);
+            half[i]->Draw("same");
         }
     }
-  
-  const Double_t min   = obj2->GetBinCenter(obj2->GetXaxis()->GetFirst());
-  const Double_t max   = obj2->GetBinCenter(obj2->GetXaxis()->GetLast());
-  const Double_t integ = obj2->Integral("width")/2.5;
-  const Double_t mean  = obj2->GetMean();
-  const Double_t rms   = obj2->GetRMS();
-  const Double_t width = max-min;
-  
-  const TString dgausformula = "([0]-[3])/[2]*exp(-0.5*(x-[1])*(x-[1])/[2]/[2])"
-                               "+[3]/[5]*exp(-0.5*(x-[4])*(x-[4])/[5]/[5])";
-
-  const TString tgausformula = "([0]-[3]-[6])/[2]*exp(-0.5*(x-[1])*(x-[1])/[2]/[2])"
-                               "+[3]/[5]*exp(-0.5*(x-[4])*(x-[4])/[5]/[5])"
-                               "+[6]/[8]*exp(-0.5*(x-[7])*(x-[7])/[8]/[8])";
-  TF1 *f=0;
-  switch (fit)
+
+    const Double_t min   = obj2->GetBinCenter(obj2->GetXaxis()->GetFirst());
+    const Double_t max   = obj2->GetBinCenter(obj2->GetXaxis()->GetLast());
+    const Double_t integ = obj2->Integral("width")/2.5;
+    const Double_t mean  = obj2->GetMean();
+    const Double_t rms   = obj2->GetRMS();
+    const Double_t width = max-min;
+
+    const TString dgausformula = "([0]-[3])/[2]*exp(-0.5*(x-[1])*(x-[1])/[2]/[2])"
+        "+[3]/[5]*exp(-0.5*(x-[4])*(x-[4])/[5]/[5])";
+
+    const TString tgausformula = "([0]-[3]-[6])/[2]*exp(-0.5*(x-[1])*(x-[1])/[2]/[2])"
+        "+[3]/[5]*exp(-0.5*(x-[4])*(x-[4])/[5]/[5])"
+        "+[6]/[8]*exp(-0.5*(x-[7])*(x-[7])/[8]/[8])";
+    TF1 *f=0;
+    switch (fit)
     {
     case 1:
-      f = new TF1("sgaus", "gaus(0)", min, max);
-      f->SetLineColor(kYellow);
-      f->SetBit(kCanDelete);
-      f->SetParNames("Area", "#mu", "#sigma");
-      f->SetParameters(integ/rms, mean, rms);
-      f->SetParLimits(0, 0,   integ);
-      f->SetParLimits(1, min, max);
-      f->SetParLimits(2, 0,   width/1.5);
-      
-      obj2->Fit(f, "QLR");
-      break;
-      
+        f = new TF1("sgaus", "gaus(0)", min, max);
+        f->SetLineColor(kYellow);
+        f->SetBit(kCanDelete);
+        f->SetParNames("Area", "#mu", "#sigma");
+        f->SetParameters(integ/rms, mean, rms);
+        f->SetParLimits(0, 0,   integ);
+        f->SetParLimits(1, min, max);
+        f->SetParLimits(2, 0,   width/1.5);
+
+        obj2->Fit(f, "QLR");
+        break;
+
     case 2:
-      f = new TF1("dgaus",dgausformula.Data(),min,max);
-      f->SetLineColor(kYellow);
-      f->SetBit(kCanDelete);
-      f->SetParNames("A_{tot}", "#mu1", "#sigma1", "A2", "#mu2", "#sigma2");
-      f->SetParameters(integ,(min+mean)/2.,width/4.,
-                       integ/width/2.,(max+mean)/2.,width/4.);
-      // The left-sided Gauss 
-      f->SetParLimits(0,integ-1.5      , integ+1.5);
-      f->SetParLimits(1,min+(width/10.), mean);
-      f->SetParLimits(2,0              , width/2.);
-      // The right-sided Gauss 
-      f->SetParLimits(3,0   , integ);
-      f->SetParLimits(4,mean, max-(width/10.));
-      f->SetParLimits(5,0   , width/2.);
-      obj2->Fit(f,"QLRM");
-      break;
-      
+        f = new TF1("dgaus",dgausformula.Data(),min,max);
+        f->SetLineColor(kYellow);
+        f->SetBit(kCanDelete);
+        f->SetParNames("A_{tot}", "#mu1", "#sigma1", "A2", "#mu2", "#sigma2");
+        f->SetParameters(integ,(min+mean)/2.,width/4.,
+                         integ/width/2.,(max+mean)/2.,width/4.);
+        // The left-sided Gauss
+        f->SetParLimits(0,integ-1.5      , integ+1.5);
+        f->SetParLimits(1,min+(width/10.), mean);
+        f->SetParLimits(2,0              , width/2.);
+        // The right-sided Gauss
+        f->SetParLimits(3,0   , integ);
+        f->SetParLimits(4,mean, max-(width/10.));
+        f->SetParLimits(5,0   , width/2.);
+        obj2->Fit(f,"QLRM");
+        break;
+
     case 3:
-      f = new TF1("tgaus",tgausformula.Data(),min,max);
-      f->SetLineColor(kYellow);
-      f->SetBit(kCanDelete);
-      f->SetParNames("A_{tot}","#mu_{1}","#sigma_{1}",
-                     "A_{2}","#mu_{2}","#sigma_{2}",
-                     "A_{3}","#mu_{3}","#sigma_{3}");
-      f->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 
-      f->SetParLimits(0,integ-1.5,integ+1.5);
-      f->SetParLimits(1,min+(width/10.),mean);
-      f->SetParLimits(2,width/15.,width/2.);
-      // The right-sided Gauss 
-      f->SetParLimits(3,0.,integ);
-      f->SetParLimits(4,mean,max-(width/10.));
-      f->SetParLimits(5,width/15.,width/2.);
-      // The Gauss describing the outliers
-      f->SetParLimits(6,0.,integ);
-      f->SetParLimits(7,min,max);
-      f->SetParLimits(8,width/4.,width/1.5);
-      obj2->Fit(f,"QLRM");
-      break;
+        f = new TF1("tgaus",tgausformula.Data(),min,max);
+        f->SetLineColor(kYellow);
+        f->SetBit(kCanDelete);
+        f->SetParNames("A_{tot}","#mu_{1}","#sigma_{1}",
+                       "A_{2}","#mu_{2}","#sigma_{2}",
+                       "A_{3}","#mu_{3}","#sigma_{3}");
+        f->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
+        f->SetParLimits(0,integ-1.5,integ+1.5);
+        f->SetParLimits(1,min+(width/10.),mean);
+        f->SetParLimits(2,width/15.,width/2.);
+        // The right-sided Gauss
+        f->SetParLimits(3,0.,integ);
+        f->SetParLimits(4,mean,max-(width/10.));
+        f->SetParLimits(5,width/15.,width/2.);
+        // The Gauss describing the outliers
+        f->SetParLimits(6,0.,integ);
+        f->SetParLimits(7,min,max);
+        f->SetParLimits(8,width/4.,width/1.5);
+        obj2->Fit(f,"QLRM");
+        break;
 
     case 4:
-      obj2->Fit("pol0", "Q");
-      obj2->GetFunction("pol0")->SetLineColor(kYellow);
-      break;
-      
+        obj2->Fit("pol0", "Q");
+        obj2->GetFunction("pol0")->SetLineColor(kYellow);
+        break;
+
     case 9:
-      break;
-        
+        break;
+
     default:
-      obj2->Fit("gaus", "Q");
-      obj2->GetFunction("gaus")->SetLineColor(kYellow);
-      break;
+        obj2->Fit("gaus", "Q");
+        obj2->GetFunction("gaus")->SetLineColor(kYellow);
+        break;
     }
 }
Index: trunk/MagicSoft/Mars/mjobs/MJExtractSignal.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJExtractSignal.cc	(revision 3501)
+++ trunk/MagicSoft/Mars/mjobs/MJExtractSignal.cc	(revision 3524)
@@ -71,148 +71,5 @@
     fTitle = title ? title : "Tool to create a pedestal file (MPedestalCam)";
 }
-/*
-void MJExtractSignal::CamDraw(TCanvas &c, MHCamera &cam1, MCamEvent &note, Int_t i)
-{
-    c.cd(i);
-    gPad->SetBorderMode(0);
-    MHCamera *obj1=(MHCamera*)cam1.DrawCopy("hist");
-    obj1->AddNotify(note);
-
-    c.cd(i+2);
-    gPad->SetBorderMode(0);
-    obj1->Draw();
-
-    c.cd(i+4);
-    gPad->SetBorderMode(0);
-    TH1D *obj2 = (TH1D*)obj1->Projection();
-    obj2->Draw();
-    obj2->SetBit(kCanDelete);
-    obj2->Fit("gaus","Q");
-    obj2->GetFunction("gaus")->SetLineColor(kYellow);
-}
-
-void MJExtractSignal::CamDraw(TCanvas &c, MHCamera &cam1, MHCamera &cam2, MCamEvent &note)
-{
-    c.Divide(2, 3);
-
-    CamDraw(c, cam1, note, 1);
-    CamDraw(c, cam2, note, 2);
-}
-
-void MJExtractSignal::DisplayResult(MParList &plist)
-{
-    if (!fDisplay)
-        return;
-
-    //
-    // Update display
-    //
-    TString title = fDisplay->GetTitle();
-    title += "--  Calibration";
-    title += fRunNumber<0 ? Form("File %s", (const char*)fFileName) : Form("Run #%d", fRunNumber);
-    title += "  --";
-    fDisplay->SetTitle(title);
-
-    //
-    // Get container from list
-    //
-    MGeomCam &geomcam = *(MGeomCam*)plist.FindObject("MGeomCam");
-
-    // Create histograms to display
-    MHCamera disp1 (geomcam, "Cal;Charge",        "Fitted Mean Charges");
-    MHCamera disp3 (geomcam, "Cal;SigmaCharge",   "Sigma of Fitted Charges");
-    MHCamera disp5 (geomcam, "Cal;ChargeProb",    "Probability of Fit");
-    MHCamera disp6 (geomcam, "Cal;Time",          "Arrival Times");
-    MHCamera disp7 (geomcam, "Cal;SigmaTime",     "Sigma of Arrival Times");
-    MHCamera disp8 (geomcam, "Cal;TimeChiSquare", "Chi Square of Time Fit");
-//    MHCamera disp9 (geomcam, "Cal;Ped",           "Pedestals");
-//    MHCamera disp10(geomcam, "Cal;PedRms",        "Pedestal RMS");
-    MHCamera disp11(geomcam, "Cal;RSigma",        "Reduced Sigmas");
-    MHCamera disp12(geomcam, "Cal;PheFFactorMethod",               "Nr. of Phe's (F-Factor Method)");
-    MHCamera disp13(geomcam, "Cal;MeanConversionFFactorMethod",    "Conversion Factor (F-Factor Method)");
-    MHCamera disp14(geomcam, "Cal;MeanPhotInsidePlexiglass",       "Nr. of Photons (Blind Pixel Method)");
-    MHCamera disp15(geomcam, "Cal;MeanConversionBlindPixelMethod", "Conversion Factor (Blind Pixel Method)");
-    MHCamera disp16(geomcam, "Cal;RSigma/Charge",                  "Reduced Sigma per Charge");
-
-    disp1.SetCamContent(fCalibrationCam, 0);
-    disp1.SetCamError(fCalibrationCam, 1);
-
-    disp3.SetCamContent(fCalibrationCam, 2);
-    disp3.SetCamError(fCalibrationCam, 3);
-
-    disp5.SetCamContent(fCalibrationCam, 4);
-
-    disp6.SetCamContent(fCalibrationCam, 5);
-    disp6.SetCamError(fCalibrationCam, 6);
-    disp7.SetCamContent(fCalibrationCam, 6);
-    disp8.SetCamContent(fCalibrationCam, 7);
-    disp11.SetCamContent(fCalibrationCam, 10);
-
-    disp12.SetCamContent(fCalibrationCam, 11);
-    disp12.SetCamError(fCalibrationCam, 12);
-
-    disp13.SetCamContent(fCalibrationCam, 13);
-    disp13.SetCamError(fCalibrationCam, 14);
-
-    disp14.SetCamContent(fCalibrationCam, 15);
-    disp15.SetCamContent(fCalibrationCam, 16);
-    disp16.SetCamContent(fCalibrationCam, 17);
-
-    disp1.SetYTitle("Charge [FADC counts]");
-    disp3.SetYTitle("\\sigma_{Charge} [FADC counts]");
-    disp5.SetYTitle("P_{Charge} [1]");
-    disp6.SetYTitle("Arr. Time [Time Slice Nr.]");
-    disp7.SetYTitle("\\sigma_{Time} [Time Slices]");
-    disp8.SetYTitle("\\chi^{2}_{Time} [1]");
-//    disp9.SetYTitle("Ped [FADC Counts ]");
-//    disp10.SetYTitle("RMS_{Ped} [FADC Counts ]");
-    disp11.SetYTitle("\\sqrt{\\sigma^{2}_{Charge} - RMS^{2}_{Ped}} [FADC Counts]");
-    disp12.SetYTitle("Nr. Photo-Electrons [1]");
-    disp13.SetYTitle("Conversion Factor [PhE/FADC Count]");
-    disp14.SetYTitle("Nr. Photons [1]");
-    disp15.SetYTitle("Conversion Factor [Phot/FADC Count]");
-    disp16.SetYTitle("Reduced Sigma / Charge [1]");
-
-    gStyle->SetOptStat(1111);
-    gStyle->SetOptFit();
-
-    // Display Histograms: Charges
-    CamDraw(fDisplay->AddTab("FitdCharge"), disp1, disp3, fCalibrationCam);
-
-    // Fit Probability
-    TCanvas &c12 = fDisplay->AddTab("Fit Prob.");
-    c12.Divide(1, 3);
-
-    c12.cd(1);
-    gPad->SetBorderMode(0);
-    MHCamera *obj1=(MHCamera*)disp5.DrawCopy("hist");
-    obj1->AddNotify(fCalibrationCam);
-
-    c12.cd(2);
-    gPad->SetBorderMode(0);
-    obj1->Draw();
-    
-    c12.cd(3);
-    gPad->SetBorderMode(0);
-    TH1D *obj2 = (TH1D*)obj1->Projection();
-    obj2->Draw();
-    obj2->SetBit(kCanDelete);
-    obj2->Fit("pol0","Q");
-    obj2->GetFunction("pol0")->SetLineColor(kYellow);
-
-    // Times
-    CamDraw(fDisplay->AddTab("FitdTimes"), disp6, disp8, fCalibrationCam);
-
-    // Pedestals
-    //CamDraw(fDisplay->AddTab("Pedestals"), disp9, disp10, calcam);
-
-    // Reduced Sigmas
-    CamDraw(fDisplay->AddTab("RedSigma"), disp11, disp16, fCalibrationCam);
-
-    // F-Factor Method
-    CamDraw(fDisplay->AddTab("F-Factor"), disp12, disp13, fCalibrationCam);
-
-}
-*/
+
 Bool_t MJExtractSignal::WriteResult()
 {
Index: trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 3501)
+++ trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 3524)
@@ -113,4 +113,5 @@
 {
     TH1D *obj2 = (TH1D*)obj1->Projection(obj1->GetName());
+    obj2->SetDirectory(0);
     obj2->Draw();
     obj2->SetBit(kCanDelete);
@@ -141,13 +142,5 @@
         half[2] = obj1->ProjectionS(s0, outer, "Sector 6-1-2 Outer");
         half[3] = obj1->ProjectionS(s1, outer, "Sector 3-4-5 Outer");
-        /*
-         half[0]->Reset();
-         half[1]->Reset();
-
-         TH1D *dummy = obj1->Projection("Dummy");
-
-         for (int i=1; i<7; i++)
-         half[(i/3)%2]->Add(obj1->ProjectionS(i, "Dummy"));
-         */
+
         for (int i=0; i<4; i++)
         {
@@ -157,6 +150,4 @@
             half[i]->Draw("same");
         }
-
-        //delete dummy;
     }
 
