Changeset 3631 for trunk/MagicSoft


Ignore:
Timestamp:
04/01/04 23:05:48 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mcalib
Files:
5 edited

Legend:

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

    r3630 r3631  
    3838// The corresponding operators: [],() and the operators GetAverageHiGainArea(),
    3939// GetAverageLoGainArea(), GetAverageHiGainSector() and GetAverageLoGainSector()
    40 // have to cast to the corresponding class. It is assumed that all classes dealing
    41 // with calibration pixels derive from MHGausEvents
     40// have to be cast to the corresponding class. It is assumed that all classes
     41// dealing with calibration pixels derive from MHGausEvents.
    4242//
    4343/////////////////////////////////////////////////////////////////////////////
     
    5656
    5757#include "MGeomCam.h"
    58 #include "MGeomPix.h"
    5958
    6059ClassImp(MHCalibrationCam);
     
    6261using namespace std;
    6362
    64 const Int_t   MHCalibrationCam::fgPulserFrequency          = 500;
     63const Int_t   MHCalibrationCam::fgPulserFrequency = 500;
    6564// --------------------------------------------------------------------------
    6665//
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationCam.h

    r3629 r3631  
    3030protected:
    3131
    32   static const Int_t fgPulserFrequency;  // The default for fPulserFrequency
     32  static const Int_t fgPulserFrequency;  // The default for fPulserFrequency (now set to: 500)
    3333  Int_t   fPulserFrequency;             // Light pulser frequency
    3434 
     
    8686  virtual void   DrawPixelContent( Int_t num )  const;   
    8787
    88   ClassDef(MHCalibrationCam, 1) // Base Histogram class for camera calibration
     88  ClassDef(MHCalibrationCam, 1) // Base Histogram class for Calibration Camera
    8989};
    9090
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.cc

    r3626 r3631  
    2929// MHCalibrationChargeHiGainPix and MHCalibrationChargeLoGainPix for every:
    3030//
    31 // - pixel, stored in the TObjArray's fHiGainArray and fLoGainArray
     31// - pixel, stored in the TObjArray's MHCalibrationCam::fHiGainArray and
     32//   MHCalibrationCam::fLoGainArray
    3233//
    3334// - average pixel per area index (e.g. inner and outer for the MAGIC camera),
    34 //   stored in the TObjArray's fAverageHiGainAreas and fAverageLoGainAreas
     35//   stored in the TObjArray's MHCalibrationCam::fAverageHiGainAreas and
     36//   MHCalibrationCam::fAverageLoGainAreas
    3537//
    3638// - average pixel per camera sector (e.g. sectors 1-6 for the MAGIC camera),
    37 //   stored in the TObjArray's fAverageHiGainSectors and fAverageLoGainSectors
     39//   stored in the TObjArray's MHCalibrationCam::fAverageHiGainSectors and
     40//   MHCalibrationCam::fAverageLoGainSectors
    3841//
    3942// Every signal is filled into a Charge histogram and an array, in order to perform
    4043// a Fourier analysis (see MHGausEvents). The signals are moreover averaged on an
    41 // event-by-event basis and written into the TObjArray's fAverageHiGainAreas,
    42 // fAverageLoGainAreas, fAverageHiGainSectors and fAverageLoGainSectors.
     44// event-by-event basis and written into the corresponding average pixels
    4345//
    4446// Additionally, the (FADC slice) position of the maximum is stored in an Absolute
     
    108110/////////////////////////////////////////////////////////////////////////////
    109111#include "MHCalibrationChargeCam.h"
    110 
    111 #include <TVirtualPad.h>
    112 #include <TCanvas.h>
    113 #include <TPad.h>
    114 #include <TText.h>
    115 #include <TPaveText.h>
     112#include "MHCalibrationCam.h"
    116113
    117114#include "MLog.h"
     
    146143const Float_t MHCalibrationChargeCam::fgNumHiGainSaturationLimit = 0.01;
    147144const Float_t MHCalibrationChargeCam::fgNumLoGainSaturationLimit = 0.005;
    148 const Int_t   MHCalibrationChargeCam::fgPulserFrequency          = 500;
    149145// --------------------------------------------------------------------------
    150146//
     
    154150// - all pointers to NULL
    155151//
    156 // Initializes and sets owner of:
     152// Initializes and sets owner of (done in MHCalibrationCam):
    157153// - fHiGainArray, fLoGainArray
    158154// - fAverageHiGainAreas, fAverageLoGainAreas
     
    162158// - fNumHiGainSaturationLimit to fgNumHiGainSaturationLimit
    163159// - fNumLoGainSaturationLimit to fgNumLoGainSaturationLimit
    164 // - fPulserFrequency to fgPulserFrequency
     160// - fPulserFrequency to fgPulserFrequency (in MHCalibrationCam)
    165161//
    166162MHCalibrationChargeCam::MHCalibrationChargeCam(const char *name, const char *title)
     
    170166    fTitle = title ? title : "Class to fill the calibration histograms ";
    171167
    172     fHiGainArray = new TObjArray;
    173     fHiGainArray->SetOwner();
    174    
    175     fLoGainArray = new TObjArray;
    176     fLoGainArray->SetOwner();
    177 
    178     fAverageHiGainAreas = new TObjArray;
    179     fAverageHiGainAreas->SetOwner();
    180 
    181     fAverageLoGainAreas = new TObjArray;
    182     fAverageLoGainAreas->SetOwner();
    183 
    184     fAverageHiGainSectors = new TObjArray;
    185     fAverageHiGainSectors->SetOwner();
    186 
    187     fAverageLoGainSectors = new TObjArray;
    188     fAverageLoGainSectors->SetOwner();
    189 
    190168    SetNumHiGainSaturationLimit();
    191169    SetNumLoGainSaturationLimit();
    192     SetPulserFrequency();
    193 }
    194 
    195 // --------------------------------------------------------------------------
    196 //
    197 // Deletes the TClonesArray of:
    198 // - fHiGainArray, fLoGainArray
    199 // - fAverageHiGainAreas, fAverageLoGainAreas
    200 // - fAverageHiGainSectors, fAverageLoGainSectors
    201 //
    202 MHCalibrationChargeCam::~MHCalibrationChargeCam()
    203 {
    204   delete fHiGainArray;
    205   delete fLoGainArray;
    206 
    207   delete fAverageHiGainAreas;
    208   delete fAverageLoGainAreas;
    209 
    210   delete fAverageHiGainSectors;
    211   delete fAverageLoGainSectors;
    212 }
    213 
    214 // --------------------------------------------------------------------------
    215 //
    216 // Get i-th High Gain pixel (pixel number)
    217 //
    218 MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::operator[](UInt_t i)
    219 {
    220   return *static_cast<MHCalibrationChargeHiGainPix*>(fHiGainArray->UncheckedAt(i));
    221 }
    222 
    223 // --------------------------------------------------------------------------
    224 //
    225 // Get i-th High Gain pixel (pixel number)
    226 //
    227 const MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::operator[](UInt_t i) const
    228 {
    229   return *static_cast<MHCalibrationChargeHiGainPix*>(fHiGainArray->UncheckedAt(i));
    230 }
    231 
    232 // --------------------------------------------------------------------------
    233 //
    234 // Get i-th Low Gain pixel (pixel number)
    235 //
    236 MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::operator()(UInt_t i)
    237 {
    238   return *static_cast<MHCalibrationChargeLoGainPix*>(fLoGainArray->UncheckedAt(i));
    239 }
    240 
    241 // --------------------------------------------------------------------------
    242 //
    243 // Get i-th Low Gain pixel (pixel number)
    244 //
    245 const MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::operator()(UInt_t i) const
    246 {
    247   return *static_cast<MHCalibrationChargeLoGainPix*>(fLoGainArray->UncheckedAt(i));
    248 }
    249 
    250 // --------------------------------------------------------------------------
    251 //
    252 // Get i-th High Gain pixel Area (area number)
    253 //
    254 MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::GetAverageHiGainArea(UInt_t i)
    255 {
    256   return *static_cast<MHCalibrationChargeHiGainPix*>(fAverageHiGainAreas->UncheckedAt(i));
    257 }
    258 
    259 // --------------------------------------------------------------------------
    260 //
    261 // Get i-th High Gain pixel Area (area number)
    262 //
    263 const MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::GetAverageHiGainArea(UInt_t i) const
    264 {
    265   return *static_cast<MHCalibrationChargeHiGainPix*>(fAverageHiGainAreas->UncheckedAt(i));
    266 }
    267 
    268 // --------------------------------------------------------------------------
    269 //
    270 // Get i-th Low Gain pixel Area (area number)
    271 //
    272 MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::GetAverageLoGainArea(UInt_t i)
    273 {
    274   return *static_cast<MHCalibrationChargeLoGainPix*>(fAverageLoGainAreas->UncheckedAt(i));
    275 }
    276 
    277 // --------------------------------------------------------------------------
    278 //
    279 // Get i-th Low Gain pixel Area (area number)
    280 //
    281 const MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::GetAverageLoGainArea(UInt_t i) const
    282 {
    283   return *static_cast<MHCalibrationChargeLoGainPix*>(fAverageLoGainAreas->UncheckedAt(i));
    284 }
    285 
    286 // --------------------------------------------------------------------------
    287 //
    288 // Get i-th High Gain Sector (sector number)
    289 //
    290 MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::GetAverageHiGainSector(UInt_t i)
    291 {
    292   return *static_cast<MHCalibrationChargeHiGainPix*>(fAverageHiGainSectors->UncheckedAt(i));
    293 }
    294 
    295 // --------------------------------------------------------------------------
    296 //
    297 // Get i-th High Gain Sector (sector number)
    298 //
    299 const MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::GetAverageHiGainSector(UInt_t i) const
    300 {
    301   return *static_cast<MHCalibrationChargeHiGainPix*>(fAverageHiGainSectors->UncheckedAt(i));
    302 }
    303 
    304 // --------------------------------------------------------------------------
    305 //
    306 // Get i-th Low Gain Sector (sector number)
    307 //
    308 MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::GetAverageLoGainSector(UInt_t i)
    309 {
    310   return *static_cast<MHCalibrationChargeLoGainPix*>(fAverageLoGainSectors->UncheckedAt(i));
    311 }
    312 
    313 // --------------------------------------------------------------------------
    314 //
    315 // Get i-th Low Gain Sector (sector number)
    316 //
    317 const MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::GetAverageLoGainSector(UInt_t i) const
    318 {
    319   return *static_cast<MHCalibrationChargeLoGainPix*>(fAverageLoGainSectors->UncheckedAt(i));
    320 }
    321 
    322 // --------------------------------------------------------------------------
    323 //
    324 // Our own clone function is necessary since root 3.01/06 or Mars 0.4
    325 // I don't know the reason.
    326 //
    327 // Creates new MHCalibrationChargeCam
    328 // Deletes the TObjArray's and Clones them individually
    329 // Copies the TArray's
    330 //
    331 TObject *MHCalibrationChargeCam::Clone(const char *) const
    332 {
    333 
    334   const Int_t nhi   = fHiGainArray->GetEntries();
    335   const Int_t nlo   = fLoGainArray->GetEntries();
    336   const Int_t navhi = fAverageHiGainAreas->GetEntries();
    337   const Int_t navlo = fAverageLoGainAreas->GetEntries();
    338   const Int_t nsehi = fAverageHiGainSectors->GetEntries();
    339   const Int_t nselo = fAverageLoGainSectors->GetEntries();
    340  
    341   //
    342   // FIXME, this might be done faster and more elegant, by direct copy.
    343   //
    344   MHCalibrationChargeCam *cam = new MHCalibrationChargeCam();
    345 
    346   cam->fHiGainArray->Expand(nhi);
    347   cam->fLoGainArray->Expand(nlo);
    348   cam->fAverageHiGainAreas->Expand(navhi);
    349   cam->fAverageLoGainAreas->Expand(navlo);
    350   cam->fAverageHiGainSectors->Expand(nsehi);
    351   cam->fAverageLoGainSectors->Expand(nselo);
    352 
    353   for (int i=0; i<nhi; i++)
    354     {
    355       delete (*cam->fHiGainArray)[i];
    356       (*cam->fHiGainArray)[i] = (MHCalibrationChargeHiGainPix*)(*fHiGainArray)[i]->Clone();
    357     }
    358   for (int i=0; i<nlo; i++)
    359     {
    360       delete (*cam->fLoGainArray)[i];
    361       (*cam->fLoGainArray)[i] = (MHCalibrationChargeLoGainPix*)(*fLoGainArray)[i]->Clone();
    362     }
    363   for (int i=0; i<navhi; i++)
    364     {
    365       delete (*cam->fAverageHiGainAreas)[i];
    366       (*cam->fAverageHiGainAreas)[i] = (MHCalibrationChargeHiGainPix*)(*fAverageHiGainAreas)[i]->Clone();
    367     }
    368   for (int i=0; i<navlo; i++)
    369     {
    370       delete (*cam->fAverageLoGainAreas)[i];
    371       (*cam->fAverageLoGainAreas)[i] = (MHCalibrationChargeLoGainPix*)(*fAverageLoGainAreas)[i]->Clone();
    372     }
    373   for (int i=0; i<nsehi; i++)
    374     {
    375       delete (*cam->fAverageHiGainSectors)[i];
    376       (*cam->fAverageHiGainSectors)[i] = (MHCalibrationChargeHiGainPix*)(*fAverageHiGainSectors)[i]->Clone();
    377     }
    378   for (int i=0; i<nselo; i++)
    379     {
    380       delete (*cam->fAverageLoGainSectors)[i];
    381       (*cam->fAverageLoGainSectors)[i] = (MHCalibrationChargeLoGainPix*)(*fAverageLoGainSectors)[i]->Clone();
    382     }
    383 
    384   cam->fAverageAreaNum         = fAverageAreaNum;
    385   cam->fAverageAreaSat         = fAverageAreaSat;
    386   cam->fAverageAreaSigma       = fAverageAreaSigma;     
    387   cam->fAverageAreaSigmaErr    = fAverageAreaSigmaErr;   
    388   cam->fAverageAreaRelSigma    = fAverageAreaRelSigma;
    389   cam->fAverageAreaRelSigmaErr = fAverageAreaRelSigmaErr;   
    390   cam->fAverageSectorNum       = fAverageSectorNum;     
    391 
    392   return cam;
    393170}
    394171
     
    400177//
    401178// Calls Delete-Function of:
    402 // - fHiGainArray, fLoGainArray
    403 // - fAverageHiGainAreas, fAverageLoGainAreas
    404 // - fAverageHiGainSectors, fAverageLoGainSectors
     179// - MHCalibrationCam::fHiGainArray, MHCalibrationCam::fLoGainArray
     180// - MHCalibrationCam::fAverageHiGainAreas, MHCalibrationCam::fAverageLoGainAreas
     181// - MHCalibrationCam::fAverageHiGainSectors, MHCalibrationCam::fAverageLoGainSectors
    405182//
    406183Bool_t MHCalibrationChargeCam::SetupFill(const MParList *pList)
     
    443220//
    444221// Initializes, if empty to MExtractedSignalCam::GetSize() for:
    445 // - fHiGainArray, fLoGainArray
     222// - MHCalibrationCam::fHiGainArray, MHCalibrationCam::fLoGainArray
    446223//
    447224// Initializes, if empty to MGeomCam::GetNumAreas() for:
    448 // - fAverageHiGainAreas, fAverageLoGainAreas
     225// - MHCalibrationCam::fAverageHiGainAreas, MHCalibrationCam::fAverageLoGainAreas
    449226//
    450227// Initializes, if empty to MGeomCam::GetNumSectors() for:
    451 // - fAverageHiGainSectors, fAverageLoGainSectors
     228// - MHCalibrationCam::fAverageHiGainSectors, MHCalibrationCam::fAverageLoGainSectors
    452229//
    453230// Initializes TArrays to MGeomCam::GetNumAreas and MGeomCam::GetNumSectors, respectively
    454231// Fills with number of valid pixels (if !MBadPixelsPix::IsBad()):
    455 // - fAverageAreaNum[area index]
    456 // - fAverageSectorNum[area index]
     232// - MHCalibrationCam::fAverageAreaNum[area index]
     233// - MHCalibrationCam::fAverageSectorNum[area index]
    457234//
    458235// Calls InitializeHiGainHists() and InitializeLoGainHists() for every entry in:
    459 // - fHiGainArray, fLoGainArray
    460 // - fAverageHiGainAreas, fAverageLoGainAreas
    461 // - fAverageHiGainSectors, fAverageLoGainSectors
     236// - MHCalibrationCam::fHiGainArray, MHCalibrationCam::fLoGainArray
     237// - MHCalibrationCam::fAverageHiGainAreas, MHCalibrationCam::fAverageLoGainAreas
     238// - MHCalibrationCam::fAverageHiGainSectors, MHCalibrationCam::fAverageLoGainSectors
    462239//
    463240// Sets Titles and Names for the Charge Histograms and
    464241// Sets number of bins to fAverageNbins for:
    465 // - fAverageHiGainAreas, fAverageLoGainAreas
    466 // - fAverageHiGainSectors, fAverageLoGainSectors
     242// - MHCalibrationCam::fAverageHiGainAreas, MHCalibrationCam::fAverageLoGainAreas
     243// - MHCalibrationCam::fAverageHiGainSectors, MHCalibrationCam::fAverageLoGainSectors
    467244//
    468245Bool_t MHCalibrationChargeCam::ReInit(MParList *pList)
     
    514291      {
    515292          (*fHiGainArray)[i] = new MHCalibrationChargeHiGainPix;
    516           InitializeHiGainHists((*this)[i],(*fBadPixels)[i],i);
     293          InitializeHiGainHists((MHCalibrationChargePix&)(*this)[i],(*fBadPixels)[i],i);
    517294      }
    518295  }
     
    526303      {
    527304          (*fLoGainArray)[i] = new MHCalibrationChargeLoGainPix;
    528           InitializeLoGainHists((*this)(i),(*fBadPixels)[i],i);
     305          InitializeLoGainHists((MHCalibrationChargePix&)(*this)(i),(*fBadPixels)[i],i);
    529306      }
    530307     
     
    540317          new MHCalibrationChargeHiGainPix("AverageHiGainArea",
    541318                                           "Average HiGain FADC sums area idx ");
    542         InitializeHiGainHists(GetAverageHiGainArea(j),fCam->GetAverageBadArea(j),j);       
    543         GetAverageHiGainArea(j).GetHGausHist()->SetTitle("Summed FADC slices average HiGain Area Idx ");
    544         GetAverageHiGainArea(j).GetHAbsTime()->SetTitle("Absolute Arrival Time average HiGain Area Idx ");
    545         GetAverageHiGainArea(j).SetChargeNbins(fAverageNbins);
     319
     320        MHCalibrationChargePix &hist = (MHCalibrationChargePix&)GetAverageHiGainArea(j);
     321
     322        InitializeHiGainHists(hist,fCam->GetAverageBadArea(j),j);
     323
     324        hist.GetHGausHist()->SetTitle("Summed FADC slices average HiGain Area Idx ");
     325        hist.SetChargeNbins(fAverageNbins);
     326        hist.GetHAbsTime()->SetTitle("Absolute Arrival Time average HiGain Area Idx ");
    546327      }
    547328  }
     
    556337            new MHCalibrationChargeLoGainPix("AverageLoGainArea",
    557338                                             "Average LoGain FADC sums of pixel area idx ");
    558           InitializeLoGainHists(GetAverageLoGainArea(j),fCam->GetAverageBadArea(j),j);       
    559           GetAverageLoGainArea(j).GetHGausHist()->SetTitle("Summed FADC slices average LoGain Area Idx ");
    560           GetAverageLoGainArea(j).GetHAbsTime()->SetTitle("Absolute Arrival Time average LoGain Area Idx ");
    561           GetAverageLoGainArea(j).SetChargeNbins(fAverageNbins);
     339
     340        MHCalibrationChargePix &hist = (MHCalibrationChargePix&)GetAverageLoGainArea(j);
     341
     342        InitializeLoGainHists(hist,fCam->GetAverageBadArea(j),j);
     343
     344        hist.GetHGausHist()->SetTitle("Summed FADC slices average LoGain Area Idx ");
     345        hist.SetChargeNbins(fAverageNbins);
     346        hist.GetHAbsTime()->SetTitle("Absolute Arrival Time average LoGain Area Idx ");
     347
    562348        }
    563349    }
     
    572358            new MHCalibrationChargeHiGainPix("AverageHiGainSector",
    573359                                             "Average HiGain FADC sums of pixel sector ");
    574           InitializeHiGainHists(GetAverageHiGainSector(j),fCam->GetAverageBadSector(j),j);       
    575           GetAverageHiGainSector(j).GetHGausHist()->SetTitle("Summed FADC slices average HiGain Sector ");
    576           GetAverageHiGainSector(j).GetHAbsTime()->SetTitle("Absolute Arrival Time average HiGain Sector ");
    577           GetAverageHiGainSector(j).SetChargeNbins(fAverageNbins);
     360
     361          MHCalibrationChargePix &hist = (MHCalibrationChargePix&)GetAverageHiGainSector(j);
     362
     363          InitializeHiGainHists(hist,fCam->GetAverageBadSector(j),j);
     364         
     365          hist.GetHGausHist()->SetTitle("Summed FADC slices average HiGain Sector ");
     366          hist.SetChargeNbins(fAverageNbins);
     367          hist.GetHAbsTime()->SetTitle("Absolute Arrival Time average HiGain Sector ");
     368
    578369      }
    579370  }
     
    588379            new MHCalibrationChargeLoGainPix("AverageLoGainSector",
    589380                                             "Average LoGain FADC sums of pixel sector ");
    590           InitializeLoGainHists(GetAverageLoGainSector(j),fCam->GetAverageBadSector(j),j);
    591           GetAverageLoGainSector(j).GetHGausHist()->SetTitle("Summed FADC slices average LoGain Sector ");
    592           GetAverageLoGainSector(j).GetHAbsTime()->SetTitle("Absolute Arrival Time average LoGain Sector ");
    593           GetAverageLoGainSector(j).SetChargeNbins(fAverageNbins);
     381
     382          MHCalibrationChargePix &hist = (MHCalibrationChargePix&)GetAverageLoGainSector(j);
     383
     384          InitializeLoGainHists(hist,fCam->GetAverageBadSector(j),j);
     385         
     386          hist.GetHGausHist()->SetTitle("Summed FADC slices average LoGain Sector ");
     387          hist.SetChargeNbins(fAverageNbins);
     388          hist.GetHAbsTime()->SetTitle("Absolute Arrival Time average LoGain Sector ");
     389
    594390      }
    595391  }
     
    601397//
    602398// If MBadPixelsPix::IsBad():
    603 // - calls MHCalibrationChargeHiGainPix::SetExcluded()
     399// - calls MHCalibrationChargePix::SetExcluded()
    604400//
    605401// Calls:
     
    608404// - MHGausEvents::SetEventFrequency(fPulserFrequency)
    609405//
    610 void MHCalibrationChargeCam::InitializeHiGainHists(MHCalibrationChargeHiGainPix &hist,MBadPixelsPix &bad, const Int_t i)
     406void MHCalibrationChargeCam::InitializeHiGainHists(MHCalibrationChargePix &hist, MBadPixelsPix &bad, const Int_t i)
    611407{
    612408 
     
    626422//
    627423// If MBadPixelsPix::IsBad():
    628 // - calls MHCalibrationChargeLoGainPix::SetExcluded()
     424// - calls MHCalibrationChargePix::SetExcluded()
    629425//
    630426// Calls:
     
    633429// - MHGausEvents::SetEventFrequency(fPulserFrequency)
    634430//
    635 void MHCalibrationChargeCam::InitializeLoGainHists(MHCalibrationChargeLoGainPix &hist,MBadPixelsPix &bad, const Int_t i)
     431void MHCalibrationChargeCam::InitializeLoGainHists(MHCalibrationChargePix &hist,MBadPixelsPix &bad, const Int_t i)
    636432{
    637433
     
    738534    {
    739535
    740       if ((*this)[i].IsExcluded())
     536      MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)(*this)[i];
     537      MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)(*this)(i);
     538
     539      if (histhi.IsExcluded())
    741540        continue;
    742541
     
    746545      const Float_t sumlo  = pix.GetExtractedSignalLoGain();
    747546     
    748       (*this)[i].FillHistAndArray(sumhi);
    749       (*this)(i).FillHistAndArray(sumlo);
     547      histhi.FillHistAndArray(sumhi);
     548      histlo.FillHistAndArray(sumlo);
    750549
    751550      const Int_t sathi = (Int_t)pix.GetNumHiGainSaturated();
    752551      const Int_t satlo = (Int_t)pix.GetNumLoGainSaturated();
    753552
    754       (*this)[i].SetSaturated(sathi);
    755       (*this)(i).SetSaturated(satlo);
     553      histhi.SetSaturated(sathi);
     554      histlo.SetSaturated(satlo);
    756555
    757556      const Int_t aidx   = (*fGeom)[i].GetAidx();
     
    774573     
    775574      const UInt_t pixid = pixel.GetPixelId();
    776        if ((*this)[pixid].IsExcluded())
     575
     576      MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)(*this)[pixid];
     577      MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)(*this)(pixid);
     578
     579      if (histhi.IsExcluded())
    777580         continue;
    778 
     581     
    779582      const Float_t timehi = (Float_t)pixel.GetIdxMaxHiGainSample();
    780583      const Float_t timelo = (Float_t)pixel.GetIdxMaxLoGainSample(lofirst);
    781584
    782       (*this)[pixid].FillAbsTime(timehi);
    783       (*this)(pixid).FillAbsTime(timelo);
     585      histhi.FillAbsTime(timehi);
     586      histlo.FillAbsTime(timelo);
    784587
    785588      const Int_t aidx   = (*fGeom)[pixid].GetAidx();
     
    799602      const Int_t npix = fAverageAreaNum[j];
    800603
    801       MHCalibrationChargeHiGainPix &hipix = GetAverageHiGainArea(j);
    802       MHCalibrationChargeLoGainPix &lopix = GetAverageLoGainArea(j);
     604      MHCalibrationChargePix &hipix = (MHCalibrationChargePix&)GetAverageHiGainArea(j);
     605      MHCalibrationChargePix &lopix = (MHCalibrationChargePix&)GetAverageLoGainArea(j);
    803606
    804607      hipix.FillHistAndArray(sumhiarea[j]/npix);
     
    818621      const Int_t npix = fAverageSectorNum[j];
    819622
    820       MHCalibrationChargeHiGainPix &hipix = GetAverageHiGainSector(j);
    821       MHCalibrationChargeLoGainPix &lopix = GetAverageLoGainSector(j);
     623      MHCalibrationChargePix &hipix = (MHCalibrationChargePix&)GetAverageHiGainSector(j);
     624      MHCalibrationChargePix &lopix = (MHCalibrationChargePix&)GetAverageLoGainSector(j);
    822625
    823626      hipix.FillHistAndArray(sumhisector[j]/npix);
     
    852655    {
    853656     
    854       if ((*this)[i].IsExcluded())
     657      MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)(*this)[i];
     658
     659      if (histhi.IsExcluded())
    855660        continue;
    856661     
    857       MHCalibrationChargeHiGainPix &histhi = (*this)[i];
     662      MCalibrationChargePix  &pix    = (*fCam)[i];
     663      MBadPixelsPix          &bad    = (*fBadPixels)[i];
     664     
     665      FinalizeHiGainHists(histhi,pix,bad);
     666     
     667    }
     668 
     669  for (Int_t i=0; i<fLoGainArray->GetSize(); i++)
     670    {
     671     
     672      MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)(*this)(i);
     673
     674      if (histlo.IsExcluded())
     675        continue;
     676     
    858677      MCalibrationChargePix        &pix    = (*fCam)[i];
    859678      MBadPixelsPix                &bad    = (*fBadPixels)[i];
    860679     
     680      FinalizeLoGainHists(histlo,pix,bad);
     681     
     682    }
     683 
     684  for (Int_t j=0; j<fAverageHiGainAreas->GetSize(); j++)
     685    {
     686     
     687      MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)GetAverageHiGainArea(j);     
     688      MCalibrationChargePix  &pix    = fCam->GetAverageArea(j);
     689      MBadPixelsPix          &bad    = fCam->GetAverageBadArea(j);       
     690     
    861691      FinalizeHiGainHists(histhi,pix,bad);
    862      
    863     }
    864  
    865   for (Int_t i=0; i<fLoGainArray->GetSize(); i++)
    866     {
    867      
    868       if ((*this)(i).IsExcluded())
    869         continue;
    870      
    871       MHCalibrationChargeLoGainPix &histlo = (*this)(i);
    872       MCalibrationChargePix        &pix    = (*fCam)[i];
    873       MBadPixelsPix                &bad    = (*fBadPixels)[i];
     692    }
     693 
     694  for (Int_t j=0; j<fAverageLoGainAreas->GetSize(); j++)
     695    {
     696     
     697      MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)GetAverageLoGainArea(j);     
     698      MCalibrationChargePix  &pix    = fCam->GetAverageArea(j);
     699      MBadPixelsPix          &bad    = fCam->GetAverageBadArea(j);       
    874700     
    875701      FinalizeLoGainHists(histlo,pix,bad);
    876      
    877     }
    878  
    879   for (Int_t j=0; j<fAverageHiGainAreas->GetSize(); j++)
    880     {
    881      
    882       MHCalibrationChargeHiGainPix &histhi = GetAverageHiGainArea(j);     
    883       MCalibrationChargePix        &pix    = fCam->GetAverageArea(j);
    884       MBadPixelsPix                &bad    = fCam->GetAverageBadArea(j);       
     702    }
     703
     704  for (Int_t j=0; j<fAverageHiGainSectors->GetSize(); j++)
     705    {
     706     
     707      MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)GetAverageHiGainSector(j);     
     708      MCalibrationChargePix  &pix    = fCam->GetAverageSector(j);
     709      MBadPixelsPix          &bad    = fCam->GetAverageBadSector(j);       
    885710     
    886711      FinalizeHiGainHists(histhi,pix,bad);
    887712    }
    888713 
    889   for (Int_t j=0; j<fAverageLoGainAreas->GetSize(); j++)
    890     {
    891      
    892       MHCalibrationChargeLoGainPix &histlo = GetAverageLoGainArea(j);     
    893       MCalibrationChargePix        &pix    = fCam->GetAverageArea(j);
    894       MBadPixelsPix                &bad    = fCam->GetAverageBadArea(j);       
    895      
    896       FinalizeLoGainHists(histlo,pix,bad);
    897     }
    898 
    899   for (Int_t j=0; j<fAverageHiGainSectors->GetSize(); j++)
    900     {
    901      
    902       MHCalibrationChargeHiGainPix &histhi = GetAverageHiGainSector(j);     
    903       MCalibrationChargePix        &pix    = fCam->GetAverageSector(j);
    904       MBadPixelsPix                &bad    = fCam->GetAverageBadSector(j);       
    905      
    906       FinalizeHiGainHists(histhi,pix,bad);
    907     }
    908  
    909714  for (Int_t j=0; j<fAverageLoGainSectors->GetSize(); j++)
    910715    {
    911716     
    912       MHCalibrationChargeLoGainPix &histlo = GetAverageLoGainSector(j);     
    913       MCalibrationChargePix        &pix    = fCam->GetAverageSector(j);
    914       MBadPixelsPix                &bad    = fCam->GetAverageBadSector(j);       
     717      MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)GetAverageLoGainSector(j);     
     718      MCalibrationChargePix  &pix    = fCam->GetAverageSector(j);
     719      MBadPixelsPix          &bad    = fCam->GetAverageBadSector(j);       
    915720     
    916721      FinalizeLoGainHists(histlo,pix,bad);
     
    970775// Retrieves the results and store them in MCalibrationChargePix
    971776//
    972 void MHCalibrationChargeCam::FinalizeHiGainHists(MHCalibrationChargeHiGainPix &hist,
     777void MHCalibrationChargeCam::FinalizeHiGainHists(MHCalibrationChargePix &hist,
    973778                                                 MCalibrationChargePix &pix,
    974779                                                 MBadPixelsPix &bad)
     
    1066871// Retrieves the results and store them in MCalibrationChargePix
    1067872//
    1068 void MHCalibrationChargeCam::FinalizeLoGainHists(MHCalibrationChargeLoGainPix &hist,
     873void MHCalibrationChargeCam::FinalizeLoGainHists(MHCalibrationChargePix &hist,
    1069874                                                 MCalibrationChargePix &pix,
    1070875                                                 MBadPixelsPix &bad)
     
    1155960}
    1156961
    1157 // -----------------------------------------------------------------------------
    1158 //
    1159 // Default draw:
    1160 //
    1161 // Displays the averaged areas, both High Gain and Low Gain
    1162 //
    1163 // The following options can be chosen:
    1164 //
    1165 // "": displays the fHGausHist and the fHAbsTime
    1166 // "all": executes additionally MHGausEvents::Draw(), with options
    1167 //
    1168 void MHCalibrationChargeCam::Draw(const Option_t *opt)
    1169 {
    1170 
    1171   const Int_t nareas = fAverageHiGainAreas->GetEntries();
    1172   if (nareas == 0)
    1173     return;
    1174 
    1175   TVirtualPad *pad = gPad ? gPad : MH::MakeDefCanvas(this); 
    1176   pad->SetBorderMode(0);
    1177 
    1178   pad->Divide(2,nareas);
    1179 
    1180   for (Int_t i=0; i<nareas;i++)
    1181     {
    1182       pad->cd(2*(i+1)-1);
    1183       GetAverageHiGainArea(i).Draw(opt);
    1184 
    1185       if (!fAverageAreaSat[i])
    1186         DrawAverageSigma(fAverageAreaSat[i], i,
    1187                          fAverageAreaSigma[i],    fAverageAreaSigmaErr[i],
    1188                          fAverageAreaRelSigma[i], fAverageAreaRelSigmaErr[i]);
    1189 
    1190       pad->cd(2*(i+1));
    1191       GetAverageLoGainArea(i).Draw(opt);
    1192      
    1193       if (fAverageAreaSat[i])
    1194         DrawAverageSigma(fAverageAreaSat[i], i,
    1195                          fAverageAreaSigma[i], fAverageAreaSigmaErr[i],
    1196                          fAverageAreaRelSigma[i], fAverageAreaRelSigmaErr[i]);
    1197     }
    1198 }
    1199 
    1200 // -----------------------------------------------------------------------------
    1201 //
    1202 // Default draw:
    1203 //
    1204 // Displays a TPaveText with the re-normalized sigmas of the average area
    1205 //
    1206 void MHCalibrationChargeCam::DrawAverageSigma(Bool_t sat, Bool_t inner,
    1207                                               Float_t sigma, Float_t sigmaerr,
    1208                                               Float_t relsigma, Float_t relsigmaerr) const
    1209 {
    1210  
    1211   if (sigma != 0)
    1212     {
    1213      
    1214       TPad *newpad = new TPad("newpad","transparent",0,0,1,1);
    1215       newpad->SetFillStyle(4000);
    1216       newpad->Draw();
    1217       newpad->cd();
    1218      
    1219       TPaveText *text = new TPaveText(sat? 0.1 : 0.35,0.7,sat ? 0.4 : 0.7,1.0);
    1220       text->SetTextSize(0.07);
    1221       const TString line1 = Form("%s%s%s",inner ? "Outer" : "Inner",
    1222                                  " Pixels ", sat ? "Low Gain" : "High Gain");
    1223       TText *txt1 = text->AddText(line1.Data());
    1224       const TString line2 = Form("Sigma per Pixel: %2.2f #pm %2.2f",sigma,sigmaerr);
    1225       TText *txt2 = text->AddText(line2.Data());
    1226       const TString line3 = Form("Rel. Sigma per Pixel: %2.2f #pm %2.2f",relsigma,relsigmaerr);
    1227       TText *txt3 = text->AddText(line3.Data());
    1228       text->Draw("");
    1229      
    1230       text->SetBit(kCanDelete);
    1231       txt1->SetBit(kCanDelete);
    1232       txt2->SetBit(kCanDelete);
    1233       txt3->SetBit(kCanDelete);
    1234       newpad->SetBit(kCanDelete);
    1235     }
    1236 }
    1237 
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.h

    r3626 r3631  
    22#define MARS_MHCalibrationChargeCam
    33
    4 #ifndef ROOT_TObjArray
    5 #include <TObjArray.h>
     4#ifndef MARS_MHCalibrationCam
     5#include "MHCalibrationCam.h"
    66#endif
    77
    8 #ifndef ROOT_TArrayI
    9 #include <TArrayI.h>
    10 #endif
    11 
    12 #ifndef ROOT_TArrayF
    13 #include <TArrayF.h>
    14 #endif
    15 
    16 #ifndef MARS_MH
    17 #include "MH.h"
    18 #endif
    19 #ifndef MARS_MCamEvent
    20 #include "MCamEvent.h"
    21 #endif
    22 
    23 class TText;
    24 class TArrayI;
    25 class TArrayF;
    268class MRawEvtData;
    279class MGeomCam;
     
    3012class MCalibrationChargeCam;
    3113class MCalibrationChargePix;
    32 class MHCalibrationChargeHiGainPix;
    33 class MHCalibrationChargeLoGainPix;
    34 class MHCalibrationChargeCam : public MH, public MCamEvent
     14class MHCalibrationChargePix;
     15class MHCalibrationChargeCam : public MHCalibrationCam
    3516{
    3617private:
     
    3920  static const Float_t fgNumHiGainSaturationLimit;   // The default for fNumHiGainSaturationLimit
    4021  static const Float_t fgNumLoGainSaturationLimit;   // The default for fNumLoGainSaturationLimit
    41   static const Int_t   fgPulserFrequency;            // The default for fPulserFrequency
    4222 
    4323  Int_t   fAverageNbins;              // Number of bins for the average histograms
    4424  Float_t fNumHiGainSaturationLimit;  // Rel. amount sat. higain FADC slices until pixel is called saturated
    4525  Float_t fNumLoGainSaturationLimit;  // Rel. amount sat. logain FADC slices until pixel is called saturated
    46   Int_t   fPulserFrequency;           // Light pulser frequency
    4726 
    48   TObjArray *fHiGainArray;            //-> Array of MHCalibrationChargeHiGainPix, one per pixel
    49   TObjArray *fLoGainArray;            //-> Array of MHCalibrationChargeLoGainPix, one per pixel
    50   TObjArray *fAverageHiGainAreas;     //-> Array of MHCalibrationChargeHiGainPix, one per pixel area
    51   TObjArray *fAverageLoGainAreas;     //-> Array of MHCalibrationChargeLoGainPix, one per pixel area
    52   TObjArray *fAverageHiGainSectors;   //-> Array of MHCalibrationChargeHiGainPix, one per camera sector
    53   TObjArray *fAverageLoGainSectors;   //-> Array of MHCalibrationChargeLoGainPix, one per camera sector
    54 
    5527  MCalibrationChargeCam  *fCam;       //!  Calibration Cam with the results
    5628  MRawEvtData            *fRawEvt;    //!  Raw event data
     
    5830  MBadPixelsCam          *fBadPixels; //!  Bad Pixels storage container
    5931
    60   TArrayI fAverageAreaNum;            // Number of pixels in average pixels per area
    61   TArrayI fAverageAreaSat;            // Number of saturated slices in average pixels per area
    62   TArrayF fAverageAreaSigma;          // Re-normalized sigmas in average pixels per area
    63   TArrayF fAverageAreaSigmaErr;       // Errors of Re-normalized sigmas in average pixels per area
    64   TArrayF fAverageAreaRelSigma;       // Re-normalized relative sigmas in average pixels per area
    65   TArrayF fAverageAreaRelSigmaErr;    // Errors of Re-normalized relative sigmas in average pixels per area
     32  void InitializeHiGainHists(MHCalibrationChargePix &hist, MBadPixelsPix &bad, const Int_t i);
     33  void InitializeLoGainHists(MHCalibrationChargePix &hist, MBadPixelsPix &bad, const Int_t i); 
     34 
     35  void FinalizeHiGainHists(MHCalibrationChargePix &hist, MCalibrationChargePix &pix, MBadPixelsPix &bad);
     36  void FinalizeLoGainHists(MHCalibrationChargePix &hist, MCalibrationChargePix &pix, MBadPixelsPix &bad);
    6637
    67   TArrayI fAverageSectorNum;          // Number of pixels in average pixels per sector
    68 
    69   void InitializeHiGainHists(MHCalibrationChargeHiGainPix &hist, MBadPixelsPix &bad, const Int_t i);
    70   void InitializeLoGainHists(MHCalibrationChargeLoGainPix &hist, MBadPixelsPix &bad, const Int_t i); 
    71  
    72   void FinalizeHiGainHists(MHCalibrationChargeHiGainPix &hist, MCalibrationChargePix &pix, MBadPixelsPix &bad);
    73   void FinalizeLoGainHists(MHCalibrationChargeLoGainPix &hist, MCalibrationChargePix &pix, MBadPixelsPix &bad);
    74   void DrawAverageSigma(Bool_t sat, Bool_t inner,
    75                         Float_t sigma, Float_t sigmaerr,
    76                         Float_t relsigma, Float_t relsigmaerr) const;
    77  
    78 public:
     38 public:
    7939
    8040  MHCalibrationChargeCam(const char *name=NULL, const char *title=NULL);
    81   ~MHCalibrationChargeCam();
     41  ~MHCalibrationChargeCam() {}
     42 
    8243
    8344  void SetAverageNbins(    const Int_t bins=fgAverageNbins  )          { fAverageNbins = bins; }
    8445  void SetNumLoGainSaturationLimit( const Float_t lim=fgNumLoGainSaturationLimit) { fNumLoGainSaturationLimit = lim; }
    8546  void SetNumHiGainSaturationLimit( const Float_t lim=fgNumHiGainSaturationLimit) { fNumHiGainSaturationLimit = lim; }
    86   void SetPulserFrequency        ( const Int_t   f=fgPulserFrequency)          { fPulserFrequency = f;            }
    8747 
    88   Float_t GetNumHiGainSaturationLimit()                       const  { return fNumHiGainSaturationLimit; }
    89   Float_t GetNumLoGainSaturationLimit()                       const  { return fNumLoGainSaturationLimit; }
    90 
    91         MHCalibrationChargeHiGainPix &operator[](UInt_t i);
    92   const MHCalibrationChargeHiGainPix &operator[](UInt_t i)    const;
    93 
    94         MHCalibrationChargeLoGainPix &operator()(UInt_t i);
    95   const MHCalibrationChargeLoGainPix &operator()(UInt_t i)    const;
    96 
    97         MHCalibrationChargeHiGainPix  &GetAverageHiGainArea(UInt_t i);
    98   const MHCalibrationChargeHiGainPix  &GetAverageHiGainArea(UInt_t i)  const;
    99 
    100         MHCalibrationChargeLoGainPix  &GetAverageLoGainArea(UInt_t i);
    101   const MHCalibrationChargeLoGainPix  &GetAverageLoGainArea(UInt_t i)  const;
    102 
    103         MHCalibrationChargeHiGainPix  &GetAverageHiGainSector(UInt_t i);
    104   const MHCalibrationChargeHiGainPix  &GetAverageHiGainSector(UInt_t i)  const;
    105 
    106         MHCalibrationChargeLoGainPix  &GetAverageLoGainSector(UInt_t i);
    107   const MHCalibrationChargeLoGainPix  &GetAverageLoGainSector(UInt_t i)  const;
     48  Float_t GetNumHiGainSaturationLimit()      const  { return fNumHiGainSaturationLimit; }
     49  Float_t GetNumLoGainSaturationLimit()      const  { return fNumLoGainSaturationLimit; }
    10850
    10951  Bool_t SetupFill(const MParList *pList);
     
    11153  Bool_t Fill     (const MParContainer *par, const Stat_t w=1);
    11254  Bool_t Finalize ( );
    113 
    114   // Clone
    115   TObject *Clone(const char *) const;
    116  
    117   // Draw
    118   void Draw(const Option_t *opt);
    11955
    12056  Bool_t GetPixelContent ( Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationChargePix.h

    r3625 r3631  
    9292  void CountPickup();
    9393
    94   ClassDef(MHCalibrationChargePix, 1)     // Base Histogram class for a Calibration Pixel
     94  ClassDef(MHCalibrationChargePix, 1)     // Base Histogram class for a Charge Calibration Pixel
    9595};
    9696
Note: See TracChangeset for help on using the changeset viewer.