Go to the documentation of this file.00001 #include "CalibFormats/CastorObjects/interface/CastorNominalCoder.h"
00002
00003 void CastorNominalCoder::adc2fC(const CastorDataFrame& df, CaloSamples& lf) const {
00004 lf=CaloSamples(df.id(),df.size());
00005 for (int i=0; i<df.size(); i++) lf[i]=df[i].nominal_fC();
00006 lf.setPresamples(df.presamples());
00007 }
00008
00009
00010 namespace CastorNominalCoderTemplate {
00011 template <class Digi>
00012 void process(const CaloSamples& clf, Digi& df, int fCapIdOffset) {
00013 df=Digi(clf.id());
00014 df.setSize(clf.size());
00015 df.setPresamples(clf.presamples());
00016 for (int i=0; i<clf.size(); i++) {
00017 int capId = (fCapIdOffset + i) % 4;
00018 for (int q=1; q<128; q++) {
00019 df.setSample(i,HcalQIESample(q,capId,0,0));
00020 if (df[i].nominal_fC()>clf[i]) {
00021 df.setSample(i,HcalQIESample(q-1,capId,0,0));
00022 break;
00023 }
00024 }
00025 }
00026 }
00027 }
00028
00029 void CastorNominalCoder::fC2adc(const CaloSamples& clf, CastorDataFrame& df, int fCapIdOffset) const {
00030 CastorNominalCoderTemplate::process(clf,df, fCapIdOffset);
00031 }
00032