CMS 3D CMS Logo

HcalCoderDb.cc
Go to the documentation of this file.
1 
9 
10 HcalCoderDb::HcalCoderDb(const HcalQIECoder& fCoder, const HcalQIEShape& fShape) : mCoder(&fCoder), mShape(&fShape) {}
11 
12 template <class Digi>
13 void HcalCoderDb::adc2fC_(const Digi& df, CaloSamples& clf) const {
14  clf = CaloSamples(df.id(), df.size());
15  for (int i = 0; i < df.size(); i++) {
16  clf[i] = mCoder->charge(*mShape, df[i].adc(), df[i].capid());
17  }
18  clf.setPresamples(df.presamples());
19 }
20 
21 template <>
22 void HcalCoderDb::adc2fC_<QIE10DataFrame>(const QIE10DataFrame& df, CaloSamples& clf) const {
23  clf = CaloSamples(df.id(), df.samples());
24  for (int i = 0; i < df.samples(); i++) {
25  clf[i] = mCoder->charge(*mShape, df[i].adc(), df[i].capid());
26  if (df[i].soi())
27  clf.setPresamples(i);
28  }
29 }
30 
31 template <>
32 void HcalCoderDb::adc2fC_<QIE11DataFrame>(const QIE11DataFrame& df, CaloSamples& clf) const {
33  clf = CaloSamples(df.id(), df.samples());
34  for (int i = 0; i < df.samples(); i++) {
35  clf[i] = mCoder->charge(*mShape, df[i].adc(), df[i].capid());
36  if (df[i].soi())
37  clf.setPresamples(i);
38  }
39 }
40 
41 template <class Digi>
42 void HcalCoderDb::fC2adc_(const CaloSamples& clf, Digi& df, int fCapIdOffset) const {
43  df = Digi(clf.id());
44  df.setSize(clf.size());
45  df.setPresamples(clf.presamples());
46  for (int i = 0; i < clf.size(); i++) {
47  int capId = (fCapIdOffset + i) % 4;
48  df.setSample(i, HcalQIESample(mCoder->adc(*mShape, clf[i], capId), capId, 0, 0));
49  }
50 }
51 
52 template <>
53 void HcalCoderDb::fC2adc_<QIE10DataFrame>(const CaloSamples& clf, QIE10DataFrame& df, int fCapIdOffset) const {
54  int presample = clf.presamples();
55  for (int i = 0; i < clf.size(); i++) {
56  int capId = (fCapIdOffset + i) % 4;
57  bool soi = (i == presample);
58  df.setSample(i, mCoder->adc(*mShape, clf[i], capId), 0, 0, capId, soi, true);
59  }
60 }
61 
62 template <>
63 void HcalCoderDb::fC2adc_<QIE11DataFrame>(const CaloSamples& clf, QIE11DataFrame& df, int fCapIdOffset) const {
64  int presample = clf.presamples();
65  df.setCapid0(fCapIdOffset % 4);
66  for (int i = 0; i < clf.size(); i++) {
67  int capId = (fCapIdOffset + i) % 4;
68  bool soi = (i == presample);
69  df.setSample(i, mCoder->adc(*mShape, clf[i], capId), 0, soi);
70  }
71 }
72 
73 void HcalCoderDb::adc2fC(const HBHEDataFrame& df, CaloSamples& lf) const { adc2fC_(df, lf); }
74 void HcalCoderDb::adc2fC(const HODataFrame& df, CaloSamples& lf) const { adc2fC_(df, lf); }
75 void HcalCoderDb::adc2fC(const HFDataFrame& df, CaloSamples& lf) const { adc2fC_(df, lf); }
76 void HcalCoderDb::adc2fC(const ZDCDataFrame& df, CaloSamples& lf) const { adc2fC_(df, lf); }
78 void HcalCoderDb::adc2fC(const QIE10DataFrame& df, CaloSamples& lf) const { adc2fC_(df, lf); }
79 void HcalCoderDb::adc2fC(const QIE11DataFrame& df, CaloSamples& lf) const { adc2fC_(df, lf); }
80 
81 void HcalCoderDb::fC2adc(const CaloSamples& clf, HBHEDataFrame& df, int fCapIdOffset) const {
82  fC2adc_(clf, df, fCapIdOffset);
83 }
84 void HcalCoderDb::fC2adc(const CaloSamples& clf, HFDataFrame& df, int fCapIdOffset) const {
85  fC2adc_(clf, df, fCapIdOffset);
86 }
87 void HcalCoderDb::fC2adc(const CaloSamples& clf, HODataFrame& df, int fCapIdOffset) const {
88  fC2adc_(clf, df, fCapIdOffset);
89 }
90 void HcalCoderDb::fC2adc(const CaloSamples& clf, ZDCDataFrame& df, int fCapIdOffset) const {
91  fC2adc_(clf, df, fCapIdOffset);
92 }
93 void HcalCoderDb::fC2adc(const CaloSamples& clf, HcalCalibDataFrame& df, int fCapIdOffset) const {
94  fC2adc_(clf, df, fCapIdOffset);
95 }
96 void HcalCoderDb::fC2adc(const CaloSamples& clf, QIE10DataFrame& df, int fCapIdOffset) const {
97  fC2adc_(clf, df, fCapIdOffset);
98 }
99 void HcalCoderDb::fC2adc(const CaloSamples& clf, QIE11DataFrame& df, int fCapIdOffset) const {
100  fC2adc_(clf, df, fCapIdOffset);
101 }
HcalCoderDb::fC2adc
void fC2adc(const CaloSamples &clf, HBHEDataFrame &df, int fCapIdOffset) const override
Definition: HcalCoderDb.cc:81
mps_fire.i
i
Definition: mps_fire.py:428
HcalQIECoder::charge
float charge(const HcalQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
ADC [0..127] + capid [0..3] -> fC conversion.
Definition: HcalQIECoder.cc:20
CaloSamples::size
int size() const
get the size
Definition: CaloSamples.h:24
gpuClustering::adc
uint16_t *__restrict__ uint16_t const *__restrict__ adc
Definition: gpuClusterChargeCut.h:20
TrendClient_cfi.Digi
Digi
Definition: TrendClient_cfi.py:7
HcalCoderDb::adc2fC
void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const override
Definition: HcalCoderDb.cc:73
HcalCoderDb::HcalCoderDb
HcalCoderDb(const HcalQIECoder &fCoder, const HcalQIEShape &fShape)
Definition: HcalCoderDb.cc:10
HcalQIESample
Definition: HcalQIESample.h:32
HcalCoderDb.h
HcalQIECoder.h
ZDCDataFrame
Definition: ZDCDataFrame.h:15
HBHEDataFrame
Definition: HBHEDataFrame.h:14
HcalCalibDataFrame
Definition: HcalCalibDataFrame.h:15
CaloSamples::setPresamples
void setPresamples(int pre)
set presample information
Definition: CaloSamples.cc:33
HcalCoderDb::fC2adc_
void fC2adc_(const CaloSamples &clf, Digi &df, int fCapIdOffset) const
Definition: HcalCoderDb.cc:42
CaloSamples::id
DetId id() const
get the (generic) id
Definition: CaloSamples.h:21
HFDataFrame
Definition: HFDataFrame.h:14
CaloSamples
Definition: CaloSamples.h:14
HcalQIECoder
Definition: HcalQIECoder.h:20
hgcalPerformanceValidation.df
df
Definition: hgcalPerformanceValidation.py:733
QIE10DataFrame
Definition: QIE10DataFrame.h:11
CaloSamples::presamples
int presamples() const
access presample information
Definition: CaloSamples.h:36
HODataFrame
Definition: HODataFrame.h:14
HcalCoderDb::adc2fC_
void adc2fC_(const Digi &df, CaloSamples &clf) const
Definition: HcalCoderDb.cc:13
QIE11DataFrame
Definition: QIE11DataFrame.h:11
HcalCoderDb::mShape
const HcalQIEShape * mShape
Definition: HcalCoderDb.h:43
HcalQIEShape
Definition: HcalQIEShape.h:17
HcalQIECoder::adc
unsigned adc(const HcalQIEShape &fShape, float fCharge, unsigned fCapId) const
fC + capid [0..3] -> ADC conversion
Definition: HcalQIECoder.cc:25
HcalCoderDb::mCoder
const HcalQIECoder * mCoder
Definition: HcalCoderDb.h:42