Index: trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc	(revision 5028)
+++ trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc	(revision 5030)
@@ -54,8 +54,17 @@
 #include "MPedestalCam.h"
 #include "MBadPixelsCam.h"
+
+#include "MCalibrationChargePINDiode.h"
+
 #include "MCalibrationQECam.h"
+#include "MCalibrationBlindCam.h"
 #include "MCalibrationChargeCam.h"
 #include "MCalibrationRelTimeCam.h"
-
+/*
+#include "MCalibrationIntensityQECam.h"
+#include "MCalibrationIntensityBlindCam.h"
+#include "MCalibrationIntensityChargeCam.h"
+#include "MCalibrationIntensityRelTimeCam.h"
+*/
 #include "MReadReports.h"
 #include "MReadMarsFile.h"
@@ -114,11 +123,10 @@
 }
 
-Bool_t MJCalibrateSignal::ReadCalibration(MCalibrationCam &calcam,
-                                          MCalibrationCam &qecam,
-                                          MCalibrationCam &tmcam,
-                                          MBadPixelsCam &badpix, MTask* &ext1, MTask* &ext2, TString &geom) const
+Bool_t MJCalibrateSignal::ReadCalibration(TObjArray &l, MBadPixelsCam &cam, MTask* &ext1, MTask* &ext2, TString &geom) const
 {
     const TString fname = Form("%s/calib%06d.root", fPathIn.Data(), fSequence.GetSequence());
 
+    *fLog << inf << "Reading from file: " << fname << endl;
+
     TFile file(fname, "READ");
     if (!file.IsOpen())
@@ -128,25 +136,4 @@
     }
 
-    if (calcam.Read("MCalibrationChargeCam")<=0)
-    {
-        *fLog << err << dbginf << "ERROR - Unable to read MCalibrationChargeCam from file " << fname << endl;
-        return kFALSE;
-    }
-    if (qecam.Read("MCalibrationQECam")<=0)
-    {
-        *fLog << err << dbginf << "ERROR - Unable to read MCalibrationQECam from file " << fname << endl;
-        return kFALSE;
-    }
-    if (tmcam.Read("MCalibrationRelTimeCam")<=0)
-    {
-        *fLog << err << dbginf << "ERROR - Unable to read MCalibrationRelTimeCam from file " << fname << endl;
-        return kFALSE;
-    }
-    if (badpix.Read("MBadPixelsCam")<=0)
-    {
-        *fLog << err << dbginf << "ERROR - Unable to read MBadPixelsCam from file " << fname << endl;
-        return kFALSE;
-    }
-
     TObject *o = file.Get("ExtractSignal");
     if (o && !o->InheritsFrom(MExtractor::Class()))
@@ -178,5 +165,7 @@
     geom = o ? o->ClassName() : "";
 
-    return kTRUE;
+    TObjArray cont(l);
+    cont.Add(&cam);
+    return ReadContainer(cont);
 }
 
@@ -219,8 +208,16 @@
 
     // Read File
-    MCalibrationChargeCam  calcam;
-    MCalibrationQECam      qecam;
-    MCalibrationRelTimeCam tmcam;
-    MBadPixelsCam          badpix;
+    /*
+     MCalibrationIntensityChargeCam      calcam;
+     MCalibrationIntensityQECam          qecam;
+     MCalibrationIntensityBlindCam       bndcam;
+     MCalibrationIntensityRelTimeCam     tmcam;
+     */
+    MCalibrationChargeCam      calcam;
+    MCalibrationQECam          qecam;
+    MCalibrationBlindCam       bndcam;
+    MCalibrationChargePINDiode pind;
+    MCalibrationRelTimeCam     tmcam;
+    MBadPixelsCam              badpix;
 
     MTask *extractor1=0;
@@ -228,6 +225,15 @@
     TString geom;
 
-    if (!ReadCalibration(calcam, qecam, tmcam, badpix, extractor1, extractor2, geom))
-        return kFALSE;
+    TObjArray calibcont;
+    calibcont.Add(&calcam);
+    calibcont.Add(&qecam);
+    calibcont.Add(&bndcam);
+    calibcont.Add(&pind);
+    calibcont.Add(&tmcam);
+
+    if (!ReadCalibration(calibcont, badpix, extractor1, extractor2, geom))
+        return kFALSE;
+
+    badpix.Print();
 
     *fLog << all;
@@ -261,9 +267,7 @@
     MParList plist;
     plist.AddToList(this); // take care of fDisplay!
-    plist.AddToList(&calcam);
-    plist.AddToList(&qecam);     
-    plist.AddToList(&tmcam);
     plist.AddToList(&badcam);
     plist.AddToList(&pedcam);
+    plist.AddToList(&calibcont);
 
     // Setup Tasklist
Index: trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.h
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.h	(revision 5028)
+++ trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.h	(revision 5030)
@@ -7,4 +7,5 @@
 
 class TEnv;
+class TList;
 
 class MTask;
@@ -14,8 +15,4 @@
 class MPedestalCam;
 class MBadPixelsCam;
-class MCalibrationCam;
-class MCalibrationQECam;
-class MCalibrationRelTimeCam;
-class MCalibrationChargeCam;
 
 class MJCalibrateSignal : public MJob
@@ -23,8 +20,6 @@
 private:
     Bool_t WriteResult();
-    Bool_t ReadCalibration(MCalibrationCam &calcam,
-                           MCalibrationCam &qecam, MCalibrationCam &tmcam,
-                           MBadPixelsCam &badpix, MTask* &ext1, MTask* &ext2,
-                           TString &geom) const;
+    Bool_t ReadCalibration(TObjArray &o, MBadPixelsCam &bpix,
+                           MTask* &ext1, MTask* &ext2, TString &geom) const;
 
 public:
Index: trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 5028)
+++ trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 5030)
@@ -1453,7 +1453,7 @@
 
     SetRelTimeCalibration(GetEnv("RelTimeCalibration", IsRelTimes()));
+    SetIntensity(GetEnv("IntensityCalibration", IsIntensity()));
     SetDataCheck(GetEnv("Datacheck", IsDataCheck()));
     SetDebug(GetEnv("Debug", IsDebug()));
-    SetIntensity(GetEnv("Intensity", IsIntensity()));
 
     SetUseBlindPixel(GetEnv("UseBlindPixel", IsUseBlindPixel()));
@@ -1491,5 +1491,4 @@
   if (run < gkSecondBlindPixelInstallation)
     {
-
       MCalibrationBlindCamOneOldStyle blindresults;
       if (IsIntensity())
@@ -1505,5 +1504,4 @@
   else if (run < gkThirdBlindPixelInstallation)
     {
-
       MCalibrationBlindCamTwoNewStyle blindresults;
 
@@ -2031,119 +2029,31 @@
     *fLog << inf << "ok." << endl;
 
+    TObjArray cont;
     if (IsIntensity())
-      {
-        *fLog << inf << " - MBadPixelsIntensityCam..." << flush;
-        if (fIntensBadCam.Write()<=0)
-          {
-            *fLog << err << "Unable to write MBadPixelsIntensityCam to " << oname << endl;
-            return kFALSE;
-          }
-        *fLog << inf << "ok." << endl;
-
-        *fLog << inf << " - MCalibrationIntensityChargeCam..." << flush;
-        if (fIntensCalibCam.Write()<=0)
-          {
-            *fLog << err << "Unable to write MCalibrationIntensityChargeCam to " << oname << endl;
-            return kFALSE;
-          }
-        *fLog << inf << "ok." << endl;
-
-        *fLog << inf << " - MCalibrationIntensityQECam..." << flush;
-        if (fIntensQECam.Write()<=0)
-          {
-            *fLog << err << "Unable to write MCalibrationIntensityQECam to " << oname << endl;
-            return kFALSE;
-          }
-        *fLog << inf << "ok." << endl;
-        *fLog << inf << " - MCalibrationIntensityBlindCam..." << flush;
-        if (fIntensBlindCam.Write()<=0)
-          {
-            *fLog << err << "Unable to write MCalibrationIntensityBlindCam to " << oname << endl;
-            return kFALSE;
-          }
-        *fLog << inf << "ok." << endl;
-      }
+    {
+        cont.Add(&fIntensBadCam);
+        cont.Add(&fIntensCalibCam);
+        cont.Add(&fIntensQECam);
+        cont.Add(&fIntensBlindCam);
+    }
     else
-      {
-        *fLog << inf << " - MCalibrationChargeCam..." << flush;
-        if (fCalibrationCam.Write()<=0)
-          {
-            *fLog << err << "Unable to write MCalibrationChargeCam to " << oname << endl;
-            return kFALSE;
-          }
-        *fLog << inf << "ok." << endl;
-
-        *fLog << inf << " - MCalibrationQECam..." << flush;
-        if (fQECam.Write()<=0)
-          {
-            *fLog << err << "Unable to write MCalibrationQECam to " << oname << endl;
-            return kFALSE;
-          }
-        *fLog << inf << "ok." << endl;
-
-        *fLog << inf << " - MCalibrationBlindCam..." << flush;
-        if (fCalibrationBlindCam.Write()<=0)
-          {
-            *fLog << err << "Unable to write MCalibrationBlindCam to " << oname << endl;
-            return kFALSE;
-          }
-        *fLog << inf << "ok." << endl;
-      }
-    
-    *fLog << inf << " - MCalibrationChargePINDiode..." << flush;
-    if (fCalibrationPINDiode.Write()<=0)
-      {
-        *fLog << err << "Unable to write MCalibrationChargePINDiode to " << oname << endl;
-        return kFALSE;
-    }
-    *fLog << inf << "ok." << endl;
-
-    *fLog << inf << " - MBadPixelsCam..." << flush;
-    if (fBadPixels.Write()<=0)
-    {
-        *fLog << err << "Unable to write MBadPixelsCam to " << oname << endl;
-        return kFALSE;
-    }
-    *fLog << inf << "ok." << endl;
+    {
+        cont.Add(&fCalibrationCam);
+        cont.Add(&fQECam);
+        cont.Add(&fCalibrationBlindCam);
+    }
+    cont.Add(&fCalibrationPINDiode);
+    cont.Add(&fBadPixels);
+    if (IsRelTimes())
+          cont.Add(IsIntensity() ? (TObject*)&fIntensRelTimeCam : (TObject*)&fRelTimeCam);
 
     if (!geom)
-        *fLog << warn << " - WARNING: MGeomCam... not found!" << endl;
-    {
-        *fLog << inf << " - MGeomCam..." << flush;
-        if (geom->Write()<=0)
-        {
-            *fLog << err << "Unable to write MGeomCam to " << oname << endl;
-            return kFALSE;
-        }
-        *fLog << inf << "ok." << endl;
-    }
-
-    if (IsRelTimes())
-    {
-      if (IsIntensity())
-        {
-          *fLog << inf << " - MCalibrationIntensityRelTimeCam..." << flush;
-          if (fIntensRelTimeCam.Write()<=0)
-            {
-              *fLog << err << "Unable to write MCalibrationIntensityRelTimeCam to " << oname << endl;
-              return kFALSE;
-            }
-          *fLog << inf << "ok." << endl;
-        }
-      else
-        {
-          *fLog << inf << " - MCalibrationRelTimeCam..." << flush;
-          if (fRelTimeCam.Write()<=0)
-            {
-              *fLog << err << "Unable to write MCalibrationRelTimeCam to " << oname << endl;
-              return kFALSE;
-            }
-          *fLog << inf << "ok." << endl;
-        }
-      
-    }
+        *fLog << warn << " - WARNING - MGeomCam... not found!" << endl;
+    else
+        cont.Add(geom);
+
+    return WriteContainer(cont);
 
     return kTRUE;
-
 }
 
Index: trunk/MagicSoft/Mars/mjobs/MJob.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJob.cc	(revision 5028)
+++ trunk/MagicSoft/Mars/mjobs/MJob.cc	(revision 5030)
@@ -33,5 +33,8 @@
 
 #include <TEnv.h>
+#include <TFile.h>
 #include <TSystem.h>
+
+#include "MIter.h"
 
 #include "MLog.h"
@@ -169,2 +172,48 @@
     return loop.ReadEnv(*fEnv, fEnvPrefix, fEnvDebug) ? kTRUE : kFALSE;
 }
+
+Bool_t MJob::WriteContainer(TCollection &list) const
+{
+    if (!gFile)
+    {
+        *fLog << err << dbginf << "ERROR - No file open (gFile==0)" << endl;
+        return kFALSE;
+    }
+
+    MIter Next(&list);
+    MParContainer *o=0;
+    while ((o=Next()))
+    {
+        *fLog << inf << " - Writing " << o->GetDescriptor() << "..." << flush;
+        if (o->Write()<=0)
+        {
+            *fLog << err << dbginf << "ERROR - Writing " << o->GetDescriptor() << " to file " << gFile->GetName() << endl;
+            return kFALSE;
+        }
+        *fLog << "done." << endl;
+    }
+    return kTRUE;
+}
+
+Bool_t MJob::ReadContainer(TCollection &list) const
+{
+    if (!gFile)
+    {
+        *fLog << err << dbginf << "ERROR - No file open (gFile==0)" << endl;
+        return kFALSE;
+    }
+
+    MIter Next(&list);
+    MParContainer *o=0;
+    while ((o=Next()))
+    {
+        *fLog << inf << " - Reading " << o->GetDescriptor() << "..." << flush;
+        if (o->Read(o->GetName())<=0)
+        {
+            *fLog << err << dbginf << "ERROR - Writing " << o->GetDescriptor() << " to file " << gFile->GetName() << endl;
+            return kFALSE;
+        }
+        *fLog << "done." << endl;
+    }
+    return kTRUE;
+}
Index: trunk/MagicSoft/Mars/mjobs/MJob.h
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJob.h	(revision 5028)
+++ trunk/MagicSoft/Mars/mjobs/MJob.h	(revision 5030)
@@ -38,4 +38,7 @@
     virtual Bool_t CheckEnvLocal() { return kTRUE; }
 
+    Bool_t WriteContainer(TCollection &list) const;
+    Bool_t ReadContainer(TCollection &list) const;
+
 public:
     MJob(const char *name=NULL, const char *title=NULL);
