Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:47:20

0001 #include "CalibFormats/CastorObjects/interface/CastorNominalCoder.h"
0002 
0003 void CastorNominalCoder::adc2fC(const CastorDataFrame& df, CaloSamples& lf) const {
0004   lf = CaloSamples(df.id(), df.size());
0005   for (int i = 0; i < df.size(); i++)
0006     lf[i] = df[i].nominal_fC();
0007   lf.setPresamples(df.presamples());
0008 }
0009 
0010 namespace CastorNominalCoderTemplate {
0011   template <class Digi>
0012   void process(const CaloSamples& clf, Digi& df, int fCapIdOffset) {
0013     df = Digi(clf.id());
0014     df.setSize(clf.size());
0015     df.setPresamples(clf.presamples());
0016     for (int i = 0; i < clf.size(); i++) {
0017       int capId = (fCapIdOffset + i) % 4;
0018       for (int q = 1; q < 128; q++) {
0019         df.setSample(i, HcalQIESample(q, capId, 0, 0));
0020         if (df[i].nominal_fC() > clf[i]) {
0021           df.setSample(i, HcalQIESample(q - 1, capId, 0, 0));
0022           break;
0023         }
0024       }
0025     }
0026   }
0027 }  // namespace CastorNominalCoderTemplate
0028 
0029 void CastorNominalCoder::fC2adc(const CaloSamples& clf, CastorDataFrame& df, int fCapIdOffset) const {
0030   CastorNominalCoderTemplate::process(clf, df, fCapIdOffset);
0031 }