Index: trunk/MagicSoft/Mars/Makefile
===================================================================
--- trunk/MagicSoft/Mars/Makefile	(revision 8939)
+++ trunk/MagicSoft/Mars/Makefile	(revision 8940)
@@ -109,4 +109,5 @@
 	$(CXX) $(CXXFLAGS) $(SOFLAG) $(OBJS) $(SUBDIRS:=/*.o) $(ROOTGLIBS) -o ${RNDMNAME}
 	mv ${RNDMNAME} $@
+ 	chmod go+r $@
 
 # This is a special workaround to create the shared object (bundle, plugin)
Index: trunk/MagicSoft/Mars/datacenter/macros/fillsignal.C
===================================================================
--- trunk/MagicSoft/Mars/datacenter/macros/fillsignal.C	(revision 8939)
+++ trunk/MagicSoft/Mars/datacenter/macros/fillsignal.C	(revision 8940)
@@ -119,4 +119,5 @@
     }
 
+    MHCamera *cal = (MHCamera*)arr.FindObjectInCanvas("CalPos;avg", "MHCamera", "CalPos");
     MHCamera *pul = (MHCamera*)arr.FindObjectInCanvas("PulsePos;avg", "MHCamera", "PulsePos");
     if (!pul)
@@ -220,4 +221,6 @@
     TString meansiginner =Form("%6.2f", meansigi);
     TString meansigouter =Form("%6.2f", meansigo);
+
+    TString calpos = cal ? Form("%5.1f", cal->GetMean()) : "NULL";
 
     if (pul->GetMean()<0 || pul->GetRMS()<0)
@@ -300,17 +303,14 @@
         Int_t nx = htp->GetNbinsX();
 
-        rateped  = Form("%8.1f", iped <0 ? 0 : htp->Integral(1, nx, iped,  iped)  / nx);
-        rateped2 = Form("%7.2f", iped2<0 ? 0 : htp->Integral(1, nx, iped2, iped2) / nx);
-        ratecal  = Form("%8.1f", ical <0 ? 0 : htp->Integral(1, nx, ical,  ical)  / nx);
-        ratetrig = Form("%8.1f", itrig<0 ? 0 : htp->Integral(1, nx, itrig, itrig) / nx);
-        ratesum  = Form("%8.1f", isum <0 ? 0 : htp->Integral(1, nx, isum,  isum)  / nx);
-        ratenull = Form("%8.1f", inull<0 ? 0 : htp->Integral(1, nx, inull, inull) / nx);
-        ratena   = Form("%7.2f", ina  <0 ? 0 : htp->Integral(1, nx, ina,   ina)   / nx);
+        rateped  = iped <0 ? "NULL" : Form("%8.1f", htp->Integral(1, nx, iped,  iped)  / nx);
+        rateped2 = iped2<0 ? "NULL" : Form("%7.2f", htp->Integral(1, nx, iped2, iped2) / nx);
+        ratecal  = ical <0 ? "NULL" : Form("%8.1f", htp->Integral(1, nx, ical,  ical)  / nx);
+        ratetrig = itrig<0 ? "NULL" : Form("%8.1f", htp->Integral(1, nx, itrig, itrig) / nx);
+        ratesum  = isum <0 ? "NULL" : Form("%8.1f", htp->Integral(1, nx, isum,  isum)  / nx);
+        ratenull = inull<0 ? "NULL" : Form("%8.1f", htp->Integral(1, nx, inull, inull) / nx);
+        ratena   = ina  <0 ? "NULL" : Form("%7.2f", htp->Integral(1, nx, ina,   ina)   / nx);
     }
 
     // *****************************************************
-
-    // *****************************************************
-
 
     cout << "Sequence #" << seq << endl;
@@ -319,6 +319,7 @@
     cout << "  Mean Signal  inner [phe] " << meansiginner  << endl;
     cout << "  Mean Signal  outer [phe] " << meansigouter  << endl;
+    cout << "  Mean extracted  PulsePos " << meanextpulpos << " +- " << rmsextpulpos << endl;
     cout << "  Mean calibrated PulsePos " << meanpulpos    << " +- " << rmspulpos    << endl;
-    cout << "  Mean extracted  PulsePos " << meanextpulpos << " +- " << rmsextpulpos << endl;
+    cout << "  Mean calib pulse pos     " << calpos << endl;
 //    cout << "  Mean ext.HiGain PulsePos " << meanpulhi     << " +- " << rmspulhi     << endl;
 //    cout << "  Mean ext.LoGain PulsePos " << meanpullo     << " +- " << rmspullo     << endl;
@@ -346,4 +347,5 @@
                         " fPulsePosMean=%s,      fPulsePosRms=%s,      "
                         " fPulsePosCheckMean=%s, fPulsePosCheckRms=%s, "
+                        " fPulsePosCalib=%s, "
                         //" fPulsePosHiMean=%s,    fPulsePosHiRms=%s,    "
                         //" fPulsePosLoMean=%s,    fPulsePosLoRms=%s,    "
@@ -360,4 +362,5 @@
                          meanpulpos.Data(),    rmspulpos.Data(),
                          meanextpulpos.Data(), rmsextpulpos.Data(),
+                         calpos.Data(),
                          //meanpulhi.Data(),     rmspulhi.Data(),
                          //meanpullo.Data(),     rmspullo.Data(),
Index: trunk/MagicSoft/Mars/datacenter/macros/fillstar.C
===================================================================
--- trunk/MagicSoft/Mars/datacenter/macros/fillstar.C	(revision 8939)
+++ trunk/MagicSoft/Mars/datacenter/macros/fillstar.C	(revision 8940)
@@ -183,6 +183,6 @@
         return 2;
     }
-    TString maxhum = Form("%5.1f", TMath::MaxElement(g->GetN(), g->GetY()));
-    TString avghum = Form("%5.1f", g->GetMean(2));
+    TString maxhum = g->GetN()>0 ? Form("%5.1f", TMath::MaxElement(g->GetN(), g->GetY())) : "NULL";
+    TString avghum = g->GetN()>0 ? Form("%5.1f", g->GetMean(2)) : "NULL";
 
     g = (TGraph*)arr.FindObjectInCanvas("Temperature", "TGraph", "MHWeather");
@@ -192,5 +192,5 @@
         return 2;
     }
-    TString avgtemp = Form("%5.1f", g->GetMean(2));
+    TString avgtemp = g->GetN()>0 ? Form("%5.1f", g->GetMean(2)) : "NULL";
 
     g = (TGraph*)arr.FindObjectInCanvas("WindSpeed", "TGraph", "MHWeather");
@@ -200,16 +200,16 @@
         return 2;
     }
-    TString avgwind = Form("%5.1f", g->GetMean(2));
+    TString avgwind = g->GetN()>0 ? Form("%5.1f", g->GetMean(2)) : "NULL";
 
     g = (TGraph*)arr.FindObjectInCanvas("Cloudiness", "TGraph", "MHWeather");
     if (!g)
         cout << "WARNING - Reading of Cloudiness failed." << endl;
-    TString avgclouds = g ? Form("%5.1f", g->GetMean(2)) : 0;
-    TString rmsclouds = g ? Form("%5.1f", g->GetRMS(2))  : 0;
+    TString avgclouds = g ? Form("%5.1f", g->GetMean(2)) : "NULL";
+    TString rmsclouds = g ? Form("%5.1f", g->GetRMS(2))  : "NULL";
 
     g = (TGraph*)arr.FindObjectInCanvas("TempSky", "TGraph", "MHWeather");
     if (!g)
         cout << "WARNING - Reading of TempSky failed." << endl;
-    TString avgsky = g ? Form("%5.1f", g->GetMean(2)+200) : 0;
+    TString avgsky = g ? Form("%5.1f", g->GetMean(2)+200) : "NULL";
 
 
@@ -218,8 +218,6 @@
         cout << "WARNING - Reading of NumStars failed." << endl;
 
-    Double_t numstarmed = g ? TMath::Median(g->GetN(), g->GetY()) : -1;
-    TString numstarsmed = Form("%5.1f", numstarmed);
-    Double_t numstarrms = g ? g->GetRMS(2) : -1;
-    TString numstarsrms = Form("%5.1f", numstarrms);
+    TString numstarsmed = g ? Form("%5.1f", TMath::Median(g->GetN(), g->GetY())) : "NULL";
+    TString numstarsrms = g ? Form("%5.1f", g->GetRMS(2)) : "NULL";
 
     g = (TGraph*)arr.FindObjectInCanvas("NumStarsCor", "TGraph", "MHPointing");
@@ -230,6 +228,6 @@
     }
 
-    TString numcorsmed = Form("%5.1f", g ? TMath::Median(g->GetN(), g->GetY()) : -1);
-    TString numcorsrms = Form("%5.1f", g ? g->GetRMS(2) : -1);
+    TString numcorsmed = g ? Form("%5.1f", TMath::Median(g->GetN(), g->GetY())) : "NULL";
+    TString numcorsrms = g ? Form("%5.1f", g->GetRMS(2)) : "NULL";
 
     g = (TGraph*)arr.FindObjectInCanvas("Brightness", "TGraph", "MHPointing");
@@ -240,7 +238,6 @@
     }
 
-    TString skybrightnessmed = Form("%5.1f", g ? TMath::Median(g->GetN(), g->GetY()) : -1);
-    TString skybrightnessrms = Form("%5.1f", g ? g->GetRMS(2) : -1);
-
+    TString skybrightnessmed = g ? Form("%5.1f", TMath::Median(g->GetN(), g->GetY())) : "NULL";
+    TString skybrightnessrms = g ? Form("%5.1f", g->GetRMS(2)) : "NULL";
 
     TString sequence = fname(TRegexp("star[0-9]+[.]root$"));
Index: trunk/MagicSoft/Mars/macros/tutorials/readrfl.C
===================================================================
--- trunk/MagicSoft/Mars/macros/tutorials/readrfl.C	(revision 8939)
+++ trunk/MagicSoft/Mars/macros/tutorials/readrfl.C	(revision 8940)
@@ -53,5 +53,5 @@
 }
 
-void readrfl(int runno=-1, int evtno=-1, const char *fname="Gamma_zbin0_90_7_50700to50704_w0.rfl")
+void readrfl(int runno=-1, int evtno=-1, const char *fname="~msmeyer/MC/MagicSoft/Simulation/Detector/ReflectorII/resultsQi/000302.rfl")
 {
     MParList plist;
@@ -87,4 +87,6 @@
     cout << "Runno: " << runno << "  Eventno: " << evtno << endl;
 
+    runhead.Print();
+
     while (JumpTo(tlist, read, runno, evtno))
     {
@@ -94,5 +96,10 @@
         cout << "Event #" << evthead.GetEvtNumber() << endl;
 
+        evthead.Print();
+
 	display.SetCamContent(event);
+
+        if (display.GetMean()<1e-5)
+            continue;
 
 	gPad->Modified();
Index: trunk/MagicSoft/Mars/mhist/MHEvent.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHEvent.cc	(revision 8939)
+++ trunk/MagicSoft/Mars/mhist/MHEvent.cc	(revision 8940)
@@ -295,7 +295,7 @@
 
     pad->GetPad(2)->cd(1);
-    if (gPad->FindObject(Form("Proj_%p", this)))
-    {
-        TH1 *h=fHist->Projection(Form("Proj_%p", this));
+    if (gPad->FindObject("Proj"))
+    {
+        TH1 *h=fHist->Projection("Proj");
         if (h->GetMaximum()>0)
             gPad->SetLogy();
@@ -303,10 +303,10 @@
 
     pad->GetPad(2)->cd(2);
-    if (gPad->FindObject(Form("ProfR_%p", this)))
-        fHist->RadialProfile(Form("ProfR_%p", this));
+    if (gPad->FindObject("ProfRad"))
+        fHist->RadialProfile("ProfRad");
 
     pad->GetPad(2)->cd(3);
-    if (gPad->FindObject(Form("ProfA_%p", this)))
-        fHist->AzimuthProfile(Form("ProfA_%p", this));
+    if (gPad->FindObject("ProfAz"))
+        fHist->AzimuthProfile("ProfAz");
 }
 
@@ -341,5 +341,5 @@
     gPad->SetBorderMode(0);
 
-    TH1 *h = fHist->Projection(Form("Proj_%p", this), 50);
+    TH1 *h = fHist->Projection("Proj", 50);
     h->SetTitle("Projection");
     h->SetBit(kCanDelete);
@@ -349,5 +349,5 @@
     gPad->SetBorderMode(0);
 
-    h = (TH1*)fHist->RadialProfile(Form("ProfR_%p", this), 20);
+    h = (TH1*)fHist->RadialProfile("ProfRad", 20);
     h->SetTitle("Radial Profile");
     h->SetBit(kCanDelete|TH1::kNoStats);
@@ -356,5 +356,5 @@
     pad->cd(3);
     gPad->SetBorderMode(0);
-    h = (TH1*)fHist->AzimuthProfile(Form("ProfA_%p", this), 30);
+    h = (TH1*)fHist->AzimuthProfile("ProfAz", 30);
     h->SetTitle("Azimuth Profile");
     h->SetBit(kCanDelete|TH1::kNoStats);
Index: trunk/MagicSoft/Mars/mhist/MHWeather.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHWeather.cc	(revision 8939)
+++ trunk/MagicSoft/Mars/mhist/MHWeather.cc	(revision 8940)
@@ -249,4 +249,5 @@
     axis->SetTitleOffset(1.2);
     axis->SetTextColor(col);
+    axis->SetLabelColor(col);
     axis->SetBit(kCanDelete);
     axis->Draw();
@@ -281,5 +282,5 @@
     gPad->SetGridx();
     gPad->SetGridy();
-    fHumidity.Draw("AP");
+     fHumidity.Draw("AP");
     fCloudiness.Draw("P");
     DrawRightAxis("Cloudiness [%]");
@@ -340,6 +341,6 @@
     if (gPad)
     {
-        fTemperature.GetHistogram()->GetYaxis()->SetTitleColor(kRed);
-        //fTempSky.GetHistogram()->GetYaxis()->SetTitleColor(kBlue);
+        fTemperature.GetYaxis()->SetLabelColor(kRed);
+        fTemperature.GetYaxis()->SetTitleColor(kRed);
         UpdateRightAxis(fTemperature); // Primary axis
     }
@@ -348,6 +349,7 @@
     if (gPad)
     {
-        fHumidity.GetHistogram()->GetYaxis()->SetTitleColor(kBlue);
-        fHumidity.GetHistogram()->GetYaxis()->SetTitleOffset(1.2);
+        fHumidity.GetYaxis()->SetLabelColor(kBlue);
+        fHumidity.GetYaxis()->SetTitleColor(kBlue);
+        fHumidity.GetYaxis()->SetTitleOffset(1.2);
         UpdateRightAxis(fHumidity);    // Primary axis
     }
Index: trunk/MagicSoft/Mars/mjobs/MJSpectrum.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJSpectrum.cc	(revision 8939)
+++ trunk/MagicSoft/Mars/mjobs/MJSpectrum.cc	(revision 8940)
@@ -1263,5 +1263,5 @@
             // Don't do this on the original object!
             histsel->SetStats(kFALSE);
-
+          /*
             fLog->Separator("Kolmogorov Test");
             histsel->KolmogorovTest(excess, "DX");
@@ -1272,4 +1272,5 @@
             tex.SetBit(TLatex::kTextNDC);
             tex.DrawLatex(0.75, 0.93, Form("P(\\chi^{2})=%.0f%%", p*100));
+           */
         }
     }
@@ -1388,4 +1389,26 @@
     hist.InitTitle(";Slope;Disp-Dist [\\circ];");
     hist.SetDrawOption("colz profx");
+}
+
+void MJSpectrum::SetupHistEnergyRes(MHn &hist) const
+{
+    hist.AddHist("MEnergyEst.fVal", "(MMcEvt.fEnergy/MEnergyEst.fVal-1)^2", MH3::kProfile);
+    hist.InitName("ResEest;EnergyEst;");
+    hist.InitTitle(";E_{est} [GeV];Resolution (E_{mc}/E_{est}-1)^{2};");
+
+    //hist.AddHist("MMcEvt.fEnergy", "(MEnergyEst.fVal/MMcEvt.fEnergy-1)^2", MH3::kProfile);
+    //hist.InitName("ResEmc;EnergyEst;");
+    //hist.InitTitle(";E_{mc} [GeV];Resolution (E_{est}/E_{mc}-1)^{2};");
+    hist.AddHist("MHillas.fSize", "(MMcEvt.fEnergy/MEnergyEst.fVal-1)^2", MH3::kProfile);
+    hist.InitName("ResSize;Size;");
+    hist.InitTitle(";S [phe];Resolution (E_{mc}/E_{est}-1)^{2};");
+
+    hist.AddHist("MPointingPos.fZd", "(MMcEvt.fEnergy/MEnergyEst.fVal-1)^2", MH3::kProfile);
+    hist.InitName("ResTheta;Theta;");
+    hist.InitTitle(";\\Theta [\\circ];Resolution (E_{mc}/E_{est}-1)^{2};");
+
+    hist.AddHist("MMcEvt.fImpact/100", "(MMcEvt.fEnergy/MEnergyEst.fVal-1)^2", MH3::kProfile);
+    hist.InitName("ResImpact;Impact;");
+    hist.InitTitle(";I [m];Resolution (E_{mc}/E_{est}-1)^{2};");
 }
 
@@ -1533,5 +1556,5 @@
     GetThetaDistribution(htheta, hist);
 
-    // Give the zenoith angle weights to the weighting task
+    // Give the zenith angle weights to the weighting task
     weight.SetWeightsZd(&htheta);
 
@@ -1634,4 +1657,5 @@
     MBinning binsB(51, -1, 1,      "BinningEnergyResidual", "lin");
     MBinning binsD(51, -1, 1,      "BinningResidualDist",   "lin");
+    MBinning binsI(16,  0, 800,    "BinningImpact",         "lin");
 
     plist.AddToList(&binsA);
@@ -1639,4 +1663,5 @@
     plist.AddToList(&binsC);
     plist.AddToList(&binsD);
+    plist.AddToList(&binsI);
 
     MHn heest("Energy", "Energy Residual (lg E_{est} - lg E_{mc})");
@@ -1649,4 +1674,7 @@
     SetupHistEvtDist(henergy);
 
+    MHn heres("EnergyRes");
+    SetupHistEnergyRes(heres);
+
     MFillH fill4b(&heest, "", "FillEnergyResidual");
     fill4b.SetWeight();
@@ -1654,4 +1682,7 @@
     MFillH fill4c(&hdisp, "", "FillDispResidual");
     fill4c.SetWeight();
+
+    MFillH fill4d(&heres, "", "FillEnergyResolution");
+    fill4d.SetWeight();
 
     MFDataPhrase fdisp("Disp.fVal*sign(MHillasSrc.fCosDeltaAlpha)<0", "FilterDisp");
@@ -1745,4 +1776,5 @@
     tlist2.AddToList(&fill4);
     tlist2.AddToList(&fill4b);
+    tlist2.AddToList(&fill4d);
     tlist2.AddToList(&fill5);
     tlist2.AddToList(&fill0a);
@@ -1818,4 +1850,6 @@
         return kTRUE;
 
+    TNamed ganame("ganymed.root", gSystem->BaseName(fPathIn));
+
     // Write the output
     TObjArray cont;
@@ -1826,4 +1860,5 @@
     cont.Add(&area1);
     cont.Add(&hest);
+    cont.Add(&ganame);
 
     if (fDisplay)
Index: trunk/MagicSoft/Mars/mjobs/MJSpectrum.h
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJSpectrum.h	(revision 8939)
+++ trunk/MagicSoft/Mars/mjobs/MJSpectrum.h	(revision 8940)
@@ -43,4 +43,5 @@
     void SetupHistEnergyEst(MHn &hist) const;
     void SetupHistDisp(MHn &hist) const;
+    void SetupHistEnergyRes(MHn &hist) const;
 
     // Read Input
Index: trunk/MagicSoft/Mars/mjobs/MJStar.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJStar.cc	(revision 8939)
+++ trunk/MagicSoft/Mars/mjobs/MJStar.cc	(revision 8940)
@@ -478,4 +478,5 @@
     MFillH fillw2("MHWeather", "MTimePyrometer", "FillPyrometer");
     fillw2.SetBit(MFillH::kDoNotDisplay);
+    fillw2.SetBit(MFillH::kCanSkip);
 
     // instantiate camera histogram containers
