Ignore:
Timestamp:
04/03/04 17:50:04 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mcalib
Files:
10 edited

Legend:

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

    r3480 r3638  
    226226
    227227         
    228           MCalibrationChargePix &pix = (*fCalibrations)[pixidx];
     228          MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCalibrations)[pixidx];
    229229          MBadPixelsPix         &bad = (*fBadPixels)[pixidx];
    230230
  • trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc

    r3466 r3638  
    248248  if(fCalibrationMode!=kNone)
    249249  {
    250     MCalibrationChargePix &pix = (*fCalibrations)[pixidx];       
     250    MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCalibrations)[pixidx];       
    251251    MBadPixelsPix         &bad = (*fBadPixels)[pixidx];
    252252   
  • trunk/MagicSoft/Mars/mcalib/MCalibrationCam.h

    r3634 r3638  
    1616class MCalibrationCam : public MParContainer, public MCamEvent
    1717{
     18
    1819protected:
    1920 
     
    2425  TClonesArray *fAverageBadSectors;  //-> Array of MBadPixelsPix, one per camera sector
    2526 
    26   Byte_t  fFlags;
    27 
     27  Byte_t fFlags;                     // Byte to hold the flags
     28 
    2829public:
    2930
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc

    r3626 r3638  
    378378    {
    379379
    380       MCalibrationChargePix &pix = (*fCam)      [i];
     380      MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
    381381      MCalibrationQEPix     &pqe = (*fQECam)    [i];
    382382      MBadPixelsPix         &bad = (*fBadPixels)[i];
     
    491491  // 4) Pixel has a charge sigma bigger than its Pedestal RMS
    492492  //
    493   if (cal.GetMeanCharge() < fChargeLimit*cal.GetPedRms())
    494     {
    495       *fLog << warn << "WARNING: Fitted Charge: " << cal.GetMeanCharge() << " is smaller than "
     493  if (cal.GetMean() < fChargeLimit*cal.GetPedRms())
     494    {
     495      *fLog << warn << "WARNING: Fitted Charge: " << cal.GetMean() << " is smaller than "
    496496            << fChargeLimit << " Pedestal RMS: " <<  cal.GetPedRms() << " in Pixel  " << cal.GetPixId() << endl;
    497497      bad.SetUncalibrated( MBadPixelsPix::kChargeIsPedestal);
     
    499499    }
    500500 
    501   if (cal.GetMeanChargeErr() < fChargeErrLimit)
    502     {
    503       *fLog << warn << "WARNING: Sigma of Fitted Charge: " << cal.GetMeanChargeErr() << " is smaller than "
     501  if (cal.GetMeanErr() < fChargeErrLimit)
     502    {
     503      *fLog << warn << "WARNING: Sigma of Fitted Charge: " << cal.GetMeanErr() << " is smaller than "
    504504            << fChargeErrLimit << " in Pixel  " << cal.GetPixId() << endl;
    505505      bad.SetUncalibrated( MBadPixelsPix::kChargeErrNotValid );
     
    507507    }
    508508     
    509    if (cal.GetMeanCharge() < fChargeRelErrLimit*cal.GetMeanChargeErr())
    510     {
    511       *fLog << warn << "WARNING: Fitted Charge: " << cal.GetMeanCharge() << " is smaller than "
    512             << fChargeRelErrLimit << "* its error: " << cal.GetMeanChargeErr() << " in Pixel  " << cal.GetPixId() << endl;
     509   if (cal.GetMean() < fChargeRelErrLimit*cal.GetMeanErr())
     510    {
     511      *fLog << warn << "WARNING: Fitted Charge: " << cal.GetMean() << " is smaller than "
     512            << fChargeRelErrLimit << "* its error: " << cal.GetMeanErr() << " in Pixel  " << cal.GetPixId() << endl;
    513513      bad.SetUncalibrated( MBadPixelsPix::kChargeRelErrNotValid );
    514514      bad.SetUnsuitable(   MBadPixelsPix::kUnsuitableRun        );
    515515    }
    516516
    517   if (cal.GetSigmaCharge() < cal.GetPedRms())
    518     {
    519       *fLog << warn << "WARNING: Sigma of Fitted Charge: " << cal.GetSigmaCharge()
     517  if (cal.GetSigma() < cal.GetPedRms())
     518    {
     519      *fLog << warn << "WARNING: Sigma of Fitted Charge: " << cal.GetSigma()
    520520            << " smaller than Pedestal RMS: " << cal.GetPedRms() << " in Pixel  " << cal.GetPixId() << endl;
    521521      bad.SetUncalibrated( MBadPixelsPix::kChargeSigmaNotValid );
     
    601601    {
    602602
    603       MCalibrationChargePix &pix = (*fCam)[pixid];
     603      MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[pixid];
    604604      //
    605605      // Check if the pixel has been excluded from the fits
     
    642642    {
    643643
    644       FinalizeAvPedestals(fCam->GetAverageArea(aidx), avinnerped, avinnerprms,avinnernum);
    645       FinalizeCharges(fCam->GetAverageArea(aidx),fCam->GetAverageBadArea(aidx));
     644      FinalizeAvPedestals((MCalibrationChargePix&)fCam->GetAverageArea(aidx),
     645                          avinnerped, avinnerprms,avinnernum);
     646      FinalizeCharges((MCalibrationChargePix&)fCam->GetAverageArea(aidx),
     647                      fCam->GetAverageBadArea(aidx));
    646648    }
    647649 
     
    649651    {
    650652
    651       FinalizeAvPedestals(fCam->GetAverageSector(sector), avinnerped, avinnerprms,avinnernum);
    652       FinalizeCharges(fCam->GetAverageSector(sector),fCam->GetAverageBadSector(sector));
     653      FinalizeAvPedestals((MCalibrationChargePix&)fCam->GetAverageSector(sector),
     654                          avinnerped, avinnerprms,avinnernum);
     655      FinalizeCharges((MCalibrationChargePix&)fCam->GetAverageSector(sector),
     656                      fCam->GetAverageBadSector(sector));
    653657    }
    654658 
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc

    r3624 r3638  
    107107/////////////////////////////////////////////////////////////////////////////
    108108#include "MCalibrationChargeCam.h"
     109#include "MCalibrationCam.h"
    109110
    110111#include <TH2.h>
     
    152153    fPixels           = new TClonesArray("MCalibrationChargePix",1);
    153154    fAverageAreas     = new TClonesArray("MCalibrationChargePix",1);
    154     fAverageBadAreas  = new TClonesArray("MBadPixelsPix",1);
    155     fAverageSectors     = new TClonesArray("MCalibrationChargePix",1);
    156     fAverageBadSectors  = new TClonesArray("MBadPixelsPix",1);
    157 
    158     Clear();
    159 
     155    fAverageSectors   = new TClonesArray("MCalibrationChargePix",1);
     156
     157    fMeanFluxPhesInnerPixel       = 0.;
     158    fMeanFluxPhesInnerPixelVar    = 0.;
     159    fMeanFluxPhesOuterPixel       = 0.;
     160    fMeanFluxPhesOuterPixelVar    = 0.;
     161   
     162    CLRBIT(fFlags,kBlindPixelMethodValid);
     163    CLRBIT(fFlags,kFFactorMethodValid);
     164    CLRBIT(fFlags,kPINDiodeMethodValid);
     165 
    160166    SetAverageQE();
    161167    SetConvFFactorRelErrLimit();
     
    173179{
    174180
    175   //
    176   // delete fPixels should delete all Objects stored inside
    177   //
    178   delete fPixels;
    179   delete fAverageAreas;
    180   delete fAverageBadAreas;
    181   delete fAverageSectors;
    182   delete fAverageBadSectors;
    183  
    184181 
    185182  if (fOffsets)
     
    192189}
    193190
    194 // -------------------------------------------------------------------
    195 //
    196 // This function simply allocates memory via the ROOT command:
    197 // (TObject**) TStorage::ReAlloc(fCont, newSize * sizeof(TObject*),
    198 //                                      fSize * sizeof(TObject*));
    199 // newSize corresponds to size in our case
    200 // fSize is the old size (in most cases: 1)
    201 //
    202 void MCalibrationChargeCam::InitSize(const UInt_t i)
    203 {
    204   fPixels->ExpandCreate(i);
    205 }
    206 
    207 void MCalibrationChargeCam::InitAverageAreas(const UInt_t i)
    208 {
    209   fAverageAreas->ExpandCreate(i);
    210   fAverageBadAreas->ExpandCreate(i);
    211 }
    212 
    213 void MCalibrationChargeCam::InitAverageSectors(const UInt_t i)
    214 {
    215   fAverageSectors->ExpandCreate(i);
    216   fAverageBadSectors->ExpandCreate(i);
    217 }
    218 
    219 
    220 
    221 // --------------------------------------------------------------------------
    222 //
    223 // This function returns the current size of the TClonesArray
    224 // independently if the MCalibrationPix is filled with values or not.
    225 //
    226 // It is the size of the array fPixels.
    227 //
    228 Int_t MCalibrationChargeCam::GetSize() const
    229 {
    230   return fPixels->GetEntriesFast();
    231 }
    232 
    233 Int_t MCalibrationChargeCam::GetAverageAreas() const
    234 {
    235   return fAverageAreas->GetEntriesFast();
    236 }
    237 
    238 Int_t MCalibrationChargeCam::GetAverageSectors() const
    239 {
    240   return fAverageSectors->GetEntriesFast();
    241 }
    242 
    243 
    244 // --------------------------------------------------------------------------
    245 //
    246 // Get i-th pixel (pixel number)
    247 //
    248 MCalibrationChargePix &MCalibrationChargeCam::operator[](UInt_t i)
    249 {
    250   return *static_cast<MCalibrationChargePix*>(fPixels->UncheckedAt(i));
    251 }
    252 
    253 // --------------------------------------------------------------------------
    254 //
    255 // Get i-th pixel (pixel number)
    256 //
    257 const MCalibrationChargePix &MCalibrationChargeCam::operator[](UInt_t i) const
    258 {
    259   return *static_cast<MCalibrationChargePix*>(fPixels->UncheckedAt(i));
    260 }
    261 
    262 // --------------------------------------------------------------------------
    263 //
    264 // Get i-th average pixel (area number)
    265 //
    266 MCalibrationChargePix &MCalibrationChargeCam::GetAverageArea(UInt_t i)
    267 {
    268   return *static_cast<MCalibrationChargePix*>(fAverageAreas->UncheckedAt(i));
    269 }
    270 
    271 // --------------------------------------------------------------------------
    272 //
    273 // Get i-th average pixel (area number)
    274 //
    275 const MCalibrationChargePix &MCalibrationChargeCam::GetAverageArea(UInt_t i) const
    276 {
    277   return *static_cast<MCalibrationChargePix*>(fAverageAreas->UncheckedAt(i));
    278 }
    279 
    280 // --------------------------------------------------------------------------
    281 //
    282 // Get i-th average pixel (sector number)
    283 //
    284 MCalibrationChargePix &MCalibrationChargeCam::GetAverageSector(UInt_t i)
    285 {
    286   return *static_cast<MCalibrationChargePix*>(fAverageSectors->UncheckedAt(i));
    287 }
    288 
    289 // --------------------------------------------------------------------------
    290 //
    291 // Get i-th average pixel (sector number)
    292 //
    293 const MCalibrationChargePix &MCalibrationChargeCam::GetAverageSector(UInt_t i) const
    294 {
    295   return *static_cast<MCalibrationChargePix*>(fAverageSectors->UncheckedAt(i));
    296 }
    297 
    298 // --------------------------------------------------------------------------
    299 //
    300 // Get i-th average pixel (area number)
    301 //
    302 MBadPixelsPix &MCalibrationChargeCam::GetAverageBadArea(UInt_t i)
    303 {
    304   return *static_cast<MBadPixelsPix*>(fAverageBadAreas->UncheckedAt(i));
    305 }
    306 
    307 // --------------------------------------------------------------------------
    308 //
    309 // Get i-th average pixel (area number)
    310 //
    311 const MBadPixelsPix &MCalibrationChargeCam::GetAverageBadArea(UInt_t i) const
    312 {
    313   return *static_cast<MBadPixelsPix*>(fAverageBadAreas->UncheckedAt(i));
    314 }
    315 
    316 // --------------------------------------------------------------------------
    317 //
    318 // Get i-th average pixel (sector number)
    319 //
    320 MBadPixelsPix &MCalibrationChargeCam::GetAverageBadSector(UInt_t i)
    321 {
    322   return *static_cast<MBadPixelsPix*>(fAverageBadSectors->UncheckedAt(i));
    323 }
    324 
    325 // --------------------------------------------------------------------------
    326 //
    327 // Get i-th average pixel (sector number)
    328 //
    329 const MBadPixelsPix &MCalibrationChargeCam::GetAverageBadSector(UInt_t i) const
    330 {
    331   return *static_cast<MBadPixelsPix*>(fAverageBadSectors->UncheckedAt(i));
    332 }
    333 
    334191
    335192// --------------------------------------
     
    338195{
    339196
    340   fPixels->ForEach(TObject, Clear)();
    341 
    342   //
    343   // another ForEach does not compile, thus have to do the loop ourselves:
    344   //
    345   for (Int_t i=0;i<GetAverageAreas();i++)
    346     {
    347       fAverageAreas[i].Clear();
    348       fAverageBadAreas[i].Clear();
    349     }
    350 
    351   //
    352   // another ForEach does not compile, thus have to do the loop ourselves:
    353   //
    354   for (Int_t i=0;i<GetAverageSectors();i++)
    355     {
    356       fAverageSectors[i].Clear();
    357       fAverageBadSectors[i].Clear();
    358     }
    359  
    360197  fMeanFluxPhesInnerPixel       = 0.;
    361198  fMeanFluxPhesInnerPixelVar    = 0.;
     
    366203  CLRBIT(fFlags,kFFactorMethodValid);
    367204  CLRBIT(fFlags,kPINDiodeMethodValid);
     205
     206  MCalibrationCam::Clear();
    368207
    369208  return;
     
    448287          *fLog << all << "Pix " << pix->GetPixId()
    449288                << ":  Ped.  Rms: "            << pix->GetPedRms()        << " +- " << pix->GetPedRmsErr()
    450                 << "   Mean signal: "          << pix->GetMeanCharge()    << " +- " << pix->GetSigmaCharge()
    451                 << "   Reduced Sigma: "        << pix->GetRSigmaCharge()
     289                << "   Mean signal: "          << pix->GetMean()    << " +- " << pix->GetSigma()
     290                << "   Reduced Sigma: "        << pix->GetRSigma()
    452291                << "   Nr Phe's: "             << pix->GetPheFFactorMethod()
    453292                << " Saturated? :" << pix->IsHiGainSaturation()
     
    484323    *fLog << all << "Average Area:"
    485324          << "   Ped.  Rms: "            << pix->GetPedRms()        << " +- " << pix->GetPedRmsErr()
    486           << "   Mean signal: "          << pix->GetMeanCharge()    << " +- " << pix->GetMeanChargeErr()
    487           << "   Sigma signal: "         << pix->GetSigmaCharge()    << " +- "<< pix->GetSigmaChargeErr()
    488           << "   Reduced Sigma: "        << pix->GetRSigmaCharge()
     325          << "   Mean signal: "          << pix->GetMean()    << " +- " << pix->GetMeanErr()
     326          << "   Sigma signal: "         << pix->GetSigma()    << " +- "<< pix->GetSigmaErr()
     327          << "   Reduced Sigma: "        << pix->GetRSigma()
    489328          << "   Nr Phe's: "             << pix->GetPheFFactorMethod()
    490329          << endl;
     
    496335    *fLog << all << "Average Sector:"
    497336          << "   Ped.  Rms: "            << pix->GetPedRms()        << " +- " << pix->GetPedRmsErr()
    498           << "   Mean signal: "          << pix->GetMeanCharge()    << " +- " << pix->GetMeanChargeErr()
    499           << "   Sigma signal: "         << pix->GetSigmaCharge()    << " +- "<< pix->GetSigmaChargeErr()
    500           << "   Reduced Sigma: "        << pix->GetRSigmaCharge()
     337          << "   Mean signal: "          << pix->GetMean()    << " +- " << pix->GetMeanErr()
     338          << "   Sigma signal: "         << pix->GetSigma()    << " +- "<< pix->GetSigmaErr()
     339          << "   Reduced Sigma: "        << pix->GetRSigma()
    501340          << "   Nr Phe's: "             << pix->GetPheFFactorMethod()
    502341          << endl;
     
    594433    return kFALSE;
    595434
     435 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[idx];
     436
    596437  switch (type)
    597438    {
    598439    case 0:
    599       if ((*this)[idx].IsExcluded())
    600         return kFALSE;
    601       val = (*this)[idx].GetMeanCharge();
     440      if (pix.IsExcluded())
     441        return kFALSE;
     442      val = pix.GetMean();
    602443      break;
    603444    case 1:
    604       if ((*this)[idx].IsExcluded())
    605         return kFALSE;
    606       val = (*this)[idx].GetMeanChargeErr();
     445      if (pix.IsExcluded())
     446        return kFALSE;
     447      val = pix.GetMeanErr();
    607448      break;
    608449    case 2:
    609       if ((*this)[idx].IsExcluded())
    610         return kFALSE;
    611       val = (*this)[idx].GetSigmaCharge();
     450      if (pix.IsExcluded())
     451        return kFALSE;
     452      val = pix.GetSigma();
    612453      break;
    613454    case 3:
    614       if ((*this)[idx].IsExcluded())
    615         return kFALSE;
    616       val = (*this)[idx].GetSigmaChargeErr();
     455      if (pix.IsExcluded())
     456        return kFALSE;
     457      val = pix.GetSigmaErr();
    617458      break;
    618459    case 4:
    619       if ((*this)[idx].IsExcluded())
    620         return kFALSE;
    621       val = (*this)[idx].GetChargeProb();
     460      if (pix.IsExcluded())
     461        return kFALSE;
     462      val = pix.GetProb();
    622463      break;
    623464    case 5:
    624       if ((*this)[idx].IsExcluded())
    625         return kFALSE;
    626       if ((*this)[idx].GetRSigmaCharge() == -1.)
     465      if (pix.IsExcluded())
     466        return kFALSE;
     467      if (pix.GetRSigma() == -1.)
    627468          return kFALSE;
    628       val = (*this)[idx].GetRSigmaCharge();
     469      val = pix.GetRSigma();
    629470      break;
    630471    case 6:
    631       if ((*this)[idx].IsExcluded())
     472      if (pix.IsExcluded())
    632473        return kFALSE;   
    633       if ((*this)[idx].GetRSigmaCharge() == -1.)
     474      if (pix.GetRSigma() == -1.)
    634475          return kFALSE;
    635       val = (*this)[idx].GetRSigmaChargeErr();
     476      val = pix.GetRSigmaErr();
    636477      break;
    637478    case 7:
    638       if ((*this)[idx].IsExcluded())
    639         return kFALSE;
    640       if ((*this)[idx].GetRSigmaCharge() == -1.)
    641         return kFALSE;
    642       if ((*this)[idx].GetMeanCharge() == 0.)
    643         return kFALSE;
    644       val = (*this)[idx].GetRSigmaCharge() / (*this)[idx].GetMeanCharge();
     479      if (pix.IsExcluded())
     480        return kFALSE;
     481      if (pix.GetRSigma() == -1.)
     482        return kFALSE;
     483      if (pix.GetMean() == 0.)
     484        return kFALSE;
     485      val = pix.GetRSigma() / pix.GetMean();
    645486      break;
    646487    case 8:
    647       if ((*this)[idx].IsExcluded())
    648         return kFALSE;
    649       if ((*this)[idx].GetRSigmaCharge() <= 0.)
     488      if (pix.IsExcluded())
     489        return kFALSE;
     490      if (pix.GetRSigma() <= 0.)
    650491          return kFALSE;
    651       if ((*this)[idx].GetMeanCharge() <= 0.)
    652         return kFALSE;
    653       if ((*this)[idx].GetRSigmaChargeErr() <= 0.)
     492      if (pix.GetMean() <= 0.)
     493        return kFALSE;
     494      if (pix.GetRSigmaErr() <= 0.)
    654495          return kFALSE;
    655       if ((*this)[idx].GetMeanChargeErr() <= 0.)
    656         return kFALSE;
    657       // relative error RsigmaCharge square
    658       val =    (*this)[idx].GetRSigmaChargeErr()* (*this)[idx].GetRSigmaChargeErr()
    659             / ((*this)[idx].GetRSigmaCharge()   * (*this)[idx].GetRSigmaCharge()   );
    660       // relative error Charge square
    661       val +=   (*this)[idx].GetMeanChargeErr() * (*this)[idx].GetMeanChargeErr()
    662             / ((*this)[idx].GetMeanCharge()    * (*this)[idx].GetMeanCharge()   );
     496      if (pix.GetMeanErr() <= 0.)
     497        return kFALSE;
     498      // relative error Rsigma square
     499      val =    pix.GetRSigmaErr()* pix.GetRSigmaErr()
     500            / (pix.GetRSigma()   * pix.GetRSigma()   );
     501      // relative error square
     502      val +=   pix.GetMeanErr() * pix.GetMeanErr()
     503            / (pix.GetMean()    * pix.GetMean()   );
    663504      // calculate relative error out of squares
    664505      val  =   TMath::Sqrt(val) ;
    665506      // multiply with value to get absolute error
    666       val  *=  (*this)[idx].GetRSigmaCharge() / (*this)[idx].GetMeanCharge();
     507      val  *=  pix.GetRSigma() / pix.GetMean();
    667508      break;
    668509    case 9:
    669       if ((*this)[idx].IsExcluded() || !(*this)[idx].IsFFactorMethodValid())
    670         return kFALSE;
    671       val = (*this)[idx].GetPheFFactorMethod();
     510      if (pix.IsExcluded() || !pix.IsFFactorMethodValid())
     511        return kFALSE;
     512      val = pix.GetPheFFactorMethod();
    672513      break;
    673514    case 10:
    674       if ((*this)[idx].IsExcluded() || !(*this)[idx].IsFFactorMethodValid())
    675         return kFALSE;
    676       val = (*this)[idx].GetPheFFactorMethodErr();
     515      if (pix.IsExcluded() || !pix.IsFFactorMethodValid())
     516        return kFALSE;
     517      val = pix.GetPheFFactorMethodErr();
    677518      break;
    678519    case 11:
    679       if ((*this)[idx].IsExcluded() || !(*this)[idx].IsFFactorMethodValid())
    680         return kFALSE;
    681       val = (*this)[idx].GetMeanConversionFFactorMethod();
     520      if (pix.IsExcluded() || !pix.IsFFactorMethodValid())
     521        return kFALSE;
     522      val = pix.GetMeanConversionFFactorMethod();
    682523      break;
    683524    case 12:
    684       if ((*this)[idx].IsExcluded() || !(*this)[idx].IsFFactorMethodValid())
    685         return kFALSE;
    686       val = (*this)[idx].GetConversionFFactorMethodErr();
     525      if (pix.IsExcluded() || !pix.IsFFactorMethodValid())
     526        return kFALSE;
     527      val = pix.GetConversionFFactorMethodErr();
    687528      break;
    688529    case 13:
    689       if ((*this)[idx].IsExcluded() || !(*this)[idx].IsFFactorMethodValid())
    690         return kFALSE;
    691       val = (*this)[idx].GetTotalFFactorFFactorMethod();
     530      if (pix.IsExcluded() || !pix.IsFFactorMethodValid())
     531        return kFALSE;
     532      val = pix.GetTotalFFactorFFactorMethod();
    692533      break;
    693534    case 14:
    694       if ((*this)[idx].IsExcluded() || !(*this)[idx].IsFFactorMethodValid())
    695         return kFALSE;
    696       val = (*this)[idx].GetTotalFFactorFFactorMethodErr();
     535      if (pix.IsExcluded() || !pix.IsFFactorMethodValid())
     536        return kFALSE;
     537      val = pix.GetTotalFFactorFFactorMethodErr();
    697538      break;
    698539    case 15:
    699       if ((*this)[idx].IsExcluded())
    700         return kFALSE;
    701       if ((*this)[idx].IsFFactorMethodValid())
     540      if (pix.IsExcluded())
     541        return kFALSE;
     542      if (pix.IsFFactorMethodValid())
    702543        val = 1;
    703544      else
     
    705546      break;
    706547    case 16:
    707       if ((*this)[idx].IsExcluded() || !(*this)[idx].IsBlindPixelMethodValid())
    708         return kFALSE;
    709       val = (*this)[idx].GetMeanConversionBlindPixelMethod();
     548      if (pix.IsExcluded() || !pix.IsBlindPixelMethodValid())
     549        return kFALSE;
     550      val = pix.GetMeanConversionBlindPixelMethod();
    710551      break;
    711552    case 17:
    712       if ((*this)[idx].IsExcluded() || !(*this)[idx].IsBlindPixelMethodValid())
    713         return kFALSE;
    714       val = (*this)[idx].GetConversionBlindPixelMethodErr();
     553      if (pix.IsExcluded() || !pix.IsBlindPixelMethodValid())
     554        return kFALSE;
     555      val = pix.GetConversionBlindPixelMethodErr();
    715556      break;
    716557    case 18:
    717       if ((*this)[idx].IsExcluded() || !(*this)[idx].IsBlindPixelMethodValid())
    718         return kFALSE;
    719       val = (*this)[idx].GetTotalFFactorBlindPixelMethod();
     558      if (pix.IsExcluded() || !pix.IsBlindPixelMethodValid())
     559        return kFALSE;
     560      val = pix.GetTotalFFactorBlindPixelMethod();
    720561      break;
    721562    case 19:
    722       if ((*this)[idx].IsExcluded() || !(*this)[idx].IsBlindPixelMethodValid())
    723         return kFALSE;
    724       val = (*this)[idx].GetTotalFFactorBlindPixelMethodErr();
     563      if (pix.IsExcluded() || !pix.IsBlindPixelMethodValid())
     564        return kFALSE;
     565      val = pix.GetTotalFFactorBlindPixelMethodErr();
    725566      break;
    726567    case 20:
    727       if ((*this)[idx].IsExcluded())
    728         return kFALSE;
    729       if ((*this)[idx].IsBlindPixelMethodValid())
     568      if (pix.IsExcluded())
     569        return kFALSE;
     570      if (pix.IsBlindPixelMethodValid())
    730571        val = 1;
    731572      else
     
    733574      break;
    734575    case 21:
    735       if ((*this)[idx].IsExcluded() || !(*this)[idx].IsPINDiodeMethodValid())
    736         return kFALSE;
    737       val = (*this)[idx].GetMeanConversionPINDiodeMethod();
     576      if (pix.IsExcluded() || !pix.IsPINDiodeMethodValid())
     577        return kFALSE;
     578      val = pix.GetMeanConversionPINDiodeMethod();
    738579      break;
    739580    case 22:
    740       if ((*this)[idx].IsExcluded() || !(*this)[idx].IsPINDiodeMethodValid())
    741         return kFALSE;
    742       val = (*this)[idx].GetConversionPINDiodeMethodErr();
     581      if (pix.IsExcluded() || !pix.IsPINDiodeMethodValid())
     582        return kFALSE;
     583      val = pix.GetConversionPINDiodeMethodErr();
    743584      break;
    744585    case 23:
    745       if ((*this)[idx].IsExcluded() || !(*this)[idx].IsPINDiodeMethodValid())
    746         return kFALSE;
    747       val = (*this)[idx].GetTotalFFactorPINDiodeMethod();
     586      if (pix.IsExcluded() || !pix.IsPINDiodeMethodValid())
     587        return kFALSE;
     588      val = pix.GetTotalFFactorPINDiodeMethod();
    748589      break;
    749590    case 24:
    750       if ((*this)[idx].IsExcluded() || !(*this)[idx].IsPINDiodeMethodValid())
    751         return kFALSE;
    752       val = (*this)[idx].GetTotalFFactorPINDiodeMethodErr();
     591      if (pix.IsExcluded() || !pix.IsPINDiodeMethodValid())
     592        return kFALSE;
     593      val = pix.GetTotalFFactorPINDiodeMethodErr();
    753594      break;
    754595    case 25:
    755       if ((*this)[idx].IsExcluded())
    756         return kFALSE;
    757       if ((*this)[idx].IsPINDiodeMethodValid())
     596      if (pix.IsExcluded())
     597        return kFALSE;
     598      if (pix.IsPINDiodeMethodValid())
    758599        val = 1;
    759600      else
     
    761602      break;
    762603    case 26:
    763       if ((*this)[idx].IsExcluded())
     604      if (pix.IsExcluded())
    764605        val = 1.;
    765606      else
     
    767608      break;
    768609    case 27:
    769       if ((*this)[idx].IsExcluded())
    770         return kFALSE;
    771       val = (*this)[idx].GetHiGainNumPickup();
     610      if (pix.IsExcluded())
     611        return kFALSE;
     612      val = pix.GetHiGainNumPickup();
    772613      break;
    773614    case 28:
    774       if ((*this)[idx].IsExcluded())
    775         return kFALSE;
    776       val = (*this)[idx].GetLoGainNumPickup();
     615      if (pix.IsExcluded())
     616        return kFALSE;
     617      val = pix.GetLoGainNumPickup();
    777618      break;
    778619    case 29:
    779       if ((*this)[idx].IsExcluded())
    780         return kFALSE;
    781       val = (*this)[idx].IsHiGainSaturation();
     620      if (pix.IsExcluded())
     621        return kFALSE;
     622      val = pix.IsHiGainSaturation();
    782623      break;
    783624    case 30:
    784       if ((*this)[idx].IsExcluded())
    785         return kFALSE;
    786       val = (*this)[idx].GetPed();
     625      if (pix.IsExcluded())
     626        return kFALSE;
     627      val = pix.GetPed();
    787628      break;
    788629    case 31:
    789       if ((*this)[idx].IsExcluded())
    790         return kFALSE;
    791       val = (*this)[idx].GetPedErr();
     630      if (pix.IsExcluded())
     631        return kFALSE;
     632      val = pix.GetPedErr();
    792633      break;
    793634    case 32:
    794       if ((*this)[idx].IsExcluded())
    795         return kFALSE;
    796       val = (*this)[idx].GetPedRms();
     635      if (pix.IsExcluded())
     636        return kFALSE;
     637      val = pix.GetPedRms();
    797638      break;
    798639    case 33:
    799       if ((*this)[idx].IsExcluded())
    800         return kFALSE;
    801       val = (*this)[idx].GetPedErr()/2.;
     640      if (pix.IsExcluded())
     641        return kFALSE;
     642      val = pix.GetPedErr()/2.;
    802643      break;
    803644    case 34:
    804       if ((*this)[idx].IsExcluded())
    805         return kFALSE;
    806       val = (*this)[idx].GetAbsTimeMean();
     645      if (pix.IsExcluded())
     646        return kFALSE;
     647      val = pix.GetAbsTimeMean();
    807648      break;
    808649    case 35:
    809       if ((*this)[idx].IsExcluded())
    810         return kFALSE;
    811       val = (*this)[idx].GetAbsTimeRms();
     650      if (pix.IsExcluded())
     651        return kFALSE;
     652      val = pix.GetAbsTimeRms();
    812653      break;
    813654    default:
     
    825666void MCalibrationChargeCam::DrawPixelContent(Int_t idx) const
    826667{
    827     (*this)[idx].DrawClone();
     668  MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[idx];
     669  pix.DrawClone();
    828670}
    829671
     
    1096938     
    1097939      if (ratio == 1.)
    1098         conv               = fMeanFluxPhotonsInnerPixel / pix->GetMeanCharge();
     940        conv               = fMeanFluxPhotonsInnerPixel / pix->GetMean();
    1099941      else
    1100         conv               = fMeanFluxPhotonsOuterPixel / pix->GetMeanCharge();
     942        conv               = fMeanFluxPhotonsOuterPixel / pix->GetMean();
    1101943
    1102944      if (conv <= 0.)
     
    1106948        }
    1107949     
    1108       const Float_t chargeRelVar       =   pix->GetMeanChargeErr() * pix->GetMeanChargeErr()
    1109                                        / ( pix->GetMeanCharge()    * pix->GetMeanCharge());
    1110       const Float_t rsigmaChargeRelVar =   pix->GetRSigmaChargeErr() *  pix->GetRSigmaChargeErr()
    1111                                         / (pix->GetRSigmaCharge()    * pix->GetRSigmaCharge()) ;
     950      const Float_t chargeRelVar       =   pix->GetMeanErr() * pix->GetMeanErr()
     951                                       / ( pix->GetMean()    * pix->GetMean());
     952      const Float_t rsigmaRelVar =   pix->GetRSigmaErr() *  pix->GetRSigmaErr()
     953                                        / (pix->GetRSigma()    * pix->GetRSigma()) ;
    1112954
    1113955      const Float_t convrelvar = meanphotRelVar + chargeRelVar;
     
    1125967      // Calculate the Total F-Factor of the camera (in photons)
    1126968      //
    1127       const Float_t totalFFactor  =  (pix->GetRSigmaCharge()/pix->GetMeanCharge())
     969      const Float_t totalFFactor  =  (pix->GetRSigma()/pix->GetMean())
    1128970                                    *TMath::Sqrt(fMeanFluxPhotonsInnerPixel);
    1129971     
     
    1131973      // Calculate the error of the Total F-Factor of the camera ( in photons )
    1132974      //
    1133       const Float_t totalFFactorVar = rsigmaChargeRelVar + chargeRelVar + meanphotRelVar;
     975      const Float_t totalFFactorVar = rsigmaRelVar + chargeRelVar + meanphotRelVar;
    1134976
    1135977      if (convrelvar > 0. && conv > 0.)
     
    11681010        }
    11691011     
    1170       const Float_t charge    = pix->GetMeanCharge();
     1012      const Float_t charge    = pix->GetMean();
    11711013      const Float_t area      = geom[idx].GetA();
    1172       const Float_t chargeerr = pix->GetMeanChargeErr();         
     1014      const Float_t chargeerr = pix->GetMeanErr();         
    11731015     
    11741016      const Float_t nphot      = flux    * area;
     
    12121054        }
    12131055     
    1214       const Float_t charge    = pix->GetMeanCharge();
     1056      const Float_t charge    = pix->GetMean();
    12151057      const Float_t area      = geom[idx].GetA();
    1216       const Float_t chargeerr = pix->GetMeanChargeErr();         
     1058      const Float_t chargeerr = pix->GetMeanErr();         
    12171059     
    12181060      const Float_t nphot      = flux    * area;
     
    12441086{
    12451087
    1246   mean  = (*this)[ipx].GetMeanConversionBlindPixelMethod();
    1247   err   = (*this)[ipx].GetConversionBlindPixelMethodErr();
    1248   sigma = (*this)[ipx].GetSigmaConversionBlindPixelMethod();
     1088  MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[ipx];
     1089
     1090  mean  = pix.GetMeanConversionBlindPixelMethod();
     1091  err   = pix.GetConversionBlindPixelMethodErr();
     1092  sigma = pix.GetSigmaConversionBlindPixelMethod();
    12491093
    12501094  return kTRUE;
     
    12551099{
    12561100
    1257   Float_t conv = (*this)[ipx].GetMeanConversionFFactorMethod();
     1101  MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[ipx];
     1102
     1103  Float_t conv = pix.GetMeanConversionFFactorMethod();
    12581104
    12591105  if (conv < 0.)
     
    12611107
    12621108  mean  = conv;
    1263   err   = (*this)[ipx].GetConversionFFactorMethodErr();
    1264   sigma = (*this)[ipx].GetSigmaConversionFFactorMethod();
     1109  err   = pix.GetConversionFFactorMethodErr();
     1110  sigma = pix.GetSigmaConversionFFactorMethod();
    12651111
    12661112  return kTRUE;
     
    12771123{
    12781124
    1279   mean  = (*this)[ipx].GetMeanConversionPINDiodeMethod();
    1280   err   = (*this)[ipx].GetConversionPINDiodeMethodErr();
    1281   sigma = (*this)[ipx].GetSigmaConversionPINDiodeMethod();
     1125  MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[ipx];
     1126
     1127  mean  = pix.GetMeanConversionPINDiodeMethod();
     1128  err   = pix.GetConversionPINDiodeMethodErr();
     1129  sigma = pix.GetSigmaConversionPINDiodeMethod();
    12821130
    12831131  return kFALSE;
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.h

    r3624 r3638  
    22#define MARS_MCalibrationChargeCam
    33
    4 #ifndef MARS_MParContainer
    5 #include "MParContainer.h"
    6 #endif
    7 #ifndef MARS_MCamEvent
    8 #include "MCamEvent.h"
     4#ifndef MARS_MCalibrationCam
     5#include "MCalibrationCam.h"
    96#endif
    107
    118class TH1D;
    129class TH2D;
    13 class TClonesArray;
    1410
    1511class MCalibrationChargeBlindPix;
    1612class MCalibrationChargePINDiode;
    1713class MCalibrationChargePix;
    18 class MBadPixelsPix;
     14class MGeomCam;
    1915class MBadPixelsCam;
    20 class MCalibrationChargeCam : public MParContainer, public MCamEvent
     16class MCalibrationChargeCam : public MCalibrationCam
    2117{
    2218private:
     
    3228  Float_t fPheFFactorRelVarLimit;    // Acceptance limit for number of phe's w.r.t mean number (in variances)
    3329 
    34   TClonesArray *fPixels;             //-> Array of MCalibrationChargePix, one per pixel
    35   TClonesArray *fAverageAreas;       //-> Array of MCalibrationChargePix, one per pixel area
    36   TClonesArray *fAverageSectors;     //-> Array of MCalibrationChargePix, one per camera sector
    37   TClonesArray *fAverageBadAreas;    //-> Array of MBadPixelsPix, one per pixel area
    38   TClonesArray *fAverageBadSectors;  //-> Array of MBadPixelsPix, one per camera sector
    39  
    4030  TH1D* fOffsets;                    //!
    4131  TH1D* fSlopes;                     //!
    4232 
    4333  TH2D* fOffvsSlope;                 //!
    44 
    45   Byte_t  fFlags;
    4634
    4735  enum  { kFFactorMethodValid, kBlindPixelMethodValid, kPINDiodeMethodValid, kCombinedMethodValid };
     
    6351 
    6452  void Clear(    Option_t *o="" );
    65   void InitSize( const UInt_t i );
    66   void InitAverageAreas(  const UInt_t i );
    67   void InitAverageSectors( const UInt_t i );
    6853
    6954  // Setters   
     
    7964
    8065  // Getters
    81   Int_t   GetSize()               const;
    82   Int_t   GetAverageAreas()       const;
    83   Int_t   GetAverageSectors()     const; 
    84 
    8566  Bool_t  GetConversionFactorFFactor(    Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma );
    8667  Bool_t  GetConversionFactorBlindPixel( Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma );
     
    10081  Bool_t IsBlindPixelMethodValid()   const;
    10182  Bool_t IsPINDiodeMethodValid()     const; 
    102 
    103   // Others
    104   MCalibrationChargePix &operator[](UInt_t i);
    105   const MCalibrationChargePix &operator[](UInt_t i) const;
    106 
    107   MCalibrationChargePix &GetAverageArea(UInt_t i);
    108   const MCalibrationChargePix &GetAverageArea(UInt_t i) const;
    109 
    110   MBadPixelsPix &GetAverageBadArea(UInt_t i);
    111   const MBadPixelsPix &GetAverageBadArea(UInt_t i) const;
    112 
    113   MCalibrationChargePix &GetAverageSector(UInt_t i);
    114   const MCalibrationChargePix &GetAverageSector(UInt_t i) const;
    115 
    116   MBadPixelsPix &GetAverageBadSector(UInt_t i);
    117   const MBadPixelsPix &GetAverageBadSector(UInt_t i) const;
    11883
    11984  // Prints
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.h

    r3637 r3638  
    7474  Float_t fConversionHiLoVar;               // The error of the conversion factor between Hi Gain and Lo Gain 
    7575
    76   Byte_t fCalibFlags;
     76  Byte_t fCalibFlags;                       // The bit-field for the class-own bits
    7777
    78   enum  { kBlindPixelMethodValid, kFFactorMethodValid, 
    79           kPINDiodeMethodValid, kCombinedMethodValid };
     78  enum  { kBlindPixelMethodValid, kFFactorMethodValid,
     79          kPINDiodeMethodValid, kCombinedMethodValid }; // The possible bits to be set
    8080
    8181public:
  • trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimePix.cc

    r3635 r3638  
    3939//
    4040MCalibrationRelTimePix::MCalibrationRelTimePix(const char *name, const char *title)
     41    : fRelTimeFlags(0)
    4142{
    4243
     
    5556{
    5657
    57   SetExcluded  ( kFALSE );
    5858  SetValid     ( kFALSE );
    5959
     
    8282// Set the Excluded Bit from outside
    8383//
    84 void MCalibrationRelTimePix::SetExcluded(Bool_t b )
    85 {
    86     b ?  SETBIT(fFlags, kExcluded) : CLRBIT(fFlags, kExcluded);
    87 }
    88 
    89    
    90 // --------------------------------------------------------------------------
    91 //
    92 // Set the Excluded Bit from outside
    93 //
    9484void MCalibrationRelTimePix::SetValid(const Bool_t b )
    9585{
    96   b ?  SETBIT(fFlags, kValid) : CLRBIT(fFlags, kValid);
     86  b ?  SETBIT(fRelTimeFlags, kValid) : CLRBIT(fRelTimeFlags, kValid);
    9787}   
    9888
     
    10696
    10797
    108 Bool_t MCalibrationRelTimePix::IsExcluded()     const
    109 {
    110    return TESTBIT(fFlags,kExcluded); 
    111 }
    112 
    11398Bool_t MCalibrationRelTimePix::IsValid() const
    11499{
    115   return TESTBIT(fFlags, kValid);
     100  return TESTBIT(fRelTimeFlags, kValid);
    116101}
  • trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimePix.h

    r3635 r3638  
    1414  Float_t fSigmaConversion;    // The sigma of conversion factor to Phe's (F-factor method)
    1515
    16   enum  { kExcluded, kValid };
     16  Byte_t fRelTimeFlags;        // The bit-field for the class-own bits
     17
     18  enum  { kValid };             // The possible bits to be set
    1719
    1820public:
     
    2729 
    2830  // Setters
    29   void SetExcluded (  const Bool_t b = kTRUE );
    3031  void SetValid( const Bool_t b = kTRUE );
    3132
     
    3940  Float_t GetTimePrecisionErr() const { return GetSigmaErr();    }
    4041
    41   Bool_t IsExcluded()           const;
    4242  Bool_t IsValid()              const;
    4343
  • trunk/MagicSoft/Mars/mcalib/MMcCalibrationCalc.cc

    r3374 r3638  
    246246    for (int i=0; i<num; i++)
    247247    {
    248         MCalibrationChargePix &calpix = (*fCalCam)[i];
     248        MCalibrationChargePix &calpix = (MCalibrationChargePix&)(*fCalCam)[i];
    249249
    250250        const Float_t factor = fADC2Phot*calpix.GetMeanConversionBlindPixelMethod();
Note: See TracChangeset for help on using the changeset viewer.