Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 4956)
+++ trunk/MagicSoft/Mars/Changelog	(revision 4957)
@@ -37,4 +37,9 @@
      - added functions ProjectArray(MArrayD,...) 
        and ProjectArray(MArrayF,...)
+
+   * mbadpixels/MBadPixelsIntensityCam.[h,cc]
+   * mbadpixels/Makefile
+   * mbadpixels/BadPixelsLinkDef.h
+     - new class for the intensity calibration
 
 
Index: trunk/MagicSoft/Mars/mbadpixels/BadPixelsLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mbadpixels/BadPixelsLinkDef.h	(revision 4956)
+++ trunk/MagicSoft/Mars/mbadpixels/BadPixelsLinkDef.h	(revision 4957)
@@ -8,4 +8,6 @@
 #pragma link C++ class MBadPixelsCam+;
 
+#pragma link C++ class MBadPixelsIntensityCam+;
+
 #pragma link C++ class MBadPixelsCalc+;
 #pragma link C++ class MBadPixelsTreat+;
Index: trunk/MagicSoft/Mars/mbadpixels/MBadPixelsIntensityCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mbadpixels/MBadPixelsIntensityCam.cc	(revision 4957)
+++ trunk/MagicSoft/Mars/mbadpixels/MBadPixelsIntensityCam.cc	(revision 4957)
@@ -0,0 +1,241 @@
+/* ======================================================================== *\
+!
+! *
+! * 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   11/2003 <mailto:markus@ifae.es>
+!
+!   Copyright: MAGIC Software Development, 2000-2004
+!
+!
+\* ======================================================================== */
+/////////////////////////////////////////////////////////////////////////////
+//                                                               
+// MBadPixelsIntensityCam                                               
+//                                                               
+// Base class for intensity calibration results 
+//
+// Contains TClonesArrays for the following objects:
+// - fCams:  Array of classes derived from MBadPixelsCam, one entry 
+//           per calibration camera result. Has to be created
+//
+// See also: MCalibrationIntensityChargeCam, MCalibrationIntensityQECam,
+//           MCalibrationIntensityRelTimeCam,
+//           MCalibrationCam, MCalibrationPix, 
+//           MCalibrationQECam, MCalibrationQEPix,
+//           MHCalibrationChargePix, MHCalibrationChargeCam              
+//           MCalibrationChargeBlindPix, MCalibrationChargePINDiode
+//
+//
+/////////////////////////////////////////////////////////////////////////////
+#include "MBadPixelsIntensityCam.h"
+
+#include <TClonesArray.h>
+
+#include "MGeomCam.h"
+
+ClassImp(MBadPixelsIntensityCam);
+
+using namespace std;
+// --------------------------------------------------------------------------
+//
+// Default constructor. 
+//
+// Set the following pointer to NULL:
+// - fCams
+//
+MBadPixelsIntensityCam::MBadPixelsIntensityCam(const char *name, const char *title)
+    : fCams(NULL)
+{
+
+  fName  = name  ? name  : "MBadPixelsIntensityCam";
+  fTitle = title ? title : "Base container for the Intensity Calibration";
+  
+}
+
+// --------------------------------------------------------------------------
+//
+// Deletes the histograms if they exist
+//
+MBadPixelsIntensityCam::~MBadPixelsIntensityCam()
+{
+  if (fCams)
+    delete fCams;
+}
+
+// --------------------------------------------------------------------------
+//
+// Add a new MBadPixelsCam to fCams, give it the name "name" and initialize
+// it with geom.
+//
+void MBadPixelsIntensityCam::AddToList( const char* name, const MGeomCam &geom) 
+{
+
+  fCams->ExpandCreate(GetSize()+1);
+
+  GetCam()->SetName(name);
+  GetCam()->Init(geom);
+}
+
+
+
+// --------------------------------------------------------------------------
+//
+// Copy 'constructor'
+//
+void MBadPixelsIntensityCam::Copy(TObject& object) const
+{
+  
+  MBadPixelsIntensityCam &calib = (MBadPixelsIntensityCam&)object;
+  
+  MParContainer::Copy(calib);
+  
+  const UInt_t n = GetSize();
+  if (n != 0)
+    {
+      calib.InitSize(n);
+      for (UInt_t i=0; i<n; i++)
+        GetCam(i)->Copy(*(calib.GetCam(i)));
+    }
+  
+}
+
+// -----------------------------------------------------
+//
+// Calls Clear() for all entries fCams
+//
+void MBadPixelsIntensityCam::Clear(Option_t *o)
+{
+
+  fCams->ForEach(MBadPixelsCam, Clear)(); 
+
+  return;
+}
+
+// -----------------------------------------------------
+//
+// Calls Print(o) for all entries fCams
+//
+void MBadPixelsIntensityCam::Print(Option_t *o) const
+{
+  fCams->ForEach(MBadPixelsCam, Print)(o); 
+}
+
+
+// -------------------------------------------------------------------
+//
+// Calls TClonesArray::ExpandCreate() for fCams
+//
+void MBadPixelsIntensityCam::InitSize(const UInt_t n)
+{
+  fCams->ExpandCreate(n);
+}
+
+// -------------------------------------------------------------------
+//
+// If size is still 0, Intialize a first Cam.
+// Calls Init(geom) for all fCams
+//
+void MBadPixelsIntensityCam::Init(const MGeomCam &geom)
+{
+  if (GetSize() == 0)
+    InitSize(1);
+  fCams->ForEach(MBadPixelsCam,Init)(geom);
+}
+
+
+// --------------------------------------------------------------------------
+//
+// Returns the current size of the TClonesArray fCams 
+// independently if the MBadPixelsCam is filled with values or not.
+//
+Int_t MBadPixelsIntensityCam::GetSize() const 
+{
+  return fCams->GetEntriesFast();
+}
+
+// --------------------------------------------------------------------------
+//
+// Get i-th pixel from current camera
+//
+MBadPixelsPix &MBadPixelsIntensityCam::operator[](Int_t i)
+{
+  return (*GetCam(GetSize()-1))[i];
+}
+
+// --------------------------------------------------------------------------
+//
+// Get i-th pixel from current camera
+//
+const MBadPixelsPix &MBadPixelsIntensityCam::operator[](Int_t i) const 
+{
+  return (*GetCam(GetSize()-1))[i];
+}
+
+
+// --------------------------------------------------------------------------
+//
+// Get i-th camera 
+//
+MBadPixelsCam *MBadPixelsIntensityCam::GetCam(Int_t i)
+{
+  return static_cast<MBadPixelsCam*>(fCams->UncheckedAt(i==-1 ? GetSize()-1 : i));
+}
+
+// --------------------------------------------------------------------------
+//
+// Get i-th camera 
+//
+const MBadPixelsCam *MBadPixelsIntensityCam::GetCam(Int_t i) const 
+{
+  return static_cast<MBadPixelsCam*>(fCams->UncheckedAt(i==-1 ? GetSize()-1 : i));
+}
+
+// --------------------------------------------------------------------------
+//
+// Get camera with name 'name' 
+//
+MBadPixelsCam *MBadPixelsIntensityCam::GetCam(const char *name )
+{
+  return static_cast<MBadPixelsCam*>(fCams->FindObject(name));
+}
+
+// --------------------------------------------------------------------------
+//
+// Get camera with name 'name' 
+//
+const MBadPixelsCam *MBadPixelsIntensityCam::GetCam(const char *name ) const 
+{
+  return static_cast<MBadPixelsCam*>(fCams->FindObject(name));
+}
+
+// --------------------------------------------------------------------------
+//
+// Calls GetPixelContent for the current entry in fCams
+//
+Bool_t MBadPixelsIntensityCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
+{
+  return GetCam()->GetPixelContent(val,idx,cam,type);
+}
+
+// --------------------------------------------------------------------------
+//
+// Calls DrawPixelContent for the current entry in fCams
+//
+void MBadPixelsIntensityCam::DrawPixelContent( Int_t num ) const
+{
+  return GetCam()->DrawPixelContent(num);
+}
+
Index: trunk/MagicSoft/Mars/mbadpixels/MBadPixelsIntensityCam.h
===================================================================
--- trunk/MagicSoft/Mars/mbadpixels/MBadPixelsIntensityCam.h	(revision 4957)
+++ trunk/MagicSoft/Mars/mbadpixels/MBadPixelsIntensityCam.h	(revision 4957)
@@ -0,0 +1,80 @@
+#ifndef MARS_MBadPixelsIntensityCam
+#define MARS_MBadPixelsIntensityCam
+
+#ifndef MARS_MBadPixelsPix
+#include "MBadPixelsPix.h"
+#endif
+#ifndef MARS_MCamEvent
+#include "MCamEvent.h"
+#endif
+#ifndef MARS_MBadPixelsCam
+#include "MBadPixelsCam.h"
+#endif
+
+class TClonesArray;
+class MGeomCam;
+class MBadPixelsIntensityCam : public MParContainer, public MCamEvent
+{
+private:
+  
+  void InitSize( const UInt_t n );
+  
+protected:  
+
+  TClonesArray *fCams;        //-> Array of MBadPixelsCams, one per pulse colour and intensity
+
+public:
+
+  MBadPixelsIntensityCam(const char *name=NULL, const char *title=NULL);
+  ~MBadPixelsIntensityCam();
+  
+  void  Clear ( Option_t *o="" );
+  void  Print ( Option_t *o="" ) const;
+  void  Copy  ( TObject& object) const;  
+  
+  void AddToList( const char* name, const MGeomCam &geom );
+
+  // Getters
+  Int_t GetSize() const;
+
+        MBadPixelsCam *GetCam     ( Int_t i=-1);
+  const MBadPixelsCam *GetCam     ( Int_t i=-1) const;
+
+        MBadPixelsCam *GetCam     ( const char *name );
+  const MBadPixelsCam *GetCam     ( const char *name ) const;
+
+        MBadPixelsPix &operator[] ( Int_t i );
+  const MBadPixelsPix &operator[] ( Int_t i )  const;
+ 
+  Short_t GetNumUnsuitable(MBadPixelsPix::UnsuitableType_t type,const MGeomCam *geom,Int_t aidx=-1) 
+	const { return GetCam()->GetNumUnsuitable(type,geom,aidx); }
+  Short_t GetNumUnsuitable(MBadPixelsPix::UnsuitableType_t type) 
+	const { return GetCam()->GetNumUnsuitable(type); }
+  Short_t GetNumIsolated(MBadPixelsPix::UnsuitableType_t type,const MGeomCam &geom,Int_t aidx=-1) 
+	const { return GetCam()->GetNumIsolated(type,geom,aidx); }
+  Short_t GetNumIsolated(const MGeomCam &geom,Int_t aidx=-1) 
+	const { return GetCam()->GetNumIsolated(geom, aidx); }
+  Short_t GetNumMaxCluster(MBadPixelsPix::UnsuitableType_t type,const MGeomCam &geom,Int_t aidx=-1) 
+	const { return GetCam()->GetNumMaxCluster(type,geom,aidx); }
+  Short_t GetNumMaxCluster(const MGeomCam &geom,Int_t aidx=-1)
+        { return GetCam()->GetNumMaxCluster(geom, aidx); }
+  
+  void   AsciiRead(istream &fin, UInt_t run) 
+	{ GetCam()->AsciiRead(fin,run); }
+  void   AsciiRead(istream &fin) 
+	{GetCam()->AsciiRead(fin); }
+  Bool_t AsciiWrite(ostream &out, UInt_t run) 
+	const { return GetCam()->AsciiWrite(out,run); }
+  Bool_t AsciiWrite(ostream &out) 
+	const { return GetCam()->AsciiWrite(out); }
+  
+  // Inits
+  void  Init   ( const MGeomCam &geom );
+
+  Bool_t GetPixelContent ( Double_t &val, Int_t idx, const MGeomCam &cam,Int_t type=0) const;
+  void   DrawPixelContent( Int_t num) const;
+
+  ClassDef(MBadPixelsIntensityCam, 1) // Base Container Intensity BadPixels Results
+};
+
+#endif
Index: trunk/MagicSoft/Mars/mbadpixels/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mbadpixels/Makefile	(revision 4956)
+++ trunk/MagicSoft/Mars/mbadpixels/Makefile	(revision 4957)
@@ -33,4 +33,5 @@
 SRCFILES = MBadPixelsPix.cc \
            MBadPixelsCam.cc \
+           MBadPixelsIntensityCam.cc \
            MBadPixelsMerge.cc \
            MBadPixelsCalc.cc \
