/* ======================================================================== *\
!
! *
! * 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
!
!
\* ======================================================================== */
/////////////////////////////////////////////////////////////////////////////
//                                                               
// MCalibrationIntensityBlindCam                                               
//                                                               
// Storage container for intensity charge calibration results. 
// 
// Individual MCalibrationBlindCam's can be retrieved with: 
// - GetCam() yielding the current cam.
// - GetCam("name") yielding the current camera with name "name".
// - GetCam(i) yielding the i-th camera.
//
// See also: MCalibrationIntensityCam, MCalibrationBlindCam,
//           MCalibrationBlindPix, MCalibrationChargeCalc, MCalibrationQECam
//           MHCalibrationChargeBlindPix, MHCalibrationChargeBlindCam              
//
/////////////////////////////////////////////////////////////////////////////
#include "MCalibrationIntensityBlindCam.h"
#include "MCalibrationBlindCam.h"

#include <TOrdCollection.h>

ClassImp(MCalibrationIntensityBlindCam);

using namespace std;

// --------------------------------------------------------------------------
//
// Default constructor. 
//
MCalibrationIntensityBlindCam::MCalibrationIntensityBlindCam(const char *name, const char *title)
{

  fName  = name  ? name  : "MCalibrationIntensityBlindCam";
  fTitle = title ? title : "Results of the Intensity Calibration";

  InitSize(1);
}

// -------------------------------------------------------------------
//
// Add MCalibrationBlindCam's in the ranges from - to. 
//
void MCalibrationIntensityBlindCam::Add(const UInt_t from, const UInt_t to)
{
  for (UInt_t i=from; i<to; i++)
    fCams->AddAt(new MCalibrationBlindCam,i);
}

// --------------------------------------------------------------------------
//
// Calls TOrdCollection::Expand() for fCams and initialze one MCalibrationBlindCam
// and copy the entries
// 
void MCalibrationIntensityBlindCam::InitSize(const UInt_t n)
{

  MCalibrationBlindCam *oldcam = NULL;

  if (n>1)
    oldcam = (MCalibrationBlindCam*)GetCam();

  MCalibrationIntensityCam::InitSize(n);

  MCalibrationBlindCam *newcam = (MCalibrationBlindCam*)GetCam();  
  
  if (oldcam)
    oldcam->Copy(*newcam);
}

