CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 ( double  threshold_currentTDC = 0.)

Definition at line 7 of file HcalTDC.cc.

8  : theTDCParameters(), theDbService(nullptr), threshold_currentTDC_(threshold_currentTDC), lsb(3.74) {}
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 ( )

Definition at line 10 of file HcalTDC.cc.

10 {}

Member Function Documentation

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
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
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 }
float deltaT() const
int preciseSize() const
get the size
Definition: CaloSamples.h:70
tuple result
Definition: mps_fire.py:311
float preciseAt(int i) const
const function to access precise samples
Definition: CaloSamples.h:33
double getThreshold() const
Definition: HcalTDC.h:35
int noTransitionCode() const
int alreadyTransitionCode() const
int size() const
get the size
Definition: CaloSamples.h:24
int nbins() const
HcalTDCParameters theTDCParameters
Definition: HcalTDC.h:35
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
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
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 }
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
int size() const
get the size
Definition: CaloSamples.h:24
uint16_t *__restrict__ uint16_t const *__restrict__ adc
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 }
constexpr int capid() const
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 bool soi() const
constexpr int adc() const
int size() const
get the size
Definition: CaloSamples.h:24
constexpr bool ok() const

Member Data Documentation

double const HcalTDC::lsb
private

Definition at line 43 of file HcalTDC.h.

unsigned int HcalTDC::theDAC
private

Definition at line 41 of file HcalTDC.h.

Referenced by getThresholdDAC(), and setThresholdDAC().

const HcalDbService* HcalTDC::theDbService
private

Definition at line 39 of file HcalTDC.h.

Referenced by setDbService().

HcalTDCParameters HcalTDC::theTDCParameters
private

Definition at line 35 of file HcalTDC.h.

Referenced by leadingEdgeTDC().

double HcalTDC::threshold_currentTDC_
private

Definition at line 42 of file HcalTDC.h.