CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

HcalDbService Class Reference

#include <HcalDbService.h>

List of all members.

Public Member Functions

const HcalGaingetGain (const HcalGenericDetId &fId) const
const HcalGainWidthgetGainWidth (const HcalGenericDetId &fId) const
const HcalCalibrationsgetHcalCalibrations (const HcalGenericDetId &fId) const
const HcalCalibrationWidthsgetHcalCalibrationWidths (const HcalGenericDetId &fId) const
const HcalChannelStatusgetHcalChannelStatus (const HcalGenericDetId &fId) const
const HcalQIECodergetHcalCoder (const HcalGenericDetId &fId) const
const HcalL1TriggerObjectgetHcalL1TriggerObject (const HcalGenericDetId &fId) const
const HcalLUTCorrgetHcalLUTCorr (const HcalGenericDetId &fId) const
const HcalLutMetadatagetHcalLutMetadata () const
const HcalElectronicsMapgetHcalMapping () const
const HcalPFCorrgetHcalPFCorr (const HcalGenericDetId &fId) const
const HcalRespCorrgetHcalRespCorr (const HcalGenericDetId &fId) const
const HcalQIEShapegetHcalShape () const
const HcalTimeCorrgetHcalTimeCorr (const HcalGenericDetId &fId) const
const HcalZSThresholdgetHcalZSThreshold (const HcalGenericDetId &fId) const
const HcalPedestalgetPedestal (const HcalGenericDetId &fId) const
const HcalPedestalWidthgetPedestalWidth (const HcalGenericDetId &fId) const
 HcalDbService (const edm::ParameterSet &)
void setData (const HcalLUTCorrs *fItem)
void setData (const HcalLutMetadata *fItem)
void setData (const HcalPFCorrs *fItem)
void setData (const HcalL1TriggerObjects *fItem)
void setData (const HcalElectronicsMap *fItem)
void setData (const HcalQIEData *fItem)
void setData (const HcalGainWidths *fItem)
void setData (const HcalGains *fItem)
void setData (const HcalPedestalWidths *fItem)
void setData (const HcalTimeCorrs *fItem)
void setData (const HcalZSThresholds *fItem)
void setData (const HcalRespCorrs *fItem)
void setData (const HcalPedestals *fItem)
void setData (const HcalChannelQuality *fItem)

Private Member Functions

void buildCalibrations () const
void buildCalibWidths () const
bool makeHcalCalibration (const HcalGenericDetId &fId, HcalCalibrations *fObject, bool pedestalInADC) const
bool makeHcalCalibrationWidth (const HcalGenericDetId &fId, HcalCalibrationWidths *fObject, bool pedestalInADC) const

Private Attributes

HcalCalibrationsSet mCalibSet
HcalCalibrationWidthsSet mCalibWidthSet
const HcalChannelQualitymChannelQuality
const HcalElectronicsMapmElectronicsMap
const HcalGainsmGains
const HcalGainWidthsmGainWidths
const HcalL1TriggerObjectsmL1TriggerObjects
const HcalLUTCorrsmLUTCorrs
const HcalLutMetadatamLutMetadata
const HcalPedestalsmPedestals
const HcalPedestalWidthsmPedestalWidths
const HcalPFCorrsmPFCorrs
const HcalQIEDatamQIEData
QieShapemQieShapeCache
const HcalRespCorrsmRespCorrs
const HcalTimeCorrsmTimeCorrs
bool mUpdateCalibrations
bool mUpdateCalibWidths
const HcalZSThresholdsmZSThresholds

Detailed Description

Definition at line 27 of file HcalDbService.h.


Constructor & Destructor Documentation

HcalDbService::HcalDbService ( const edm::ParameterSet cfg)

Member Function Documentation

void HcalDbService::buildCalibrations ( ) const [private]

Definition at line 53 of file HcalDbService.cc.

References HcalCalibrationsSet::clear(), HcalCondObjectContainer< Item >::getAllChannels(), ExpressReco_HICollisions_FallBack::id, HcalPedestals::isADC(), makeHcalCalibration(), mCalibSet, mGains, mLUTCorrs, mPedestals, mQIEData, mRespCorrs, mTimeCorrs, convertSQLiteXML::ok, HcalCalibrationsSet::setCalibrations(), and HcalCalibrationsSet::sort().

Referenced by getHcalCalibrations().

                                            {
  // we use the set of ids for pedestals as the master list
  if ((!mPedestals) || (!mGains) || (!mQIEData) || (!mRespCorrs) || (!mTimeCorrs) || (!mLUTCorrs) ) return;

  std::vector<DetId> ids=mPedestals->getAllChannels();
  bool pedsInADC = mPedestals->isADC();
  // clear the calibrations set
  mCalibSet.clear();
  // loop!
  HcalCalibrations tool;

  //  std::cout << " length of id-vector: " << ids.size() << std::endl;
  for (std::vector<DetId>::const_iterator id=ids.begin(); id!=ids.end(); ++id) {
    // make
    bool ok=makeHcalCalibration(*id,&tool,pedsInADC);
    // store
    if (ok) mCalibSet.setCalibrations(*id,tool);
    //    std::cout << "Hcal calibrations built... detid no. " << HcalGenericDetId(*id) << std::endl;
  }
  mCalibSet.sort();
}
void HcalDbService::buildCalibWidths ( ) const [private]

Definition at line 75 of file HcalDbService.cc.

References HcalCalibrationWidthsSet::clear(), HcalCondObjectContainer< Item >::getAllChannels(), ExpressReco_HICollisions_FallBack::id, HcalPedestalWidths::isADC(), makeHcalCalibrationWidth(), mCalibWidthSet, mGainWidths, mPedestalWidths, mQIEData, convertSQLiteXML::ok, HcalCalibrationWidthsSet::setCalibrationWidths(), and HcalCalibrationWidthsSet::sort().

Referenced by getHcalCalibrationWidths().

                                           {
  // we use the set of ids for pedestal widths as the master list
  if ((!mPedestalWidths) || (!mGainWidths) || (!mQIEData) ) return;

  std::vector<DetId> ids=mPedestalWidths->getAllChannels();
  bool pedsInADC = mPedestalWidths->isADC();
  // clear the calibrations set
  mCalibWidthSet.clear();
  // loop!
  HcalCalibrationWidths tool;

  //  std::cout << " length of id-vector: " << ids.size() << std::endl;
  for (std::vector<DetId>::const_iterator id=ids.begin(); id!=ids.end(); ++id) {
    // make
    bool ok=makeHcalCalibrationWidth(*id,&tool,pedsInADC);
    // store
    if (ok) mCalibWidthSet.setCalibrationWidths(*id,tool);
    //    std::cout << "Hcal calibrations built... detid no. " << HcalGenericDetId(*id) << std::endl;
  }
  mCalibWidthSet.sort();
}
const HcalGain * HcalDbService::getGain ( const HcalGenericDetId fId) const
const HcalGainWidth * HcalDbService::getGainWidth ( const HcalGenericDetId fId) const
const HcalCalibrations & HcalDbService::getHcalCalibrations ( const HcalGenericDetId fId) const
const HcalCalibrationWidths & HcalDbService::getHcalCalibrationWidths ( const HcalGenericDetId fId) const
const HcalChannelStatus * HcalDbService::getHcalChannelStatus ( const HcalGenericDetId fId) const

Definition at line 224 of file HcalDbService.cc.

References HcalCondObjectContainer< Item >::getValues(), and mChannelQuality.

Referenced by HcaluLUTTPGCoder::update().

{
  return mChannelQuality->getValues (fId);
}
const HcalQIECoder * HcalDbService::getHcalCoder ( const HcalGenericDetId fId) const
const HcalL1TriggerObject * HcalDbService::getHcalL1TriggerObject ( const HcalGenericDetId fId) const
const HcalLUTCorr * HcalDbService::getHcalLUTCorr ( const HcalGenericDetId fId) const

Definition at line 241 of file HcalDbService.cc.

References HcalCondObjectContainer< Item >::getValues(), and mLUTCorrs.

Referenced by makeHcalCalibration().

                                                                                   {
  if (mLUTCorrs) {
    return mLUTCorrs->getValues (fId);
  }
  return 0;
}
const HcalLutMetadata * HcalDbService::getHcalLutMetadata ( ) const

Definition at line 255 of file HcalDbService.cc.

References mLutMetadata.

Referenced by HcaluLUTTPGCoder::update().

                                                                {
  return mLutMetadata;
}
const HcalElectronicsMap * HcalDbService::getHcalMapping ( ) const

Definition at line 215 of file HcalDbService.cc.

References mElectronicsMap.

                                                               {
  return mElectronicsMap;
}
const HcalPFCorr * HcalDbService::getHcalPFCorr ( const HcalGenericDetId fId) const

Definition at line 248 of file HcalDbService.cc.

References HcalCondObjectContainer< Item >::getValues(), and mPFCorrs.

                                                                                 {
  if (mPFCorrs) {
    return mPFCorrs->getValues (fId);
  }
  return 0;
}
const HcalRespCorr * HcalDbService::getHcalRespCorr ( const HcalGenericDetId fId) const

Definition at line 166 of file HcalDbService.cc.

References HcalCondObjectContainer< Item >::getValues(), and mRespCorrs.

Referenced by makeHcalCalibration().

                                                                                     {
  if (mRespCorrs) {
    return mRespCorrs->getValues (fId);
  }
  return 0;
}
const HcalQIEShape * HcalDbService::getHcalShape ( ) const
const HcalTimeCorr * HcalDbService::getHcalTimeCorr ( const HcalGenericDetId fId) const

Definition at line 234 of file HcalDbService.cc.

References HcalCondObjectContainer< Item >::getValues(), and mTimeCorrs.

Referenced by makeHcalCalibration().

                                                                                     {
  if (mTimeCorrs) {
    return mTimeCorrs->getValues (fId);
  }
  return 0;
}
const HcalZSThreshold * HcalDbService::getHcalZSThreshold ( const HcalGenericDetId fId) const

Definition at line 229 of file HcalDbService.cc.

References HcalCondObjectContainer< Item >::getValues(), and mZSThresholds.

Referenced by HcalZSAlgoRealistic::keepMe().

{
  return mZSThresholds->getValues (fId);
}
const HcalPedestal * HcalDbService::getPedestal ( const HcalGenericDetId fId) const
const HcalPedestalWidth * HcalDbService::getPedestalWidth ( const HcalGenericDetId fId) const
bool HcalDbService::makeHcalCalibration ( const HcalGenericDetId fId,
HcalCalibrations fObject,
bool  pedestalInADC 
) const [private]

Definition at line 97 of file HcalDbService.cc.

References HcalQIECoder::charge(), getGain(), getHcalCoder(), getHcalLUTCorr(), getHcalRespCorr(), getHcalShape(), getHcalTimeCorr(), getPedestal(), HcalLUTCorr::getValue(), HcalRespCorr::getValue(), HcalTimeCorr::getValue(), HcalGain::getValues(), HcalPedestal::getValues(), i, and ExpressReco_HICollisions_FallBack::x.

Referenced by buildCalibrations().

                                                                                                                         {
  if (fObject) {
    const HcalPedestal* pedestal = getPedestal (fId);
    const HcalGain* gain = getGain (fId);
    const HcalRespCorr* respcorr = getHcalRespCorr (fId);
    const HcalTimeCorr* timecorr = getHcalTimeCorr (fId);
    const HcalLUTCorr* lutcorr = getHcalLUTCorr (fId);

    if (pedestalInADC) {
      const HcalQIEShape* shape=getHcalShape();
      const HcalQIECoder* coder=getHcalCoder(fId);
      if (pedestal && gain && shape && coder && respcorr && timecorr && lutcorr) {
        float pedTrue[4];
        for (int i=0; i<4; i++) {
          float x=pedestal->getValues()[i];
          int x1=(int)std::floor(x);
          int x2=(int)std::floor(x+1);
          // y = (y2-y1)/(x2-x1) * (x - x1) + y1  [note: x2-x1=1]
          float y2=coder->charge(*shape,x2,i);
          float y1=coder->charge(*shape,x1,i);
          pedTrue[i]=(y2-y1)*(x-x1)+y1;
        }
        *fObject = HcalCalibrations (gain->getValues (), pedTrue, respcorr->getValue(), timecorr->getValue(), lutcorr->getValue() );
        return true; 
      }
    } else {
      if (pedestal && gain && respcorr && timecorr && lutcorr) {
        *fObject = HcalCalibrations (gain->getValues (), pedestal->getValues (), respcorr->getValue(), timecorr->getValue(), lutcorr->getValue() );
        return true;
      }
    }
  }
  return false;
}
bool HcalDbService::makeHcalCalibrationWidth ( const HcalGenericDetId fId,
HcalCalibrationWidths fObject,
bool  pedestalInADC 
) const [private]

Definition at line 132 of file HcalDbService.cc.

References HcalQIECoder::charge(), getGainWidth(), getHcalCoder(), getHcalShape(), getPedestalWidth(), HcalGainWidth::getValues(), HcalPedestalWidth::getWidth(), i, and ExpressReco_HICollisions_FallBack::x.

Referenced by buildCalibWidths().

                                                                                                        {
  if (fObject) {
    const HcalPedestalWidth* pedestalwidth = getPedestalWidth (fId);
    const HcalGainWidth* gainwidth = getGainWidth (fId);
    if (pedestalInADC) {
      const HcalQIEShape* shape=getHcalShape();
      const HcalQIECoder* coder=getHcalCoder(fId);
      if (pedestalwidth && gainwidth && shape && coder) {
        float pedTrueWidth[4];
        for (int i=0; i<4; i++) {
          float x=pedestalwidth->getWidth(i);
          // assume QIE is linear in low range and use x1=0 and x2=1
          // y = (y2-y1) * (x) [do not add any constant, only scale!]
          float y2=coder->charge(*shape,1,i);
          float y1=coder->charge(*shape,0,i);
          pedTrueWidth[i]=(y2-y1)*x;
        }
        *fObject = HcalCalibrationWidths (gainwidth->getValues (), pedTrueWidth);
        return true; 
      } 
    } else {
      if (pedestalwidth && gainwidth) {
        float pedestalWidth [4];
        for (int i = 0; i < 4; i++) pedestalWidth [i] = pedestalwidth->getWidth (i);
        *fObject = HcalCalibrationWidths (gainwidth->getValues (), pedestalWidth);
        return true;
      }      
    }
  }
  return false;
}  
void HcalDbService::setData ( const HcalPFCorrs fItem) [inline]

Definition at line 62 of file HcalDbService.h.

References mPFCorrs.

{mPFCorrs = fItem; }
void HcalDbService::setData ( const HcalL1TriggerObjects fItem) [inline]

Definition at line 60 of file HcalDbService.h.

References mL1TriggerObjects.

{mL1TriggerObjects = fItem;}
void HcalDbService::setData ( const HcalGains fItem) [inline]

Definition at line 52 of file HcalDbService.h.

References mGains, and mUpdateCalibrations.

{mGains = fItem; mUpdateCalibrations = true; }
void HcalDbService::setData ( const HcalLUTCorrs fItem) [inline]

Definition at line 61 of file HcalDbService.h.

References mLUTCorrs, and mUpdateCalibrations.

{mLUTCorrs = fItem; mUpdateCalibrations = true; }
void HcalDbService::setData ( const HcalElectronicsMap fItem) [inline]

Definition at line 56 of file HcalDbService.h.

References mElectronicsMap.

{mElectronicsMap = fItem;}
void HcalDbService::setData ( const HcalQIEData fItem) [inline]

Definition at line 54 of file HcalDbService.h.

References mQIEData, mUpdateCalibrations, and mUpdateCalibWidths.

{mQIEData = fItem; mUpdateCalibrations = true; mUpdateCalibWidths = true; }
void HcalDbService::setData ( const HcalRespCorrs fItem) [inline]

Definition at line 57 of file HcalDbService.h.

References mRespCorrs, and mUpdateCalibrations.

{mRespCorrs = fItem; mUpdateCalibrations = true; }
void HcalDbService::setData ( const HcalChannelQuality fItem) [inline]

Definition at line 55 of file HcalDbService.h.

References mChannelQuality.

{mChannelQuality = fItem;}
void HcalDbService::setData ( const HcalZSThresholds fItem) [inline]

Definition at line 59 of file HcalDbService.h.

References mZSThresholds.

{mZSThresholds = fItem;}
void HcalDbService::setData ( const HcalPedestalWidths fItem) [inline]

Definition at line 51 of file HcalDbService.h.

References mPedestalWidths, and mUpdateCalibWidths.

{mPedestalWidths = fItem; mUpdateCalibWidths = true; }
void HcalDbService::setData ( const HcalPedestals fItem) [inline]

Definition at line 50 of file HcalDbService.h.

References mPedestals, and mUpdateCalibrations.

{mPedestals = fItem; mUpdateCalibrations = true; }
void HcalDbService::setData ( const HcalGainWidths fItem) [inline]

Definition at line 53 of file HcalDbService.h.

References mGainWidths, and mUpdateCalibWidths.

{mGainWidths = fItem; mUpdateCalibWidths = true; }
void HcalDbService::setData ( const HcalTimeCorrs fItem) [inline]

Definition at line 58 of file HcalDbService.h.

References mTimeCorrs, and mUpdateCalibrations.

{mTimeCorrs = fItem; mUpdateCalibrations = true; }
void HcalDbService::setData ( const HcalLutMetadata fItem) [inline]

Definition at line 63 of file HcalDbService.h.

References mLutMetadata.

{mLutMetadata = fItem;}

Member Data Documentation

Definition at line 88 of file HcalDbService.h.

Referenced by buildCalibrations(), and getHcalCalibrations().

Definition at line 89 of file HcalDbService.h.

Referenced by buildCalibWidths(), and getHcalCalibrationWidths().

Definition at line 78 of file HcalDbService.h.

Referenced by getHcalChannelStatus(), and setData().

Definition at line 79 of file HcalDbService.h.

Referenced by getHcalMapping(), and setData().

const HcalGains* HcalDbService::mGains [private]

Definition at line 74 of file HcalDbService.h.

Referenced by buildCalibrations(), getGain(), and setData().

Definition at line 75 of file HcalDbService.h.

Referenced by buildCalibWidths(), getGainWidth(), and setData().

Definition at line 82 of file HcalDbService.h.

Referenced by getHcalL1TriggerObject(), and setData().

Definition at line 84 of file HcalDbService.h.

Referenced by buildCalibrations(), getHcalLUTCorr(), and setData().

Definition at line 86 of file HcalDbService.h.

Referenced by getHcalLutMetadata(), and setData().

Definition at line 72 of file HcalDbService.h.

Referenced by buildCalibrations(), getPedestal(), and setData().

Definition at line 73 of file HcalDbService.h.

Referenced by buildCalibWidths(), getPedestalWidth(), and setData().

Definition at line 85 of file HcalDbService.h.

Referenced by getHcalPFCorr(), and setData().

Definition at line 76 of file HcalDbService.h.

Definition at line 80 of file HcalDbService.h.

Referenced by buildCalibrations(), getHcalRespCorr(), and setData().

Definition at line 83 of file HcalDbService.h.

Referenced by buildCalibrations(), getHcalTimeCorr(), and setData().

bool HcalDbService::mUpdateCalibrations [mutable, private]

Definition at line 90 of file HcalDbService.h.

Referenced by getHcalCalibrations(), and setData().

bool HcalDbService::mUpdateCalibWidths [mutable, private]

Definition at line 90 of file HcalDbService.h.

Referenced by getHcalCalibrationWidths(), and setData().

Definition at line 81 of file HcalDbService.h.

Referenced by getHcalZSThreshold(), and setData().