Ignore:
Timestamp:
08/17/04 23:31:30 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeBlindCam.cc

    r4401 r4669  
    2727// MCalibrationChargeBlindCam                                               
    2828//                                                               
    29 // Base class for Blind Pixels Calibration results.
     29// Base class for Blind Pixels Calibration results. Derived classes intialize
     30// the actual values of the MCalibrationBlindPix's.
    3031//
    3132// Contains TClonesArrays for the following objects:
     
    3637// - InitSize()
    3738//
     39// See also: MCalibrationChargeBlindCamOneOldStyle
     40//
    3841/////////////////////////////////////////////////////////////////////////////
    3942#include "MCalibrationChargeBlindCam.h"
     
    4144
    4245#include "MCalibrationCam.h"
    43 #include "MCalibrationPix.h"
    44 
    45 #include "MLog.h"
    46 #include "MLogManip.h"
    47 
    48 #include <TClonesArray.h>
     46#include "MParContainer.h"
    4947
    5048ClassImp(MCalibrationChargeBlindCam);
     
    5452//
    5553// Default constructor.
    56 //
    57 // Set the following pointer to NULL:
    58 // - fBlindPixels
    5954//
    6055// Initializes:
     
    6863// has to be performed in order to get the dimension correctly.
    6964//
    70 MCalibrationChargeBlindCam::MCalibrationChargeBlindCam(const char *name, const char *title)
    71     : fPulserColor(MCalibrationCam::kNONE),
    72       fBlindPixels(NULL),
    73       fValid(kFALSE)
     65MCalibrationChargeBlindCam::MCalibrationChargeBlindCam(UInt_t nblind,const char *name, const char *title)
     66    : fNumBlindPixels(nblind),
     67      fPulserColor(MCalibrationCam::kNONE),
     68      fBlindPixels(nblind)
    7469{
     70
    7571  fName  = name  ? name  : "MCalibrationChargeBlindCam";
    76   fTitle = title ? title : "Container for the Calibration Information of the blind pixels in the camera";
     72  fTitle = title ? title : "Calibration Information of blinded pixels in camera";
    7773
    78   fBlindPixels = new TClonesArray("MCalibrationChargeBlindPix",1);
     74   //
     75  // make sure that the destructor delete all contained objects
     76  //
     77  fBlindPixels.SetOwner();
     78 
     79  for (UInt_t i=0; i<nblind; i++)
     80    fBlindPixels[i] = new MCalibrationChargeBlindPix;
     81 
    7982}
    8083
    81 // --------------------------------------------------------------------------
    82 //
    83 // Deletes the following TClonesArray's of MCalibrationPix containers (if exist):
    84 // - fBlindPixels
    85 //
    86 MCalibrationChargeBlindCam::~MCalibrationChargeBlindCam()
    87 {
    88 
    89   //
    90   // delete fBlindPixels should delete all Objects stored inside
    91   //
    92   delete fBlindPixels;
    93 
    94 }
    9584
    9685// --------------------------------------
     
    10089void MCalibrationChargeBlindCam::Clear(Option_t *o)
    10190{
    102 
    103   fBlindPixels->ForEach(TObject, Clear)();
    104 
    105   return;
     91  fBlindPixels.ForEach(TObject, Clear)();
    10692}
    10793
    10894// -----------------------------------------------------
    10995//
    110 // own copy function to do the initialization correctly
     96// copy 'constructor'
    11197//
    11298void MCalibrationChargeBlindCam::Copy(TObject& object) const
    11399{
    114  
     100
     101  MParContainer::Copy(object);
     102
    115103  MCalibrationChargeBlindCam &calib = (MCalibrationChargeBlindCam&)object;
    116  
    117   MParContainer::Copy(calib);
    118  
    119   calib.fPulserColor          = fPulserColor;
    120  
    121   const Int_t n3 = GetSize();
    122   if (n3 != 0)
     104  calib.fPulserColor    = fPulserColor;
     105  calib.fNumBlindPixels = fNumBlindPixels;
     106
     107  for (UInt_t i=0; i<fNumBlindPixels; i++)
    123108    {
    124       calib.InitSize(n3);
    125       for (int i=0; i<n3; i++)
    126         (*this)[i].Copy(calib[i]);
     109      calib.fBlindPixels[i] = new MCalibrationChargeBlindPix;
     110      (*this)[i].Copy(calib[i]);
    127111    }
    128  
    129112}
    130 
    131 // -------------------------------------------------------------------
    132 //
    133 // Calls TClonesArray::ExpandCreate() for fBlindPixels
    134 //
    135 void MCalibrationChargeBlindCam::InitSize(const UInt_t i)
    136 {
    137   fBlindPixels->ExpandCreate(i);
    138 }
    139 
    140113
    141114// --------------------------------------------------------------------------
     
    145118MCalibrationChargeBlindPix &MCalibrationChargeBlindCam::operator[](UInt_t i)
    146119{
    147   return *static_cast<MCalibrationChargeBlindPix*>(fBlindPixels->UncheckedAt(i));
     120  return *static_cast<MCalibrationChargeBlindPix*>(fBlindPixels.UncheckedAt(i));
    148121}
    149122
     
    154127const MCalibrationChargeBlindPix &MCalibrationChargeBlindCam::operator[](UInt_t i) const
    155128{
    156   return *static_cast<MCalibrationChargeBlindPix*>(fBlindPixels->UncheckedAt(i));
     129  return *static_cast<MCalibrationChargeBlindPix*>(fBlindPixels.UncheckedAt(i));
    157130}
     131
    158132
    159133// --------------------------------------------------------------------------
    160134//
    161 // Returns the current size of the TClonesArray fBlindPixels
    162 // independently if the MCalibrationChargeBlindPix is filled with values or not.
    163 //
    164 const Int_t MCalibrationChargeBlindCam::GetSize() const
    165 {
    166   return fBlindPixels->GetEntriesFast();
    167 }
    168 
    169 // --------------------------------------------------------------------------
    170 //
    171 // Print first the results of the pixels
    172 // and then the ones which are not FitValid
     135// Print the results of the blind pixels
    173136//
    174137void MCalibrationChargeBlindCam::Print(Option_t *o) const
    175138{
    176139
    177   *fLog << all << GetDescriptor() << ":" << endl;
    178   int id = 0;
    179  
    180   *fLog << all << "Calibrated Blind pixels:" << endl;
    181   *fLog << all << endl;
    182 
    183   TIter Next(fBlindPixels);
    184   MCalibrationChargeBlindPix *pix;
    185   while ((pix=(MCalibrationChargeBlindPix*)Next()))
    186     {
    187      
    188       if (pix->IsSinglePheFitOK())
    189         {                           
    190 
    191           *fLog << all
    192                 << Form("%s%3i","BlindPixel: ",pix->GetPixId())
    193                 << Form("%s%4.2f%s%4.2f","  Lambda: ",pix->GetLambda(),"+-",pix->GetLambdaErr())
    194                 << Form("%s%4.2f%s%4.2f","  Mu0: ",pix->GetMu0(),"+-",pix->GetMu0Err())
    195                 << Form("%s%4.2f%s%4.2f","  Mu1: ",pix->GetMu1(),"+-",pix->GetMu1Err())
    196                 << Form("%s%4.2f%s%4.2f","  Sigma0: ",pix->GetSigma0(),"+-",pix->GetSigma0Err())
    197                 << Form("%s%4.2f%s%4.2f","  Sigma1: ",pix->GetSigma1(),"+-",pix->GetSigma1Err())
    198                 << endl;
    199           *fLog << all
    200                 << " Pedestal Fit OK? :" << pix->IsPedestalFitOK()
    201                 << Form("%s%4.2f%s%4.2f","  Lambda (Check): " ,pix->GetLambdaCheck(),"+-",pix->GetLambdaCheckErr()) << endl;
    202           *fLog << all
    203                 << " Flux available? :" << pix->IsFluxInsidePlexiglassAvailable()
    204                 << Form("%s%4.2f%s%4.2f","  Flux: " ,pix->GetFluxInsidePlexiglass(),"+-",pix->GetFluxInsidePlexiglassErr())
    205                 << endl;
    206           id++;
    207         }
    208     }
    209   *fLog << all << id << " blind pixels OK" << endl;
    210   id = 0;
    211  
    212   TIter Next2(fBlindPixels);
    213   while ((pix=(MCalibrationChargeBlindPix*)Next2()))
    214     {
    215      
    216       if (!pix->IsSinglePheFitOK())
    217         {                           
    218 
    219           *fLog << all
    220                 << Form("%s%3i","BlindPixel: ",pix->GetPixId())
    221                 << Form("%s%4.2f%s%4.2f","  Lambda: ",pix->GetLambda(),"+-",pix->GetLambdaErr())
    222                 << Form("%s%4.2f%s%4.2f","  Mu0: ",pix->GetMu0(),"+-",pix->GetMu0Err())
    223                 << Form("%s%4.2f%s%4.2f","  Mu1: ",pix->GetMu1(),"+-",pix->GetMu1Err())
    224                 << Form("%s%4.2f%s%4.2f","  Sigma0: ",pix->GetSigma0(),"+-",pix->GetSigma0Err())
    225                 << Form("%s%4.2f%s%4.2f","  Sigma1: ",pix->GetSigma1(),"+-",pix->GetSigma1Err())
    226                 << endl;
    227           *fLog << all
    228                 << " Pedestal Fit OK? :" << pix->IsPedestalFitOK()
    229                 << Form("%s%4.2f%s%4.2f","  Lambda (Check): " ,pix->GetLambdaCheck(),"+-",pix->GetLambdaCheckErr()) << endl;
    230           *fLog << all
    231                 << " Flux available? :" << pix->IsFluxInsidePlexiglassAvailable()
    232                 << Form("%s%4.2f%s%4.2f","  Flux: " ,pix->GetFluxInsidePlexiglass(),"+-",pix->GetFluxInsidePlexiglassErr())
    233                 << endl;
    234           id++;
    235         }
    236     }
    237   *fLog << all << id << " blind pixels NOT OK" << endl;
    238  
     140  fBlindPixels.Print();
    239141}
Note: See TracChangeset for help on using the changeset viewer.