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.)
 
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
 
 ~HcalTDC ()
 

Private Attributes

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

Detailed Description

Definition at line 17 of file HcalTDC.h.

Constructor & Destructor Documentation

◆ HcalTDC()

HcalTDC::HcalTDC ( double  threshold_currentTDC = 0.)

Definition at line 7 of file HcalTDC.cc.

◆ ~HcalTDC()

HcalTDC::~HcalTDC ( )

Definition at line 10 of file HcalTDC.cc.

10 {}

Member Function Documentation

◆ getThreshold()

double HcalTDC::getThreshold ( ) const
inline

Definition at line 31 of file HcalTDC.h.

31 { return threshold_currentTDC_; };

Referenced by timing().

◆ getThresholdDAC()

unsigned int HcalTDC::getThresholdDAC ( )
inline

Definition at line 30 of file HcalTDC.h.

30 { return theDAC; }

References theDAC.

◆ setDbService()

void HcalTDC::setDbService ( const HcalDbService service)

the Producer will probably update this every event

Definition at line 74 of file HcalTDC.cc.

74 { theDbService = service; }

References theDbService.

Referenced by HcalElectronicsSim::setDbService().

◆ setThresholdDAC()

void HcalTDC::setThresholdDAC ( unsigned int  DAC)
inline

Definition at line 29 of file HcalTDC.h.

29 { theDAC = DAC; }

References theDAC.

◆ timing()

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.

13  {
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 }

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

Referenced by HcalElectronicsSim::analogToDigital().

Member Data Documentation

◆ lsb

const double HcalTDC::lsb
private

Definition at line 39 of file HcalTDC.h.

◆ theDAC

unsigned int HcalTDC::theDAC
private

Definition at line 37 of file HcalTDC.h.

Referenced by getThresholdDAC(), and setThresholdDAC().

◆ theDbService

const HcalDbService* HcalTDC::theDbService
private

Definition at line 35 of file HcalTDC.h.

Referenced by setDbService().

◆ theTDCParameters

HcalTDCParameters HcalTDC::theTDCParameters
private

Definition at line 31 of file HcalTDC.h.

Referenced by timing().

◆ threshold_currentTDC_

double HcalTDC::threshold_currentTDC_
private

Definition at line 38 of file HcalTDC.h.

service
Definition: service.py:1
mps_fire.i
i
Definition: mps_fire.py:428
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
hcalSimParameters_cfi.threshold_currentTDC
threshold_currentTDC
Definition: hcalSimParameters_cfi.py:24
HcalTDC::lsb
const double lsb
Definition: HcalTDC.h:39
HcalTDCParameters::deltaT
float deltaT() const
Definition: HcalTDCParameters.h:10
ecalLiteDTU::adc
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
Definition: EcalLiteDTUSample.h:12
HcalTDCParameters::alreadyTransitionCode
int alreadyTransitionCode() const
Definition: HcalTDCParameters.h:12
CaloSamples::preciseSize
int preciseSize() const
get the size
Definition: CaloSamples.h:70
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
HcalTDC::theDAC
unsigned int theDAC
Definition: HcalTDC.h:37
HcalTDC::theTDCParameters
HcalTDCParameters theTDCParameters
Definition: HcalTDC.h:31
HcalTDC::theDbService
const HcalDbService * theDbService
Definition: HcalTDC.h:35
HcalTDC::threshold_currentTDC_
double threshold_currentTDC_
Definition: HcalTDC.h:38
HcalTDC::getThreshold
double getThreshold() const
Definition: HcalTDC.h:31
HcalTDCParameters::nbins
int nbins() const
Definition: HcalTDCParameters.h:9
HcalTDCParameters::noTransitionCode
int noTransitionCode() const
Definition: HcalTDCParameters.h:13