CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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); }
77 void HcalCoderDb::adc2fC(const HcalCalibDataFrame& 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 }
void adc2fC_(const Digi &df, CaloSamples &clf) const
Definition: HcalCoderDb.cc:13
void fC2adc(const CaloSamples &clf, HBHEDataFrame &df, int fCapIdOffset) const override
Definition: HcalCoderDb.cc:81
int presamples() const
access presample information
Definition: CaloSamples.h:36
void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const override
Definition: HcalCoderDb.cc:73
HcalCoderDb(const HcalQIECoder &fCoder, const HcalQIEShape &fShape)
Definition: HcalCoderDb.cc:10
void fC2adc_(const CaloSamples &clf, Digi &df, int fCapIdOffset) const
Definition: HcalCoderDb.cc:42
void setPresamples(int pre)
set presample information
Definition: CaloSamples.cc:33
const HcalQIEShape * mShape
Definition: HcalCoderDb.h:43
int size() const
get the size
Definition: CaloSamples.h:24
unsigned adc(const HcalQIEShape &fShape, float fCharge, unsigned fCapId) const
fC + capid [0..3] -&gt; ADC conversion
Definition: HcalQIECoder.cc:25
DetId id() const
get the (generic) id
Definition: CaloSamples.h:21
const HcalQIECoder * mCoder
Definition: HcalCoderDb.h:42
uint16_t *__restrict__ uint16_t const *__restrict__ adc
float charge(const HcalQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
ADC [0..127] + capid [0..3] -&gt; fC conversion.
Definition: HcalQIECoder.cc:20