Index: trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 5531)
+++ trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 5533)
@@ -339,33 +339,16 @@
     //
     if (fDisplayType != kDataCheckDisplay && fExtractType != kUseHists && !fExtractorResolution)
-    {
-      TCanvas &c3 = fDisplay->AddTab("Pedestals");
-      c3.Divide(2,3);
-
-      disp0.CamDraw(c3, 1, 2, 1);
-      disp1.CamDraw(c3, 2, 2, 6);
-      return;
-    }
-
-    if (fExtractorResolution)
       {
-
-        TCanvas &c3 = fDisplay->AddTab("Extr.Res.");
+        TCanvas &c3 = fDisplay->AddTab("Pedestals");
         c3.Divide(2,3);
         
         disp0.CamDraw(c3, 1, 2, 1);
         disp1.CamDraw(c3, 2, 2, 6);
-
-        TCanvas &c13 = fDisplay->AddTab("Diff.(Extr.-Pedestal)");
-        c13.Divide(2,3);
-        
-        disp9.CamDraw(c13, 1, 2, 5);
-        disp10.CamDraw(c13, 2, 2, 5);
         return;
       }
-
+    
     if (fExtractType == kUseHists)
       {
-
+        
         TCanvas &c3 = fDisplay->AddTab("Extractor Hist.");
         c3.Divide(2,3);
@@ -395,155 +378,177 @@
       }
 
-    TCanvas &c3 = fDisplay->AddTab(fExtractorResolution ? "Extr.Res." : "Pedestals");
-    c3.Divide(2,3);
-
-    c3.cd(1);
-    gPad->SetBorderMode(0);
-    gPad->SetTicks();
-    MHCamera *obj1=(MHCamera*)disp0.DrawCopy("hist");
-    //
-    // for the datacheck, fix the ranges!!
-    //
-    obj1->SetMinimum(fgPedestalMin);
-    obj1->SetMaximum(fgPedestalMax);
-
-    //
-    // Set the datacheck sizes:
-    //
-    FixDataCheckHist((TH1D*)obj1);
-    //
-    // set reference lines
-    //
-    DisplayReferenceLines(obj1,0);
-
-    //
-    // end reference lines
-    //
-    c3.cd(3);
-    gPad->SetBorderMode(0);
-    obj1->SetPrettyPalette();
-    obj1->Draw();
-
-    c3.cd(5);
-    gPad->SetBorderMode(0);
-    gPad->SetTicks();
-    TH1D *obj2 = (TH1D*)obj1->Projection(obj1->GetName());
-    obj2->Draw();
-    obj2->SetBit(kCanDelete);
-    obj2->Fit("gaus","Q");
-    obj2->GetFunction("gaus")->SetLineColor(kYellow);
-    //
-    // Set the datacheck sizes:
-    //
-    FixDataCheckHist(obj2);
-    obj2->SetStats(1);
-
-    c3.cd(2);
-    gPad->SetBorderMode(0);
-    gPad->SetTicks();
-    MHCamera *obj3=(MHCamera*)disp1.DrawCopy("hist");
-    //
-    // for the datacheck, fix the ranges!!
-    //
-    obj3->SetMinimum(fgPedRmsMin);
-    obj3->SetMaximum(fgPedRmsMax);
-    //
-    // Set the datacheck sizes:
-    //
-    FixDataCheckHist((TH1D*)obj3);
-    //
-    // set reference lines
-    //
-    DisplayReferenceLines(obj1,1);
-
-    c3.cd(4);
-    gPad->SetBorderMode(0);
-    obj3->SetPrettyPalette();
-    obj3->Draw();
-
-    c3.cd(6);
-    gPad->SetBorderMode(0);
-
-    if (geomcam.InheritsFrom("MGeomCamMagic"))
-    {
-        TArrayI inner(1);
-        inner[0] = 0;
-
-        TArrayI outer(1);
-        outer[0] = 1;
-
-        TArrayI s0(6);
-        s0[0] = 6;
-        s0[1] = 1;
-        s0[2] = 2;
-        s0[3] = 3;
-        s0[4] = 4;
-        s0[5] = 5;
-
-        TArrayI s1(3);
-        s1[0] = 6;
-        s1[1] = 1;
-        s1[2] = 2;
-
-        TArrayI s2(3);
-        s2[0] = 3;
-        s2[1] = 4;
-        s2[2] = 5;
-
-        TVirtualPad *pad = gPad;
-        pad->Divide(2,1);
-
-        TH1D *inout[2];
-        inout[0] = disp1.ProjectionS(s0, inner, "Inner");
-        inout[1] = disp1.ProjectionS(s0, outer, "Outer");
-        FixDataCheckHist(inout[0]);
-        FixDataCheckHist(inout[1]);
-
-        inout[0]->SetTitle(Form("%s %s",disp1.GetTitle(),"Inner"));
-        inout[1]->SetTitle(Form("%s %s",disp1.GetTitle(),"Outer"));
-        
-
-        for (int i=0; i<2; i++)
-        {
-            pad->cd(i+1);
-            gPad->SetBorderMode(0);
-            gPad->SetTicks();
-
-            inout[i]->SetDirectory(NULL);
-            inout[i]->SetLineColor(kRed+i);
-            inout[i]->SetBit(kCanDelete);
-            inout[i]->Draw();
-            inout[i]->Fit("gaus", "Q");
-
-            TLegend *leg2 = new TLegend(0.6,0.2,0.9,0.55);
-            leg2->SetHeader(inout[i]->GetName());
-            leg2->AddEntry(inout[i], inout[i]->GetName(), "l");
-
+    if (fDisplayType == kDataCheckDisplay)
+      {
+
+        TCanvas &c3 = fDisplay->AddTab(fExtractorResolution ? "Extr.Res." : "Pedestals");
+        c3.Divide(2,3);
+        
+        c3.cd(1);
+        gPad->SetBorderMode(0);
+        gPad->SetTicks();
+        MHCamera *obj1=(MHCamera*)disp0.DrawCopy("hist");
+        //
+        // for the datacheck, fix the ranges!!
+        //
+        if (!fExtractorResolution)
+          {
+            obj1->SetMinimum(fgPedestalMin);
+            obj1->SetMaximum(fgPedestalMax);
             //
-            // Display the outliers as dead and noisy pixels
+            // Set the datacheck sizes:
             //
-            DisplayOutliers(inout[i]);
-
+            FixDataCheckHist((TH1D*)obj1);
             //
-            // Display the two half of the camera separately
+            // set reference lines
             //
-            TH1D *half[2];
-            half[0] = disp1.ProjectionS(s1, i==0 ? inner : outer , "Sector 6-1-2");
-            half[1] = disp1.ProjectionS(s2, i==0 ? inner : outer , "Sector 3-4-5");
-
-            for (int j=0; j<2; j++)
-            {
-                half[j]->SetLineColor(kRed+i+2*j+1);
-                half[j]->SetDirectory(NULL);
-                half[j]->SetBit(kCanDelete);
-                half[j]->Draw("same");
-                leg2->AddEntry(half[j], half[j]->GetName(), "l");
-            }
-            leg2->Draw();
-            delete leg2;
-        }
-
-    }
-
+            DisplayReferenceLines(obj1,0);
+          }
+        
+        //
+        // end reference lines
+        //
+        c3.cd(3);
+        gPad->SetBorderMode(0);
+        obj1->SetPrettyPalette();
+        obj1->Draw();
+        
+        c3.cd(5);
+        gPad->SetBorderMode(0);
+        gPad->SetTicks();
+        TH1D *obj2 = (TH1D*)obj1->Projection(obj1->GetName());
+        obj2->Draw();
+        obj2->SetBit(kCanDelete);
+        obj2->Fit("gaus","Q");
+        obj2->GetFunction("gaus")->SetLineColor(kYellow);
+        //
+        // Set the datacheck sizes:
+        //
+        FixDataCheckHist(obj2);
+        obj2->SetStats(1);
+        
+        c3.cd(2);
+        gPad->SetBorderMode(0);
+        gPad->SetTicks();
+        MHCamera *obj3=(MHCamera*)disp1.DrawCopy("hist");
+        //
+        // for the datacheck, fix the ranges!!
+        //
+        obj3->SetMinimum(fgPedRmsMin);
+        obj3->SetMaximum(fgPedRmsMax);
+        //
+        // Set the datacheck sizes:
+        //
+        FixDataCheckHist((TH1D*)obj3);
+        //
+        // set reference lines
+        //
+        DisplayReferenceLines(obj3,1);
+        
+        c3.cd(4);
+        gPad->SetBorderMode(0);
+        obj3->SetPrettyPalette();
+        obj3->Draw();
+
+        c3.cd(6);
+        gPad->SetBorderMode(0);
+        
+        if (geomcam.InheritsFrom("MGeomCamMagic"))
+          {
+            TArrayI inner(1);
+            inner[0] = 0;
+
+            TArrayI outer(1);
+            outer[0] = 1;
+            
+            TArrayI s0(6);
+            s0[0] = 6;
+            s0[1] = 1;
+            s0[2] = 2;
+            s0[3] = 3;
+            s0[4] = 4;
+            s0[5] = 5;
+            
+            TArrayI s1(3);
+            s1[0] = 6;
+            s1[1] = 1;
+            s1[2] = 2;
+            
+            TArrayI s2(3);
+            s2[0] = 3;
+            s2[1] = 4;
+            s2[2] = 5;
+            
+            TVirtualPad *pad = gPad;
+            pad->Divide(2,1);
+            
+            TH1D *inout[2];
+            inout[0] = disp1.ProjectionS(s0, inner, "Inner");
+            inout[1] = disp1.ProjectionS(s0, outer, "Outer");
+            FixDataCheckHist(inout[0]);
+            FixDataCheckHist(inout[1]);
+            
+            inout[0]->SetTitle(Form("%s %s",disp1.GetTitle(),"Inner"));
+            inout[1]->SetTitle(Form("%s %s",disp1.GetTitle(),"Outer"));
+            
+            
+            for (int i=0; i<2; i++)
+              {
+                pad->cd(i+1);
+                gPad->SetBorderMode(0);
+                gPad->SetTicks();
+                
+                inout[i]->SetDirectory(NULL);
+                inout[i]->SetLineColor(kRed+i);
+                inout[i]->SetBit(kCanDelete);
+                inout[i]->Draw();
+                inout[i]->Fit("gaus", "Q");
+                
+                TLegend *leg2 = new TLegend(0.6,0.2,0.9,0.55);
+                leg2->SetHeader(inout[i]->GetName());
+                leg2->AddEntry(inout[i], inout[i]->GetName(), "l");
+                
+                //
+                // Display the outliers as dead and noisy pixels
+                //
+                DisplayOutliers(inout[i]);
+                
+                //
+                // Display the two half of the camera separately
+                //
+                TH1D *half[2];
+                half[0] = disp1.ProjectionS(s1, i==0 ? inner : outer , "Sector 6-1-2");
+                half[1] = disp1.ProjectionS(s2, i==0 ? inner : outer , "Sector 3-4-5");
+                
+                for (int j=0; j<2; j++)
+                  {
+                    half[j]->SetLineColor(kRed+i+2*j+1);
+                    half[j]->SetDirectory(NULL);
+                    half[j]->SetBit(kCanDelete);
+                    half[j]->Draw("same");
+                    leg2->AddEntry(half[j], half[j]->GetName(), "l");
+                  }
+                leg2->Draw();
+                delete leg2;
+              }
+            return;
+          }
+
+        if (fExtractorResolution)
+          {
+            
+            TCanvas &c3 = fDisplay->AddTab("Extr.Res.");
+            c3.Divide(2,3);
+            
+            disp0.CamDraw(c3, 1, 2, 1);
+            disp1.CamDraw(c3, 2, 2, 6);
+            
+            TCanvas &c13 = fDisplay->AddTab("Diff.(Extr.-Pedestal)");
+            c13.Divide(2,3);
+            
+            disp9.CamDraw(c13, 1, 2, 5);
+            disp10.CamDraw(c13, 2, 2, 5);
+            return;
+          }
+      }
 }
 
@@ -551,4 +556,5 @@
 void  MJPedestal::DisplayReferenceLines(MHCamera *cam, const Int_t what) const
 {
+
   Double_t x = cam->GetNbinsX();
   
@@ -599,5 +605,4 @@
   leg->AddEntry(l3, "Closed Lids","l");
   leg->Draw();
-  delete leg;
 }
 
