CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalCoderDb.cc
Go to the documentation of this file.
1 
10 
11 HcalCoderDb::HcalCoderDb (const HcalQIECoder& fCoder, const HcalQIEShape& fShape)
12  : mCoder (&fCoder),
13  mShape (&fShape)
14 {}
15 
16 template <class Digi> void HcalCoderDb::adc2fC_ (const Digi& df, CaloSamples& clf) const {
17  clf=CaloSamples(df.id(),df.size());
18  for (int i=0; i<df.size(); i++) {
19  clf[i]=mCoder->charge (*mShape, df[i].adc (), df[i].capid ());
20  }
21  clf.setPresamples(df.presamples());
22 }
23 
24 template <> void HcalCoderDb::adc2fC_<QIE10DataFrame> (const QIE10DataFrame& df, CaloSamples& clf) const {
25  clf=CaloSamples(df.id(),df.samples());
26  for (int i=0; i<df.samples(); i++) {
27  clf[i]=mCoder->charge (*mShape, df[i].adc (), df[i].capid ());
28  if(df[i].soi()) clf.setPresamples(i);
29  }
30 }
31 
32 template <class Digi> void HcalCoderDb::fC2adc_ (const CaloSamples& clf, Digi& df, int fCapIdOffset) const {
33  df = Digi (clf.id ());
34  df.setSize (clf.size ());
35  df.setPresamples (clf.presamples ());
36  for (int i=0; i<clf.size(); i++) {
37  int capId = (fCapIdOffset + i) % 4;
38  df.setSample(i, HcalQIESample(mCoder->adc(*mShape, clf[i], capId), capId, 0, 0));
39  }
40 }
41 
42 template <class Digi> void HcalCoderDb::fCUpgrade2adc_ (const CaloSamples& clf, Digi& df, int fCapIdOffset) const {
43  df = HcalUpgradeDataFrame(clf.id(), fCapIdOffset, clf.size(),
44  clf.presamples());
45  for (int i=0; i<clf.size(); ++i) {
46  df.setSample(i, mCoder->adc(*mShape, clf[i], df.capId(i)),
47  0, true);
48  }
49 }
50 
51 template <> void HcalCoderDb::fC2adc_<QIE10DataFrame> (const CaloSamples& clf, QIE10DataFrame& df, int fCapIdOffset) const {
52  int presample = clf.presamples ();
53  for (int i=0; i<clf.size(); i++) {
54  int capId = (fCapIdOffset + i) % 4;
55  bool soi = (i==presample);
56  df.setSample(i, mCoder->adc(*mShape, clf[i], capId), 0, 0, capId, soi, true);
57  }
58 }
59 
60 void HcalCoderDb::adc2fC(const HBHEDataFrame& df, CaloSamples& lf) const {adc2fC_ (df, lf);}
61 void HcalCoderDb::adc2fC(const HODataFrame& df, CaloSamples& lf) const {adc2fC_ (df, lf);}
62 void HcalCoderDb::adc2fC(const HFDataFrame& df, CaloSamples& lf) const {adc2fC_ (df, lf);}
63 void HcalCoderDb::adc2fC(const ZDCDataFrame& df, CaloSamples& lf) const {adc2fC_ (df, lf);}
64 void HcalCoderDb::adc2fC(const HcalCalibDataFrame& df, CaloSamples& lf) const {adc2fC_ (df, lf);}
65 void HcalCoderDb::adc2fC(const HcalUpgradeDataFrame& df, CaloSamples& lf) const {adc2fC_ (df, lf);}
66 void HcalCoderDb::adc2fC(const QIE10DataFrame& df, CaloSamples& lf) const {adc2fC_ (df, lf);}
67 
68 void HcalCoderDb::fC2adc(const CaloSamples& clf, HBHEDataFrame& df, int fCapIdOffset) const {fC2adc_ (clf, df, fCapIdOffset);}
69 void HcalCoderDb::fC2adc(const CaloSamples& clf, HFDataFrame& df, int fCapIdOffset) const {fC2adc_ (clf, df, fCapIdOffset);}
70 void HcalCoderDb::fC2adc(const CaloSamples& clf, HODataFrame& df, int fCapIdOffset) const {fC2adc_ (clf, df, fCapIdOffset);}
71 void HcalCoderDb::fC2adc(const CaloSamples& clf, ZDCDataFrame& df, int fCapIdOffset) const {fC2adc_ (clf, df, fCapIdOffset);}
72 void HcalCoderDb::fC2adc(const CaloSamples& clf, HcalCalibDataFrame& df, int fCapIdOffset) const {fC2adc_ (clf, df, fCapIdOffset);}
73 void HcalCoderDb::fC2adc(const CaloSamples& clf, HcalUpgradeDataFrame& df, int fCapIdOffset) const {fCUpgrade2adc_ (clf, df, fCapIdOffset);}
74 void HcalCoderDb::fC2adc(const CaloSamples& clf, QIE10DataFrame& df, int fCapIdOffset) const {fC2adc_ (clf, df, fCapIdOffset);}
75 
int adc(sample_type sample)
get the ADC sample (12 bits)
int i
Definition: DBlmapReader.cc:9
void adc2fC_(const Digi &df, CaloSamples &clf) const
Definition: HcalCoderDb.cc:16
int presamples() const
access presample information
Definition: CaloSamples.h:36
void fCUpgrade2adc_(const CaloSamples &clf, Digi &df, int fCapIdOffset) const
Definition: HcalCoderDb.cc:42
std::tuple< unsigned int, int, int, DigiType, int, int, int, float > Digi
Definition: GenericDigi.h:30
virtual void fC2adc(const CaloSamples &clf, HBHEDataFrame &df, int fCapIdOffset) const
Definition: HcalCoderDb.cc:68
HcalCoderDb(const HcalQIECoder &fCoder, const HcalQIEShape &fShape)
Definition: HcalCoderDb.cc:11
void fC2adc_(const CaloSamples &clf, Digi &df, int fCapIdOffset) const
Definition: HcalCoderDb.cc:32
virtual void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const
Definition: HcalCoderDb.cc:60
void setPresamples(int pre)
set presample information
Definition: CaloSamples.cc:31
const HcalQIEShape * mShape
Definition: HcalCoderDb.h:41
void setSample(int iSample, uint16_t adc, uint16_t tdc, bool dv)
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:27
DetId id() const
get the (generic) id
Definition: CaloSamples.h:21
const HcalQIECoder * mCoder
Definition: HcalCoderDb.h:40
float charge(const HcalQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
ADC [0..127] + capid [0..3] -&gt; fC conversion.
Definition: HcalQIECoder.cc:22