Changeset 5046 for trunk


Ignore:
Timestamp:
09/15/04 22:12:28 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mcalib
Files:
2 added
15 edited

Legend:

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

    r5032 r5046  
    265265//
    266266MCalibrationChargeCalc::MCalibrationChargeCalc(const char *name, const char *title)
    267     :
    268       fGeom(NULL), fSignal(NULL), fHeader(NULL)
     267    : fGeom(NULL), fSignal(NULL), fHeader(NULL)
    269268{
    270269       
     
    340339//
    341340// The following container are searched for and execution aborted if not in MParList:
     341//  - MRawEvtHeader
    342342//  - MPedestalCam
    343 //
    344 // The following containers are searched and created if they were not found:
    345 //
    346 //  - MCalibrationQECam
    347 //  - MBadPixelsCam
     343//  - MExtractedSignalCam
    348344//
    349345Int_t MCalibrationChargeCalc::PreProcess(MParList *pList)
     
    374370    }
    375371 
    376   fHeader = (MRawEvtHeader*)pList->FindObject("MRawEvtHeader");
    377   if (!fHeader)
    378     {
    379       *fLog << err << "MRawEvtHeader not found... abort." << endl;
    380       return kFALSE;
    381     }
    382 
    383372
    384373  return kTRUE;
     
    390379// Search for the following input containers and abort if not existing:
    391380//  - MGeomCam
    392 //  - MCalibrationChargeCam
     381// -  MCalibrationIntensityChargeCam or MCalibrationChargeCam
     382//  - MCalibrationIntensityQECam or MCalibrationQECam
     383//  - MBadPixelsIntensityCam or MBadPixelsCam
    393384//
    394385// Search for the following input containers and give a warning if not existing:
  • trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityBlindCam.cc

    r5020 r5046  
    4141#include "MCalibrationBlindCam.h"
    4242
    43 #include <TObjArray.h>
     43#include <TOrdCollection.h>
    4444
    4545ClassImp(MCalibrationIntensityBlindCam);
     
    6060}
    6161
     62// -------------------------------------------------------------------
     63//
     64// Add MCalibrationBlindCam's in the ranges from - to.
     65//
     66void MCalibrationIntensityBlindCam::Add(const UInt_t from, const UInt_t to)
     67{
     68  for (UInt_t i=from; i<to; i++)
     69    fCams->AddAt(new MCalibrationBlindCam,i);
     70}
     71
    6272// --------------------------------------------------------------------------
    6373//
    64 // Calls TObjArray::Expand() for fCams and initialze one MCalibrationBlindCam
     74// Calls TOrdCollection::Expand() for fCams and initialze one MCalibrationBlindCam
    6575// and copy the entries
    6676//
     
    7484
    7585  MCalibrationIntensityCam::InitSize(n);
    76   (*fCams)[n-1] = new MCalibrationBlindCam;
    7786
    7887  MCalibrationBlindCam *newcam = (MCalibrationBlindCam*)GetCam(); 
  • trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityBlindCam.h

    r5019 r5046  
    1212class MCalibrationIntensityBlindCam : public MCalibrationIntensityCam
    1313{
     14private:
     15
     16  void Add(const UInt_t from, const UInt_t tox);
     17
    1418public:
    1519
  • trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityCam.cc

    r5043 r5046  
    2828// Base class for intensity calibration results
    2929//
    30 // Contains TObjArrays for the following objects:
     30// Contains TOrdCollections for the following objects:
    3131// - fCams:  Array of classes derived from MCalibrationCam, one entry
    3232//           per calibration camera result. Has to be created
     
    4343#include "MCalibrationIntensityCam.h"
    4444
    45 #include <TObjArray.h>
     45#include <TOrdCollection.h>
    4646
    4747#include "MGeomCam.h"
     
    6464  fTitle = title ? title : "Base container for the Intensity Calibration";
    6565
    66   fCams = new TObjArray;
     66  fCams = new TOrdCollection;
    6767  fCams->SetOwner();
    6868 
     
    188188// -------------------------------------------------------------------
    189189//
    190 // Calls TObjArray::Expand() for fCams
    191 //
    192 void MCalibrationIntensityCam::InitSize(const UInt_t n)
    193 {
    194   fCams->Expand(n);
     190// Initialize the objects inside the TOrdCollection using the
     191// virtual function Add().
     192//
     193// InitSize can only increase the size, but not shrink.
     194//
     195// It can be called more than one time. New Containers are
     196// added only from the current size to the argument i.
     197//
     198void MCalibrationIntensityCam::InitSize(const UInt_t i)
     199{
     200
     201  const UInt_t save = GetSize();
     202
     203  if (i==save)
     204    return;
     205 
     206  if (i>save)
     207    Add(save,i);
     208}
     209
     210// -------------------------------------------------------------------
     211//
     212// Add MCalibrationCams in the ranges from - to. In order to initialize
     213// from MCalibrationCam derived containers, overwrite this function
     214//
     215void MCalibrationIntensityCam::Add(const UInt_t from, const UInt_t to)
     216{
     217  for (UInt_t i=from; i<to; i++)
     218    fCams->AddAt(new MCalibrationCam,i);
    195219}
    196220
     
    211235// --------------------------------------------------------------------------
    212236//
    213 // Returns the current size of the TObjArray fCams
     237// Returns the current size of the TOrdCollection fCams
    214238// independently if the MCalibrationCam is filled with values or not.
    215239//
    216240const Int_t MCalibrationIntensityCam::GetSize() const
    217241{
    218   return fCams->GetEntriesFast();
     242  return fCams->GetSize();
    219243}
    220244
     
    240264// --------------------------------------------------------------------------
    241265//
    242 // Returns the current size of the TObjArray fAverageAreas of the current camera.
     266// Returns the current size of the TOrdCollection fAverageAreas of the current camera.
    243267//
    244268const Int_t MCalibrationIntensityCam::GetAverageAreas() const
     
    285309// --------------------------------------------------------------------------
    286310//
    287 // Returns the current size of the TObjArray fAverageSectors or the current camera
     311// Returns the current size of the TOrdCollection fAverageSectors or the current camera
    288312//
    289313const Int_t MCalibrationIntensityCam::GetAverageSectors() const
  • trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityCam.h

    r5015 r5046  
    1818#endif
    1919
    20 class TObjArray;
     20class TOrdCollection;
    2121class MCalibrationPix;
    2222class MBadPixelsPix;
     
    3131protected: 
    3232
    33   TObjArray *fCams;        // Array of MCalibrationCams, one per pulse colour and intensity
     33  TOrdCollection *fCams;        // Array of MCalibrationCams, one per pulse colour and intensity
    3434
     35  virtual void Add(const UInt_t from, const UInt_t to);
    3536  virtual void InitSize( const UInt_t n );
    3637 
  • trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityChargeCam.cc

    r5020 r5046  
    3535// See also: MCalibrationIntensityCam, MCalibrationChargeCam,
    3636//           MCalibrationChargePix, MCalibrationChargeCalc, MCalibrationQECam
     37//           MCalibrationBlindCam, MCalibrationChargePINDiode
    3738//           MHCalibrationChargePix, MHCalibrationChargeCam             
    38 //           MCalibrationChargeBlindPix, MCalibrationChargePINDiode
    3939//
    4040/////////////////////////////////////////////////////////////////////////////
     
    4242#include "MCalibrationChargeCam.h"
    4343
    44 #include <TObjArray.h>
     44#include <TOrdCollection.h>
    4545
    4646ClassImp(MCalibrationIntensityChargeCam);
     
    5151//
    5252// Default constructor.
    53 // 
     53//
    5454MCalibrationIntensityChargeCam::MCalibrationIntensityChargeCam(const char *name, const char *title)
    5555{
     
    5757  fName  = name  ? name  : "MCalibrationIntensityChargeCam";
    5858  fTitle = title ? title : "Results of the Intensity Calibration";
    59 
     59 
    6060  InitSize(1);
    6161}
    6262
    63 // --------------------------------------------------------------------------
     63// -------------------------------------------------------------------
    6464//
    65 // Calls TObjArray::Expand() for fCams and initialze one CalibrationChargeCam
     65// Add MCalibrationChargeCam's in the ranges from - to.
    6666//
    67 void MCalibrationIntensityChargeCam::InitSize(const UInt_t n)
     67void MCalibrationIntensityChargeCam::Add(const UInt_t from, const UInt_t to)
    6868{
    69   MCalibrationIntensityCam::InitSize(n);
    70   (*fCams)[n-1] = new MCalibrationChargeCam;
     69  for (UInt_t i=from; i<to; i++)
     70    fCams->AddAt(new MCalibrationChargeCam,i);
    7171}
    7272
  • trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityChargeCam.h

    r5015 r5046  
    1212class MCalibrationIntensityChargeCam : public MCalibrationIntensityCam
    1313{
     14private:
     15
     16  void Add(const UInt_t a, const UInt_t b);
     17
    1418public:
    1519
    1620  MCalibrationIntensityChargeCam(const char *name=NULL, const char *title=NULL);
    17 
    18   void InitSize( const UInt_t n ); 
    1921
    2022  // Setters   
  • trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityQECam.cc

    r5020 r5046  
    4141#include "MCalibrationQECam.h"
    4242
    43 #include <TObjArray.h>
     43#include <TOrdCollection.h>
    4444
    4545ClassImp(MCalibrationIntensityQECam);
     
    5959}
    6060
     61// -------------------------------------------------------------------
     62//
     63// Add MCalibrationQECams in the ranges from - to.
     64//
     65void MCalibrationIntensityQECam::Add(const UInt_t from, const UInt_t to)
     66{
     67  for (UInt_t i=from; i<to; i++)
     68    fCams->AddAt(new MCalibrationQECam,i);
     69}
     70
    6171// --------------------------------------------------------------------------
    6272//
     
    7383
    7484  MCalibrationIntensityCam::InitSize(n);
    75   (*fCams)[n-1] = new MCalibrationQECam;
    76 
     85 
    7786  MCalibrationQECam *newcam = (MCalibrationQECam*)GetCam(); 
    7887 
  • trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityQECam.h

    r5022 r5046  
    1212class MCalibrationIntensityQECam : public MCalibrationIntensityCam
    1313{
     14private:
     15
     16  void Add(const UInt_t from, const UInt_t to);
     17
    1418public:
    1519
    1620  MCalibrationIntensityQECam(const char *name=NULL, const char *title=NULL);
    1721
    18   void InitSize( const UInt_t n ); 
     22  void InitSize( const UInt_t n );
     23
     24  const MArrayD &GetCorningBlues   () const {
     25    return ((MCalibrationQECam*)GetCam())->GetCorningBlues();  }
     26  const MArrayD &GetCorningReds    () const {
     27    return ((MCalibrationQECam*)GetCam())->GetCorningReds();   }
    1928 
    2029  Float_t GetPlexiglassQE          () const {
  • trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityRelTimeCam.cc

    r5030 r5046  
    4141#include "MCalibrationRelTimeCam.h"
    4242
    43 #include <TObjArray.h>
     43#include <TOrdCollection.h>
    4444
    4545ClassImp(MCalibrationIntensityRelTimeCam);
     
    6060}
    6161
    62 
    63 // --------------------------------------------------------------------------
     62// -------------------------------------------------------------------
    6463//
    65 // Calls TObjArray::Expand() for fCams and initialze one CalibrationRelTimeCam
     64// Add MCalibrationRelTimeCam's in the ranges from - to.
    6665//
    67 void MCalibrationIntensityRelTimeCam::InitSize(const UInt_t n)
     66void MCalibrationIntensityRelTimeCam::Add(const UInt_t from, const UInt_t to)
    6867{
    69   MCalibrationIntensityCam::InitSize(n);
    70   (*fCams)[n-1] = new MCalibrationRelTimeCam;
     68  for (UInt_t i=from; i<to; i++)
     69    fCams->AddAt(new MCalibrationRelTimeCam,i);
    7170}
    7271
  • trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityRelTimeCam.h

    r5015 r5046  
    88class MCalibrationIntensityRelTimeCam : public MCalibrationIntensityCam
    99{
     10private:
     11
     12  void Add(const UInt_t from, const UInt_t to);
     13
    1014public:
    1115
    1216  MCalibrationIntensityRelTimeCam(const char *name=NULL, const char *title=NULL);
    1317
    14   void InitSize( const UInt_t n );   
    15  
    1618  ClassDef(MCalibrationIntensityRelTimeCam, 1) // Container Intensity Rel.Times Calibration Results Camera
    1719};
  • trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.cc

    r4908 r5046  
    6262
    6363#include "MCalibrationIntensityRelTimeCam.h"
    64 
    6564#include "MCalibrationRelTimeCam.h"
    6665#include "MCalibrationRelTimePix.h"
    6766
     67#include "MBadPixelsIntensityCam.h"
    6868#include "MBadPixelsCam.h"
    6969#include "MBadPixelsPix.h"
     
    113113{
    114114
     115  fIntensBad  = NULL;
    115116  fBadPixels  = NULL;
    116117  fCam        = NULL;
     
    120121
    121122
    122 // -----------------------------------------------------------------------------------
    123 //
    124 // The following containers are searched and created if they were not found:
    125 //
    126 //  - MBadPixelsCam
    127 //
    128 Int_t MCalibrationRelTimeCalc::PreProcess(MParList *pList)
    129 {
    130  
    131 
    132   fBadPixels = (MBadPixelsCam*)pList->FindCreateObj("MBadPixelsCam");
    133   if (!fBadPixels)
    134     {
    135       *fLog << err << "Could not find or create MBadPixelsCam ... aborting." << endl;
    136       return kFALSE;
    137     }
    138 
    139  
    140  
    141   return kTRUE;
    142 }
    143 
    144123
    145124// --------------------------------------------------------------------------
     
    147126// Search for the following input containers and abort if not existing:
    148127//  - MGeomCam
    149 //  - MCalibrationRelTimeCam
     128//  - MCalibrationIntensityRelTimeCam or MCalibrationRelTimeCam
     129//  - MBadPixelsIntensityCam or MBadPixelsCam
    150130//
    151131// It defines the PixId of every pixel in:
     
    167147    }
    168148 
     149  fIntensBad = (MBadPixelsIntensityCam*)pList->FindObject(AddSerialNumber("MBadPixelsIntensityCam"));
     150  if (fIntensBad)
     151    *fLog << inf << "Found MBadPixelsIntensityCam ... " << endl;
     152  else
     153    {
     154      fBadPixels = (MBadPixelsCam*)pList->FindObject(AddSerialNumber("MBadPixelsCam"));
     155      if (!fBadPixels)
     156        {
     157          *fLog << err << "Cannot find MBadPixelsCam ... abort." << endl;
     158          return kFALSE;
     159        }
     160    }
     161
    169162  fIntensCam = (MCalibrationIntensityRelTimeCam*)pList->FindObject(AddSerialNumber("MCalibrationIntensityRelTimeCam"));
    170163  if (fIntensCam)
     
    183176  UInt_t npixels     = fGeom->GetNumPixels();
    184177 
     178  MCalibrationRelTimeCam *relcam = fIntensCam
     179    ? (MCalibrationRelTimeCam*)fIntensCam->GetCam()  : fCam;
     180  MBadPixelsCam          *badcam    = fIntensBad
     181    ? (MBadPixelsCam*)        fIntensBad->GetCam()  : fBadPixels;
     182
    185183  for (UInt_t i=0; i<npixels; i++)
    186184    {
    187185     
    188       MCalibrationRelTimePix &pix = fIntensCam
    189         ? (MCalibrationRelTimePix&)(*fIntensCam)[i]
    190         : (MCalibrationRelTimePix&)(*fCam)      [i];
    191       MBadPixelsPix          &bad = (*fBadPixels)[i];
     186      MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*relcam)[i];
     187      MBadPixelsPix          &bad =                          (*badcam)[i];
    192188     
    193189      pix.SetPixId(i);
     
    203199    }
    204200
    205   return kTRUE;
    206 }
    207 
    208 // ----------------------------------------------------------------------------------
    209 // 
    210 // Nothing to be done in Process, but have a look at MHCalibrationRelTimeCam, instead
    211 //
    212 Int_t MCalibrationRelTimeCalc::Process()
    213 {
    214201  return kTRUE;
    215202}
     
    265252  else
    266253    fCam      ->SetReadyToSave();
    267   fBadPixels->SetReadyToSave();
     254
     255  if (fIntensBad)
     256    fIntensBad->SetReadyToSave();
     257  else
     258    fBadPixels->SetReadyToSave();
    268259
    269260  *fLog << inf << endl;
     
    301292{
    302293
     294  MCalibrationRelTimeCam *relcam = fIntensCam
     295    ? (MCalibrationRelTimeCam*)fIntensCam->GetCam()  : fCam;
     296  MBadPixelsCam         *badcam    = fIntensBad
     297    ? (MBadPixelsCam*)        fIntensBad->GetCam()  : fBadPixels;
     298
    303299  const UInt_t npixels  = fGeom->GetNumPixels();
    304300  const UInt_t nareas   = fGeom->GetNumAreas();
     
    316312  for (UInt_t i=0; i<npixels; i++)
    317313    {
    318       MBadPixelsPix &bad = (*fBadPixels)[i];     
     314      MBadPixelsPix &bad = (*badcam)[i];     
    319315      const Int_t  aidx  = (*fGeom)[i].GetAidx();
    320316
     
    340336    {
    341337     
    342       MCalibrationRelTimePix &pix = fIntensCam
    343         ? (MCalibrationRelTimePix&)(*fIntensCam)[i]
    344         : (MCalibrationRelTimePix&)(*fCam)      [i];
    345       MBadPixelsPix          &bad = (*fBadPixels)[i];
     338      MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*relcam)[i];
     339      MBadPixelsPix          &bad =                          (*badcam)[i];
    346340     
    347341      if (pix.IsExcluded())
     
    390384    {
    391385     
    392       MCalibrationRelTimePix &pix = fIntensCam
    393         ? (MCalibrationRelTimePix&)(*fIntensCam)[i]
    394         : (MCalibrationRelTimePix&)(*fCam)      [i];
    395       MBadPixelsPix          &bad = (*fBadPixels)[i];
     386      MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*relcam)[i];
     387      MBadPixelsPix          &bad =                          (*badcam)[i];
    396388     
    397389      if (pix.IsExcluded())
     
    428420{
    429421 
     422  MCalibrationRelTimeCam *relcam = fIntensCam
     423    ? (MCalibrationRelTimeCam*)fIntensCam->GetCam()  : fCam;
     424  MBadPixelsCam         *badcam    = fIntensBad
     425    ? (MBadPixelsCam*)        fIntensBad->GetCam()  : fBadPixels;
     426
    430427  for (Int_t i=0; i<fBadPixels->GetSize(); i++)
    431428    {
    432429     
    433       MBadPixelsPix          &bad = (*fBadPixels)[i];
    434       MCalibrationRelTimePix &pix = fIntensCam
    435         ? (MCalibrationRelTimePix&)(*fIntensCam)[i]
    436         : (MCalibrationRelTimePix&)(*fCam)      [i];
     430      MBadPixelsPix          &bad =                          (*badcam)[i];
     431      MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*relcam)[i];
    437432
    438433      if (bad.IsUncalibrated( MBadPixelsPix::kDeviatingTimeResolution))
     
    464459  *fLog << dec << setfill(' ');
    465460
     461  MCalibrationRelTimeCam *relcam = fIntensCam
     462    ? (MCalibrationRelTimeCam*)fIntensCam->GetCam()  : fCam;
     463  MBadPixelsCam         *badcam    = fIntensBad
     464    ? (MBadPixelsCam*)        fIntensBad->GetCam()  : fBadPixels;
     465
    466466  const Int_t nareas = fGeom->GetNumAreas();
    467467
    468468  TArrayI counts(nareas);
    469469
    470   for (Int_t i=0; i<fBadPixels->GetSize(); i++)
    471     {
    472       MBadPixelsPix &bad = (*fBadPixels)[i];
     470  for (Int_t i=0; i<badcam->GetSize(); i++)
     471    {
     472      MBadPixelsPix &bad = (*badcam)[i];
    473473      if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
    474474        {
     
    479479
    480480  for (Int_t aidx=0; aidx<nareas; aidx++)
    481     if (fIntensCam)
    482       fIntensCam->SetNumUnsuitable(counts[aidx], aidx);
    483     else
    484       fCam->SetNumUnsuitable(counts[aidx], aidx);
     481    relcam->SetNumUnsuitable(counts[aidx], aidx);
    485482
    486483  if (fGeom->InheritsFrom("MGeomCamMagic"))
     
    490487  counts.Reset();
    491488
    492   for (Int_t i=0; i<fBadPixels->GetSize(); i++)
    493     {
    494       MBadPixelsPix &bad = (*fBadPixels)[i];
     489  for (Int_t i=0; i<badcam->GetSize(); i++)
     490    {
     491      MBadPixelsPix &bad = (*badcam)[i];
    495492      if (bad.IsUnsuitable(MBadPixelsPix::kUnreliableRun))
    496493        {
     
    501498
    502499  for (Int_t aidx=0; aidx<nareas; aidx++)
    503     if (fIntensCam)
    504       fIntensCam->SetNumUnreliable(counts[aidx], aidx);
    505     else
    506       fCam->SetNumUnreliable(counts[aidx], aidx);
     500    relcam->SetNumUnreliable(counts[aidx], aidx);
    507501
    508502  *fLog << " " << setw(7) << "Unreliable Pixels:              "
     
    518512{
    519513 
     514  MBadPixelsCam         *badcam    = fIntensBad
     515    ? (MBadPixelsCam*)        fIntensBad->GetCam()  : fBadPixels;
     516
    520517  UInt_t countinner = 0;
    521518  UInt_t countouter = 0;
    522   for (Int_t i=0; i<fBadPixels->GetSize(); i++)
    523     {
    524       MBadPixelsPix &bad = (*fBadPixels)[i];
     519  for (Int_t i=0; i<badcam->GetSize(); i++)
     520    {
     521      MBadPixelsPix &bad = (*badcam)[i];
    525522      if (bad.IsUncalibrated(typ))
    526523        {
  • trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.h

    r4908 r5046  
    2222class MCalibrationRelTimeCam;
    2323class MGeomCam;
     24class MBadPixelsIntensityCam;
    2425class MBadPixelsCam;
    2526
     
    3637 
    3738  // Pointers
     39  MBadPixelsIntensityCam     *fIntensBad;        //  Bad Pixels Intensity Cam
    3840  MBadPixelsCam              *fBadPixels;        //  Bad Pixels
    3941  MCalibrationIntensityRelTimeCam *fIntensCam;   //  Calibrated RelTimes for different intensities
     
    5456  void   PrintUncalibrated( MBadPixelsPix::UncalibratedType_t typ, const char *text) const;
    5557
    56   Int_t  PreProcess (MParList *pList);
    5758  Bool_t ReInit     (MParList *pList);
    58   Int_t  Process    ();
    5959  Int_t  PostProcess();
    6060
  • trunk/MagicSoft/Mars/mcalib/MCalibrationTestCalc.cc

    r4810 r5046  
    6464#include "MHCalibrationTestPix.h"
    6565
     66#include "MCalibrationIntensityTestCam.h"
    6667#include "MCalibrationTestCam.h"
    6768#include "MCalibrationTestPix.h"
    6869
     70#include "MBadPixelsIntensityCam.h"
    6971#include "MBadPixelsCam.h"
    7072#include "MBadPixelsPix.h"
     
    8890//
    8991MCalibrationTestCalc::MCalibrationTestCalc(const char *name, const char *title)
    90     : fBadPixels(NULL), fTestCam(NULL), fCam(NULL), fGeom(NULL)
     92    : fIntensBad(NULL), fBadPixels(NULL),
     93      fTestCam(NULL), fIntensCam(NULL), fCam(NULL),
     94      fGeom(NULL)
    9195{
    9296       
     
    102106
    103107
    104 // -----------------------------------------------------------------------------------
    105 //
    106 // The following containers are searched and created if they were not found:
    107 //
    108 //  - MBadPixelsCam
    109 //
    110 Int_t MCalibrationTestCalc::PreProcess(MParList *pList)
    111 {
    112  
    113   //
    114   // Containers that are created in case that they are not there.
    115   //
    116   fBadPixels = (MBadPixelsCam*)pList->FindCreateObj(AddSerialNumber("MBadPixelsCam"));
    117   if (!fBadPixels)
    118     {
    119       *fLog << err << "Could not find or create MBadPixelsCam ... aborting." << endl;
    120       return kFALSE;
    121     }
    122  
    123   fCam = (MCalibrationTestCam*)pList->FindCreateObj("MCalibrationTestCam");
    124   if (!fCam)
    125     {
    126       *fLog << err << "Could not find or create MCalibrationTestCam ... aborting." << endl;
    127       return kFALSE;
    128     }
    129  
    130   return kTRUE;
    131 }
    132 
    133 
    134108// --------------------------------------------------------------------------
    135109//
    136110// Search for the following input containers and abort if not existing:
    137 //  - MGeomCam
    138 //  - MHCalibrationTestCam
     111// - MGeomCam
     112// - MHCalibrationTestCam
     113// - MCalibrationIntensityTestCam or MCalibrationTestCam
     114// - MBadPixelsIntensityCam or MBadPixelsCam
    139115//
    140 //
    141116Bool_t MCalibrationTestCalc::ReInit(MParList *pList )
    142117{
     
    155130      *fLog << err << "Maybe you forget to call an MFillH for the MHCalibrationTestCam before..." << endl;
    156131      return kFALSE;
     132    }
     133
     134  fIntensCam = (MCalibrationIntensityTestCam*)pList->FindObject(AddSerialNumber("MCalibrationIntensityTestCam"));
     135  if (fIntensCam)
     136    *fLog << inf << "Found MCalibrationIntensityTestCam ... " << endl;
     137  else
     138    {
     139      fCam = (MCalibrationTestCam*)pList->FindObject(AddSerialNumber("MCalibrationTestCam"));
     140      if (!fCam)
     141        {
     142          *fLog << err << "Cannot find MCalibrationTestCam ... abort." << endl;
     143          *fLog << err << "Maybe you forget to call an MFillH for the MHCalibrationTestCam before..." << endl;
     144          return kFALSE;
     145        }
     146    }
     147
     148  fIntensBad = (MBadPixelsIntensityCam*)pList->FindObject(AddSerialNumber("MBadPixelsIntensityCam"));
     149  if (fIntensBad)
     150    *fLog << inf << "Found MBadPixelsIntensityCam ... " << endl;
     151  else
     152    {
     153      fBadPixels = (MBadPixelsCam*)pList->FindObject(AddSerialNumber("MBadPixelsCam"));
     154      if (!fBadPixels)
     155        {
     156          *fLog << err << "Cannot find MBadPixelsCam ... abort." << endl;
     157          return kFALSE;
     158        }
    157159    }
    158160
     
    182184    return kFALSE;
    183185
     186  MCalibrationTestCam *testcam = fIntensCam
     187    ? (MCalibrationTestCam*)fIntensCam->GetCam()  : fCam;
     188
    184189  //
    185190  // Re-direct the output to an ascii-file from now on:
     
    202207    {
    203208      *fLog << " " << setw(7) << "Not interpolateable Pixels: "
    204             << Form("%s%3i%s%3i","Inner: ",fCam->GetNumUninterpolated(0),
    205                     " Outer: ",fCam->GetNumUninterpolated(1)) << endl;
     209            << Form("%s%3i%s%3i","Inner: ",testcam->GetNumUninterpolated(0),
     210                    " Outer: ",testcam->GetNumUninterpolated(1)) << endl;
    206211      *fLog << " " << setw(7) << "Biggest not-interpolateable cluster: "
    207212            << maxbad << endl;
    208213    }
    209214 
    210   fCam->SetNumUninterpolatedInMaxCluster(maxbad);
     215  testcam->SetNumUninterpolatedInMaxCluster(maxbad);
    211216
    212217  *fLog << endl; 
     
    234239  const UInt_t nareas   = fGeom->GetNumAreas();
    235240  const UInt_t nsectors = fGeom->GetNumSectors();
     241
     242  MCalibrationTestCam *testcam = fIntensCam
     243    ? (MCalibrationTestCam*)fIntensCam->GetCam()  : fCam;
     244  MBadPixelsCam       *badcam    = fIntensBad
     245    ? (MBadPixelsCam*)        fIntensBad->GetCam()  : fBadPixels;
    236246
    237247  TArrayD lowlim      (nareas);
     
    256266     
    257267      MHCalibrationTestPix &hist = (MHCalibrationTestPix&)(*fTestCam)[i];
    258       MCalibrationTestPix  &pix =                         (*fCam)[i];
     268      MCalibrationTestPix  &pix =  (MCalibrationTestPix &) (*testcam)[i];
    259269      //
    260270      // We assume that the pixels have been interpolated so far.
     
    316326      const Float_t areaerr  = TMath::Sqrt(areavars[aidx]);
    317327     
    318       MCalibrationTestPix &avpix = fCam->GetAverageArea(aidx);
     328      MCalibrationTestPix &avpix = (MCalibrationTestPix&)testcam->GetAverageArea(aidx);
    319329      avpix.SetNumPhotons   (areamean);
    320330      avpix.SetNumPhotonsErr(areaerr );
     
    385395     
    386396      MHCalibrationTestPix &hist = (MHCalibrationTestPix&)(*fTestCam)[i];
    387       MCalibrationTestPix  &pix =                         (*fCam)[i];
     397      MCalibrationTestPix  &pix =  (MCalibrationTestPix&) (*testcam)[i];
    388398
    389399      const Int_t    aidx         = (*fGeom)[i].GetAidx();
     
    401411                << Form("%8.2f out of %3.1f sigma limit: ",nphot,fPhotErrLimit)
    402412                << Form("[%8.2f,%8.2f] pixel%4i",lowlim[aidx],upplim[aidx],i) << endl;
    403           MBadPixelsPix &bad = (*fBadPixels)[i];
     413          MBadPixelsPix &bad = (*badcam)[i];
    404414          bad.SetUncalibrated( MBadPixelsPix::kDeviatingNumPhots );
    405415          bad.SetUnsuitable  ( MBadPixelsPix::kUnsuitableRun     );
     
    436446     
    437447
    438       MCalibrationTestPix &avpix = fCam->GetAverageArea(aidx);
     448      MCalibrationTestPix &avpix = (MCalibrationTestPix&)testcam->GetAverageArea(aidx);
    439449
    440450      if (areavars[aidx] < 0. || areaphotons[aidx] <= 0.)
     
    479489        }
    480490     
    481       MCalibrationTestPix &avpix = fCam->GetAverageSector(sector);
     491      MCalibrationTestPix &avpix = (MCalibrationTestPix&)testcam->GetAverageSector(sector);
    482492
    483493      if (sectorvars[sector] < 0. || sectorphotons[sector] <= 0.)
     
    513523{
    514524 
     525  MCalibrationTestCam *testcam = fIntensCam
     526    ? (MCalibrationTestCam*)fIntensCam->GetCam()  : fCam;
     527
    515528  const Int_t areas  = fGeom->GetNumAreas();
    516529  TArrayI *newarr[areas];
     
    519532    newarr[aidx] = new TArrayI(0);
    520533
    521   for (Int_t i=0; i<fCam->GetSize(); i++)
     534  for (Int_t i=0; i<testcam->GetSize(); i++)
    522535    {
    523536      const Int_t aidx = (*fGeom)[i].GetAidx();
    524       if ((*fCam)[i].IsExcluded())
     537      MCalibrationTestPix &pix = (MCalibrationTestPix&)(*testcam)[i];
     538      if (pix.IsExcluded())
    525539        {
    526540          const Int_t size = newarr[aidx]->GetSize();
     
    542556          num++;
    543557        }
    544       fCam->SetNumUninterpolated(newarr[aidx]->GetSize(),aidx);
     558      testcam->SetNumUninterpolated(newarr[aidx]->GetSize(),aidx);
    545559      *fLog << endl;
    546560    }
     
    553567{
    554568
     569  MCalibrationTestCam *testcam = fIntensCam
     570    ? (MCalibrationTestCam*)fIntensCam->GetCam()  : fCam;
     571
    555572  TArrayI arr(0);
    556573 
    557   for (Int_t i=0; i<fCam->GetSize(); i++)
    558     if ((*fCam)[i].IsExcluded())
    559       {
     574  for (Int_t i=0; i<testcam->GetSize(); i++)
     575    {
     576      MCalibrationTestPix &pix = (MCalibrationTestPix&)(*testcam)[i];
     577      if (pix.IsExcluded())
     578        {
    560579        const Int_t s = arr.GetSize();
    561580        arr.Set(s+1);
    562581        arr[s] = i;
    563       }
    564 
     582        }
     583    }
     584 
    565585  const Int_t size = arr.GetSize();
    566586 
     
    634654}
    635655
    636 
    637 
    638 
    639 
    640656// --------------------------------------------------------------------------
    641657//
  • trunk/MagicSoft/Mars/mcalib/MCalibrationTestCalc.h

    r4882 r5046  
    2020
    2121class MHCalibrationTestCam;
     22class MCalibrationIntensityTestCam;
    2223class MCalibrationTestCam;
     24class MBadPixelsIntensityCam;
    2325class MBadPixelsCam;
    2426class MGeomCam;
     
    3739 
    3840  // Pointers
    39   MBadPixelsCam         *fBadPixels;   //! Bad Pixels
    40   MHCalibrationTestCam  *fTestCam;     //! Calibrated Photons in the camera
    41   MCalibrationTestCam   *fCam;         //! Storage Calibrated Photons in the camera
    42   MGeomCam              *fGeom;        //! Camera geometry
     41  MBadPixelsIntensityCam       *fIntensBad;   //! Bad Pixels
     42  MBadPixelsCam                *fBadPixels;   //! Bad Pixels
     43  MHCalibrationTestCam         *fTestCam;     //! Calibrated Photons in the camera
     44  MCalibrationIntensityTestCam *fIntensCam;   //! Storage Calibrated Photons in the camera
     45  MCalibrationTestCam          *fCam;         //! Storage Calibrated Photons in the camera
     46  MGeomCam                     *fGeom;        //! Camera geometry
    4347
    4448  // functions
     
    5054  void   LoopNeighbours( const TArrayI &arr, TArrayI &known, Int_t &clustersize, const Int_t idx );
    5155 
    52   Int_t  PreProcess (MParList *pList);
    5356  Bool_t ReInit     (MParList *pList);
    5457  Int_t  Process    ();
Note: See TracChangeset for help on using the changeset viewer.