CMS 3D CMS Logo

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

#include <ETLElectronicsSim.h>

Public Member Functions

 ETLElectronicsSim (const edm::ParameterSet &pset)
 
void getEvent (const edm::Event &evt)
 
void getEventSetup (const edm::EventSetup &evt)
 
void run (const mtd::MTDSimHitDataAccumulator &input, ETLDigiCollection &output, CLHEP::HepRandomEngine *hre) const
 
void runTrivialShaper (ETLDataFrame &dataFrame, const mtd::MTDSimHitData &chargeColl, const mtd::MTDSimHitData &toa, const uint8_t row, const uint8_t column) const
 
void updateOutput (ETLDigiCollection &coll, const ETLDataFrame &rawDataFrame) const
 

Static Public Attributes

static constexpr int dfSIZE = 5
 

Private Attributes

const float adcLSB_MIP_
 
const uint32_t adcNbits_
 
const float adcSaturation_MIP_
 
const float adcThreshold_MIP_
 
const float bxTime_
 
const bool debug_
 
const reco::FormulaEvaluator sigmaEta_
 
const uint32_t tdcNbits_
 
const float toaLSB_ns_
 

Detailed Description

Definition at line 21 of file ETLElectronicsSim.h.

Constructor & Destructor Documentation

◆ ETLElectronicsSim()

ETLElectronicsSim::ETLElectronicsSim ( const edm::ParameterSet pset)

Definition at line 8 of file ETLElectronicsSim.cc.

9  : debug_(pset.getUntrackedParameter<bool>("debug", false)),
10  bxTime_(pset.getParameter<double>("bxTime")),
11  sigmaEta_(pset.getParameter<std::string>("etaResolution")),
12  adcNbits_(pset.getParameter<uint32_t>("adcNbits")),
13  tdcNbits_(pset.getParameter<uint32_t>("tdcNbits")),
14  adcSaturation_MIP_(pset.getParameter<double>("adcSaturation_MIP")),
16  adcThreshold_MIP_(pset.getParameter<double>("adcThreshold_MIP")),
17  toaLSB_ns_(pset.getParameter<double>("toaLSB_ns")) {}

Member Function Documentation

◆ getEvent()

void ETLElectronicsSim::getEvent ( const edm::Event evt)
inline

Definition at line 25 of file ETLElectronicsSim.h.

25 {}

◆ getEventSetup()

void ETLElectronicsSim::getEventSetup ( const edm::EventSetup evt)
inline

Definition at line 27 of file ETLElectronicsSim.h.

27 {}

◆ run()

void ETLElectronicsSim::run ( const mtd::MTDSimHitDataAccumulator input,
ETLDigiCollection output,
CLHEP::HepRandomEngine *  hre 
) const

Definition at line 19 of file ETLElectronicsSim.cc.

21  {
22  MTDSimHitData chargeColl, toa;
23 
24  std::vector<double> emptyV;
25  std::vector<double> eta(1);
26 
27  for (MTDSimHitDataAccumulator::const_iterator it = input.begin(); it != input.end(); it++) {
28  chargeColl.fill(0.f);
29  toa.fill(0.f);
30  for (size_t i = 0; i < it->second.hit_info[0].size(); i++) {
31  if ((it->second).hit_info[0][i] < adcThreshold_MIP_)
32  continue;
33 
34  // time of arrival
35  float finalToA = (it->second).hit_info[1][i];
36 
37  // Gaussian smearing of the time of arrival
38  eta[0] = 2.; // This is just temporary. Once the RECO geometry is
39  // available, the actual module eta will be used.
40  double sigmaToA = sigmaEta_.evaluate(eta, emptyV);
41 
42  if (sigmaToA > 0.)
43  finalToA += CLHEP::RandGaussQ::shoot(hre, 0., sigmaToA);
44 
45  // fill the time and charge arrays
46  const unsigned int ibucket = std::floor(finalToA / bxTime_);
47  if ((i + ibucket) >= chargeColl.size())
48  continue;
49 
50  chargeColl[i + ibucket] += (it->second).hit_info[0][i];
51 
52  if (toa[i + ibucket] == 0. || (finalToA - ibucket * bxTime_) < toa[i + ibucket])
53  toa[i + ibucket] = finalToA - ibucket * bxTime_;
54  }
55 
56  // run the shaper to create a new data frame
57  ETLDataFrame rawDataFrame(it->first.detid_);
58  runTrivialShaper(rawDataFrame, chargeColl, toa, it->first.row_, it->first.column_);
59  updateOutput(output, rawDataFrame);
60  }
61 }

References adcThreshold_MIP_, bxTime_, PVValHelper::eta, reco::FormulaEvaluator::evaluate(), f, mps_fire::i, input, convertSQLitetoXML_cfg::output, runTrivialShaper(), sigmaEta_, and updateOutput().

◆ runTrivialShaper()

void ETLElectronicsSim::runTrivialShaper ( ETLDataFrame dataFrame,
const mtd::MTDSimHitData chargeColl,
const mtd::MTDSimHitData toa,
const uint8_t  row,
const uint8_t  column 
) const

Definition at line 63 of file ETLElectronicsSim.cc.

67  {
68  bool debug = debug_;
69 #ifdef EDM_ML_DEBUG
70  for (int it = 0; it < (int)(chargeColl.size()); it++)
71  debug |= (chargeColl[it] > adcThreshold_MIP_);
72 #endif
73 
74  if (debug)
75  edm::LogVerbatim("ETLElectronicsSim") << "[runTrivialShaper]" << std::endl;
76 
77  //set new ADCs
78  for (int it = 0; it < (int)(chargeColl.size()); it++) {
79  //brute force saturation, maybe could to better with an exponential like saturation
80  const uint32_t adc = std::floor(std::min(chargeColl[it], adcSaturation_MIP_) / adcLSB_MIP_);
81  const uint32_t tdc_time = std::floor(toa[it] / toaLSB_ns_);
82  ETLSample newSample;
83  newSample.set(chargeColl[it] > adcThreshold_MIP_, false, tdc_time, adc, row, col);
84  dataFrame.setSample(it, newSample);
85 
86  if (debug)
87  edm::LogVerbatim("ETLElectronicsSim") << adc << " (" << chargeColl[it] << "/" << adcLSB_MIP_ << ") ";
88  }
89 
90  if (debug) {
91  std::ostringstream msg;
92  dataFrame.print(msg);
93  edm::LogVerbatim("ETLElectronicsSim") << msg.str() << std::endl;
94  }
95 }

References ecalMGPA::adc(), adcLSB_MIP_, adcSaturation_MIP_, adcThreshold_MIP_, cuy::col, debug, debug_, createfilelist::int, min(), mps_check::msg, FTLDataFrameT< D, S, DECODE >::print(), ETLSample::set(), FTLDataFrameT< D, S, DECODE >::setSample(), and toaLSB_ns_.

Referenced by run().

◆ updateOutput()

void ETLElectronicsSim::updateOutput ( ETLDigiCollection coll,
const ETLDataFrame rawDataFrame 
) const

Definition at line 97 of file ETLElectronicsSim.cc.

97  {
98  int itIdx(9);
99  if (rawDataFrame.size() <= itIdx + 2)
100  return;
101 
102  ETLDataFrame dataFrame(rawDataFrame.id());
103  dataFrame.resize(dfSIZE);
104  bool putInEvent(false);
105  for (int it = 0; it < dfSIZE; ++it) {
106  dataFrame.setSample(it, rawDataFrame[itIdx - 2 + it]);
107  if (it == 2)
108  putInEvent = rawDataFrame[itIdx - 2 + it].threshold();
109  }
110 
111  if (putInEvent) {
112  coll.push_back(dataFrame);
113  }
114 }

References dfSIZE, FTLDataFrameT< D, S, DECODE >::id(), edm::SortedCollection< T, SORT >::push_back(), FTLDataFrameT< D, S, DECODE >::resize(), and FTLDataFrameT< D, S, DECODE >::size().

Referenced by run().

Member Data Documentation

◆ adcLSB_MIP_

const float ETLElectronicsSim::adcLSB_MIP_
private

Definition at line 51 of file ETLElectronicsSim.h.

Referenced by runTrivialShaper().

◆ adcNbits_

const uint32_t ETLElectronicsSim::adcNbits_
private

Definition at line 47 of file ETLElectronicsSim.h.

◆ adcSaturation_MIP_

const float ETLElectronicsSim::adcSaturation_MIP_
private

Definition at line 50 of file ETLElectronicsSim.h.

Referenced by runTrivialShaper().

◆ adcThreshold_MIP_

const float ETLElectronicsSim::adcThreshold_MIP_
private

Definition at line 52 of file ETLElectronicsSim.h.

Referenced by run(), and runTrivialShaper().

◆ bxTime_

const float ETLElectronicsSim::bxTime_
private

Definition at line 43 of file ETLElectronicsSim.h.

Referenced by run().

◆ debug_

const bool ETLElectronicsSim::debug_
private

Definition at line 42 of file ETLElectronicsSim.h.

Referenced by runTrivialShaper().

◆ dfSIZE

constexpr int ETLElectronicsSim::dfSIZE = 5
staticconstexpr

Definition at line 39 of file ETLElectronicsSim.h.

Referenced by updateOutput().

◆ sigmaEta_

const reco::FormulaEvaluator ETLElectronicsSim::sigmaEta_
private

Definition at line 44 of file ETLElectronicsSim.h.

Referenced by run().

◆ tdcNbits_

const uint32_t ETLElectronicsSim::tdcNbits_
private

Definition at line 47 of file ETLElectronicsSim.h.

◆ toaLSB_ns_

const float ETLElectronicsSim::toaLSB_ns_
private

Definition at line 53 of file ETLElectronicsSim.h.

Referenced by runTrivialShaper().

ETLElectronicsSim::bxTime_
const float bxTime_
Definition: ETLElectronicsSim.h:43
FTLDataFrameT::print
void print(std::ostream &out=std::cout)
Definition: FTLDataFrameT.h:62
FTLDataFrameT::id
const D & id() const
det id
Definition: FTLDataFrameT.h:31
ecalMGPA::adc
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
Definition: EcalMGPASample.h:11
mps_fire.i
i
Definition: mps_fire.py:355
input
static const std::string input
Definition: EdmProvDump.cc:48
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
min
T min(T a, T b)
Definition: MathUtil.h:58
ETLElectronicsSim::adcThreshold_MIP_
const float adcThreshold_MIP_
Definition: ETLElectronicsSim.h:52
cuy.col
col
Definition: cuy.py:1010
ETLElectronicsSim::tdcNbits_
const uint32_t tdcNbits_
Definition: ETLElectronicsSim.h:47
ETLElectronicsSim::toaLSB_ns_
const float toaLSB_ns_
Definition: ETLElectronicsSim.h:53
mps_check.msg
tuple msg
Definition: mps_check.py:285
ETLSample::set
void set(bool thr, bool mode, uint16_t toa, uint16_t data, uint8_t row, uint8_t col)
Definition: ETLSample.h:48
ETLElectronicsSim::updateOutput
void updateOutput(ETLDigiCollection &coll, const ETLDataFrame &rawDataFrame) const
Definition: ETLElectronicsSim.cc:97
edm::SortedCollection::push_back
void push_back(T const &t)
Definition: SortedCollection.h:188
debug
#define debug
Definition: HDRShower.cc:19
mtd_digitizer::MTDSimHitData
std::array< MTDSimData_t, nSamples > MTDSimHitData
Definition: MTDDigitizerTypes.h:15
PVValHelper::eta
Definition: PVValidationHelpers.h:69
ETLElectronicsSim::debug_
const bool debug_
Definition: ETLElectronicsSim.h:42
FTLDataFrameT::setSample
void setSample(int i, const S &sample)
Definition: FTLDataFrameT.h:58
ETLSample
wrapper for a data word
Definition: ETLSample.h:13
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ETLElectronicsSim::sigmaEta_
const reco::FormulaEvaluator sigmaEta_
Definition: ETLElectronicsSim.h:44
ETLElectronicsSim::runTrivialShaper
void runTrivialShaper(ETLDataFrame &dataFrame, const mtd::MTDSimHitData &chargeColl, const mtd::MTDSimHitData &toa, const uint8_t row, const uint8_t column) const
Definition: ETLElectronicsSim.cc:63
ETLElectronicsSim::adcLSB_MIP_
const float adcLSB_MIP_
Definition: ETLElectronicsSim.h:51
createfilelist.int
int
Definition: createfilelist.py:10
edm::LogVerbatim
Definition: MessageLogger.h:297
ETLElectronicsSim::adcSaturation_MIP_
const float adcSaturation_MIP_
Definition: ETLElectronicsSim.h:50
ETLElectronicsSim::adcNbits_
const uint32_t adcNbits_
Definition: ETLElectronicsSim.h:47
FTLDataFrameT
Readout digi for HGC.
Definition: FTLDataFrameT.h:14
FTLDataFrameT::resize
void resize(size_t s)
allow to set size
Definition: FTLDataFrameT.h:51
reco::FormulaEvaluator::evaluate
double evaluate(V const &iVariables, P const &iParameters) const
Definition: FormulaEvaluator.h:73
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
FTLDataFrameT::size
int size() const
total number of samples in the digi
Definition: FTLDataFrameT.h:46
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
ETLElectronicsSim::dfSIZE
static constexpr int dfSIZE
Definition: ETLElectronicsSim.h:39