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 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 ( const edm::ParameterSet pset)

Definition at line 8 of file ETLElectronicsSim.cc.

8  :
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") ) {
18 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const float toaLSB_ns_
const uint32_t tdcNbits_
const reco::FormulaEvaluator sigmaEta_
const uint32_t adcNbits_
const float adcLSB_MIP_
const float adcSaturation_MIP_
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
const float adcThreshold_MIP_

Member Function Documentation

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

Definition at line 25 of file ETLElectronicsSim.h.

25 { }
void ETLElectronicsSim::getEventSetup ( const edm::EventSetup evt)
inline

Definition at line 27 of file ETLElectronicsSim.h.

References coll, input, convertSQLitetoXML_cfg::output, and findQualityFiles::run.

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

Definition at line 21 of file ETLElectronicsSim.cc.

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

23  {
24 
25  MTDSimHitData chargeColl, toa;
26 
27 
28  std::vector<double> emptyV;
29  std::vector<double> eta(1);
30 
31  for(MTDSimHitDataAccumulator::const_iterator it=input.begin();
32  it!=input.end();
33  it++) {
34 
35  chargeColl.fill(0.f);
36  toa.fill(0.f);
37  for(size_t i=0; i<it->second.hit_info[0].size(); i++) {
38 
39  if ( (it->second).hit_info[0][i] < adcThreshold_MIP_ ) continue;
40 
41  // time of arrival
42  float finalToA = (it->second).hit_info[1][i];
43 
44  // Gaussian smearing of the time of arrival
45  eta[0] = 2.; // This is just temporary. Once the RECO geometry is
46  // available, the actual module eta will be used.
47  double sigmaToA = sigmaEta_.evaluate(eta, emptyV);
48 
49  if ( sigmaToA > 0. )
50  finalToA += CLHEP::RandGaussQ::shoot(hre, 0., sigmaToA);
51 
52  // fill the time and charge arrays
53  const unsigned int ibucket = std::floor( finalToA/bxTime_ );
54  if ( (i+ibucket) >= chargeColl.size() ) continue;
55 
56  chargeColl[i+ibucket] += (it->second).hit_info[0][i];
57 
58  if ( toa[i+ibucket] == 0. || (finalToA-ibucket*bxTime_) < toa[i+ibucket] )
59  toa[i+ibucket] = finalToA - ibucket*bxTime_;
60 
61  }
62 
63  // run the shaper to create a new data frame
64  ETLDataFrame rawDataFrame( it->first.detid_ );
65  runTrivialShaper(rawDataFrame,chargeColl,toa, it->first.row_, it->first.column_);
66  updateOutput(output,rawDataFrame);
67 
68  }
69 
70 }
void runTrivialShaper(ETLDataFrame &dataFrame, const mtd::MTDSimHitData &chargeColl, const mtd::MTDSimHitData &toa, const uint8_t row, const uint8_t column) const
std::array< MTDSimData_t, nSamples > MTDSimHitData
static std::string const input
Definition: EdmProvDump.cc:45
const reco::FormulaEvaluator sigmaEta_
void updateOutput(ETLDigiCollection &coll, const ETLDataFrame &rawDataFrame) const
double evaluate(V const &iVariables, P const &iParameters) const
double f[11][100]
const float adcThreshold_MIP_
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 73 of file ETLElectronicsSim.cc.

References ecalMGPA::adc(), adcLSB_MIP_, adcSaturation_MIP_, adcThreshold_MIP_, 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().

76  {
77  bool debug = debug_;
78 #ifdef EDM_ML_DEBUG
79  for(int it=0; it<(int)(chargeColl.size()); it++) debug |= (chargeColl[it]>adcThreshold_fC_);
80 #endif
81 
82  if(debug) edm::LogVerbatim("ETLElectronicsSim") << "[runTrivialShaper]" << std::endl;
83 
84  //set new ADCs
85  for(int it=0; it<(int)(chargeColl.size()); it++)
86  {
87  //brute force saturation, maybe could to better with an exponential like saturation
88  const uint32_t adc=std::floor( std::min(chargeColl[it],adcSaturation_MIP_) / adcLSB_MIP_ );
89  const uint32_t tdc_time=std::floor( toa[it] / toaLSB_ns_ );
90  ETLSample newSample;
91  newSample.set(chargeColl[it] > adcThreshold_MIP_,false,tdc_time,adc,row,col);
92  dataFrame.setSample(it,newSample);
93 
94  if(debug) edm::LogVerbatim("ETLElectronicsSim") << adc << " (" << chargeColl[it] << "/" << adcLSB_MIP_ << ") ";
95  }
96 
97  if(debug) {
98  std::ostringstream msg;
99  dataFrame.print(msg);
100  edm::LogVerbatim("ETLElectronicsSim") << msg.str() << std::endl;
101  }
102 }
int adc(sample_type sample)
get the ADC sample (12 bits)
const float toaLSB_ns_
wrapper for a data word
Definition: ETLSample.h:13
void setSample(int i, const S &sample)
Definition: FTLDataFrameT.h:59
T min(T a, T b)
Definition: MathUtil.h:58
#define debug
Definition: HDRShower.cc:19
tuple msg
Definition: mps_check.py:278
const float adcLSB_MIP_
void set(bool thr, bool mode, uint16_t toa, uint16_t data, uint8_t row, uint8_t col)
Definition: ETLSample.h:38
col
Definition: cuy.py:1010
const float adcSaturation_MIP_
void print(std::ostream &out=std::cout)
Definition: FTLDataFrameT.h:60
const float adcThreshold_MIP_
void ETLElectronicsSim::updateOutput ( ETLDigiCollection coll,
const ETLDataFrame rawDataFrame 
) const

Definition at line 104 of file ETLElectronicsSim.cc.

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

105  {
106  int itIdx(9);
107  if(rawDataFrame.size()<=itIdx+2) return;
108 
109  ETLDataFrame dataFrame( rawDataFrame.id() );
110  dataFrame.resize(dfSIZE);
111  bool putInEvent(false);
112  for(int it=0;it<dfSIZE; ++it) {
113  dataFrame.setSample(it, rawDataFrame[itIdx-2+it]);
114  if(it==2) putInEvent = rawDataFrame[itIdx-2+it].threshold();
115  }
116 
117  if(putInEvent) {
118  coll.push_back(dataFrame);
119  }
120 }
void push_back(T const &t)
int size() const
total number of samples in the digi
Definition: FTLDataFrameT.h:47
void resize(size_t s)
allow to set size
Definition: FTLDataFrameT.h:52
const D & id() const
det id
Definition: FTLDataFrameT.h:32

Member Data Documentation

const float ETLElectronicsSim::adcLSB_MIP_
private

Definition at line 55 of file ETLElectronicsSim.h.

Referenced by runTrivialShaper().

const uint32_t ETLElectronicsSim::adcNbits_
private

Definition at line 51 of file ETLElectronicsSim.h.

const float ETLElectronicsSim::adcSaturation_MIP_
private

Definition at line 54 of file ETLElectronicsSim.h.

Referenced by runTrivialShaper().

const float ETLElectronicsSim::adcThreshold_MIP_
private

Definition at line 56 of file ETLElectronicsSim.h.

Referenced by run(), and runTrivialShaper().

const float ETLElectronicsSim::bxTime_
private

Definition at line 47 of file ETLElectronicsSim.h.

Referenced by run().

const bool ETLElectronicsSim::debug_
private

Definition at line 46 of file ETLElectronicsSim.h.

Referenced by runTrivialShaper().

int ETLElectronicsSim::dfSIZE = 5
static

Definition at line 42 of file ETLElectronicsSim.h.

Referenced by updateOutput().

const reco::FormulaEvaluator ETLElectronicsSim::sigmaEta_
private

Definition at line 48 of file ETLElectronicsSim.h.

Referenced by run().

const uint32_t ETLElectronicsSim::tdcNbits_
private

Definition at line 51 of file ETLElectronicsSim.h.

const float ETLElectronicsSim::toaLSB_ns_
private

Definition at line 57 of file ETLElectronicsSim.h.

Referenced by runTrivialShaper().