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
CastorDbService Class Reference

#include <CastorDbService.h>

Public Member Functions

 CastorDbService (const edm::ParameterSet &)
 
const CastorCalibrationsgetCastorCalibrations (const HcalGenericDetId &fId) const
 
const CastorCalibrationWidthsgetCastorCalibrationWidths (const HcalGenericDetId &fId) const
 
const CastorChannelStatusgetCastorChannelStatus (const HcalGenericDetId &fId) const
 
const CastorQIECodergetCastorCoder (const HcalGenericDetId &fId) const
 
const CastorElectronicsMapgetCastorMapping () const
 
const CastorQIEShapegetCastorShape () const
 
const CastorGaingetGain (const HcalGenericDetId &fId) const
 
const CastorGainWidthgetGainWidth (const HcalGenericDetId &fId) const
 
const CastorPedestalgetPedestal (const HcalGenericDetId &fId) const
 
const CastorPedestalWidthgetPedestalWidth (const HcalGenericDetId &fId) const
 
void setData (const CastorPedestals *fItem)
 
void setData (const CastorPedestalWidths *fItem)
 
void setData (const CastorGains *fItem)
 
void setData (const CastorGainWidths *fItem)
 
void setData (const CastorQIEData *fItem)
 
void setData (const CastorChannelQuality *fItem)
 
void setData (const CastorElectronicsMap *fItem)
 

Private Member Functions

void buildCalibrations ()
 
void buildCalibWidths ()
 
bool makeCastorCalibration (const HcalGenericDetId &fId, CastorCalibrations *fObject, bool pedestalInADC) const
 
bool makeCastorCalibrationWidth (const HcalGenericDetId &fId, CastorCalibrationWidths *fObject, bool pedestalInADC) const
 

Private Attributes

CastorCalibrationsSet mCalibSet
 
CastorCalibrationWidthsSet mCalibWidthSet
 
const CastorChannelQualitymChannelQuality
 
const CastorElectronicsMapmElectronicsMap
 
const CastorGainsmGains
 
const CastorGainWidthsmGainWidths
 
const CastorPedestalsmPedestals
 
const CastorPedestalWidthsmPedestalWidths
 
const CastorQIEDatamQIEData
 
QieShapemQieShapeCache
 

Detailed Description

Definition at line 28 of file CastorDbService.h.

Constructor & Destructor Documentation

CastorDbService::CastorDbService ( const edm::ParameterSet cfg)

Definition at line 17 of file CastorDbService.cc.

18  :
19  mQieShapeCache (0),
20  mPedestals (0),
21  mPedestalWidths (0),
22  mGains (0),
23  mGainWidths (0),
24  mQIEData(0),
26  {}
const CastorQIEData * mQIEData
const CastorPedestals * mPedestals
const CastorGainWidths * mGainWidths
const CastorElectronicsMap * mElectronicsMap
const CastorPedestalWidths * mPedestalWidths
const CastorGains * mGains
QieShape * mQieShapeCache

Member Function Documentation

void CastorDbService::buildCalibrations ( )
private

Definition at line 60 of file CastorDbService.cc.

References CastorCalibrationsSet::clear(), CastorCondObjectContainer< Item >::getAllChannels(), ExpressReco_HICollisions_FallBack::id, CastorPedestals::isADC(), makeCastorCalibration(), mCalibSet, mGains, mPedestals, mQIEData, convertSQLiteXML::ok, CastorCalibrationsSet::setCalibrations(), and CastorCalibrationsSet::sort().

Referenced by setData().

60  {
61  // we use the set of ids for pedestals as the master list
62  if ((!mPedestals) || (!mGains) || (!mQIEData) ) return;
63  std::vector<DetId> ids=mPedestals->getAllChannels();
64  bool pedsInADC = mPedestals->isADC();
65  // clear the calibrations set
66  mCalibSet.clear();
67  // loop!
68  CastorCalibrations tool;
69 
70  // std::cout << " length of id-vector: " << ids.size() << std::endl;
71  for (std::vector<DetId>::const_iterator id=ids.begin(); id!=ids.end(); ++id) {
72  // make
73  bool ok=makeCastorCalibration(*id,&tool,pedsInADC);
74  // store
75  if (ok) mCalibSet.setCalibrations(*id,tool);
76  // std::cout << "Castor calibrations built... detid no. " << HcalGenericDetId(*id) << std::endl;
77  }
78  mCalibSet.sort();
79 }
bool makeCastorCalibration(const HcalGenericDetId &fId, CastorCalibrations *fObject, bool pedestalInADC) const
const CastorQIEData * mQIEData
std::vector< DetId > getAllChannels() const
const CastorPedestals * mPedestals
CastorCalibrationsSet mCalibSet
void setCalibrations(const DetId id, const CastorCalibrations &ca)
bool isADC() const
const CastorGains * mGains
void CastorDbService::buildCalibWidths ( )
private

Definition at line 81 of file CastorDbService.cc.

References CastorCalibrationWidthsSet::clear(), CastorCondObjectContainer< Item >::getAllChannels(), ExpressReco_HICollisions_FallBack::id, CastorPedestalWidths::isADC(), makeCastorCalibrationWidth(), mCalibWidthSet, mGainWidths, mPedestalWidths, mQIEData, convertSQLiteXML::ok, CastorCalibrationWidthsSet::setCalibrationWidths(), and CastorCalibrationWidthsSet::sort().

Referenced by setData().

81  {
82  // we use the set of ids for pedestal widths as the master list
83  if ((!mPedestalWidths) || (!mGainWidths) || (!mQIEData) ) return;
84 
85  std::vector<DetId> ids=mPedestalWidths->getAllChannels();
86  bool pedsInADC = mPedestalWidths->isADC();
87  // clear the calibrations set
89  // loop!
91 
92  // std::cout << " length of id-vector: " << ids.size() << std::endl;
93  for (std::vector<DetId>::const_iterator id=ids.begin(); id!=ids.end(); ++id) {
94  // make
95  bool ok=makeCastorCalibrationWidth(*id,&tool,pedsInADC);
96  // store
97  if (ok) mCalibWidthSet.setCalibrationWidths(*id,tool);
98  // std::cout << "Castor calibrations built... detid no. " << HcalGenericDetId(*id) << std::endl;
99  }
101 }
void setCalibrationWidths(const DetId id, const CastorCalibrationWidths &ca)
const CastorQIEData * mQIEData
std::vector< DetId > getAllChannels() const
const CastorGainWidths * mGainWidths
bool makeCastorCalibrationWidth(const HcalGenericDetId &fId, CastorCalibrationWidths *fObject, bool pedestalInADC) const
const CastorPedestalWidths * mPedestalWidths
CastorCalibrationWidthsSet mCalibWidthSet
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().

33  { return mCalibSet.getCalibrations(fId); }
const CastorCalibrations & getCalibrations(const DetId id) const
CastorCalibrationsSet mCalibSet
const CastorCalibrationWidths& CastorDbService::getCastorCalibrationWidths ( const HcalGenericDetId fId) const
inline

Definition at line 34 of file CastorDbService.h.

References CastorCalibrationWidthsSet::getCalibrationWidths(), and mCalibWidthSet.

35  { return mCalibWidthSet.getCalibrationWidths(fId); }
const CastorCalibrationWidths & getCalibrationWidths(const DetId id) const
CastorCalibrationWidthsSet mCalibWidthSet
const CastorChannelStatus * CastorDbService::getCastorChannelStatus ( const HcalGenericDetId fId) const

Definition at line 183 of file CastorDbService.cc.

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

184 {
185  return mChannelQuality->getValues (fId);
186 }
const Item * getValues(DetId fId) const
const CastorChannelQuality * mChannelQuality
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(), CastorPedestalAnalysis::per2CapsHists(), CastorPSMonitor::processEvent(), and CastorPedestalAnalysis::processEvent().

165  {
166  if (mQIEData) {
167  return mQIEData->getCoder (fId);
168  }
169  return 0;
170 }
const CastorQIEData * mQIEData
const CastorQIECoder * getCoder(DetId fId) const
get QIE parameters
Definition: CastorQIEData.h:39
const CastorElectronicsMap * CastorDbService::getCastorMapping ( ) const

Definition at line 179 of file CastorDbService.cc.

References mElectronicsMap.

179  {
180  return mElectronicsMap;
181 }
const CastorElectronicsMap * 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(), CastorPedestalAnalysis::per2CapsHists(), CastorPSMonitor::processEvent(), and CastorPedestalAnalysis::processEvent().

172  {
173  if (mQIEData) {
174  return &mQIEData->getShape ();
175  }
176  return 0;
177 }
const CastorQIEShape & getShape() const
get basic shape
Definition: CastorQIEData.h:37
const CastorQIEData * mQIEData
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().

151  {
152  if (mGains) {
153  return mGains->getValues(fId);
154  }
155  return 0;
156 }
const Item * getValues(DetId fId) const
const CastorGains * mGains
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().

158  {
159  if (mGainWidths) {
160  return mGainWidths->getValues (fId);
161  }
162  return 0;
163 }
const CastorGainWidths * mGainWidths
const Item * getValues(DetId fId) const
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().

137  {
138  if (mPedestals) {
139  return mPedestals->getValues (fId);
140  }
141  return 0;
142 }
const CastorPedestals * mPedestals
const Item * getValues(DetId fId) const
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().

144  {
145  if (mPedestalWidths) {
146  return mPedestalWidths->getValues (fId);
147  }
148  return 0;
149 }
const Item * getValues(DetId fId) const
const CastorPedestalWidths * mPedestalWidths
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(), CastorGain::getValues(), CastorPedestal::getValues(), i, and ExpressReco_HICollisions_FallBack::x.

Referenced by buildCalibrations().

28  {
29  if (fObject) {
30  const CastorPedestal* pedestal = getPedestal (fId);
31  const CastorGain* gain = getGain (fId);
32 
33  if (pedestalInADC) {
34  const CastorQIEShape* shape=getCastorShape();
35  const CastorQIECoder* coder=getCastorCoder(fId);
36  if (pedestal && gain && shape && coder ) {
37  float pedTrue[4];
38  for (int i=0; i<4; i++) {
39  float x=pedestal->getValues()[i];
40  int x1=(int)std::floor(x);
41  int x2=(int)std::floor(x+1);
42  // y = (y2-y1)/(x2-x1) * (x - x1) + y1 [note: x2-x1=1]
43  float y2=coder->charge(*shape,x2,i);
44  float y1=coder->charge(*shape,x1,i);
45  pedTrue[i]=(y2-y1)*(x-x1)+y1;
46  }
47  *fObject = CastorCalibrations (gain->getValues (), pedTrue );
48  return true;
49  }
50  } else {
51  if (pedestal && gain ) {
52  *fObject = CastorCalibrations (gain->getValues (), pedestal->getValues () );
53  return true;
54  }
55  }
56  }
57  return false;
58 }
int i
Definition: DBlmapReader.cc:9
const CastorPedestal * getPedestal(const HcalGenericDetId &fId) const
const CastorQIEShape * getCastorShape() const
float charge(const CastorQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
ADC [0..127] + capid [0..3] -&gt; fC conversion.
const CastorGain * getGain(const HcalGenericDetId &fId) const
const float * getValues() const
get value for all capId = 0..3
const float * getValues() const
get value for all capId = 0..3
Definition: CastorGain.h:15
const CastorQIECoder * getCastorCoder(const HcalGenericDetId &fId) const
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 ExpressReco_HICollisions_FallBack::x.

Referenced by buildCalibWidths().

104  {
105  if (fObject) {
106  const CastorPedestalWidth* pedestalwidth = getPedestalWidth (fId);
107  const CastorGainWidth* gainwidth = getGainWidth (fId);
108  if (pedestalInADC) {
109  const CastorQIEShape* shape=getCastorShape();
110  const CastorQIECoder* coder=getCastorCoder(fId);
111  if (pedestalwidth && gainwidth && shape && coder) {
112  float pedTrueWidth[4];
113  for (int i=0; i<4; i++) {
114  float x=pedestalwidth->getWidth(i);
115  // assume QIE is linear in low range and use x1=0 and x2=1
116  // y = (y2-y1) * (x) [do not add any constant, only scale!]
117  float y2=coder->charge(*shape,1,i);
118  float y1=coder->charge(*shape,0,i);
119  pedTrueWidth[i]=(y2-y1)*x;
120  }
121  *fObject = CastorCalibrationWidths (gainwidth->getValues (), pedTrueWidth);
122  return true;
123  }
124  } else {
125  if (pedestalwidth && gainwidth) {
126  float pedestalWidth [4];
127  for (int i = 0; i < 4; i++) pedestalWidth [i] = pedestalwidth->getWidth (i);
128  *fObject = CastorCalibrationWidths (gainwidth->getValues (), pedestalWidth);
129  return true;
130  }
131  }
132  }
133  return false;
134 }
int i
Definition: DBlmapReader.cc:9
float getWidth(int fCapId) const
get width (sqrt(sigma_i_i)) for capId = 0..3
const CastorQIEShape * getCastorShape() const
float charge(const CastorQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
ADC [0..127] + capid [0..3] -&gt; fC conversion.
const float * getValues() const
get value for all capId = 0..3
const CastorGainWidth * getGainWidth(const HcalGenericDetId &fId) const
const CastorPedestalWidth * getPedestalWidth(const HcalGenericDetId &fId) const
const CastorQIECoder * getCastorCoder(const HcalGenericDetId &fId) const
void CastorDbService::setData ( const CastorPedestals fItem)
inline

Definition at line 46 of file CastorDbService.h.

References buildCalibrations(), and mPedestals.

46 {mPedestals = fItem; buildCalibrations(); }
const CastorPedestals * mPedestals
void CastorDbService::setData ( const CastorPedestalWidths fItem)
inline

Definition at line 47 of file CastorDbService.h.

References buildCalibWidths(), and mPedestalWidths.

47 {mPedestalWidths = fItem; buildCalibWidths(); }
const CastorPedestalWidths * mPedestalWidths
void CastorDbService::setData ( const CastorGains fItem)
inline

Definition at line 48 of file CastorDbService.h.

References buildCalibrations(), and mGains.

48 {mGains = fItem; buildCalibrations(); }
const CastorGains * mGains
void CastorDbService::setData ( const CastorGainWidths fItem)
inline

Definition at line 49 of file CastorDbService.h.

References mGainWidths.

49 {mGainWidths = fItem; }
const CastorGainWidths * mGainWidths
void CastorDbService::setData ( const CastorQIEData fItem)
inline

Definition at line 50 of file CastorDbService.h.

References mQIEData.

50 {mQIEData = fItem; }
const CastorQIEData * mQIEData
void CastorDbService::setData ( const CastorChannelQuality fItem)
inline

Definition at line 51 of file CastorDbService.h.

References mChannelQuality.

51 {mChannelQuality = fItem;}
const CastorChannelQuality * mChannelQuality
void CastorDbService::setData ( const CastorElectronicsMap fItem)
inline

Definition at line 52 of file CastorDbService.h.

References mElectronicsMap.

52 {mElectronicsMap = fItem;}
const CastorElectronicsMap * mElectronicsMap

Member Data Documentation

CastorCalibrationsSet CastorDbService::mCalibSet
private

Definition at line 69 of file CastorDbService.h.

Referenced by buildCalibrations(), and getCastorCalibrations().

CastorCalibrationWidthsSet CastorDbService::mCalibWidthSet
private

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
QieShape* CastorDbService::mQieShapeCache
mutableprivate

Definition at line 61 of file CastorDbService.h.