CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
HcalTDC Class Reference

#include <HcalTDC.h>

Public Member Functions

double getThreshold () const
 
unsigned int getThresholdDAC ()
 
 HcalTDC (double threshold_currentTDC=0.)
 
std::vector< int > leadingEdgeTDC (const CaloSamples &lf) const
 
void setDbService (const HcalDbService *service)
 the Producer will probably update this every event More...
 
void setThresholdDAC (unsigned int DAC)
 
void timing (const CaloSamples &lf, QIE11DataFrame &digi) const
 
void timing (const CaloSamples &lf, QIE10DataFrame &digi) const
 
 ~HcalTDC ()
 

Private Attributes

double const lsb
 
unsigned int theDAC
 
const HcalDbServicetheDbService
 
HcalTDCParameters theTDCParameters
 
double threshold_currentTDC_
 

Detailed Description

Definition at line 18 of file HcalTDC.h.

Constructor & Destructor Documentation

◆ HcalTDC()

HcalTDC::HcalTDC ( double  threshold_currentTDC = 0.)

Definition at line 7 of file HcalTDC.cc.

const HcalDbService * theDbService
Definition: HcalTDC.h:39
double threshold_currentTDC_
Definition: HcalTDC.h:42
double const lsb
Definition: HcalTDC.h:43
HcalTDCParameters theTDCParameters
Definition: HcalTDC.h:35

◆ ~HcalTDC()

HcalTDC::~HcalTDC ( )

Definition at line 10 of file HcalTDC.cc.

10 {}

Member Function Documentation

◆ getThreshold()

double HcalTDC::getThreshold ( ) const
inline

Definition at line 35 of file HcalTDC.h.

Referenced by leadingEdgeTDC().

35 { return threshold_currentTDC_; };
double threshold_currentTDC_
Definition: HcalTDC.h:42

◆ getThresholdDAC()

unsigned int HcalTDC::getThresholdDAC ( )
inline

Definition at line 34 of file HcalTDC.h.

References theDAC.

34 { return theDAC; }
unsigned int theDAC
Definition: HcalTDC.h:41

◆ leadingEdgeTDC()

std::vector< int > HcalTDC::leadingEdgeTDC ( const CaloSamples lf) const

Definition at line 33 of file HcalTDC.cc.

References HcalTDCParameters::alreadyTransitionCode(), HcalTDCParameters::deltaT(), getThreshold(), mps_fire::i, HcalTDCParameters::nbins(), HcalTDCParameters::noTransitionCode(), CaloSamples::preciseAt(), CaloSamples::preciseSize(), mps_fire::result, CaloSamples::size(), and theTDCParameters.

Referenced by timing().

33  {
34  std::vector<int> result;
35 
36  float const TDC_Threshold(getThreshold());
37  bool risingReady(true);
38  int tdcBins = theTDCParameters.nbins();
39  bool hasTDCValues = true;
40  if (lf.preciseSize() == 0)
41  hasTDCValues = false;
42 
43  for (int ibin = 0; ibin < lf.size(); ++ibin) {
44  /*
45  If in a given 25ns bunch/time sample, the pulse is above
46  TDC_Thresh, then TDC_RisingEdge set to time when threshold
47  was crossed.
48  TDC_RisingEdge=0 if it was low in the last precision bin
49  on the previous bunch crossing, but above by first precision
50  bin in current bunch crossing.
51  TDC_RisingEdge=62 if pulse starts above threshold by end of
52  previous bunch crossing and stays above threshold in current
53  bunch crossing.
54  TDC_RisingEdge=63 if the pulse never crosses the threshold.
55  */
56  // special codes
57  int TDC_RisingEdge = (risingReady) ? theTDCParameters.noTransitionCode() : theTDCParameters.alreadyTransitionCode();
58  int preciseBegin = ibin * tdcBins;
59  int preciseEnd = preciseBegin + tdcBins;
60 
61  if (hasTDCValues) {
62  for (int i = preciseBegin; i < preciseEnd; ++i) {
63  if ((!risingReady) && (i == preciseBegin) && (i != 0)) {
64  if (lf.preciseAt(i) / theTDCParameters.deltaT() > TDC_Threshold) {
65  TDC_RisingEdge = theTDCParameters.alreadyTransitionCode();
66  } else {
67  risingReady = true;
68  }
69  }
70 
71  if (risingReady) {
72  if (lf.preciseAt(i) / theTDCParameters.deltaT() > TDC_Threshold) {
73  TDC_RisingEdge = i - preciseBegin;
74  risingReady = false;
75  } else if (i == (preciseEnd - 1)) {
76  TDC_RisingEdge = theTDCParameters.noTransitionCode();
77  }
78  }
79 
80  if ((!risingReady) && (i == (preciseEnd - 1))) {
81  if (lf.preciseAt(i) / theTDCParameters.deltaT() < TDC_Threshold) {
82  risingReady = true;
83  }
84  }
85 
86  } //end of looping precise bins
87  }
88 
89  // change packing to allow for special codes
90  int packedTDC = TDC_RisingEdge;
91 
92  result.push_back(packedTDC);
93 
94  } // loop over bunch crossing bins
95 
96  return result;
97 }
int size() const
get the size
Definition: CaloSamples.h:24
float deltaT() const
double getThreshold() const
Definition: HcalTDC.h:35
int alreadyTransitionCode() const
int preciseSize() const
get the size
Definition: CaloSamples.h:70
int noTransitionCode() const
float preciseAt(int i) const
const function to access precise samples
Definition: CaloSamples.h:33
HcalTDCParameters theTDCParameters
Definition: HcalTDC.h:35

◆ setDbService()

void HcalTDC::setDbService ( const HcalDbService service)

the Producer will probably update this every event

Definition at line 99 of file HcalTDC.cc.

References theDbService.

Referenced by HcalElectronicsSim::setDbService().

99 { theDbService = service; }
const HcalDbService * theDbService
Definition: HcalTDC.h:39

◆ setThresholdDAC()

void HcalTDC::setThresholdDAC ( unsigned int  DAC)
inline

Definition at line 33 of file HcalTDC.h.

References theDAC.

33 { theDAC = DAC; }
unsigned int theDAC
Definition: HcalTDC.h:41

◆ timing() [1/2]

void HcalTDC::timing ( const CaloSamples lf,
QIE11DataFrame digi 
) const

adds timing information to the digi template <class digi>="">

Definition at line 13 of file HcalTDC.cc.

References gpuClustering::adc, leadingEdgeTDC(), QIE11DataFrame::setSample(), and CaloSamples::size().

Referenced by HcalElectronicsSim::analogToDigital().

13  {
14  std::vector<int> packedTDCs = leadingEdgeTDC(lf);
15 
16  for (int ibin = 0; ibin < lf.size(); ++ibin) {
17  digi.setSample(ibin, digi[ibin].adc(), packedTDCs[ibin], digi[ibin].soi());
18 
19  } // loop over bunch crossing bins
20 }
int size() const
get the size
Definition: CaloSamples.h:24
std::vector< int > leadingEdgeTDC(const CaloSamples &lf) const
Definition: HcalTDC.cc:33
constexpr void setSample(edm::DataFrame::size_type isample, int adc, int tdc, bool soi=false)
set the sample contents
uint16_t *__restrict__ uint16_t const *__restrict__ adc

◆ timing() [2/2]

void HcalTDC::timing ( const CaloSamples lf,
QIE10DataFrame digi 
) const

Definition at line 22 of file HcalTDC.cc.

References QIE10DataFrame::Sample::adc(), QIE10DataFrame::Sample::capid(), leadingEdgeTDC(), QIE10DataFrame::Sample::ok(), QIE10DataFrame::setSample(), CaloSamples::size(), and QIE10DataFrame::Sample::soi().

22  {
23  std::vector<int> packedTDCs = leadingEdgeTDC(lf);
24 
25  for (int ibin = 0; ibin < lf.size(); ++ibin) {
26  QIE10DataFrame::Sample sam = digi[ibin];
27  digi.setSample(ibin, sam.adc(), packedTDCs[ibin] /*LE TDC*/, 0. /*TE TDC*/, sam.capid(), sam.soi(), sam.ok());
28 
29  } // loop over bunch crossing bins
30 }
int size() const
get the size
Definition: CaloSamples.h:24
constexpr void setSample(edm::DataFrame::size_type isample, int adc, int le_tdc, int te_tdc, int capid, bool soi=false, bool ok=true)
set the sample contents
std::vector< int > leadingEdgeTDC(const CaloSamples &lf) const
Definition: HcalTDC.cc:33
constexpr int adc() const
constexpr bool ok() const
constexpr int capid() const
constexpr bool soi() const

Member Data Documentation

◆ lsb

double const HcalTDC::lsb
private

Definition at line 43 of file HcalTDC.h.

◆ theDAC

unsigned int HcalTDC::theDAC
private

Definition at line 41 of file HcalTDC.h.

Referenced by getThresholdDAC(), and setThresholdDAC().

◆ theDbService

const HcalDbService* HcalTDC::theDbService
private

Definition at line 39 of file HcalTDC.h.

Referenced by setDbService().

◆ theTDCParameters

HcalTDCParameters HcalTDC::theTDCParameters
private

Definition at line 35 of file HcalTDC.h.

Referenced by leadingEdgeTDC().

◆ threshold_currentTDC_

double HcalTDC::threshold_currentTDC_
private

Definition at line 42 of file HcalTDC.h.