Index: trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 7005)
+++ trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 7013)
@@ -222,9 +222,9 @@
   fTimeResolutionMin         =  0.;
   fTimeResolutionMax         =  1.;
-  
-  fRefConvFADC2PheInner      = 0.14;       
-  fRefConvFADC2PheOuter      = 0.4;       
-  fRefConvFADC2PhotInner     = 0.8; 
-  fRefConvFADC2PhotOuter     = 3.8; 
+
+  fRefFADC2PheInner          = 0.14;
+  fRefFADC2PheOuter          = 0.4;
+  fRefConvFADC2PheInner      = 0.14;
+  fRefConvFADC2PheOuter      = 0.52;
   fRefQEInner                = 0.18;            
   fRefQEOuter                = 0.12;
@@ -330,5 +330,5 @@
     MHCamera disp4 (geomcam, "RSigmaPerCharge",   "Reduced Sigma per Charge");
     MHCamera disp5 (geomcam, "NumPhes",           "Number Photo-electrons");
-    MHCamera disp6 (geomcam, "ConvFADC2Phes",     "Phes per Charge (before flat-field)");
+    MHCamera disp6 (geomcam, "ConvFADC2Phes",     "Phes per Charge (Before Flat-Field)");
     MHCamera disp7 (geomcam, "TotalFFactor",      "Total F-Factor(F-Factor Method)");
     MHCamera disp8 (geomcam, "CascadesQEFFactor", "Cascades QE (F-Factor Method)");
@@ -336,18 +336,18 @@
     MHCamera disp10(geomcam, "CascadesQEPINDiode","Cascades QE (PIN Diode Method)");
     MHCamera disp11(geomcam, "CascadesQECombined","Cascades QE (Combined Method)");
-    MHCamera disp12(geomcam, "FFactorValid",      "Pixels with valid F-Factor calibration");
-    MHCamera disp13(geomcam, "BlindPixelValid",   "Pixels with valid BlindPixel calibration");
-    MHCamera disp14(geomcam, "PINdiodeValid",     "Pixels with valid PINDiode calibration");
-    MHCamera disp15(geomcam, "CombinedValid",     "Pixels with valid Combined calibration");
-    MHCamera disp16(geomcam, "Saturation",        "Pixels with saturated Hi Gain");
+    MHCamera disp12(geomcam, "FFactorValid",      "Pixels with Valid F-Factor Calibration");
+    MHCamera disp13(geomcam, "BlindPixelValid",   "Pixels with valid BlindPixel Calibration");
+    MHCamera disp14(geomcam, "PINdiodeValid",     "Pixels with Valid PINDiode Calibration");
+    MHCamera disp15(geomcam, "CombinedValid",     "Pixels with Valid Combined Calibration");
+    MHCamera disp16(geomcam, "Saturation",        "Pixels with Saturated Hi Gain");
     MHCamera disp17(geomcam, "ConversionMeans",   "Conversion HiGain.vs.LoGain Means");
     MHCamera disp18(geomcam, "ConversionSigmas",  "Conversion HiGain.vs.LoGain Sigmas");
-    MHCamera disp19(geomcam, "HiGainPickup",      "Number Pickup events Hi Gain");
-    MHCamera disp20(geomcam, "LoGainPickup",      "Number Pickup events Lo Gain");
-    MHCamera disp21(geomcam, "HiGainBlackout",    "Number Blackout events Hi Gain");
-    MHCamera disp22(geomcam, "LoGainBlackout",    "Number Blackout events Lo Gain");
-    MHCamera disp23(geomcam, "Excluded",          "Pixels previously excluded");
-    MHCamera disp24(geomcam, "UnSuitable",        "Pixels not suited for further analysis");
-    MHCamera disp25(geomcam, "UnReliable",        "Pixels suitable, but not reliable for further analysis");
+    MHCamera disp19(geomcam, "HiGainPickup",      "Number Pickup Events Hi Gain");
+    MHCamera disp20(geomcam, "LoGainPickup",      "Number Pickup Events Lo Gain");
+    MHCamera disp21(geomcam, "HiGainBlackout",    "Number Blackout Events Hi Gain");
+    MHCamera disp22(geomcam, "LoGainBlackout",    "Number Blackout Events Lo Gain");
+    MHCamera disp23(geomcam, "Excluded",          "Pixels Previously Excluded");
+    MHCamera disp24(geomcam, "UnSuitable",        "Pixels NOT Suited for Further Analysis");
+    MHCamera disp25(geomcam, "UnReliable",        "Pixels Suitable, but NOT Reliable for Further Analysis");
     MHCamera disp26(geomcam, "HiGainOscillating", "Oscillating Pixels High Gain");
     MHCamera disp27(geomcam, "LoGainOscillating", "Oscillating Pixels Low Gain");
@@ -357,8 +357,9 @@
     MHCamera disp31(geomcam, "SigmaTime",         "Sigma Rel. Arrival Times");
     MHCamera disp32(geomcam, "TimeProb",          "Probability of Time Fit");
-    MHCamera disp33(geomcam, "TimeNotFitValid",   "Pixels with not valid fit results");
+    MHCamera disp33(geomcam, "TimeNotFitValid",   "Pixels with not valid Fit Results");
     MHCamera disp34(geomcam, "TimeOscillating",   "Oscillating Pixels");
-    MHCamera disp35(geomcam, "TotalConv",         "Conversion Factor to photons");
+    MHCamera disp35(geomcam, "TotalConv",         "Conversion Factor to Photons");
     MHCamera disp36(geomcam, "RMSperMean",        "Charge histogram RMS per Mean");
+    MHCamera disp37(geomcam, "TotalConvPhe",      "Conversion Factor to equiv. Phe's");
     
     MCalibrationChargeCam  *cam    = NULL;
@@ -447,4 +448,5 @@
     // RMS and Mean
     disp36.SetCamContent(*cam,32);
+    disp36.SetCamError(*cam,33);
 
     disp1.SetYTitle("Q [FADC cnts]");
@@ -484,8 +486,7 @@
     disp28.SetYTitle("Mean Abs. Time [FADC sl.]");
     disp29.SetYTitle("RMS Abs. Time [FADC sl.]");
-
     disp35.SetYTitle("Conv.Factor [Ph/FADC cnts]");
-
     disp36.SetYTitle("Charge RMS/<Q> [1]");
+    disp37.SetYTitle("Conv.Factor [Phe/FADC cnts]");
 
     for (UInt_t i=0;i<geomcam.GetNumPixels();i++)
@@ -503,4 +504,7 @@
         disp35.Fill(i,convphe/quaeff);
         disp35.SetUsed(i);
+
+        disp37.Fill(i,convphe/quaeff*MCalibrationQEPix::gkDefaultAverageQE);
+        disp37.SetUsed(i);
       }
     
@@ -733,10 +737,10 @@
       gPad->SetBorderMode(0);
       gPad->SetTicks();
-      MHCamera *obj7=(MHCamera*)disp35.DrawCopy("hist");
+      MHCamera *obj7=(MHCamera*)disp37.DrawCopy("hist");
       //
       // for the datacheck, fix the ranges!!
       //
-      obj7->SetMinimum(fConvFADC2PhotMin);
-      obj7->SetMaximum(fConvFADC2PhotMax);
+      obj7->SetMinimum(fConvFADC2PheMin);
+      obj7->SetMaximum(fConvFADC2PheMax);
       //
       // Set the datacheck sizes:
@@ -855,5 +859,5 @@
       pave->SetTextSize(0.05);
       pave->AddText("  ");
-      TText *t1 = pave->AddText(Form("Signal smaller 3 Pedestal RMS:                 %3i pixels",
+      TText *t1 = pave->AddText(Form("Signal smaller 4.5 Pedestal RMS:                 %3i pixels",
                                        CountBadPixels(&disp24,1)));
       t1->SetTextColor(gStyle->GetColorPalette(Int_t(1./max*numcol + 1.)));
@@ -887,8 +891,16 @@
       t11->SetTextColor(gStyle->GetColorPalette(Int_t(8./max*numcol + 1.)));
       t11->SetTextAlign(12);
-      TText *t12= pave->AddText(Form("Previously Excluded:                                    %3i pixels",
-                                       CountBadPixels(&disp24,9)));
+      TText *t12= pave->AddText(Form("Presumably dead from Ped. Rms:              %3i pixels",
+                                       CountBadPixels(&disp24,9 )));
       t12->SetTextColor(gStyle->GetColorPalette(Int_t(9./max*numcol + 1.)));
       t12->SetTextAlign(12);
+      TText *t13= pave->AddText(Form("Fluctuating Pulse Arrival Times:                 %3i pixels",
+                                       CountBadPixels(&disp24,10)));
+      t13->SetTextColor(gStyle->GetColorPalette(Int_t(10./max*numcol + 1.)));
+      t13->SetTextAlign(12);
+      TText *t14= pave->AddText(Form("Previously Excluded:                                   %3i pixels",
+                                       CountBadPixels(&disp24,11)));
+      t14->SetTextColor(gStyle->GetColorPalette(Int_t(11./max*numcol + 1.)));
+      t14->SetTextAlign(12);
       pave->Draw();
 
@@ -909,5 +921,5 @@
       // for the datacheck, fix the ranges!!
       //
-      const Double_t max2 = 8.;
+      const Double_t max2 = 9.;
       obj9->SetMinimum(0.);
       obj9->SetMaximum(max2);
@@ -927,5 +939,5 @@
       TText *t3 = pave2->AddText(Form("Signal Sigma smaller Pedestal RMS:      %3i pixels",
                                        CountBadPixels(&disp25,1)));
-      t3->SetTextColor(gStyle->GetColorPalette(Int_t(1./max*numcol + 1.)));
+      t3->SetTextColor(gStyle->GetColorPalette(Int_t(1./max2*numcol + 1.)));
       t3->SetTextAlign(12);
 
@@ -1250,8 +1262,8 @@
       break;
     case  1:
-      l1 = line.DrawLine(0, fRefConvFADC2PhotInner, x, fRefConvFADC2PhotInner);      
+      l1 = line.DrawLine(0, fRefConvFADC2PheInner, x, fRefConvFADC2PheInner);
       break;
     case  2:
-      l1 = line.DrawLine(0, fRefConvFADC2PheInner, x, fRefConvFADC2PheInner );
+      l1 = line.DrawLine(0, fRefFADC2PheInner, x, fRefFADC2PheInner );
       break;
     case  3:
@@ -1281,8 +1293,8 @@
           break;
         case 1:
-          line.DrawLine(x2, fRefConvFADC2PhotOuter, 398, fRefConvFADC2PhotOuter );      
+          line.DrawLine(x2, fRefConvFADC2PheOuter, 398, fRefConvFADC2PheOuter );
           break;
         case 2:
-          line.DrawLine(x2, fRefConvFADC2PheOuter, 398, fRefConvFADC2PheOuter);
+          line.DrawLine(x2, fRefFADC2PheOuter, 398, fRefFADC2PheOuter);
           break;
         case 3:
@@ -1437,8 +1449,10 @@
     fTimeResolutionMax      = refenv.GetValue("TimeResolutionMax",fTimeResolutionMax);
 			     		                        
+    fRefFADC2PheInner       = refenv.GetValue("RefFADC2PheInner",fRefFADC2PheInner);
+    fRefFADC2PheOuter       = refenv.GetValue("RefFADC2PheOuter",fRefFADC2PheOuter);
+    fRefConvFADC2PhotInner  = refenv.GetValue("RefConvFADC2PhotInner",fRefConvFADC2PhotInner);
+    fRefConvFADC2PhotOuter  = refenv.GetValue("RefConvFADC2PhotOuter",fRefConvFADC2PhotOuter);
     fRefConvFADC2PheInner   = refenv.GetValue("RefConvFADC2PheInner",fRefConvFADC2PheInner);
     fRefConvFADC2PheOuter   = refenv.GetValue("RefConvFADC2PheOuter",fRefConvFADC2PheOuter);
-    fRefConvFADC2PhotInner  = refenv.GetValue("RefConvFADC2PhotInner",fRefConvFADC2PhotInner);
-    fRefConvFADC2PhotOuter  = refenv.GetValue("RefConvFADC2PhotOuter",fRefConvFADC2PhotOuter);
     fRefQEInner             = refenv.GetValue("RefQEInner",fRefQEInner);
     fRefQEOuter             = refenv.GetValue("RefQEOuter",fRefQEOuter);
Index: trunk/MagicSoft/Mars/mjobs/MJCalibration.h
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCalibration.h	(revision 7005)
+++ trunk/MagicSoft/Mars/mjobs/MJCalibration.h	(revision 7013)
@@ -79,8 +79,10 @@
   Double_t fTimeResolutionMax;             //! Histogram maximum for time resolutions
   					   
-  Float_t  fRefConvFADC2PheInner;          //! Reference value for the conversion factor to phes - inner
-  Float_t  fRefConvFADC2PheOuter;          //! Reference value for the conversion factor to phes - outer
+  Float_t  fRefFADC2PheInner;              //! Reference value for the ratio phes/charge - inner
+  Float_t  fRefFADC2PheOuter;              //! Reference value for the ratio phes/charge - outer
   Float_t  fRefConvFADC2PhotInner;         //! Reference value for the conversion factor to phs - inner
   Float_t  fRefConvFADC2PhotOuter;         //! Reference value for the conversion factor to phs - outer
+  Float_t  fRefConvFADC2PheInner;          //! Reference value for the conversion factor to phs - inner
+  Float_t  fRefConvFADC2PheOuter;          //! Reference value for the conversion factor to phs - outer
   Float_t  fRefQEInner;                    //! Reference value for the quantum eff. cascades - inner
   Float_t  fRefQEOuter;                    //! Reference value for the quantum eff. cascades - outer
Index: trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 7005)
+++ trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 7013)
@@ -83,4 +83,5 @@
 #include "MRawEvtData.h"
 #include "MGeomApply.h"
+#include "MTriggerPatternDecode.h"
 #include "MBadPixelsMerge.h"
 #include "MFillH.h"
@@ -944,4 +945,5 @@
     // data file will be processed. In any case there are no interleaved
     // calibration events in such data, so this is fine.
+    MTriggerPatternDecode decode;
     MFTriggerPattern fcalib("CalibFilter");
     fcalib.SetDefault(kFALSE);
@@ -950,8 +952,10 @@
 
     if (fIsPulsePosCheck)
-      {
+    {
         fillpul.SetFilter(&fcalib);
+	tlist.AddToList(&decode);
+	tlist.AddToList(&fcalib);
         tlist.AddToList(&fillpul);
-      }
+    }
 
     // ----------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mjobs/MJob.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJob.cc	(revision 7005)
+++ trunk/MagicSoft/Mars/mjobs/MJob.cc	(revision 7013)
@@ -60,5 +60,4 @@
 //
 MJob::MJob(const char *name, const char *title) : fEnv(0), fEnvDebug(0), fOverwrite(kFALSE), fMaxEvents(0)
-  
 {
     fName  = name  ? name  : "MJob";
@@ -300,2 +299,36 @@
     return WriteContainer(cont);
 }
+
+TString MJob::ExpandPath(TString fname)
+{
+    // empty
+    if (fname.IsNull())
+        return fname;
+
+    // Expand path using environment
+    gSystem->ExpandPathName(fname);
+
+    // Absolute path
+    if (fname[0]=='/')
+        return fname;
+
+    // relative path to file and file could be found
+    if (!gSystem->AccessPathName(fname, kFileExists))
+        return fname;
+
+    // Now check gEnv and MARSSYS. gEnv can overwrite MARSSYS
+    TString path(gEnv ? gEnv->GetValue("Mars.Path", "$MARSSYS") : "$MARSSYS");
+
+    // Expand path using environment
+    gSystem->ExpandPathName(path);
+
+    // check if path ends with a slash
+    if (!path.EndsWith("/"))
+        path += "/";
+
+    // compile full qualified path
+    path += fname;
+
+    // return new path
+    return path;
+}
Index: trunk/MagicSoft/Mars/mjobs/MJob.h
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJob.h	(revision 7005)
+++ trunk/MagicSoft/Mars/mjobs/MJob.h	(revision 7013)
@@ -75,4 +75,6 @@
     MStatusDisplay *GetDisplay() { return fDisplay; }
 
+    static TString ExpandPath(TString fname);
+
     ClassDef(MJob, 0) // Bas class for Jobs
 };
Index: trunk/MagicSoft/Mars/mjobs/calibrationref.rc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/calibrationref.rc	(revision 7005)
+++ trunk/MagicSoft/Mars/mjobs/calibrationref.rc	(revision 7013)
@@ -42,8 +42,10 @@
 # Converstion factors:
 #
-RefConvFADC2PheInner:     0.14
-RefConvFADC2PheOuter:     0.4
+RefFADC2PheInner:         0.14
+RefFADC2PheOuter:         0.4
 RefConvFADC2PhotInner:    0.8
 RefConvFADC2PhotOuter:    3.8
+RefConvFADC2PheInner:     0.14
+RefConvFADC2PheOuter:     0.56
 #
 # Quantum Efficiencies:
Index: trunk/MagicSoft/Mars/mjobs/calibrationref_Dec04.rc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/calibrationref_Dec04.rc	(revision 7005)
+++ trunk/MagicSoft/Mars/mjobs/calibrationref_Dec04.rc	(revision 7013)
@@ -42,8 +42,10 @@
 # Converstion factors:
 #
-RefConvFADC2PheInner:     0.3
-RefConvFADC2PheOuter:     0.6
+RefFADC2PheInner:         0.3
+RefFADC2PheOuter:         0.6
 RefConvFADC2PhotInner:    1.7
 RefConvFADC2PhotOuter:    6.55
+RefConvFADC2PheInner:     0.31
+RefConvFADC2PheOuter:     1.26
 #
 # Quantum Efficiencies:
Index: trunk/MagicSoft/Mars/mjobs/calibrationref_Nov04.rc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/calibrationref_Nov04.rc	(revision 7005)
+++ trunk/MagicSoft/Mars/mjobs/calibrationref_Nov04.rc	(revision 7013)
@@ -42,8 +42,10 @@
 # Converstion factors:
 #
-RefConvFADC2PheInner:     0.13
-RefConvFADC2PheOuter:     0.33
+RefFADC2PheInner:         0.13
+RefFADC2PheOuter:         0.33
 RefConvFADC2PhotInner:    0.71.
 RefConvFADC2PhotOuter:    2.8
+RefConvFADC2PheInner:     0.135
+RefConvFADC2PheOuter:     0.53
 #
 # Quantum Efficiencies:
