#include <CastorDbService.h>
Definition at line 28 of file CastorDbService.h.
CastorDbService::CastorDbService | ( | const edm::ParameterSet & | cfg | ) |
Definition at line 17 of file CastorDbService.cc.
: mQieShapeCache (0), mPedestals (0), mPedestalWidths (0), mGains (0), mGainWidths (0), mQIEData(0), mElectronicsMap(0) {}
void CastorDbService::buildCalibrations | ( | ) | [private] |
Definition at line 60 of file CastorDbService.cc.
References CastorCalibrationsSet::clear(), CastorCondObjectContainer< Item >::getAllChannels(), CastorPedestals::isADC(), makeCastorCalibration(), mCalibSet, mGains, mPedestals, mQIEData, convertSQLiteXML::ok, CastorCalibrationsSet::setCalibrations(), and CastorCalibrationsSet::sort().
Referenced by setData().
{ // we use the set of ids for pedestals as the master list if ((!mPedestals) || (!mGains) || (!mQIEData) ) return; std::vector<DetId> ids=mPedestals->getAllChannels(); bool pedsInADC = mPedestals->isADC(); // clear the calibrations set mCalibSet.clear(); // loop! CastorCalibrations 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=makeCastorCalibration(*id,&tool,pedsInADC); // store if (ok) mCalibSet.setCalibrations(*id,tool); // std::cout << "Castor calibrations built... detid no. " << HcalGenericDetId(*id) << std::endl; } mCalibSet.sort(); }
void CastorDbService::buildCalibWidths | ( | ) | [private] |
Definition at line 81 of file CastorDbService.cc.
References CastorCalibrationWidthsSet::clear(), CastorCondObjectContainer< Item >::getAllChannels(), CastorPedestalWidths::isADC(), makeCastorCalibrationWidth(), mCalibWidthSet, mGainWidths, mPedestalWidths, mQIEData, convertSQLiteXML::ok, CastorCalibrationWidthsSet::setCalibrationWidths(), and CastorCalibrationWidthsSet::sort().
Referenced by setData().
{ // 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! CastorCalibrationWidths 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=makeCastorCalibrationWidth(*id,&tool,pedsInADC); // store if (ok) mCalibWidthSet.setCalibrationWidths(*id,tool); // std::cout << "Castor calibrations built... detid no. " << HcalGenericDetId(*id) << std::endl; } mCalibWidthSet.sort(); }
const CastorCalibrations& CastorDbService::getCastorCalibrations | ( | const HcalGenericDetId & | fId | ) | const [inline] |
Definition at line 32 of file CastorDbService.h.
References CastorCalibrationsSet::getCalibrations(), and mCalibSet.
Referenced by CastorPSMonitor::processEvent().
{ return mCalibSet.getCalibrations(fId); }
const CastorCalibrationWidths& CastorDbService::getCastorCalibrationWidths | ( | const HcalGenericDetId & | fId | ) | const [inline] |
Definition at line 34 of file CastorDbService.h.
References CastorCalibrationWidthsSet::getCalibrationWidths(), and mCalibWidthSet.
{ return mCalibWidthSet.getCalibrationWidths(fId); }
const CastorChannelStatus * CastorDbService::getCastorChannelStatus | ( | const HcalGenericDetId & | fId | ) | const |
Definition at line 183 of file CastorDbService.cc.
References CastorCondObjectContainer< Item >::getValues(), and mChannelQuality.
{ return mChannelQuality->getValues (fId); }
const CastorQIECoder * CastorDbService::getCastorCoder | ( | const HcalGenericDetId & | fId | ) | const |
Definition at line 165 of file CastorDbService.cc.
References CastorQIEData::getCoder(), and mQIEData.
Referenced by CastorCoderFactory::coder(), CastorLedAnalysis::LedCastorHists(), makeCastorCalibration(), makeCastorCalibrationWidth(), HcalPedestalAnalysis::per2CapsHists(), CastorPedestalAnalysis::processEvent(), and CastorPSMonitor::processEvent().
const CastorElectronicsMap * CastorDbService::getCastorMapping | ( | ) | const |
Definition at line 179 of file CastorDbService.cc.
References mElectronicsMap.
{ return mElectronicsMap; }
const CastorQIEShape * CastorDbService::getCastorShape | ( | ) | const |
Definition at line 172 of file CastorDbService.cc.
References CastorQIEData::getShape(), and mQIEData.
Referenced by CastorCoderFactory::coder(), CastorLedAnalysis::LedCastorHists(), makeCastorCalibration(), makeCastorCalibrationWidth(), HcalPedestalAnalysis::per2CapsHists(), CastorPedestalAnalysis::processEvent(), and CastorPSMonitor::processEvent().
const CastorGain * CastorDbService::getGain | ( | const HcalGenericDetId & | fId | ) | const |
Definition at line 151 of file CastorDbService.cc.
References CastorCondObjectContainer< Item >::getValues(), and mGains.
Referenced by CastorSimParameters::fCtoGeV(), and makeCastorCalibration().
const CastorGainWidth * CastorDbService::getGainWidth | ( | const HcalGenericDetId & | fId | ) | const |
Definition at line 158 of file CastorDbService.cc.
References CastorCondObjectContainer< Item >::getValues(), and mGainWidths.
Referenced by CastorSimParameters::fCtoGeV(), and makeCastorCalibrationWidth().
{ if (mGainWidths) { return mGainWidths->getValues (fId); } return 0; }
const CastorPedestal * CastorDbService::getPedestal | ( | const HcalGenericDetId & | fId | ) | const |
Definition at line 137 of file CastorDbService.cc.
References CastorCondObjectContainer< Item >::getValues(), and mPedestals.
Referenced by CastorAmplifier::amplify(), CastorLedAnalysis::LedCastorHists(), and makeCastorCalibration().
{ if (mPedestals) { return mPedestals->getValues (fId); } return 0; }
const CastorPedestalWidth * CastorDbService::getPedestalWidth | ( | const HcalGenericDetId & | fId | ) | const |
Definition at line 144 of file CastorDbService.cc.
References CastorCondObjectContainer< Item >::getValues(), and mPedestalWidths.
Referenced by CastorAmplifier::amplify(), and makeCastorCalibrationWidth().
{ if (mPedestalWidths) { return mPedestalWidths->getValues (fId); } return 0; }
bool CastorDbService::makeCastorCalibration | ( | const HcalGenericDetId & | fId, |
CastorCalibrations * | fObject, | ||
bool | pedestalInADC | ||
) | const [private] |
Definition at line 28 of file CastorDbService.cc.
References CastorQIECoder::charge(), getCastorCoder(), getCastorShape(), getGain(), getPedestal(), CastorPedestal::getValues(), CastorGain::getValues(), i, and x.
Referenced by buildCalibrations().
{ if (fObject) { const CastorPedestal* pedestal = getPedestal (fId); const CastorGain* gain = getGain (fId); if (pedestalInADC) { const CastorQIEShape* shape=getCastorShape(); const CastorQIECoder* coder=getCastorCoder(fId); if (pedestal && gain && shape && coder ) { 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 = CastorCalibrations (gain->getValues (), pedTrue ); return true; } } else { if (pedestal && gain ) { *fObject = CastorCalibrations (gain->getValues (), pedestal->getValues () ); return true; } } } return false; }
bool CastorDbService::makeCastorCalibrationWidth | ( | const HcalGenericDetId & | fId, |
CastorCalibrationWidths * | fObject, | ||
bool | pedestalInADC | ||
) | const [private] |
Definition at line 103 of file CastorDbService.cc.
References CastorQIECoder::charge(), getCastorCoder(), getCastorShape(), getGainWidth(), getPedestalWidth(), CastorGainWidth::getValues(), CastorPedestalWidth::getWidth(), i, and x.
Referenced by buildCalibWidths().
{ if (fObject) { const CastorPedestalWidth* pedestalwidth = getPedestalWidth (fId); const CastorGainWidth* gainwidth = getGainWidth (fId); if (pedestalInADC) { const CastorQIEShape* shape=getCastorShape(); const CastorQIECoder* coder=getCastorCoder(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 = CastorCalibrationWidths (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 = CastorCalibrationWidths (gainwidth->getValues (), pedestalWidth); return true; } } } return false; }
void CastorDbService::setData | ( | const CastorChannelQuality * | fItem | ) | [inline] |
Definition at line 51 of file CastorDbService.h.
References mChannelQuality.
{mChannelQuality = fItem;}
void CastorDbService::setData | ( | const CastorElectronicsMap * | fItem | ) | [inline] |
Definition at line 52 of file CastorDbService.h.
References mElectronicsMap.
{mElectronicsMap = fItem;}
void CastorDbService::setData | ( | const CastorGains * | fItem | ) | [inline] |
Definition at line 48 of file CastorDbService.h.
References buildCalibrations(), and mGains.
{mGains = fItem; buildCalibrations(); }
void CastorDbService::setData | ( | const CastorQIEData * | fItem | ) | [inline] |
void CastorDbService::setData | ( | const CastorPedestals * | fItem | ) | [inline] |
Definition at line 46 of file CastorDbService.h.
References buildCalibrations(), and mPedestals.
{mPedestals = fItem; buildCalibrations(); }
void CastorDbService::setData | ( | const CastorPedestalWidths * | fItem | ) | [inline] |
Definition at line 47 of file CastorDbService.h.
References buildCalibWidths(), and mPedestalWidths.
{mPedestalWidths = fItem; buildCalibWidths(); }
void CastorDbService::setData | ( | const CastorGainWidths * | fItem | ) | [inline] |
Definition at line 69 of file CastorDbService.h.
Referenced by buildCalibrations(), and getCastorCalibrations().
Definition at line 70 of file CastorDbService.h.
Referenced by buildCalibWidths(), and getCastorCalibrationWidths().
const CastorChannelQuality* CastorDbService::mChannelQuality [private] |
Definition at line 67 of file CastorDbService.h.
Referenced by getCastorChannelStatus(), and setData().
const CastorElectronicsMap* CastorDbService::mElectronicsMap [private] |
Definition at line 68 of file CastorDbService.h.
Referenced by getCastorMapping(), and setData().
const CastorGains* CastorDbService::mGains [private] |
Definition at line 64 of file CastorDbService.h.
Referenced by buildCalibrations(), getGain(), and setData().
const CastorGainWidths* CastorDbService::mGainWidths [private] |
Definition at line 65 of file CastorDbService.h.
Referenced by buildCalibWidths(), getGainWidth(), and setData().
const CastorPedestals* CastorDbService::mPedestals [private] |
Definition at line 62 of file CastorDbService.h.
Referenced by buildCalibrations(), getPedestal(), and setData().
const CastorPedestalWidths* CastorDbService::mPedestalWidths [private] |
Definition at line 63 of file CastorDbService.h.
Referenced by buildCalibWidths(), getPedestalWidth(), and setData().
const CastorQIEData* CastorDbService::mQIEData [private] |
Definition at line 66 of file CastorDbService.h.
Referenced by buildCalibrations(), buildCalibWidths(), getCastorCoder(), getCastorShape(), and setData().
reco::castor::QieShape* CastorDbService::mQieShapeCache [mutable, private] |
Definition at line 61 of file CastorDbService.h.