test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
HcalDbService Class Reference

#include <HcalDbService.h>

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 HcalQIETypegetHcalQIEType (const HcalGenericDetId &fId) const
 
const HcalRespCorrgetHcalRespCorr (const HcalGenericDetId &fId) const
 
const HcalQIEShapegetHcalShape (const HcalGenericDetId &fId) const
 
const HcalQIEShapegetHcalShape (const HcalQIECoder *coder) 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
 
const HcalTopologygetTopologyUsed () const
 
 HcalDbService (const edm::ParameterSet &)
 
void setData (const HcalPedestals *fItem)
 
void setData (const HcalPedestalWidths *fItem)
 
void setData (const HcalGains *fItem)
 
void setData (const HcalGainWidths *fItem)
 
void setData (const HcalQIEData *fItem)
 
void setData (const HcalQIETypes *fItem)
 
void setData (const HcalChannelQuality *fItem)
 
void setData (const HcalElectronicsMap *fItem)
 
void setData (const HcalRespCorrs *fItem)
 
void setData (const HcalTimeCorrs *fItem)
 
void setData (const HcalZSThresholds *fItem)
 
void setData (const HcalL1TriggerObjects *fItem)
 
void setData (const HcalLUTCorrs *fItem)
 
void setData (const HcalPFCorrs *fItem)
 
void setData (const HcalLutMetadata *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

std::atomic
< HcalCalibrationsSet const * > 
mCalibSet
 
std::atomic
< HcalCalibrationWidthsSet
const * > 
mCalibWidthSet
 
const HcalChannelQualitymChannelQuality
 
const HcalElectronicsMapmElectronicsMap
 
const HcalGainsmGains
 
const HcalGainWidthsmGainWidths
 
const HcalL1TriggerObjectsmL1TriggerObjects
 
const HcalLUTCorrsmLUTCorrs
 
const HcalLutMetadatamLutMetadata
 
const HcalPedestalsmPedestals
 
const HcalPedestalWidthsmPedestalWidths
 
const HcalPFCorrsmPFCorrs
 
const HcalQIEDatamQIEData
 
const HcalQIETypesmQIETypes
 
const HcalRespCorrsmRespCorrs
 
const HcalTimeCorrsmTimeCorrs
 
const HcalZSThresholdsmZSThresholds
 

Detailed Description

Definition at line 27 of file HcalDbService.h.

Constructor & Destructor Documentation

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

Definition at line 16 of file HcalDbService.cc.

16  :
17  mPedestals (0), mPedestalWidths (0),
18  mGains (0), mGainWidths (0),
19  mQIEData(0),
20  mQIETypes(0),
21  mElectronicsMap(0),
22  mRespCorrs(0),
24  mTimeCorrs(0),
25  mLUTCorrs(0),
26  mPFCorrs(0),
27  mLutMetadata(0),
28  mCalibSet(nullptr), mCalibWidthSet(nullptr)
29  {}
const HcalLUTCorrs * mLUTCorrs
Definition: HcalDbService.h:89
const HcalQIETypes * mQIETypes
Definition: HcalDbService.h:82
std::atomic< HcalCalibrationWidthsSet const * > mCalibWidthSet
Definition: HcalDbService.h:94
const HcalL1TriggerObjects * mL1TriggerObjects
Definition: HcalDbService.h:87
const HcalPFCorrs * mPFCorrs
Definition: HcalDbService.h:90
const HcalGains * mGains
Definition: HcalDbService.h:79
const HcalLutMetadata * mLutMetadata
Definition: HcalDbService.h:91
const HcalPedestalWidths * mPedestalWidths
Definition: HcalDbService.h:78
const HcalRespCorrs * mRespCorrs
Definition: HcalDbService.h:85
const HcalElectronicsMap * mElectronicsMap
Definition: HcalDbService.h:84
const HcalGainWidths * mGainWidths
Definition: HcalDbService.h:80
const HcalTimeCorrs * mTimeCorrs
Definition: HcalDbService.h:88
const HcalQIEData * mQIEData
Definition: HcalDbService.h:81
std::atomic< HcalCalibrationsSet const * > mCalibSet
Definition: HcalDbService.h:93
const HcalPedestals * mPedestals
Definition: HcalDbService.h:77

Member Function Documentation

void HcalDbService::buildCalibrations ( ) const
private

Definition at line 54 of file HcalDbService.cc.

References HcalCondObjectContainer< Item >::getAllChannels(), HcalPedestals::isADC(), makeHcalCalibration(), mCalibSet, mGains, mLUTCorrs, mPedestals, mQIEData, mQIETypes, mRespCorrs, mTimeCorrs, and convertSQLiteXML::ok.

Referenced by getHcalCalibrations().

54  {
55  // we use the set of ids for pedestals as the master list
56  if ((!mPedestals) || (!mGains) || (!mQIEData) || (!mQIETypes) || (!mRespCorrs) || (!mTimeCorrs) || (!mLUTCorrs) ) return;
57 
58  if (!mCalibSet.load(std::memory_order_acquire)) {
59 
60  auto ptr = new HcalCalibrationsSet();
61 
62  std::vector<DetId> ids=mPedestals->getAllChannels();
63  bool pedsInADC = mPedestals->isADC();
64  // loop!
65  HcalCalibrations tool;
66 
67  // std::cout << " length of id-vector: " << ids.size() << std::endl;
68  for (std::vector<DetId>::const_iterator id=ids.begin(); id!=ids.end(); ++id) {
69  // make
70  bool ok=makeHcalCalibration(*id,&tool,pedsInADC);
71  // store
72  if (ok) ptr->setCalibrations(*id,tool);
73  // std::cout << "Hcal calibrations built... detid no. " << HcalGenericDetId(*id) << std::endl;
74  }
75  ptr->sort();
76  HcalCalibrationsSet const * cptr = ptr;
77  HcalCalibrationsSet const * expect = nullptr;
78  bool exchanged = mCalibSet.compare_exchange_strong(expect, cptr, std::memory_order_acq_rel);
79  if(!exchanged) {
80  delete ptr;
81  }
82  }
83 }
const HcalLUTCorrs * mLUTCorrs
Definition: HcalDbService.h:89
const HcalQIETypes * mQIETypes
Definition: HcalDbService.h:82
bool isADC() const
Definition: HcalPedestals.h:28
const HcalGains * mGains
Definition: HcalDbService.h:79
std::vector< DetId > getAllChannels() const
bool makeHcalCalibration(const HcalGenericDetId &fId, HcalCalibrations *fObject, bool pedestalInADC) const
const HcalRespCorrs * mRespCorrs
Definition: HcalDbService.h:85
const HcalTimeCorrs * mTimeCorrs
Definition: HcalDbService.h:88
const HcalQIEData * mQIEData
Definition: HcalDbService.h:81
std::atomic< HcalCalibrationsSet const * > mCalibSet
Definition: HcalDbService.h:93
const HcalPedestals * mPedestals
Definition: HcalDbService.h:77
void HcalDbService::buildCalibWidths ( ) const
private

Definition at line 85 of file HcalDbService.cc.

References HcalCondObjectContainer< Item >::getAllChannels(), HcalPedestalWidths::isADC(), makeHcalCalibrationWidth(), mCalibWidthSet, mGainWidths, mPedestalWidths, mQIEData, and convertSQLiteXML::ok.

Referenced by getHcalCalibrationWidths().

85  {
86  // we use the set of ids for pedestal widths as the master list
87  if ((!mPedestalWidths) || (!mGainWidths) || (!mQIEData) ) return;
88 
89  if (!mCalibWidthSet.load(std::memory_order_acquire)) {
90 
91  auto ptr = new HcalCalibrationWidthsSet();
92 
93  const std::vector<DetId>& ids=mPedestalWidths->getAllChannels();
94  bool pedsInADC = mPedestalWidths->isADC();
95  // loop!
97 
98  // std::cout << " length of id-vector: " << ids.size() << std::endl;
99  for (std::vector<DetId>::const_iterator id=ids.begin(); id!=ids.end(); ++id) {
100  // make
101  bool ok=makeHcalCalibrationWidth(*id,&tool,pedsInADC);
102  // store
103  if (ok) ptr->setCalibrationWidths(*id,tool);
104  // std::cout << "Hcal calibrations built... detid no. " << HcalGenericDetId(*id) << std::endl;
105  }
106  ptr->sort();
107 
108  HcalCalibrationWidthsSet const * cptr = ptr;
109  HcalCalibrationWidthsSet const * expect = nullptr;
110  bool exchanged = mCalibWidthSet.compare_exchange_strong(expect, cptr, std::memory_order_acq_rel);
111  if(!exchanged) {
112  delete ptr;
113  }
114  }
115 }
std::atomic< HcalCalibrationWidthsSet const * > mCalibWidthSet
Definition: HcalDbService.h:94
std::vector< DetId > getAllChannels() const
bool makeHcalCalibrationWidth(const HcalGenericDetId &fId, HcalCalibrationWidths *fObject, bool pedestalInADC) const
const HcalPedestalWidths * mPedestalWidths
Definition: HcalDbService.h:78
const HcalGainWidths * mGainWidths
Definition: HcalDbService.h:80
const HcalQIEData * mQIEData
Definition: HcalDbService.h:81
const HcalGain * HcalDbService::getGain ( const HcalGenericDetId fId) const

Definition at line 213 of file HcalDbService.cc.

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

Referenced by HFSimParameters::fCtoGeV(), HcalSimParameters::fCtoGeV(), HPDIonFeedbackSim::fCtoGeV(), and makeHcalCalibration().

213  {
214  if (mGains) {
215  return mGains->getValues(fId);
216  }
217  return 0;
218 }
const Item * getValues(DetId fId, bool throwOnFail=true) const
const HcalGains * mGains
Definition: HcalDbService.h:79
const HcalGainWidth * HcalDbService::getGainWidth ( const HcalGenericDetId fId) const

Definition at line 220 of file HcalDbService.cc.

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

Referenced by HFSimParameters::fCtoGeV(), HcalSimParameters::fCtoGeV(), HPDIonFeedbackSim::fCtoGeV(), and makeHcalCalibrationWidth().

220  {
221  if (mGainWidths) {
222  return mGainWidths->getValues (fId);
223  }
224  return 0;
225 }
const Item * getValues(DetId fId, bool throwOnFail=true) const
const HcalGainWidths * mGainWidths
Definition: HcalDbService.h:80
const HcalCalibrations & HcalDbService::getHcalCalibrations ( const HcalGenericDetId fId) const

Definition at line 42 of file HcalDbService.cc.

References buildCalibrations(), readCalibrations2004_v2_cff::getCalibrations, and mCalibSet.

Referenced by HcalAmplifier::addPedestals(), HcalTDC::getThreshold(), HcalMonitorClient::PlotPedestalValues(), and HcaluLUTTPGCoder::update().

43 {
45  return (*mCalibSet.load(std::memory_order_acquire)).getCalibrations(fId);
46 }
void buildCalibrations() const
std::atomic< HcalCalibrationsSet const * > mCalibSet
Definition: HcalDbService.h:93
const HcalCalibrationWidths & HcalDbService::getHcalCalibrationWidths ( const HcalGenericDetId fId) const

Definition at line 48 of file HcalDbService.cc.

References buildCalibWidths(), and mCalibWidthSet.

Referenced by HcalAmplifier::addPedestals(), and HcalTDC::getThreshold().

49 {
51  return (*mCalibWidthSet.load(std::memory_order_acquire)).getCalibrationWidths(fId);
52 }
std::atomic< HcalCalibrationWidthsSet const * > mCalibWidthSet
Definition: HcalDbService.h:94
void buildCalibWidths() const
const HcalChannelStatus * HcalDbService::getHcalChannelStatus ( const HcalGenericDetId fId) const

Definition at line 259 of file HcalDbService.cc.

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

Referenced by HcaluLUTTPGCoder::update().

260 {
261  return mChannelQuality->getValues (fId);
262 }
const Item * getValues(DetId fId, bool throwOnFail=true) const
const HcalChannelQuality * mChannelQuality
Definition: HcalDbService.h:83
const HcalQIECoder * HcalDbService::getHcalCoder ( const HcalGenericDetId fId) const
const HcalL1TriggerObject * HcalDbService::getHcalL1TriggerObject ( const HcalGenericDetId fId) const

Definition at line 254 of file HcalDbService.cc.

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

Referenced by HcaluLUTTPGCoder::update().

255 {
256  return mL1TriggerObjects->getValues (fId);
257 }
const HcalL1TriggerObjects * mL1TriggerObjects
Definition: HcalDbService.h:87
const Item * getValues(DetId fId, bool throwOnFail=true) const
const HcalLUTCorr * HcalDbService::getHcalLUTCorr ( const HcalGenericDetId fId) const

Definition at line 276 of file HcalDbService.cc.

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

Referenced by makeHcalCalibration().

276  {
277  if (mLUTCorrs) {
278  return mLUTCorrs->getValues (fId);
279  }
280  return 0;
281 }
const HcalLUTCorrs * mLUTCorrs
Definition: HcalDbService.h:89
const Item * getValues(DetId fId, bool throwOnFail=true) const
const HcalLutMetadata * HcalDbService::getHcalLutMetadata ( ) const

Definition at line 290 of file HcalDbService.cc.

References mLutMetadata.

Referenced by HcaluLUTTPGCoder::update().

290  {
291  return mLutMetadata;
292 }
const HcalLutMetadata * mLutMetadata
Definition: HcalDbService.h:91
const HcalElectronicsMap * HcalDbService::getHcalMapping ( ) const

Definition at line 250 of file HcalDbService.cc.

References mElectronicsMap.

250  {
251  return mElectronicsMap;
252 }
const HcalElectronicsMap * mElectronicsMap
Definition: HcalDbService.h:84
const HcalPFCorr * HcalDbService::getHcalPFCorr ( const HcalGenericDetId fId) const

Definition at line 283 of file HcalDbService.cc.

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

283  {
284  if (mPFCorrs) {
285  return mPFCorrs->getValues (fId);
286  }
287  return 0;
288 }
const HcalPFCorrs * mPFCorrs
Definition: HcalDbService.h:90
const Item * getValues(DetId fId, bool throwOnFail=true) const
const HcalQIEType * HcalDbService::getHcalQIEType ( const HcalGenericDetId fId) const

Definition at line 185 of file HcalDbService.cc.

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

185  {
186  if (mQIETypes) {
187  return mQIETypes->getValues (fId);
188  }
189  return 0;
190 }
const HcalQIETypes * mQIETypes
Definition: HcalDbService.h:82
const Item * getValues(DetId fId, bool throwOnFail=true) const
const HcalRespCorr * HcalDbService::getHcalRespCorr ( const HcalGenericDetId fId) const

Definition at line 192 of file HcalDbService.cc.

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

Referenced by makeHcalCalibration().

192  {
193  if (mRespCorrs) {
194  return mRespCorrs->getValues (fId);
195  }
196  return 0;
197 }
const Item * getValues(DetId fId, bool throwOnFail=true) const
const HcalRespCorrs * mRespCorrs
Definition: HcalDbService.h:85
const HcalQIEShape * HcalDbService::getHcalShape ( const HcalGenericDetId fId) const

Definition at line 234 of file HcalDbService.cc.

References HcalQIEData::getShape(), HcalQIEType::getValue(), HcalCondObjectContainer< Item >::getValues(), mQIEData, and mQIETypes.

Referenced by HcalAmplifier::addPedestals(), HcalCoderFactory::coder(), getHcalShape(), ZSEnergy_impl::keepMe(), HcalLedAnalysis::LedHBHEHists(), HcalLedAnalysis::LedHFHists(), HcalLedAnalysis::LedHOHists(), makeHcalCalibration(), makeHcalCalibrationWidth(), HcalPedestalAnalysis::per2CapsHists(), HcalMonitorClient::PlotPedestalValues(), HcalPedestalAnalysis::processEvent(), and HcaluLUTTPGCoder::update().

234  {
235  if (mQIEData && mQIETypes) {
236  //currently 3 types of QIEs exist: QIE8, QIE10, QIE11
237  int qieType = mQIETypes->getValues(fId)->getValue();
238  //QIE10 and QIE11 have same shape (ADC ladder)
239  if(qieType>0) qieType = 1;
240  return &mQIEData->getShape(qieType);
241  }
242  return 0;
243 }
const HcalQIETypes * mQIETypes
Definition: HcalDbService.h:82
const HcalQIEShape & getShape(int qieType) const
get basic shape
Definition: HcalQIEData.h:37
int getValue() const
Definition: HcalQIEType.h:20
const Item * getValues(DetId fId, bool throwOnFail=true) const
const HcalQIEData * mQIEData
Definition: HcalDbService.h:81
const HcalQIEShape * HcalDbService::getHcalShape ( const HcalQIECoder coder) const

Definition at line 245 of file HcalDbService.cc.

References getHcalShape(), and HcalQIECoder::rawId().

245  {
246  HcalGenericDetId fId(coder->rawId());
247  return getHcalShape(fId);
248 }
uint32_t rawId() const
Definition: HcalQIECoder.h:37
const HcalQIEShape * getHcalShape(const HcalGenericDetId &fId) const
const HcalTimeCorr * HcalDbService::getHcalTimeCorr ( const HcalGenericDetId fId) const

Definition at line 269 of file HcalDbService.cc.

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

Referenced by makeHcalCalibration().

269  {
270  if (mTimeCorrs) {
271  return mTimeCorrs->getValues (fId);
272  }
273  return 0;
274 }
const Item * getValues(DetId fId, bool throwOnFail=true) const
const HcalTimeCorrs * mTimeCorrs
Definition: HcalDbService.h:88
const HcalZSThreshold * HcalDbService::getHcalZSThreshold ( const HcalGenericDetId fId) const

Definition at line 264 of file HcalDbService.cc.

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

Referenced by HcalZSAlgoRealistic::keepMe().

265 {
266  return mZSThresholds->getValues (fId);
267 }
const Item * getValues(DetId fId, bool throwOnFail=true) const
const HcalZSThresholds * mZSThresholds
Definition: HcalDbService.h:86
const HcalPedestal * HcalDbService::getPedestal ( const HcalGenericDetId fId) const

Definition at line 199 of file HcalDbService.cc.

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

Referenced by ZSEnergy_impl::keepMe(), HcalLedAnalysis::LedHBHEHists(), HcalLedAnalysis::LedHFHists(), HcalLedAnalysis::LedHOHists(), and makeHcalCalibration().

199  {
200  if (mPedestals) {
201  return mPedestals->getValues (fId);
202  }
203  return 0;
204 }
const Item * getValues(DetId fId, bool throwOnFail=true) const
const HcalPedestals * mPedestals
Definition: HcalDbService.h:77
const HcalPedestalWidth * HcalDbService::getPedestalWidth ( const HcalGenericDetId fId) const

Definition at line 206 of file HcalDbService.cc.

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

Referenced by makeHcalCalibrationWidth(), and HcalMonitorClient::PlotPedestalValues().

206  {
207  if (mPedestalWidths) {
208  return mPedestalWidths->getValues (fId);
209  }
210  return 0;
211 }
const Item * getValues(DetId fId, bool throwOnFail=true) const
const HcalPedestalWidths * mPedestalWidths
Definition: HcalDbService.h:78
const HcalTopology * HcalDbService::getTopologyUsed ( ) const

Definition at line 31 of file HcalDbService.cc.

References mGains, mL1TriggerObjects, mLutMetadata, mPedestals, mQIETypes, mRespCorrs, and HcalCondObjectContainerBase::topo().

31  {
32  if (mPedestals && mPedestals->topo()) return mPedestals->topo();
33  if (mGains && mGains->topo()) return mGains->topo();
34  if (mRespCorrs && mRespCorrs->topo()) return mRespCorrs->topo();
35  if (mQIETypes && mQIETypes->topo()) return mQIETypes->topo();
37  if (mLutMetadata && mLutMetadata->topo()) return mLutMetadata->topo();
38  return 0;
39 }
const HcalQIETypes * mQIETypes
Definition: HcalDbService.h:82
const HcalL1TriggerObjects * mL1TriggerObjects
Definition: HcalDbService.h:87
const HcalGains * mGains
Definition: HcalDbService.h:79
const HcalLutMetadata * mLutMetadata
Definition: HcalDbService.h:91
const HcalRespCorrs * mRespCorrs
Definition: HcalDbService.h:85
const HcalPedestals * mPedestals
Definition: HcalDbService.h:77
const HcalTopology * topo() const
bool HcalDbService::makeHcalCalibration ( const HcalGenericDetId fId,
HcalCalibrations fObject,
bool  pedestalInADC 
) const
private

Definition at line 117 of file HcalDbService.cc.

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

Referenced by buildCalibrations().

117  {
118  if (fObject) {
119  const HcalPedestal* pedestal = getPedestal (fId);
120  const HcalGain* gain = getGain (fId);
121  const HcalRespCorr* respcorr = getHcalRespCorr (fId);
122  const HcalTimeCorr* timecorr = getHcalTimeCorr (fId);
123  const HcalLUTCorr* lutcorr = getHcalLUTCorr (fId);
124 
125  if (pedestalInADC) {
126  const HcalQIECoder* coder=getHcalCoder(fId);
127  const HcalQIEShape* shape=getHcalShape(coder);
128  if (pedestal && gain && shape && coder && respcorr && timecorr && lutcorr) {
129  float pedTrue[4];
130  for (int i=0; i<4; i++) {
131  float x=pedestal->getValues()[i];
132  int x1=(int)std::floor(x);
133  int x2=(int)std::floor(x+1);
134  // y = (y2-y1)/(x2-x1) * (x - x1) + y1 [note: x2-x1=1]
135  float y2=coder->charge(*shape,x2,i);
136  float y1=coder->charge(*shape,x1,i);
137  pedTrue[i]=(y2-y1)*(x-x1)+y1;
138  }
139  *fObject = HcalCalibrations (gain->getValues (), pedTrue, respcorr->getValue(), timecorr->getValue(), lutcorr->getValue() );
140  return true;
141  }
142  } else {
143  if (pedestal && gain && respcorr && timecorr && lutcorr) {
144  *fObject = HcalCalibrations (gain->getValues (), pedestal->getValues (), respcorr->getValue(), timecorr->getValue(), lutcorr->getValue() );
145  return true;
146  }
147  }
148  }
149  return false;
150 }
int i
Definition: DBlmapReader.cc:9
const HcalRespCorr * getHcalRespCorr(const HcalGenericDetId &fId) const
const HcalLUTCorr * getHcalLUTCorr(const HcalGenericDetId &fId) const
const HcalTimeCorr * getHcalTimeCorr(const HcalGenericDetId &fId) const
const float * getValues() const
get value for all capId = 0..3
Definition: HcalGain.h:20
float getValue() const
Definition: HcalLUTCorr.h:20
float getValue() const
Definition: HcalTimeCorr.h:20
const HcalGain * getGain(const HcalGenericDetId &fId) const
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
const HcalQIEShape * getHcalShape(const HcalGenericDetId &fId) const
float getValue() const
Definition: HcalRespCorr.h:20
const float * getValues() const
get value for all capId = 0..3
Definition: HcalPedestal.h:19
const HcalPedestal * getPedestal(const HcalGenericDetId &fId) const
float charge(const HcalQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
ADC [0..127] + capid [0..3] -&gt; fC conversion.
Definition: HcalQIECoder.cc:22
bool HcalDbService::makeHcalCalibrationWidth ( const HcalGenericDetId fId,
HcalCalibrationWidths fObject,
bool  pedestalInADC 
) const
private

Definition at line 152 of file HcalDbService.cc.

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

Referenced by buildCalibWidths().

153  {
154  if (fObject) {
155  const HcalPedestalWidth* pedestalwidth = getPedestalWidth (fId);
156  const HcalGainWidth* gainwidth = getGainWidth (fId);
157  if (pedestalInADC) {
158  const HcalQIECoder* coder=getHcalCoder(fId);
159  const HcalQIEShape* shape=getHcalShape(coder);
160  if (pedestalwidth && gainwidth && shape && coder) {
161  float pedTrueWidth[4];
162  for (int i=0; i<4; i++) {
163  float x=pedestalwidth->getWidth(i);
164  // assume QIE is linear in low range and use x1=0 and x2=1
165  // y = (y2-y1) * (x) [do not add any constant, only scale!]
166  float y2=coder->charge(*shape,1,i);
167  float y1=coder->charge(*shape,0,i);
168  pedTrueWidth[i]=(y2-y1)*x;
169  }
170  *fObject = HcalCalibrationWidths (gainwidth->getValues (), pedTrueWidth);
171  return true;
172  }
173  } else {
174  if (pedestalwidth && gainwidth) {
175  float pedestalWidth [4];
176  for (int i = 0; i < 4; i++) pedestalWidth [i] = pedestalwidth->getWidth (i);
177  *fObject = HcalCalibrationWidths (gainwidth->getValues (), pedestalWidth);
178  return true;
179  }
180  }
181  }
182  return false;
183 }
const HcalGainWidth * getGainWidth(const HcalGenericDetId &fId) const
int i
Definition: DBlmapReader.cc:9
const float * getValues() const
get value for all capId = 0..3
Definition: HcalGainWidth.h:19
const HcalPedestalWidth * getPedestalWidth(const HcalGenericDetId &fId) const
float getWidth(int fCapId) const
get width (sqrt(sigma_i_i)) for capId = 0..3
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
const HcalQIEShape * getHcalShape(const HcalGenericDetId &fId) const
float charge(const HcalQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
ADC [0..127] + capid [0..3] -&gt; fC conversion.
Definition: HcalQIECoder.cc:22
void HcalDbService::setData ( const HcalPedestals fItem)
inline

Definition at line 54 of file HcalDbService.h.

References mCalibSet, and mPedestals.

54 {mPedestals = fItem; mCalibSet = nullptr;}
std::atomic< HcalCalibrationsSet const * > mCalibSet
Definition: HcalDbService.h:93
const HcalPedestals * mPedestals
Definition: HcalDbService.h:77
void HcalDbService::setData ( const HcalPedestalWidths fItem)
inline

Definition at line 55 of file HcalDbService.h.

References mCalibWidthSet, and mPedestalWidths.

55 {mPedestalWidths = fItem; mCalibWidthSet = nullptr;}
std::atomic< HcalCalibrationWidthsSet const * > mCalibWidthSet
Definition: HcalDbService.h:94
const HcalPedestalWidths * mPedestalWidths
Definition: HcalDbService.h:78
void HcalDbService::setData ( const HcalGains fItem)
inline

Definition at line 56 of file HcalDbService.h.

References mCalibSet, and mGains.

56 {mGains = fItem; mCalibSet = nullptr; }
const HcalGains * mGains
Definition: HcalDbService.h:79
std::atomic< HcalCalibrationsSet const * > mCalibSet
Definition: HcalDbService.h:93
void HcalDbService::setData ( const HcalGainWidths fItem)
inline

Definition at line 57 of file HcalDbService.h.

References mCalibWidthSet, and mGainWidths.

57 {mGainWidths = fItem; mCalibWidthSet = nullptr; }
std::atomic< HcalCalibrationWidthsSet const * > mCalibWidthSet
Definition: HcalDbService.h:94
const HcalGainWidths * mGainWidths
Definition: HcalDbService.h:80
void HcalDbService::setData ( const HcalQIEData fItem)
inline

Definition at line 58 of file HcalDbService.h.

References mCalibSet, mCalibWidthSet, and mQIEData.

58 {mQIEData = fItem; mCalibSet=nullptr; mCalibWidthSet=nullptr;}
std::atomic< HcalCalibrationWidthsSet const * > mCalibWidthSet
Definition: HcalDbService.h:94
const HcalQIEData * mQIEData
Definition: HcalDbService.h:81
std::atomic< HcalCalibrationsSet const * > mCalibSet
Definition: HcalDbService.h:93
void HcalDbService::setData ( const HcalQIETypes fItem)
inline

Definition at line 59 of file HcalDbService.h.

References mCalibSet, and mQIETypes.

59 {mQIETypes = fItem; mCalibSet = nullptr; }
const HcalQIETypes * mQIETypes
Definition: HcalDbService.h:82
std::atomic< HcalCalibrationsSet const * > mCalibSet
Definition: HcalDbService.h:93
void HcalDbService::setData ( const HcalChannelQuality fItem)
inline

Definition at line 60 of file HcalDbService.h.

References mChannelQuality.

60 {mChannelQuality = fItem;}
const HcalChannelQuality * mChannelQuality
Definition: HcalDbService.h:83
void HcalDbService::setData ( const HcalElectronicsMap fItem)
inline

Definition at line 61 of file HcalDbService.h.

References mElectronicsMap.

61 {mElectronicsMap = fItem;}
const HcalElectronicsMap * mElectronicsMap
Definition: HcalDbService.h:84
void HcalDbService::setData ( const HcalRespCorrs fItem)
inline

Definition at line 62 of file HcalDbService.h.

References mCalibSet, and mRespCorrs.

62 {mRespCorrs = fItem; mCalibSet = nullptr; }
const HcalRespCorrs * mRespCorrs
Definition: HcalDbService.h:85
std::atomic< HcalCalibrationsSet const * > mCalibSet
Definition: HcalDbService.h:93
void HcalDbService::setData ( const HcalTimeCorrs fItem)
inline

Definition at line 63 of file HcalDbService.h.

References mCalibSet, and mTimeCorrs.

63 {mTimeCorrs = fItem; mCalibSet = nullptr; }
const HcalTimeCorrs * mTimeCorrs
Definition: HcalDbService.h:88
std::atomic< HcalCalibrationsSet const * > mCalibSet
Definition: HcalDbService.h:93
void HcalDbService::setData ( const HcalZSThresholds fItem)
inline

Definition at line 64 of file HcalDbService.h.

References mZSThresholds.

64 {mZSThresholds = fItem;}
const HcalZSThresholds * mZSThresholds
Definition: HcalDbService.h:86
void HcalDbService::setData ( const HcalL1TriggerObjects fItem)
inline

Definition at line 65 of file HcalDbService.h.

References mL1TriggerObjects.

65 {mL1TriggerObjects = fItem;}
const HcalL1TriggerObjects * mL1TriggerObjects
Definition: HcalDbService.h:87
void HcalDbService::setData ( const HcalLUTCorrs fItem)
inline

Definition at line 66 of file HcalDbService.h.

References mCalibSet, and mLUTCorrs.

66 {mLUTCorrs = fItem; mCalibSet = nullptr; }
const HcalLUTCorrs * mLUTCorrs
Definition: HcalDbService.h:89
std::atomic< HcalCalibrationsSet const * > mCalibSet
Definition: HcalDbService.h:93
void HcalDbService::setData ( const HcalPFCorrs fItem)
inline

Definition at line 67 of file HcalDbService.h.

References mPFCorrs.

67 {mPFCorrs = fItem; }
const HcalPFCorrs * mPFCorrs
Definition: HcalDbService.h:90
void HcalDbService::setData ( const HcalLutMetadata fItem)
inline

Definition at line 68 of file HcalDbService.h.

References mLutMetadata.

68 {mLutMetadata = fItem;}
const HcalLutMetadata * mLutMetadata
Definition: HcalDbService.h:91

Member Data Documentation

std::atomic<HcalCalibrationsSet const *> HcalDbService::mCalibSet
mutableprivate

Definition at line 93 of file HcalDbService.h.

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

std::atomic<HcalCalibrationWidthsSet const *> HcalDbService::mCalibWidthSet
mutableprivate

Definition at line 94 of file HcalDbService.h.

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

const HcalChannelQuality* HcalDbService::mChannelQuality
private

Definition at line 83 of file HcalDbService.h.

Referenced by getHcalChannelStatus(), and setData().

const HcalElectronicsMap* HcalDbService::mElectronicsMap
private

Definition at line 84 of file HcalDbService.h.

Referenced by getHcalMapping(), and setData().

const HcalGains* HcalDbService::mGains
private

Definition at line 79 of file HcalDbService.h.

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

const HcalGainWidths* HcalDbService::mGainWidths
private

Definition at line 80 of file HcalDbService.h.

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

const HcalL1TriggerObjects* HcalDbService::mL1TriggerObjects
private

Definition at line 87 of file HcalDbService.h.

Referenced by getHcalL1TriggerObject(), getTopologyUsed(), and setData().

const HcalLUTCorrs* HcalDbService::mLUTCorrs
private

Definition at line 89 of file HcalDbService.h.

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

const HcalLutMetadata* HcalDbService::mLutMetadata
private

Definition at line 91 of file HcalDbService.h.

Referenced by getHcalLutMetadata(), getTopologyUsed(), and setData().

const HcalPedestals* HcalDbService::mPedestals
private

Definition at line 77 of file HcalDbService.h.

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

const HcalPedestalWidths* HcalDbService::mPedestalWidths
private

Definition at line 78 of file HcalDbService.h.

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

const HcalPFCorrs* HcalDbService::mPFCorrs
private

Definition at line 90 of file HcalDbService.h.

Referenced by getHcalPFCorr(), and setData().

const HcalQIEData* HcalDbService::mQIEData
private
const HcalQIETypes* HcalDbService::mQIETypes
private
const HcalRespCorrs* HcalDbService::mRespCorrs
private

Definition at line 85 of file HcalDbService.h.

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

const HcalTimeCorrs* HcalDbService::mTimeCorrs
private

Definition at line 88 of file HcalDbService.h.

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

const HcalZSThresholds* HcalDbService::mZSThresholds
private

Definition at line 86 of file HcalDbService.h.

Referenced by getHcalZSThreshold(), and setData().