Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 6072)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 6073)
@@ -41,4 +41,8 @@
        it is too large.
 
+   * mcalib/MCalibConstCam.[h,cc]
+   * mcalib/MCalibConstPix.h
+     - new classes to allow display of changing cal. constants with the
+       interlaced cal. events
 
 
Index: /trunk/MagicSoft/Mars/mcalib/CalibLinkDef.h
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/CalibLinkDef.h	(revision 6072)
+++ /trunk/MagicSoft/Mars/mcalib/CalibLinkDef.h	(revision 6073)
@@ -14,4 +14,6 @@
 #pragma link C++ class MCalibrateData+;
 #pragma link C++ class MCalibrateRelTimes+;
+
+#pragma link C++ class MCalibConstCam+;
 
 #pragma link C++ class MCalibrationIntensityCam+;
Index: /trunk/MagicSoft/Mars/mcalib/MCalibConstCam.cc
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MCalibConstCam.cc	(revision 6073)
+++ /trunk/MagicSoft/Mars/mcalib/MCalibConstCam.cc	(revision 6073)
@@ -0,0 +1,272 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Markus Gaug    01/2005 <mailto:markus@ifae.es>
+!
+!   Copyright: MAGIC Software Development, 2000-2005
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//                                                                         //
+// MCalibConstCam                                                          //
+//                                                                         //
+// Hold the temporary conversion factors for MCalibrateDatara              //
+//                                                                         //
+/////////////////////////////////////////////////////////////////////////////
+#include "MCalibConstCam.h"
+#include "MCalibConstPix.h"
+
+#include <TClonesArray.h>
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+#include "MGeomCam.h"
+#include "MGeomPix.h"
+
+ClassImp(MCalibConstCam);
+
+using namespace std;
+// --------------------------------------------------------------------------
+//
+// Default constructor. 
+//
+// Creates a TClonesArray of MCalibConstPix containers, initialized to 1 entry, destinated 
+// to hold one container per pixel. Later, a call to MCalibConstCam::InitSize() 
+// has to be performed (in MGeomApply). 
+//
+// Creates a TClonesArray of MCalibConstPix containers, initialized to 1 entry, destinated 
+// to hold one container per pixel AREA. Later, a call to MCalibConstCam::InitAreas() 
+// has to be performed (in MGeomApply). 
+//
+// Creates a TClonesArray of MCalibConstPix containers, initialized to 1 entry, destinated
+// to hold one container per camera SECTOR. Later, a call to MCalibConstCam::InitSectors() 
+// has to be performed (in MGeomApply). 
+//
+MCalibConstCam::MCalibConstCam(const char *name, const char *title) 
+{
+  fName  = name  ? name  : "MCalibConstCam";
+  fTitle = title ? title : "Temporary Storage for Calibration Constants";
+  
+  fArray            = new TClonesArray("MCalibConstPix", 1);
+  fAverageAreas     = new TClonesArray("MCalibConstPix", 1);
+  fAverageSectors   = new TClonesArray("MCalibConstPix", 1);
+}
+
+// --------------------------------------------------------------------------
+//
+// Deletes the following TClonesArray's of MCalibConstPix containers:
+// - fArray
+// - fAverageAreas
+// - fAverageSectors
+//  
+MCalibConstCam::~MCalibConstCam()
+{
+  delete fArray;
+  delete fAverageAreas;
+  delete fAverageSectors;
+}
+
+// --------------------------------------------------------------------------
+//
+// Set the size of the camera
+//
+void MCalibConstCam::InitSize(const UInt_t i)
+{
+    fArray->ExpandCreate(i);
+}
+
+// -------------------------------------------------------------------
+//
+// Calls TClonesArray::ExpandCreate() for:
+// - fAverageAreas
+//
+void MCalibConstCam::InitAverageAreas(const UInt_t i)
+{
+  fAverageAreas->ExpandCreate(i);
+}
+
+// -------------------------------------------------------------------
+//
+// Calls TClonesArray::ExpandCreate() for:
+// - fAverageSectors
+//
+void MCalibConstCam::InitAverageSectors(const UInt_t i)
+{
+  fAverageSectors->ExpandCreate(i);
+}
+
+// -------------------------------------------------------------------
+//
+// Calls:
+// - InitSize()
+// - InitAverageAreas()
+// - InitAverageSectors()
+//
+void MCalibConstCam::Init(const MGeomCam &geom)
+{
+  InitSize          (geom.GetNumPixels() );
+  InitAverageAreas  (geom.GetNumAreas()  );
+  InitAverageSectors(geom.GetNumSectors());
+}
+
+// --------------------------------------------------------------------------
+//
+// This function returns the current size of the TClonesArray 
+// independently if the MCalibConstPix is filled with values or not.
+//
+// Get the size of the MCalibConstCam
+//
+Int_t MCalibConstCam::GetSize() const
+{
+    return fArray->GetEntriesFast();
+}
+
+// --------------------------------------------------------------------------
+//
+// Returns the current size of the TClonesArray fAverageAreas
+// independently if the MCalibConstPix is filled with values or not.
+//
+const Int_t MCalibConstCam::GetNumAverageArea() const
+{
+  return fAverageAreas->GetEntriesFast();
+}
+
+// --------------------------------------------------------------------------
+//
+// Returns the current size of the TClonesArray fAverageSectors
+// independently if the MCalibConstPix is filled with values or not.
+//
+const Int_t MCalibConstCam::GetNumAverageSector() const
+{
+  return fAverageSectors->GetEntriesFast();
+}
+
+// --------------------------------------------------------------------------
+//
+// Get i-th pixel (pixel number)
+//
+MCalibConstPix &MCalibConstCam::operator[](Int_t i)
+{
+    return *static_cast<MCalibConstPix*>(fArray->UncheckedAt(i));
+}
+
+// --------------------------------------------------------------------------
+//
+// Get i-th pixel (pixel number)
+//
+const MCalibConstPix &MCalibConstCam::operator[](Int_t i) const
+{
+    return *static_cast<MCalibConstPix*>(fArray->UncheckedAt(i));
+}
+
+// --------------------------------------------------------------------------
+//
+// Get i-th average pixel (area number)
+//
+MCalibConstPix &MCalibConstCam::GetAverageArea(UInt_t i)
+{
+  return *static_cast<MCalibConstPix*>(fAverageAreas->UncheckedAt(i));
+}
+
+// --------------------------------------------------------------------------
+//
+// Get i-th average pixel (area number)
+//
+const MCalibConstPix &MCalibConstCam::GetAverageArea(UInt_t i) const 
+{
+  return *static_cast<MCalibConstPix*>(fAverageAreas->UncheckedAt(i));
+}
+
+// --------------------------------------------------------------------------
+//
+// Get i-th average pixel (sector number)
+//
+MCalibConstPix &MCalibConstCam::GetAverageSector(UInt_t i)
+{
+  return *static_cast<MCalibConstPix*>(fAverageSectors->UncheckedAt(i));
+}
+
+// --------------------------------------------------------------------------
+//
+// Get i-th average pixel (sector number)
+//
+const MCalibConstPix &MCalibConstCam::GetAverageSector(UInt_t i) const 
+{
+  return *static_cast<MCalibConstPix*>(fAverageSectors->UncheckedAt(i));
+}
+
+// --------------------------------------
+//
+// Calls the ForEach macro for the TClonesArray fArray with the argument Clear()
+// 
+// Loops over the fAverageAreas, calling the function Clear() for 
+// every entry in fAverageAreas
+//
+// Loops over the fAverageSectors, calling the function Clear() for 
+// every entry in fAverageSectors
+// 
+void MCalibConstCam::Clear(Option_t *o)
+{
+    { fArray->ForEach(TObject, Clear)(); }
+    { fAverageAreas->ForEach(TObject, Clear)(); }
+    { fAverageSectors->ForEach(TObject, Clear)(); }
+  
+}
+
+void MCalibConstCam::Print(Option_t *o) const
+{
+    *fLog << all << GetDescriptor() << ":" << endl;
+    int id = 0;
+
+    TIter Next(fArray);
+    MCalibConstPix *pix;
+    while ((pix=(MCalibConstPix*)Next()))
+    {
+        *fLog << id 
+	      << Form(": Conversion Factor: %4.3f  Global F-Factor: %4.3f",pix->GetCalibConst(),pix->GetCalibFFactor()) 
+	      << endl;
+        id++;
+    }
+}
+
+
+Bool_t MCalibConstCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
+{
+    if (GetSize() <= idx)
+        return kFALSE;
+
+    switch (type)
+    {
+    case 0:
+      val = (*this)[idx].GetCalibConst();
+      break;
+    case 1:
+      val = (*this)[idx].GetCalibFFactor();
+      break;
+    default:
+      return kFALSE;
+    }
+
+    return val!=-1.;
+}
+
+void MCalibConstCam::DrawPixelContent(Int_t idx) const
+{
+    *fLog << warn << "MCalibConstCam::DrawPixelContent - not available." << endl;
+}
Index: /trunk/MagicSoft/Mars/mcalib/MCalibConstCam.h
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MCalibConstCam.h	(revision 6073)
+++ /trunk/MagicSoft/Mars/mcalib/MCalibConstCam.h	(revision 6073)
@@ -0,0 +1,55 @@
+#ifndef MARS_MCalibConstCam
+#define MARS_MCalibConstCam
+
+#ifndef MARS_MParContainer
+#include "MParContainer.h"
+#endif
+#ifndef MARS_MCamEvent
+#include "MCamEvent.h"
+#endif
+
+class TClonesArray;
+
+class MGeomCam;
+class MCalibConstPix;
+class MCalibConstCam : public MParContainer, public MCamEvent
+{
+private:
+
+  TClonesArray *fArray;           //-> Array of MCalibConstPix, one per pixel
+  TClonesArray *fAverageAreas;    //-> Array of MCalibConstPix, one per pixel area
+  TClonesArray *fAverageSectors;  //-> Array of MCalibConstPix, one per camera sector
+
+public:
+
+  MCalibConstCam(const char *name=NULL, const char *title=NULL);
+  ~MCalibConstCam();
+  
+  void Clear(Option_t *o="");
+  
+  // Getters 
+        MCalibConstPix &GetAverageArea   ( UInt_t i );
+  const MCalibConstPix &GetAverageArea   ( UInt_t i )            const;
+  const Int_t           GetNumAverageArea()                      const;
+        MCalibConstPix &GetAverageSector ( UInt_t i );
+  const MCalibConstPix &GetAverageSector ( UInt_t i )            const;
+  const Int_t           GetNumAverageSector()                    const;
+  Int_t                 GetSize          ()                      const;
+
+        MCalibConstPix &operator[]     ( Int_t i             );
+  const MCalibConstPix &operator[]     ( Int_t i             ) const;
+
+  void  Init                           ( const MGeomCam &geom);
+  void  InitSize                       ( const UInt_t i      );
+  void  InitAverageAreas               ( const UInt_t i      );
+  void  InitAverageSectors             ( const UInt_t i      );
+
+  void Print(Option_t *o="") const;
+  
+  Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
+  void  DrawPixelContent(Int_t idx) const;
+
+  ClassDef(MCalibConstCam, 0)	// Temporary Storage for calibration constants
+};
+
+#endif
Index: /trunk/MagicSoft/Mars/mcalib/MCalibConstPix.h
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MCalibConstPix.h	(revision 6073)
+++ /trunk/MagicSoft/Mars/mcalib/MCalibConstPix.h	(revision 6073)
@@ -0,0 +1,36 @@
+#ifndef MARS_MCalibConstPix
+#define MARS_MCalibConstPix
+
+#ifndef MARS_MParContainer
+#include "MParContainer.h"
+#endif
+
+class MCalibConstPix : public MParContainer
+{
+private:
+
+    Float_t fCalibConst;        // conversion factor (modified after each interlaced cal. update)
+    Float_t fCalibFFactor;      // global F-Factor   (modified after each interlaced cal. update)
+
+public:
+ 
+    MCalibConstPix();
+    
+    void Clear(Option_t *o="")
+      {
+	fCalibConst   = -1.;
+	fCalibFFactor = -1.;
+      }
+    
+    // Getters
+    Float_t GetCalibConst()   const { return fCalibConst;   }
+    Float_t GetCalibFFactor() const { return fCalibFFactor; }
+
+    // Setters
+    void SetCalibConst  ( const Float_t f )  { fCalibConst   = f; }
+    void SetCalibFFactor( const Float_t f )  { fCalibFFactor = f; }
+
+    ClassDef(MCalibConstPix, 0) // Temporay Storage Calibraion Constant of one pixel
+};
+
+#endif
Index: /trunk/MagicSoft/Mars/mcalib/Makefile
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/Makefile	(revision 6072)
+++ /trunk/MagicSoft/Mars/mcalib/Makefile	(revision 6073)
@@ -35,4 +35,5 @@
 	   MCalibCalcFromPast.cc \
 	   MCalibrateData.cc \
+	   MCalibConstCam.cc \
 	   MCalibrationPattern.cc \
 	   MCalibrationPatternDecode.cc \
