Changeset 4959


Ignore:
Timestamp:
09/12/04 21:47:54 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhcalib
Files:
2 edited

Legend:

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

    r4949 r4959  
    131131}
    132132
     133// --------------------------------------------------------------------------
     134//
     135// Returns size of fHiGainArray
     136//
    133137const Int_t MHCalibrationCam::GetSize() const
    134138{
     
    156160}
    157161
     162// --------------------------------------------------------------------------
     163//
     164// Calls Reset() for each entry in:
     165// - fHiGainArray, fLoGainArray
     166// - fAverageHiGainAreas, fAverageLoGainAreas
     167// - fAverageHiGainSectors, fAverageLoGainSectors
     168//
    158169void MHCalibrationCam::ResetHists()
    159170{
     
    161172  if (fHiGainArray)
    162173    { fHiGainArray->ForEach(MHCalibrationPix,Reset)();  }
     174  if (fAverageHiGainAreas)
     175    { fAverageHiGainAreas->ForEach(MHCalibrationPix,Reset)();  }
     176  if (fAverageHiGainSectors)
     177    { fAverageHiGainSectors->ForEach(MHCalibrationPix,Reset)();  }
     178
     179  if (!IsLoGain())
     180    return;
     181
    163182  if (fLoGainArray)
    164183    { fLoGainArray->ForEach(MHCalibrationPix,Reset)();  }
    165  
    166   if (fAverageHiGainAreas)
    167     { fAverageHiGainAreas->ForEach(MHCalibrationPix,Reset)();  }
    168184  if (fAverageLoGainAreas)
    169185    { fAverageLoGainAreas->ForEach(MHCalibrationPix,Reset)();  }
    170   if (fAverageHiGainSectors)
    171     { fAverageHiGainSectors->ForEach(MHCalibrationPix,Reset)();  }
    172186  if (fAverageLoGainSectors)
    173187    { fAverageLoGainSectors->ForEach(MHCalibrationPix,Reset)();  }
     
    175189}
    176190
    177 
    178 
    179191// --------------------------------------------------------------------------
    180192//
     
    308320// --------------------------------------------------------------------------
    309321//
    310 // Our own clone function is necessary since root 3.01/06 or Mars 0.4
    311 // I don't know the reason.
    312 //
    313 // Creates new MHCalibrationCam
    314 // Deletes the TObjArray's and Clones them individually
    315 // Copies the TArray's
    316 // Copies the fPulserFrequency
     322// Creates new MHCalibrationCam only for the averaged areas:
     323// the rest has to be retrieved directly, e.g. via:
     324//  MHCalibrationCam *cam = MParList::FindObject("MHCalibrationCam");
     325//  -  cam->GetAverageSector(5).DrawClone();
     326//  -  (*cam)[100].DrawClone()
    317327//
    318328TObject *MHCalibrationCam::Clone(const char *) const
     
    322332  //  const Int_t nlo   = fLoGainArray->GetEntries();
    323333  const Int_t navhi = fAverageHiGainAreas->GetEntries();
    324   const Int_t navlo = fAverageLoGainAreas->GetEntries();
    325   const Int_t nsehi = fAverageHiGainSectors->GetEntries();
    326   const Int_t nselo = fAverageLoGainSectors->GetEntries();
     334  //  const Int_t nsehi = fAverageHiGainSectors->GetEntries();
    327335 
    328336  //
     
    335343  cam->fAverageHiGainAreas->Expand(navhi);
    336344  cam->fAverageLoGainAreas->Expand(navlo);
    337   cam->fAverageHiGainSectors->Expand(nsehi);
    338   cam->fAverageLoGainSectors->Expand(nselo);
     345  //  cam->fAverageHiGainSectors->Expand(nsehi);
     346  //  cam->fAverageLoGainSectors->Expand(nselo);
    339347
    340348  /*
     
    352360 
    353361  for (int i=0; i<navhi; i++)
    354     {
    355       //      delete (*cam->fAverageHiGainAreas)[i];
    356       (*cam->fAverageHiGainAreas)[i] = (*fAverageHiGainAreas)[i]->Clone();
    357     }
    358   for (int i=0; i<navlo; i++)
    359     {
    360       //      delete (*cam->fAverageLoGainAreas)[i];
    361       (*cam->fAverageLoGainAreas)[i] = (*fAverageLoGainAreas)[i]->Clone();
    362     }
    363   for (int i=0; i<nsehi; i++)
    364     {
    365       //      delete (*cam->fAverageHiGainSectors)[i];
    366       (*cam->fAverageHiGainSectors)[i] = (*fAverageHiGainSectors)[i]->Clone();
    367     }
    368   for (int i=0; i<nselo; i++)
    369     {
    370       //      delete (*cam->fAverageLoGainSectors)[i];
    371       (*cam->fAverageLoGainSectors)[i] = (*fAverageLoGainSectors)[i]->Clone();
     362    (*cam->fAverageHiGainAreas)[i] = (*fAverageHiGainAreas)[i]->Clone();
     363
     364  //  for (int i=0; i<nsehi; i++)
     365  //    (*cam->fAverageHiGainSectors)[i] = (*fAverageHiGainSectors)[i]->Clone();
     366
     367  if (IsLoGain())
     368    {
     369
     370      const Int_t navlo = fAverageLoGainAreas->GetEntries();
     371
     372      cam->fAverageLoGainAreas->Expand(navlo);
     373      //      cam->fAverageLoGainSectors->Expand(nselo);
     374      //  const Int_t nselo = fAverageLoGainSectors->GetEntries();
     375     
     376      for (int i=0; i<navlo; i++)
     377        (*cam->fAverageLoGainAreas)[i] = (*fAverageLoGainAreas)[i]->Clone();
     378
     379      //      for (int i=0; i<nselo; i++)
     380      //        (*cam->fAverageLoGainSectors)[i] = (*fAverageLoGainSectors)[i]->Clone();
    372381    }
    373382
     
    575584//
    576585// - For every entry in the expanded arrays:
    577 //   * call new MHCalibrationPix(fHistName,fHistTitle)
    578 //   * SetNbins(fNbins), SetFirst(fFirst), SetLast(fLast)
    579 //   * Set fHistName and fHistTitle in the Histogram of MHCalibrationPix
     586//   * Initialize an MHCalibrationPix
     587//   * Set Binning from  fNbins, fFirst and fLast
     588//   * Set Histgram names and titles from fHistName and fHistTitle
    580589//   * Set X-axis and Y-axis titles with fHistXTitle and fHistYTitle
    581590//   * Call InitHists
     
    681690//
    682691// - For every entry in the expanded arrays:
    683 //   * call new MHCalibrationPix(fHistName,fHistTitle)
    684 //   * SetBins(fNbins), SetFirst(fFirst), SetLast(fLast)
    685 //   * Set fHistName and fHistTitle in the Histogram of MHCalibrationPix
     692//   * Initialize an MHCalibrationPix
     693//   * Set Binning from  fNbins, fFirst and fLast
     694//   * Set Histgram names and titles from fHistName and fHistTitle
    686695//   * Set X-axis and Y-axis titles with fHistXTitle and fHistYTitle
    687696//   * Call InitHists
     
    779788}
    780789
    781 
    782 
    783790//--------------------------------------------------------------------------------
    784791//
     
    788795// - number of sectors
    789796//
    790 // For all TObjArray's (including the averaged ones), the following steps are performed:
    791 //
    792 // 1) Test size and return kFALSE if not matching
    793 // 2)
     797// Return kFALSE, if sizes of the TObjArrays do not match npixels, nareas or nsectors
     798//
     799// Call FillHists()
    794800//
    795801Bool_t MHCalibrationCam::Fill(const MParContainer *par, const Stat_t w)
     
    800806  const Int_t nsectors = fGeom->GetNumSectors();
    801807 
     808  //
     809  // Hi-Gain ObjArrays
     810  //
    802811  if (fHiGainArray->GetEntries() != npixels)
    803812    {
    804       *fLog << err << "ERROR - Size mismatch... abort." << endl;
     813      *fLog << err << "ERROR - Size mismatch in number of pixels... abort." << endl;
    805814      return kFALSE;
    806815    }
    807  
    808   if (IsLoGain())
    809     if (fLoGainArray->GetEntries() != npixels)
    810       {
    811         *fLog << err << "ERROR - Size mismatch... abort." << endl;
    812         return kFALSE;
    813       }
    814816 
    815817  if (fAverageHiGainAreas->GetEntries() != nareas)
     
    819821    }
    820822
    821   if (IsLoGain())
    822     if (fAverageLoGainAreas->GetEntries() != nareas)
    823       {
    824         *fLog << err << "ERROR - Size mismatch in number of areas ... abort." << endl;
    825         return kFALSE;
    826     }
    827  
    828823  if (fAverageHiGainSectors->GetEntries() != nsectors)
    829824    {
     
    833828
    834829  if (IsLoGain())
    835     if (fAverageLoGainSectors->GetEntries() != nsectors)
    836       {
    837         *fLog << err << "ERROR - Size mismatch in number of sectors ... abort." << endl;
    838         return kFALSE;
    839       }
     830    {
     831      if (fLoGainArray->GetEntries() != npixels)
     832        {
     833          *fLog << err << "ERROR - Size mismatch in number of pixels... abort." << endl;
     834          return kFALSE;
     835        }
     836     
     837      if (fAverageLoGainAreas->GetEntries() != nareas)
     838        {
     839          *fLog << err << "ERROR - Size mismatch in number of areas ... abort." << endl;
     840          return kFALSE;
     841        }
     842     
     843      if (fAverageLoGainSectors->GetEntries() != nsectors)
     844        {
     845          *fLog << err << "ERROR - Size mismatch in number of sectors ... abort." << endl;
     846          return kFALSE;
     847        }
     848    }
    840849 
    841850  return FillHists(par, w);
    842 }
    843 
    844 Bool_t MHCalibrationCam::FillHists(const MParContainer *par, const Stat_t w)
    845 {
    846   *fLog << warn << GetDescriptor() << "FillHists not overloaded! Can't be used!" << endl;
    847   return kFALSE;
    848851}
    849852
     
    874877  return kTRUE;
    875878}
    876 
    877 Bool_t MHCalibrationCam::FinalizeHists()
    878 {
    879   return kTRUE;
    880 }
    881 
    882 void MHCalibrationCam::FinalizeBadPixels()
    883 {
    884 }
    885 
    886879
    887880// -------------------------------------------------------------
     
    909902}
    910903
     904// --------------------------------------------------------------------------
     905//
     906// Calls FitHiGainHists for every entry in:
     907// - fHiGainArray
     908// - fAverageHiGainAreas
     909// - fAverageHiGainSectors
     910//
    911911void MHCalibrationCam::FitHiGainArrays(MCalibrationCam &calcam, MBadPixelsCam &badcam,
    912912                                       MBadPixelsPix::UncalibratedType_t fittyp,
     
    952952}
    953953
     954// --------------------------------------------------------------------------
     955//
     956// Calls FitLoGainHists for every entry in:
     957// - fLoGainArray
     958// - fAverageLoGainAreas
     959// - fAverageLoGainSectors
     960//
    954961void MHCalibrationCam::FitLoGainArrays(MCalibrationCam &calcam, MBadPixelsCam &badcam,
    955962                                            MBadPixelsPix::UncalibratedType_t fittyp,
     
    957964{
    958965 
     966  if (!IsLoGain())
     967    return;
     968
    959969  for (Int_t i=0; i<fLoGainArray->GetSize(); i++)
    960970    {
     
    12901300Int_t MHCalibrationCam::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
    12911301{
    1292     Bool_t rc = kFALSE;
    1293     if (IsEnvDefined(env, prefix, "Debug", print))
    1294     {
    1295         SetDebug(GetEnvValue(env, prefix, "Debug", IsDebug()));
    1296         rc = kTRUE;
    1297     }
    1298     if (IsEnvDefined(env, prefix, "LoGain", print))
    1299     {
    1300         SetDebug(GetEnvValue(env, prefix, "LoGain", IsLoGain()));
    1301         rc = kTRUE;
    1302     }
    1303     if (IsEnvDefined(env, prefix, "Oscillations", print))
    1304     {
    1305         SetOscillations(GetEnvValue(env, prefix, "Oscillations", IsOscillations()));
    1306         rc = kTRUE;
    1307     }
    1308 
    1309     if (IsEnvDefined(env, prefix, "Nbins", print))
    1310     {
    1311         SetNbins(GetEnvValue(env, prefix, "Nbins", fNbins));
    1312         rc = kTRUE;
    1313     }
    1314     if (IsEnvDefined(env, prefix, "First", print))
    1315     {
    1316         SetFirst(GetEnvValue(env, prefix, "First", fFirst));
    1317         rc = kTRUE;
    1318     }
    1319     if (IsEnvDefined(env, prefix, "Last", print))
    1320     {
    1321         SetLast(GetEnvValue(env, prefix, "Last", fLast));
    1322         rc = kTRUE;
    1323     }
    1324 
    1325     return rc;
    1326 }
     1302
     1303  Bool_t rc = kFALSE;
     1304  if (IsEnvDefined(env, prefix, "Debug", print))
     1305    {
     1306      SetDebug(GetEnvValue(env, prefix, "Debug", IsDebug()));
     1307      rc = kTRUE;
     1308    }
     1309  if (IsEnvDefined(env, prefix, "LoGain", print))
     1310    {
     1311      SetDebug(GetEnvValue(env, prefix, "LoGain", IsLoGain()));
     1312      rc = kTRUE;
     1313    }
     1314  if (IsEnvDefined(env, prefix, "Oscillations", print))
     1315    {
     1316      SetOscillations(GetEnvValue(env, prefix, "Oscillations", IsOscillations()));
     1317      rc = kTRUE;
     1318    }
     1319 
     1320  if (IsEnvDefined(env, prefix, "Nbins", print))
     1321    {
     1322      SetNbins(GetEnvValue(env, prefix, "Nbins", fNbins));
     1323      rc = kTRUE;
     1324    }
     1325  if (IsEnvDefined(env, prefix, "First", print))
     1326    {
     1327      SetFirst(GetEnvValue(env, prefix, "First", fFirst));
     1328      rc = kTRUE;
     1329    }
     1330  if (IsEnvDefined(env, prefix, "Last", print))
     1331    {
     1332      SetLast(GetEnvValue(env, prefix, "Last", fLast));
     1333      rc = kTRUE;
     1334    }
     1335 
     1336  return rc;
     1337}
  • trunk/MagicSoft/Mars/mhcalib/MHCalibrationCam.h

    r4949 r4959  
    9696  virtual Bool_t SetupHists ( const MParList *pList ) { return kTRUE; }
    9797  virtual Bool_t ReInitHists(       MParList *pList ) { return kTRUE; }
    98   virtual Bool_t FillHists  ( const MParContainer *par, const Stat_t w=1);
    99   virtual Bool_t FinalizeHists    ();
    100   virtual void   FinalizeBadPixels();
     98  virtual Bool_t FillHists  ( const MParContainer *par, const Stat_t w=1) { return kTRUE; }
     99  virtual Bool_t FinalizeHists()                      { return kTRUE;  }
     100 
     101  virtual void   FinalizeBadPixels() { }
    101102 
    102103  virtual void   CalcAverageSigma();
Note: See TracChangeset for help on using the changeset viewer.