Ignore:
Timestamp:
09/25/04 14:01:50 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r5098 r5137  
    2626// MHCalibrationCam                                               
    2727//
    28 // Base class for camera calibration classes. Incorporates the TObjArray's:
     28// Base class for camera calibration classes. Incorporates the TOrdCollection's:
    2929// - fHiGainArray (for calibrated High Gains per pixel)
    3030// - fLoGainArray (for calibrated Low Gains per pixel)
     
    3333// - fAverageHiGainSectors (for averaged High Gains events per camera sector )
    3434// - fAverageLoGainSectors (for averaged High Gains events per camera sector )
    35 // These TObjArray's are called by their default constructors, thus no objects
     35// These TOrdCollection's are called by their default constructors, thus no objects
    3636// are created, until the derived class does so.
    3737//
     
    6161#include <TText.h>
    6262#include <TPaveText.h>
     63#include <TOrdCollection.h>
     64#include <TROOT.h>
    6365
    6466#include "MLog.h"
     
    117119{
    118120
    119     fHiGainArray = new TObjArray;
     121    fHiGainArray = new TOrdCollection;
    120122    fHiGainArray->SetOwner();
    121    
    122     fLoGainArray = new TObjArray;
     123
     124    fLoGainArray = new TOrdCollection;
    123125    fLoGainArray->SetOwner();
    124126
    125     fAverageHiGainAreas = new TObjArray;
     127    fAverageHiGainAreas = new TOrdCollection;
    126128    fAverageHiGainAreas->SetOwner();
    127129
    128     fAverageLoGainAreas = new TObjArray;
     130    fAverageLoGainAreas = new TOrdCollection;
    129131    fAverageLoGainAreas->SetOwner();
    130132
    131     fAverageHiGainSectors = new TObjArray;
     133    fAverageHiGainSectors = new TOrdCollection;
    132134    fAverageHiGainSectors->SetOwner();
    133135
    134     fAverageLoGainSectors = new TObjArray;
     136    fAverageLoGainSectors = new TOrdCollection;
    135137    fAverageLoGainSectors->SetOwner();
    136138
     
    146148// --------------------------------------------------------------------------
    147149//
    148 // Returns size of fHiGainArray
    149 //
    150 const Int_t MHCalibrationCam::GetSize() const
    151 {
    152   return fHiGainArray->GetSize();
    153 }
    154 
    155 // --------------------------------------------------------------------------
    156 //
    157 // Deletes the TClonesArray of:
     150// Deletes the TOrdCollection of:
    158151// - fHiGainArray, fLoGainArray
    159152// - fAverageHiGainAreas, fAverageLoGainAreas
     
    171164  delete fAverageHiGainSectors;
    172165  delete fAverageLoGainSectors;
    173 }
    174 
    175 // --------------------------------------------------------------------------
     166  /*
     167
     168  Remove ( fHiGainArray );
     169  Remove ( fLoGainArray );
     170
     171  Remove ( fAverageHiGainAreas );
     172  Remove ( fAverageLoGainAreas );
     173
     174  Remove ( fAverageHiGainSectors );
     175  Remove ( fAverageLoGainSectors );
     176  */
     177
     178}
     179
     180void MHCalibrationCam::Remove(TOrdCollection *col)
     181{
     182
     183  if (!col)
     184    return;
     185
     186  TOrdCollectionIter Next(col);
     187 
     188  Int_t count = 0;
     189
     190  while (MHCalibrationPix *obj = (MHCalibrationPix*)Next())
     191    {
     192      *fLog << ++count << " " << obj << flush;
     193      if (obj && obj->IsOnHeap())
     194        {
     195          obj->Draw();
     196          delete obj;
     197        }
     198    }
     199 
     200  delete col;
     201}
     202
     203// --------------------------------------------------------------------------
     204//
     205// Returns size of fHiGainArray
     206//
     207const Int_t MHCalibrationCam::GetSize() const
     208{
     209  return fHiGainArray->GetSize();
     210}
     211
     212// --------------------------------------------------------------------------
     213//
     214// Get i-th High Gain pixel (pixel number)
     215//
     216MHCalibrationPix &MHCalibrationCam::operator[](UInt_t i)
     217{
     218  return *static_cast<MHCalibrationPix*>(fHiGainArray->At(i));
     219}
     220
     221// --------------------------------------------------------------------------
     222//
     223// Get i-th High Gain pixel (pixel number)
     224//
     225const MHCalibrationPix &MHCalibrationCam::operator[](UInt_t i) const
     226{
     227  return *static_cast<MHCalibrationPix*>(fHiGainArray->At(i));
     228}
     229
     230// --------------------------------------------------------------------------
     231//
     232// Get i-th Low Gain pixel (pixel number)
     233//
     234MHCalibrationPix  &MHCalibrationCam::operator()(UInt_t i)
     235{
     236  return *static_cast<MHCalibrationPix*>(fLoGainArray->At(i));
     237}
     238
     239// --------------------------------------------------------------------------
     240//
     241// Get i-th Low Gain pixel (pixel number)
     242//
     243const MHCalibrationPix  &MHCalibrationCam::operator()(UInt_t i) const
     244{
     245  return *static_cast<MHCalibrationPix*>(fLoGainArray->At(i));
     246}
     247
     248// --------------------------------------------------------------------------
     249//
     250// Returns the current size of the TOrdCollection fAverageHiGainAreas
     251// independently if the MHCalibrationPix is filled with values or not.
     252//
     253const Int_t MHCalibrationCam::GetAverageAreas() const
     254{
     255  return fAverageHiGainAreas->GetSize();
     256}
     257
     258// --------------------------------------------------------------------------
     259//
     260// Get i-th High Gain pixel Area (area number)
     261//
     262MHCalibrationPix  &MHCalibrationCam::GetAverageHiGainArea(UInt_t i)
     263{
     264  return *static_cast<MHCalibrationPix*>(fAverageHiGainAreas->At(i));
     265}
     266
     267// --------------------------------------------------------------------------
     268//
     269// Get i-th High Gain pixel Area (area number)
     270//
     271const MHCalibrationPix  &MHCalibrationCam::GetAverageHiGainArea(UInt_t i) const
     272{
     273  return *static_cast<MHCalibrationPix *>(fAverageHiGainAreas->At(i));
     274}
     275
     276// --------------------------------------------------------------------------
     277//
     278// Get i-th Low Gain pixel Area (area number)
     279//
     280MHCalibrationPix  &MHCalibrationCam::GetAverageLoGainArea(UInt_t i)
     281{
     282  return *static_cast<MHCalibrationPix*>(fAverageLoGainAreas->At(i));
     283}
     284
     285// --------------------------------------------------------------------------
     286//
     287// Get i-th Low Gain pixel Area (area number)
     288//
     289const MHCalibrationPix  &MHCalibrationCam::GetAverageLoGainArea(UInt_t i) const
     290{
     291  return *static_cast<MHCalibrationPix*>(fAverageLoGainAreas->At(i));
     292}
     293
     294// --------------------------------------------------------------------------
     295//
     296// Returns the current size of the TOrdCollection fAverageHiGainSectors
     297// independently if the MHCalibrationPix is filled with values or not.
     298//
     299const Int_t MHCalibrationCam::GetAverageSectors() const
     300{
     301  return fAverageHiGainSectors->GetSize();
     302}
     303
     304// --------------------------------------------------------------------------
     305//
     306// Get i-th High Gain Sector (sector number)
     307//
     308MHCalibrationPix  &MHCalibrationCam::GetAverageHiGainSector(UInt_t i)
     309{
     310  return *static_cast<MHCalibrationPix*>(fAverageHiGainSectors->At(i));
     311}
     312
     313// --------------------------------------------------------------------------
     314//
     315// Get i-th High Gain Sector (sector number)
     316//
     317const MHCalibrationPix  &MHCalibrationCam::GetAverageHiGainSector(UInt_t i) const
     318{
     319  return *static_cast<MHCalibrationPix*>(fAverageHiGainSectors->At(i));
     320}
     321
     322// --------------------------------------------------------------------------
     323//
     324// Get i-th Low Gain Sector (sector number)
     325//
     326MHCalibrationPix  &MHCalibrationCam::GetAverageLoGainSector(UInt_t i)
     327{
     328  return *static_cast<MHCalibrationPix*>(fAverageLoGainSectors->At(i));
     329}
     330
     331// --------------------------------------------------------------------------
     332//
     333// Get i-th Low Gain Sector (sector number)
     334//
     335const MHCalibrationPix  &MHCalibrationCam::GetAverageLoGainSector(UInt_t i) const
     336{
     337  return *static_cast<MHCalibrationPix*>(fAverageLoGainSectors->At(i));
     338}
     339
     340// --------------------------------------------------------------------------
     341//
     342// Calls ResetHistTitles()
    176343//
    177344// Calls Reset() for each entry in:
     
    183350{
    184351 
     352  ResetHistTitles();
     353
    185354  if (fHiGainArray)
    186355    { fHiGainArray->ForEach(MHCalibrationPix,Reset)();  }
     356
    187357  if (IsAverageing())
    188358    {
     
    209379// --------------------------------------------------------------------------
    210380//
    211 // Get i-th High Gain pixel (pixel number)
    212 //
    213 MHCalibrationPix &MHCalibrationCam::operator[](UInt_t i)
    214 {
    215   return *static_cast<MHCalibrationPix*>(fHiGainArray->UncheckedAt(i));
    216 }
    217 
    218 // --------------------------------------------------------------------------
    219 //
    220 // Get i-th High Gain pixel (pixel number)
    221 //
    222 const MHCalibrationPix &MHCalibrationCam::operator[](UInt_t i) const
    223 {
    224   return *static_cast<MHCalibrationPix*>(fHiGainArray->UncheckedAt(i));
    225 }
    226 
    227 // --------------------------------------------------------------------------
    228 //
    229 // Get i-th Low Gain pixel (pixel number)
    230 //
    231 MHCalibrationPix  &MHCalibrationCam::operator()(UInt_t i)
    232 {
    233   return *static_cast<MHCalibrationPix*>(fLoGainArray->UncheckedAt(i));
    234 }
    235 
    236 // --------------------------------------------------------------------------
    237 //
    238 // Get i-th Low Gain pixel (pixel number)
    239 //
    240 const MHCalibrationPix  &MHCalibrationCam::operator()(UInt_t i) const
    241 {
    242   return *static_cast<MHCalibrationPix*>(fLoGainArray->UncheckedAt(i));
    243 }
    244 
    245 // --------------------------------------------------------------------------
    246 //
    247 // Returns the current size of the TObjArray fAverageHiGainAreas
    248 // independently if the MHCalibrationPix is filled with values or not.
    249 //
    250 const Int_t MHCalibrationCam::GetAverageAreas() const
    251 {
    252   return fAverageHiGainAreas->GetEntries();
    253 }
    254 
    255 // --------------------------------------------------------------------------
    256 //
    257 // Get i-th High Gain pixel Area (area number)
    258 //
    259 MHCalibrationPix  &MHCalibrationCam::GetAverageHiGainArea(UInt_t i)
    260 {
    261   return *static_cast<MHCalibrationPix*>(fAverageHiGainAreas->UncheckedAt(i));
    262 }
    263 
    264 // --------------------------------------------------------------------------
    265 //
    266 // Get i-th High Gain pixel Area (area number)
    267 //
    268 const MHCalibrationPix  &MHCalibrationCam::GetAverageHiGainArea(UInt_t i) const
    269 {
    270   return *static_cast<MHCalibrationPix *>(fAverageHiGainAreas->UncheckedAt(i));
    271 }
    272 
    273 // --------------------------------------------------------------------------
    274 //
    275 // Get i-th Low Gain pixel Area (area number)
    276 //
    277 MHCalibrationPix  &MHCalibrationCam::GetAverageLoGainArea(UInt_t i)
    278 {
    279   return *static_cast<MHCalibrationPix*>(fAverageLoGainAreas->UncheckedAt(i));
    280 }
    281 
    282 // --------------------------------------------------------------------------
    283 //
    284 // Get i-th Low Gain pixel Area (area number)
    285 //
    286 const MHCalibrationPix  &MHCalibrationCam::GetAverageLoGainArea(UInt_t i) const
    287 {
    288   return *static_cast<MHCalibrationPix*>(fAverageLoGainAreas->UncheckedAt(i));
    289 }
    290 
    291 // --------------------------------------------------------------------------
    292 //
    293 // Returns the current size of the TObjArray fAverageHiGainSectors
    294 // independently if the MHCalibrationPix is filled with values or not.
    295 //
    296 const Int_t MHCalibrationCam::GetAverageSectors() const
    297 {
    298   return fAverageHiGainSectors->GetEntries();
    299 }
    300 
    301 // --------------------------------------------------------------------------
    302 //
    303 // Get i-th High Gain Sector (sector number)
    304 //
    305 MHCalibrationPix  &MHCalibrationCam::GetAverageHiGainSector(UInt_t i)
    306 {
    307   return *static_cast<MHCalibrationPix*>(fAverageHiGainSectors->UncheckedAt(i));
    308 }
    309 
    310 // --------------------------------------------------------------------------
    311 //
    312 // Get i-th High Gain Sector (sector number)
    313 //
    314 const MHCalibrationPix  &MHCalibrationCam::GetAverageHiGainSector(UInt_t i) const
    315 {
    316   return *static_cast<MHCalibrationPix*>(fAverageHiGainSectors->UncheckedAt(i));
    317 }
    318 
    319 // --------------------------------------------------------------------------
    320 //
    321 // Get i-th Low Gain Sector (sector number)
    322 //
    323 MHCalibrationPix  &MHCalibrationCam::GetAverageLoGainSector(UInt_t i)
    324 {
    325   return *static_cast<MHCalibrationPix*>(fAverageLoGainSectors->UncheckedAt(i));
    326 }
    327 
    328 // --------------------------------------------------------------------------
    329 //
    330 // Get i-th Low Gain Sector (sector number)
    331 //
    332 const MHCalibrationPix  &MHCalibrationCam::GetAverageLoGainSector(UInt_t i) const
    333 {
    334   return *static_cast<MHCalibrationPix*>(fAverageLoGainSectors->UncheckedAt(i));
     381// Resets the histogram titles for each entry in:
     382// - fHiGainArray, fLoGainArray
     383// - fAverageHiGainAreas, fAverageLoGainAreas
     384// - fAverageHiGainSectors, fAverageLoGainSectors
     385//
     386void MHCalibrationCam::ResetHistTitles()
     387{
     388 
     389  TH1F *h;
     390
     391  if (fHiGainArray)
     392    for (Int_t i=0;i<fHiGainArray->GetSize(); i++)
     393      {
     394        MHCalibrationPix &pix = (*this)[i];       
     395        h = pix.GetHGausHist();
     396        h->SetName (Form("%s%s%s%4i","H",fHistName.Data(),"HiGainPix",i));
     397        h->SetTitle(Form("%s%s%4i%s",fHistTitle.Data()," High Gain Pixel ",i," Runs: ")); 
     398        h->SetXTitle(fHistXTitle.Data());
     399        h->SetYTitle(fHistYTitle.Data());
     400      }
     401 
     402  if (IsAverageing())
     403    {
     404      if (fAverageHiGainAreas)
     405        for (Int_t j=0; j<fAverageHiGainAreas->GetSize(); j++)
     406          {
     407            MHCalibrationPix &pix = GetAverageHiGainArea(j);       
     408            h = pix.GetHGausHist();
     409            h->SetName (Form("%s%s%s%d","H",fHistName.Data(),"HiGainArea",j));
     410            h->SetXTitle(fHistXTitle.Data());
     411            h->SetYTitle(fHistYTitle.Data());
     412            if (fGeom->InheritsFrom("MGeomCamMagic"))
     413              h->SetTitle(Form("%s%s%s%s",fHistTitle.Data()," averaged on event-by-event basis ",
     414                               j==0 ? "Inner Pixels " : "Outer Pixels ","High Gain Runs: "));
     415            else
     416              h->SetTitle(Form("%s%s%d%s",fHistTitle.Data(),
     417                               " averaged on event-by-event basis High Gain Area Idx ",j," Runs: "));
     418          }
     419     
     420      if (fAverageHiGainSectors)
     421        for (Int_t j=0; j<fAverageHiGainSectors->GetSize(); j++)
     422          {
     423            MHCalibrationPix &pix = GetAverageHiGainSector(j);       
     424            h = pix.GetHGausHist();
     425            h->SetName (Form("%s%s%s%2i","H",fHistName.Data(),"HiGainSector",j));
     426            h->SetTitle(Form("%s%s%2i%s",fHistTitle.Data(),
     427                             " averaged on event-by-event basis High Gain Sector ",j," Runs: "));
     428            h->SetXTitle(fHistXTitle.Data());
     429            h->SetYTitle(fHistYTitle.Data());
     430          }
     431    }
     432 
     433  if (!IsLoGain())
     434    return;
     435 
     436  if (fLoGainArray)
     437    for (Int_t i=0;i<fLoGainArray->GetSize(); i++)
     438      {
     439        MHCalibrationPix &pix = (*this)(i);       
     440        h = pix.GetHGausHist();
     441        h->SetName (Form("%s%s%s%4i","H",fHistName.Data(),"LoGainPix",i));
     442        h->SetTitle(Form("%s%s%4i%s",fHistTitle.Data()," Low Gain Pixel ",i," Runs: ")); 
     443        h->SetXTitle(fHistXTitle.Data());
     444        h->SetYTitle(fHistYTitle.Data());
     445      }
     446 
     447  if (IsAverageing())
     448    {
     449      if (fAverageLoGainAreas)
     450        for (Int_t j=0; j<fAverageLoGainAreas->GetSize(); j++)
     451          {
     452            MHCalibrationPix &pix = GetAverageLoGainArea(j);       
     453            h = pix.GetHGausHist();
     454            h->SetName (Form("%s%s%s%d","H",fHistName.Data(),"LoGainArea",j));
     455            h->SetXTitle(fHistXTitle.Data());
     456            h->SetYTitle(fHistYTitle.Data());
     457            if (fGeom->InheritsFrom("MGeomCamMagic"))
     458              h->SetTitle(Form("%s%s%s%s",fHistTitle.Data()," averaged on event-by-event basis ",
     459                               j==0 ? "Inner Pixels " : "Outer Pixels ","Low Gain Runs: "));
     460            else
     461              h->SetTitle(Form("%s%s%d%s",fHistTitle.Data(),
     462                               " averaged on event-by-event basis Low Gain Area Idx ",j," Runs: "));
     463          }
     464     
     465      if (fAverageLoGainSectors)
     466        for (Int_t j=0; j<fAverageLoGainSectors->GetSize(); j++)
     467          {
     468            MHCalibrationPix &pix = GetAverageLoGainSector(j);       
     469            h = pix.GetHGausHist();
     470            h->SetName (Form("%s%s%s%2i","H",fHistName.Data(),"LoGainSector",j));
     471            h->SetTitle(Form("%s%s%2i%s",fHistTitle.Data(),
     472                             " averaged on event-by-event basis Low Gain Sector ",j," Runs: "));
     473            h->SetXTitle(fHistXTitle.Data());
     474            h->SetYTitle(fHistYTitle.Data());
     475          }
     476    }
    335477}
    336478
     
    381523
    382524// --------------------------------------------------------------------------
     525//
     526// Searches MRawEvtHeader to find the correct pulser colour
    383527//
    384528// Gets or creates the pointers to:
     
    487631    return kFALSE;
    488632
     633  ResetHistTitles();
     634
    489635  if (!fRunHeader)
    490636    return kTRUE;
    491637 
    492   for (Int_t i=0; i<fHiGainArray->GetEntries(); i++)
     638  for (Int_t i=0; i<fHiGainArray->GetSize(); i++)
    493639    {
    494640      TH1F *h = (*this)[i].GetHGausHist();
     
    497643
    498644  if (IsLoGain())
    499     for (Int_t i=0; i<fLoGainArray->GetEntries(); i++)
     645    for (Int_t i=0; i<fLoGainArray->GetSize(); i++)
    500646      {
    501647        TH1F *h = (*this)(i).GetHGausHist();
     
    538684//
    539685// Initializes the High Gain Arrays:
    540 //
    541 // - Expand fHiGainArrays to npixels
    542 // - Expand fAverageHiGainAreas to nareas
    543 // - Expand fAverageHiGainSectors to nsectors
    544686//
    545687// - For every entry in the expanded arrays:
     
    553695{
    554696
    555   if (fHiGainArray->GetEntries()==0)
     697  if (fHiGainArray->GetSize()==0)
    556698  {
    557       fHiGainArray->Expand(npixels);
    558699      for (Int_t i=0; i<npixels; i++)
    559700      {
    560         (*fHiGainArray)[i] = new MHCalibrationPix(Form("%s%s",fHistName.Data(),"HiGainPix"),
    561                                                   Form("%s%s",fHistTitle.Data()," High Gain Pixel"));
     701        fHiGainArray->AddAt(new MHCalibrationPix(Form("%s%s",fHistName.Data(),"HiGainPix"),
     702                                                 Form("%s%s",fHistTitle.Data()," High Gain Pixel")),i);
    562703       
    563704        MHCalibrationPix &pix = (*this)[i];         
     
    566707        pix.SetLast (fLast);
    567708       
    568         TH1F *h =  pix.GetHGausHist();
    569        
    570         h->SetName (Form("%s%s%s","H",fHistName.Data(),"HiGainPix"));
    571         h->SetTitle(Form("%s%s",fHistTitle.Data()," High Gain Pixel ")); 
    572         h->SetXTitle(fHistXTitle.Data());
    573         h->SetYTitle(fHistYTitle.Data());
    574        
    575709        MBadPixelsPix &bad = fIntensBad ? (*fIntensBad)[i] : (*fBadPixels)[i];
    576710        InitHists(pix,bad,i);
     
    581715    return;
    582716
    583   if (fAverageHiGainAreas->GetEntries()==0)
     717  if (fAverageHiGainAreas->GetSize()==0)
    584718  {
    585     fAverageHiGainAreas->Expand(nareas);
    586    
    587719    for (Int_t j=0; j<nareas; j++)
    588720      {
    589         (*fAverageHiGainAreas)[j] = new MHCalibrationPix(Form("%s%s",fHistName.Data(),"HiGainArea"),
    590                                                          Form("%s%s",fHistTitle.Data()," High Gain Area Idx "));
     721        fAverageHiGainAreas->AddAt(new MHCalibrationPix(Form("%s%s",fHistName.Data(),"HiGainArea"),
     722                                                        Form("%s%s",fHistTitle.Data()," High Gain Area Idx ")),j);
    591723       
    592724        MHCalibrationPix &pix = GetAverageHiGainArea(j);
     
    595727        pix.SetFirst(fFirst);
    596728        pix.SetLast (fLast);
    597        
    598         TH1F *h =  pix.GetHGausHist();
    599 
    600         h->SetName (Form("%s%s%s","H",fHistName.Data(),"HiGainArea"));
    601         h->SetXTitle(fHistXTitle.Data());
    602         h->SetYTitle(fHistYTitle.Data());
    603729
    604730        if (fGeom && fGeom->InheritsFrom("MGeomCamMagic"))
    605731          {
    606             h->SetTitle(Form("%s%s%s%s",fHistTitle.Data()," averaged on event-by-event basis ",
    607                              j==0 ? "Inner Pixels " : "Outer Pixels ","High Gain Runs: "));
    608732            pix.InitBins();
    609733            pix.SetEventFrequency(fPulserFrequency);
    610734          }
    611735        else
    612           {
    613             h->SetTitle(Form("%s%s",fHistTitle.Data()," averaged on event-by-event basis High Gain Area Idx "));
    614             InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j);
    615           }
     736          InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j);
    616737      }
    617738  }
    618739
    619   if (fAverageHiGainSectors->GetEntries()==0)
    620     {
    621       fAverageHiGainSectors->Expand(nsectors);
    622 
     740  if (fAverageHiGainSectors->GetSize()==0)
     741    {
    623742      for (Int_t j=0; j<nsectors; j++)
    624743        {
    625           (*fAverageHiGainSectors)[j] = new MHCalibrationPix(Form("%s%s",fHistName.Data(),"HiGainSector"),
    626                                                              Form("%s%s",fHistTitle.Data()," High Gain Sector "));
     744          fAverageHiGainSectors->AddAt(new MHCalibrationPix(Form("%s%s",fHistName.Data(),"HiGainSector"),
     745                                                            Form("%s%s",fHistTitle.Data()," High Gain Sector ")),j);
    627746          MHCalibrationPix &pix = GetAverageHiGainSector(j);
    628747
     
    631750          pix.SetLast (fLast);
    632751         
    633           TH1F *h =  pix.GetHGausHist();
    634 
    635           h->SetName (Form("%s%s%s","H",fHistName.Data(),"HiGainSector"));
    636           h->SetTitle(Form("%s%s",fHistTitle.Data()," High Gain Sector ")); 
    637           h->SetXTitle(fHistXTitle.Data());
    638           h->SetYTitle(fHistYTitle.Data());
    639 
    640752          InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j);
    641753      }
     
    649761// Initializes the Low Gain Arrays:
    650762//
    651 // - Expand fLoGainArrays to npixels
    652 // - Expand fAverageLoGainAreas to nareas
    653 // - Expand fAverageLoGainSectors to nsectors
    654 //
    655763// - For every entry in the expanded arrays:
    656764//   * Initialize an MHCalibrationPix
     
    666774    return;
    667775
    668   if (fLoGainArray->GetEntries()==0)
     776  if (fLoGainArray->GetSize()==0)
    669777  {
    670       fLoGainArray->Expand(npixels);
    671778      for (Int_t i=0; i<npixels; i++)
    672779      {
    673         (*fLoGainArray)[i] = new MHCalibrationPix(Form("%s%s",fHistName.Data(),"LoGainPix"),
    674                                                   Form("%s%s",fHistTitle.Data()," Low Gain Pixel"));
     780        fLoGainArray->AddAt(new MHCalibrationPix(Form("%s%s",fHistName.Data(),"LoGainPix"),
     781                                                 Form("%s%s",fHistTitle.Data()," Low Gain Pixel")),i);
    675782
    676783          MHCalibrationPix &pix = (*this)[i];         
     
    679786          pix.SetLast (fLast);
    680787
    681           TH1F *h =  pix.GetHGausHist();
    682          
    683           h->SetName (Form("%s%s%s","H",fHistName.Data(),"LoGainPix"));
    684           h->SetTitle(Form("%s%s",fHistTitle.Data()," Low Gain Pixel ")); 
    685           h->SetXTitle(fHistXTitle.Data());
    686           h->SetYTitle(fHistYTitle.Data());
    687 
    688788          MBadPixelsPix &bad = fIntensBad ? (*fIntensBad)[i] : (*fBadPixels)[i];
    689789          InitHists(pix,bad,i);
     
    694794    return;
    695795
    696   if (fAverageLoGainAreas->GetEntries()==0)
     796  if (fAverageLoGainAreas->GetSize()==0)
    697797  {
    698     fAverageLoGainAreas->Expand(nareas);
    699    
    700798    for (Int_t j=0; j<nareas; j++)
    701799      {
    702         (*fAverageLoGainAreas)[j] = new MHCalibrationPix(Form("%s%s",fHistName.Data(),"LoGainArea"),
    703                                                          Form("%s%s",fHistTitle.Data()," Low Gain Area Idx "));
     800        fAverageLoGainAreas->AddAt(new MHCalibrationPix(Form("%s%s",fHistName.Data(),"LoGainArea"),
     801                                                        Form("%s%s",fHistTitle.Data()," Low Gain Area Idx ")),j);
    704802       
    705803        MHCalibrationPix &pix = GetAverageLoGainArea(j);
     
    709807        pix.SetLast (fLast);
    710808       
    711         TH1F *h =  pix.GetHGausHist();
    712 
    713         h->SetName (Form("%s%s%s","H",fHistName.Data(),"LoGainArea"));
    714         h->SetXTitle(fHistXTitle.Data());
    715         h->SetYTitle(fHistYTitle.Data());
    716 
    717809        if (fGeom && fGeom->InheritsFrom("MGeomCamMagic"))
    718810          {
    719             h->SetTitle(Form("%s%s%s%s",fHistTitle.Data()," averaged on event-by-event basis ",
    720                              j==0 ? "Inner Pixels " : "Outer Pixels ","Low Gain Runs: "));
    721811            pix.InitBins();
    722812            pix.SetEventFrequency(fPulserFrequency);
    723813          }
    724814        else
    725           {
    726             h->SetTitle(Form("%s%s",fHistTitle.Data()," averaged on event-by-event basis Low Gain Area Idx "));
    727             InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j);
    728           }
     815          InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j);
    729816      }
    730817  }
    731818
    732   if (fAverageLoGainSectors->GetEntries()==0)
    733     {
    734       fAverageLoGainSectors->Expand(nsectors);
    735 
     819  if (fAverageLoGainSectors->GetSize()==0)
     820    {
    736821      for (Int_t j=0; j<nsectors; j++)
    737822        {
    738           (*fAverageLoGainSectors)[j] = new MHCalibrationPix(Form("%s%s",fHistName.Data(),"LoGainSector"),
    739                                                              Form("%s%s",fHistTitle.Data()," Low Gain Sector "));
     823          fAverageLoGainSectors->AddAt(new MHCalibrationPix(Form("%s%s",fHistName.Data(),"LoGainSector"),
     824                                                            Form("%s%s",fHistTitle.Data()," Low Gain Sector ")),j);
    740825          MHCalibrationPix &pix = GetAverageLoGainSector(j);
    741826
     
    744829          pix.SetLast (fLast);
    745830         
    746           TH1F *h =  pix.GetHGausHist();
    747 
    748           h->SetName (Form("%s%s%s","H",fHistName.Data(),"LoGainSector"));
    749           h->SetTitle(Form("%s%s",fHistTitle.Data()," Low Gain Sector ")); 
    750           h->SetXTitle(fHistXTitle.Data());
    751           h->SetYTitle(fHistYTitle.Data());
    752 
    753831          InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j);
    754832      }
     
    763841// - number of sectors
    764842//
    765 // Return kFALSE, if sizes of the TObjArrays do not match npixels, nareas or nsectors
     843// Return kFALSE, if sizes of the TOrdCollections do not match npixels, nareas or nsectors
    766844//
    767845// Call FillHists()
     
    778856 
    779857  //
    780   // Hi-Gain ObjArrays
     858  // Hi-Gain OrdCollections
    781859  //
    782   if (fHiGainArray->GetEntries() != npixels)
     860  if (fHiGainArray->GetSize() != npixels)
    783861    {
    784862      *fLog << err << "ERROR - Size mismatch in number of pixels... abort." << endl;
     
    788866  if (IsLoGain())
    789867    {
    790       if (fLoGainArray->GetEntries() != npixels)
     868      if (fLoGainArray->GetSize() != npixels)
    791869        {
    792870          *fLog << err << "ERROR - Size mismatch in number of pixels... abort." << endl;
     
    798876    return FillHists(par,w);
    799877
    800   if (fAverageHiGainAreas->GetEntries() != nareas)
     878  if (fAverageHiGainAreas->GetSize() != nareas)
    801879    {
    802880      *fLog << err << "ERROR - Size mismatch in number of areas ... abort." << endl;
     
    804882    }
    805883 
    806   if (fAverageHiGainSectors->GetEntries() != nsectors)
     884  if (fAverageHiGainSectors->GetSize() != nsectors)
    807885    {
    808886      *fLog << err << "ERROR - Size mismatch in number of sectors ... abort." << endl;
     
    813891    {
    814892     
    815       if (fAverageLoGainAreas->GetEntries() != nareas)
     893      if (fAverageLoGainAreas->GetSize() != nareas)
    816894        {
    817895          *fLog << err << "ERROR - Size mismatch in number of areas ... abort." << endl;
     
    819897        }
    820898     
    821       if (fAverageLoGainSectors->GetEntries() != nsectors)
     899      if (fAverageLoGainSectors->GetSize() != nsectors)
    822900        {
    823901          *fLog << err << "ERROR - Size mismatch in number of sectors ... abort." << endl;
     
    840918{
    841919
    842   if (fHiGainArray->GetEntries() == 0 && fLoGainArray->GetEntries() == 0)
     920  if (fHiGainArray->GetSize() == 0 && fLoGainArray->GetSize() == 0)
    843921    {
    844922      *fLog << err << GetDescriptor()
     
    847925    }
    848926 
     927  for (Int_t i=0; i<fAverageHiGainAreas->GetSize(); i++)
     928    {
     929      TH1F *h = GetAverageHiGainArea(i).GetHGausHist();
     930      switch (fColor)
     931        {
     932        case MCalibrationCam::kNONE:
     933          break;
     934        case MCalibrationCam::kBLUE:
     935          h->SetTitle( Form("%s%s", h->GetTitle(),"BLUE "));
     936          break;
     937        case MCalibrationCam::kGREEN:
     938          h->SetTitle( Form("%s%s", h->GetTitle(),"GREEN "));
     939          break;
     940        case MCalibrationCam::kUV:
     941          h->SetTitle( Form("%s%s", h->GetTitle(),"UV "));
     942          break;
     943        case MCalibrationCam::kCT1:
     944          h->SetTitle( Form("%s%s", h->GetTitle(),"CT1-Pulser "));
     945          break;
     946        }
     947    }
     948
     949  for (Int_t i=0; i<fAverageLoGainAreas->GetSize(); i++)
     950    {
     951      TH1F *h = GetAverageLoGainArea(i).GetHGausHist();
     952      switch (fColor)
     953        {
     954        case MCalibrationCam::kNONE:
     955          break;
     956        case MCalibrationCam::kBLUE:
     957          h->SetTitle( Form("%s%s", h->GetTitle(),"BLUE "));
     958          break;
     959        case MCalibrationCam::kGREEN:
     960          h->SetTitle( Form("%s%s", h->GetTitle(),"GREEN "));
     961          break;
     962        case MCalibrationCam::kUV:
     963          h->SetTitle( Form("%s%s", h->GetTitle(),"UV "));
     964          break;
     965        case MCalibrationCam::kCT1:
     966          h->SetTitle( Form("%s%s", h->GetTitle(),"CT1-Pulser "));
     967          break;
     968        }
     969    }
     970 
    849971  if (!FinalizeHists())
    850972    return kFALSE;
     973
    851974
    852975  FinalizeBadPixels();
     
    873996
    874997  hist.InitBins();
    875   hist.ChangeHistId(i);
    876998  hist.SetEventFrequency(fPulserFrequency);
    877 
    878   TH1F *h = hist.GetHGausHist();
    879   h->SetTitle( Form("%s%s", h->GetTitle()," Runs: "));
    880999}
    8811000
     
    9041023     
    9051024      FitHiGainHists(hist,pix,bad,fittyp,osctyp);
    906      
    9071025    }
    9081026
     
    9131031    {
    9141032     
    915       MHCalibrationPix     &hist = GetAverageHiGainArea(j);     
     1033      MHCalibrationPix &hist = GetAverageHiGainArea(j);     
    9161034      MCalibrationPix  &pix  = calcam.GetAverageArea(j);
    9171035      MBadPixelsPix    &bad  = calcam.GetAverageBadArea(j);       
    918      
     1036
    9191037      FitHiGainHists(hist,pix,bad,fittyp,osctyp);
    9201038  }
    9211039 
    922 
    9231040  for (Int_t j=0; j<fAverageHiGainSectors->GetSize(); j++)
    9241041    {
    925      
    926       MHCalibrationPix     &hist = GetAverageHiGainSector(j);     
     1042      MHCalibrationPix &hist = GetAverageHiGainSector(j);     
    9271043      MCalibrationPix  &pix  = calcam.GetAverageSector(j);
    9281044      MBadPixelsPix    &bad  = calcam.GetAverageBadSector(j);       
    929      
     1045
    9301046      FitHiGainHists(hist,pix,bad,fittyp,osctyp);
    9311047    }
    932 
    9331048}
    9341049
     
    9761091  }
    9771092 
    978 
    9791093  for (Int_t j=0; j<fAverageLoGainSectors->GetSize(); j++)
    9801094    {
     
    10451159                                      MBadPixelsPix::UncalibratedType_t osctyp)
    10461160{
    1047 
    10481161
    10491162  if (hist.IsEmpty() || hist.IsOnlyOverflow() || hist.IsOnlyUnderflow())
     
    10881201  if (IsDebug())
    10891202    {
    1090       *fLog << dbginf << GetDescriptor() << ": ID " << hist.GetPixId()
     1203      *fLog << dbginf << GetDescriptor() << ": ID " << GetName()
    10911204            << " HiGainSaturation: "   << pix.IsHiGainSaturation()
    10921205            << " HiGainMean: "         << hist.GetMean    ()
     
    11701283  if (IsDebug())
    11711284    {
    1172       *fLog << dbginf << GetDescriptor() << "ID: " << hist.GetPixId()
     1285      *fLog << dbginf << GetDescriptor() << "ID: " << hist.GetName()
    11731286            << " HiGainSaturation: "   << pix.IsHiGainSaturation()
    11741287            << " LoGainMean: "         << hist.GetMean    ()
     
    12001313    return;
    12011314
    1202   const Int_t nareas = fAverageHiGainAreas->GetEntries();
     1315  const Int_t nareas = fAverageHiGainAreas->GetSize();
    12031316  if (nareas == 0)
    12041317    return;
Note: See TracChangeset for help on using the changeset viewer.