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 77 of file HcalTDC.cc.

77 { 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 already, then TDC_RisingEdge=0 if it was low in the
25  last precision bin on the previous bunch crossing, otherwise,
26  TDC_RisingEdge=63 if the pulse never crosses the threshold
27  having started off, then the special code is 62 and then
28  one can still have a TDC_FallingEdge that is valid. If the pulse
29  never falls below threshold having started above threshold (or
30  goes above threshold in the bunch crossing and doesn't come down),
31  then TDC_FallingEdge=. If the pulse never went above
32  threshold, then TDC_RisingEdge=63 and
33  TDC_FallingEdge=62.
34  */
35  // special codes
36  int TDC_RisingEdge = (risingReady) ? theTDCParameters.noTransitionCode() : theTDCParameters.alreadyTransitionCode();
37  int preciseBegin = ibin * tdcBins;
38  int preciseEnd = preciseBegin + tdcBins;
39 
40  if (hasTDCValues) {
41  for (int i = preciseBegin; i < preciseEnd; ++i) { //find the TDC time value in each TS
42 
43  if ((!risingReady) && (i == preciseBegin) && (i != 0)) {
44  if (((lf.preciseAt(i + 1) - lf.preciseAt(i - 1)) > TDC_Threshold)) {
45  TDC_RisingEdge = theTDCParameters.alreadyTransitionCode();
46  break;
47  } else
48  risingReady = true;
49  }
50 
51  if (risingReady) {
52  if (i != (lf.size() * tdcBins - 1) && i != 0 && (lf.preciseAt(i + 1) - lf.preciseAt(i - 1)) > TDC_Threshold) {
53  risingReady = false;
54  TDC_RisingEdge = i - preciseBegin;
55  } else if (i == 0 && (lf.preciseAt(i + 1) - lf.preciseAt(i)) / 0.5 > TDC_Threshold) {
56  risingReady = false;
57  TDC_RisingEdge = i - preciseBegin;
58  } else if (i == (preciseEnd - 1))
59  TDC_RisingEdge = theTDCParameters.noTransitionCode();
60  }
61 
62  if ((!risingReady) && (i == (preciseEnd - 1)) && (i != (lf.size() * tdcBins - 1))) {
63  if (((lf.preciseAt(i + 1) - lf.preciseAt(i - 1)) < TDC_Threshold)) {
64  risingReady = true;
65  }
66  }
67  } //end of looping precise bins
68  }
69 
70  // change packing to allow for special codes
71  int packedTDC = TDC_RisingEdge;
72  digi.setSample(ibin, digi[ibin].adc(), packedTDC, digi[ibin].soi());
73 
74  } // loop over bunch crossing bins
75 }

References ecalMGPA::adc(), HcalTDCParameters::alreadyTransitionCode(), 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.

ecalMGPA::adc
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
Definition: EcalMGPASample.h:11
service
Definition: service.py:1
mps_fire.i
i
Definition: mps_fire.py:355
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::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