CMS 3D CMS Logo

HcalTDC.cc
Go to the documentation of this file.
5 #include "CLHEP/Random/RandGaussQ.h"
6 
8  : theTDCParameters(), theDbService(nullptr), threshold_currentTDC_(threshold_currentTDC), lsb(3.74) {}
9 
11 
12 //template <class Digi>
13 void HcalTDC::timing(const CaloSamples& lf, QIE11DataFrame& digi) const {
14  float const TDC_Threshold(getThreshold());
15  bool risingReady(true);
16  int tdcBins = theTDCParameters.nbins();
17  bool hasTDCValues = true;
18  if (lf.preciseSize() == 0)
19  hasTDCValues = false;
20 
21  for (int ibin = 0; ibin < lf.size(); ++ibin) {
22  /*
23  If in a given 25ns bunch/time sample, the pulse is above
24  TDC_Thresh, then TDC_RisingEdge set to time when threshold
25  was crossed.
26  TDC_RisingEdge=0 if it was low in the last precision bin
27  on the previous bunch crossing, but above by first precision
28  bin in current bunch crossing.
29  TDC_RisingEdge=62 if pulse starts above threshold by end of
30  previous bunch crossing and stays above threshold in current
31  bunch crossing.
32  TDC_RisingEdge=63 if the pulse never crosses the threshold.
33  */
34  // special codes
35  int TDC_RisingEdge = (risingReady) ? theTDCParameters.noTransitionCode() : theTDCParameters.alreadyTransitionCode();
36  int preciseBegin = ibin * tdcBins;
37  int preciseEnd = preciseBegin + tdcBins;
38 
39  if (hasTDCValues) {
40  for (int i = preciseBegin; i < preciseEnd; ++i) {
41  if ((!risingReady) && (i == preciseBegin) && (i != 0)) {
42  if (lf.preciseAt(i) / theTDCParameters.deltaT() > TDC_Threshold) {
43  TDC_RisingEdge = theTDCParameters.alreadyTransitionCode();
44  } else {
45  risingReady = true;
46  }
47  }
48 
49  if (risingReady) {
50  if (lf.preciseAt(i) / theTDCParameters.deltaT() > TDC_Threshold) {
51  TDC_RisingEdge = i - preciseBegin;
52  risingReady = false;
53  } else if (i == (preciseEnd - 1)) {
54  TDC_RisingEdge = theTDCParameters.noTransitionCode();
55  }
56  }
57 
58  if ((!risingReady) && (i == (preciseEnd - 1))) {
59  if (lf.preciseAt(i) / theTDCParameters.deltaT() < TDC_Threshold) {
60  risingReady = true;
61  }
62  }
63 
64  } //end of looping precise bins
65  }
66 
67  // change packing to allow for special codes
68  int packedTDC = TDC_RisingEdge;
69  digi.setSample(ibin, digi[ibin].adc(), packedTDC, digi[ibin].soi());
70 
71  } // loop over bunch crossing bins
72 }
73 
service
Definition: service.py:1
HcalCalibrations.h
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
CaloSamples::preciseAt
float preciseAt(int i) const
const function to access precise samples
Definition: CaloSamples.h:33
CaloSamples::size
int size() const
get the size
Definition: CaloSamples.h:24
gpuClustering::adc
uint16_t *__restrict__ uint16_t const *__restrict__ adc
Definition: gpuClusterChargeCut.h:20
hcalSimParameters_cfi.threshold_currentTDC
threshold_currentTDC
Definition: hcalSimParameters_cfi.py:24
HcalTDCParameters::deltaT
float deltaT() const
Definition: HcalTDCParameters.h:10
hgcalVFEProducer_cfi.lsb
lsb
Definition: hgcalVFEProducer_cfi.py:80
HcalTDCParameters::alreadyTransitionCode
int alreadyTransitionCode() const
Definition: HcalTDCParameters.h:12
CaloSamples::preciseSize
int preciseSize() const
get the size
Definition: CaloSamples.h:70
HcalTDC::~HcalTDC
~HcalTDC()
Definition: HcalTDC.cc:10
QIE11DataFrame::setSample
constexpr void setSample(edm::DataFrame::size_type isample, int adc, int tdc, bool soi=false)
set the sample contents
Definition: QIE11DataFrame.h:121
CaloSamples
Definition: CaloSamples.h:14
HcalTDC::theTDCParameters
HcalTDCParameters theTDCParameters
Definition: HcalTDC.h:31
HcalTDC.h
HcalTDC::theDbService
const HcalDbService * theDbService
Definition: HcalTDC.h:35
HcalDbService
Definition: HcalDbService.h:26
QIE11DataFrame
Definition: QIE11DataFrame.h:11
HcalDbService.h
HcalTDC::timing
void timing(const CaloSamples &lf, QIE11DataFrame &digi) const
Definition: HcalTDC.cc:13
HcalTDC::getThreshold
double getThreshold() const
Definition: HcalTDC.h:31
HcalTDC::setDbService
void setDbService(const HcalDbService *service)
the Producer will probably update this every event
Definition: HcalTDC.cc:74
HcalTDCParameters::nbins
int nbins() const
Definition: HcalTDCParameters.h:9
HcalTDC::HcalTDC
HcalTDC(double threshold_currentTDC=0.)
Definition: HcalTDC.cc:7
HcalTDCParameters::noTransitionCode
int noTransitionCode() const
Definition: HcalTDCParameters.h:13