6 #include "CLHEP/Random/RandGaussQ.h" 19 float const TDC_Threshold(
getThreshold(digi.id(), engine));
20 float const TDC_Threshold_hyst(TDC_Threshold);
21 bool risingReady(
true), fallingReady(
false);
24 bool hasTDCValues=
true;
29 int const rising_ac_hysteresis(5);
30 int lastRisingEdge(0);
36 for (
int ibin = 0; ibin < lf.
size(); ++ibin) {
51 int TDC_RisingEdge = (risingReady) ?
54 int TDC_FallingEdge = (fallingReady) ?
57 int preciseBegin = ibin * tdcBins;
58 int preciseEnd = preciseBegin + tdcBins;
61 for(
int i = preciseBegin;
i < preciseEnd; ++
i) {
64 if( (fallingReady) && (
i%3 == 0) && (lf.
preciseAt(
i) < TDC_Threshold)) {
66 TDC_FallingEdge =
i-preciseBegin;
69 if ((risingReady) && (lf.
preciseAt(
i) > TDC_Threshold)) {
71 TDC_RisingEdge =
i-preciseBegin;
80 if ((!fallingReady) && (lf.
preciseAt(
i) > TDC_Threshold)) {
85 if ((!risingReady) && (lastRisingEdge > rising_ac_hysteresis) &&
95 int packedTDC = TDC_RisingEdge + (tdcBins*2) * TDC_FallingEdge;
96 digi.setSample(ibin, digi.adc(ibin), packedTDC,
true);
130 return nominal - 0.365*
lsb;
void timing(const CaloSamples &lf, Digi &digi, CLHEP::HepRandomEngine *) const
adds timing information to the digi
const HcalDbService * theDbService
double pedestal(int fCapId) const
get pedestal for capid=0..3
int preciseSize() const
get the size
std::tuple< unsigned int, int, int, DigiType, int, int, int, float > Digi
float preciseAt(int i) const
const function to access precise samples
double getHysteresisThreshold(double nominal) const
double pedestal(int fCapId) const
get pedestal width for capid=0..3
int noTransitionCode() const
int alreadyTransitionCode() const
const HcalCalibrationWidths & getHcalCalibrationWidths(const HcalGenericDetId &fId) const
int size() const
get the size
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const
HcalTDC(unsigned int thresholdDAC=12)
void setDbService(const HcalDbService *service)
the Producer will probably update this every event
double getThreshold(const HcalGenericDetId &detId, CLHEP::HepRandomEngine *) const
HcalTDCParameters theTDCParameters