CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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.)
 
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

double const 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 ( double  threshold_currentTDC = 0.)

Definition at line 7 of file HcalTDC.cc.

const HcalDbService * theDbService
Definition: HcalTDC.h:35
double threshold_currentTDC_
Definition: HcalTDC.h:38
double const lsb
Definition: HcalTDC.h:39
HcalTDCParameters theTDCParameters
Definition: HcalTDC.h:31
HcalTDC::~HcalTDC ( )

Definition at line 10 of file HcalTDC.cc.

10 {}

Member Function Documentation

double HcalTDC::getThreshold ( ) const
inline

Definition at line 31 of file HcalTDC.h.

Referenced by timing().

31 { return threshold_currentTDC_; };
double threshold_currentTDC_
Definition: HcalTDC.h:38
unsigned int HcalTDC::getThresholdDAC ( )
inline

Definition at line 30 of file HcalTDC.h.

30 { return theDAC; }
unsigned int theDAC
Definition: HcalTDC.h:37
void HcalTDC::setDbService ( const HcalDbService service)

the Producer will probably update this every event

Definition at line 77 of file HcalTDC.cc.

References theDbService.

Referenced by HcalElectronicsSim::setDbService().

77 { theDbService = service; }
const HcalDbService * theDbService
Definition: HcalTDC.h:35
void HcalTDC::setThresholdDAC ( unsigned int  DAC)
inline

Definition at line 29 of file HcalTDC.h.

29 { theDAC = DAC; }
unsigned int theDAC
Definition: HcalTDC.h:37
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 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().

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 }
void setSample(edm::DataFrame::size_type isample, int adc, int tdc, bool soi=false)
set the sample contents
int preciseSize() const
get the size
Definition: CaloSamples.h:70
float preciseAt(int i) const
const function to access precise samples
Definition: CaloSamples.h:33
double getThreshold() const
Definition: HcalTDC.h:31
int noTransitionCode() const
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
int alreadyTransitionCode() const
int size() const
get the size
Definition: CaloSamples.h:24
int nbins() const
HcalTDCParameters theTDCParameters
Definition: HcalTDC.h:31

Member Data Documentation

double const HcalTDC::lsb
private

Definition at line 39 of file HcalTDC.h.

unsigned int HcalTDC::theDAC
private

Definition at line 37 of file HcalTDC.h.

const HcalDbService* HcalTDC::theDbService
private

Definition at line 35 of file HcalTDC.h.

Referenced by setDbService().

HcalTDCParameters HcalTDC::theTDCParameters
private

Definition at line 31 of file HcalTDC.h.

Referenced by timing().

double HcalTDC::threshold_currentTDC_
private

Definition at line 38 of file HcalTDC.h.