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
 
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 bool debug_
 
const uint32_t tdcNbits_
 
const float toaLSB_ns_
 

Detailed Description

Definition at line 19 of file ETLElectronicsSim.h.

Constructor & Destructor Documentation

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

Definition at line 7 of file ETLElectronicsSim.cc.

7  :
8  debug_( pset.getUntrackedParameter<bool>("debug",false) ),
9  adcNbits_( pset.getParameter<uint32_t>("adcNbits") ),
10  tdcNbits_( pset.getParameter<uint32_t>("tdcNbits") ),
11  adcSaturation_MIP_( pset.getParameter<double>("adcSaturation_MIP") ),
13  adcThreshold_MIP_( pset.getParameter<double>("adcThreshold_MIP") ),
14  toaLSB_ns_( pset.getParameter<double>("toaLSB_ns")) {
15 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const float toaLSB_ns_
const uint32_t tdcNbits_
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 23 of file ETLElectronicsSim.h.

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

Definition at line 25 of file ETLElectronicsSim.h.

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

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

Definition at line 18 of file ETLElectronicsSim.cc.

References f, mps_fire::i, runTrivialShaper(), and updateOutput().

20  {
21 
22  MTDSimHitData chargeColl,toa;
23 
24  for(MTDSimHitDataAccumulator::const_iterator it=input.begin();
25  it!=input.end();
26  it++) {
27 
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  //time of arrival
32  float finalToA = (it->second).hit_info[1][i];
33  while(finalToA < 0.f) finalToA+=25.f;
34  while(finalToA > 25.f) finalToA-=25.f;
35  toa[i]=finalToA;
36 
37  // collected charge (in this case in MIPs)
38  chargeColl[i] = (it->second).hit_info[0][i];
39  }
40 
41  //run the shaper to create a new data frame
42  ETLDataFrame rawDataFrame( it->first );
43  runTrivialShaper(rawDataFrame,chargeColl,toa);
44  updateOutput(output,rawDataFrame);
45 
46  }
47 
48 }
std::array< MTDSimData_t, nSamples > MTDSimHitData
static std::string const input
Definition: EdmProvDump.cc:44
void runTrivialShaper(ETLDataFrame &dataFrame, const mtd::MTDSimHitData &chargeColl, const mtd::MTDSimHitData &toa) const
void updateOutput(ETLDigiCollection &coll, const ETLDataFrame &rawDataFrame) const
double f[11][100]
void ETLElectronicsSim::runTrivialShaper ( ETLDataFrame dataFrame,
const mtd::MTDSimHitData chargeColl,
const mtd::MTDSimHitData toa 
) const

Definition at line 51 of file ETLElectronicsSim.cc.

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

Referenced by run().

53  {
54  bool debug = debug_;
55 #ifdef EDM_ML_DEBUG
56  for(int it=0; it<(int)(chargeColl.size()); it++) debug |= (chargeColl[it]>adcThreshold_fC_);
57 #endif
58 
59  if(debug) edm::LogVerbatim("ETLElectronicsSim") << "[runTrivialShaper]" << std::endl;
60 
61  //set new ADCs
62  for(int it=0; it<(int)(chargeColl.size()); it++)
63  {
64  //brute force saturation, maybe could to better with an exponential like saturation
65  const uint32_t adc=std::floor( std::min(chargeColl[it],adcSaturation_MIP_) / adcLSB_MIP_ );
66  const uint32_t tdc_time=std::floor( toa[it] / toaLSB_ns_ );
67  ETLSample newSample;
68  newSample.set(chargeColl[it] > adcThreshold_MIP_,false,tdc_time,adc);
69  dataFrame.setSample(it,newSample);
70 
71  if(debug) edm::LogVerbatim("ETLElectronicsSim") << adc << " (" << chargeColl[it] << "/" << adcLSB_MIP_ << ") ";
72  }
73 
74  if(debug) {
75  std::ostringstream msg;
76  dataFrame.print(msg);
77  edm::LogVerbatim("ETLElectronicsSim") << msg.str() << std::endl;
78  }
79 }
int adc(sample_type sample)
get the ADC sample (12 bits)
void print(std::ostream &out=std::cout)
Definition: FTLDataFrameT.h:50
const float toaLSB_ns_
wrapper for a data word
Definition: ETLSample.h:13
void setSample(int i, const S &sample)
Definition: FTLDataFrameT.h:49
T min(T a, T b)
Definition: MathUtil.h:58
#define debug
Definition: HDRShower.cc:19
tuple msg
Definition: mps_check.py:277
const float adcLSB_MIP_
const float adcSaturation_MIP_
void set(bool thr, bool mode, uint16_t toa, uint16_t data)
Definition: ETLSample.h:34
const float adcThreshold_MIP_
void ETLElectronicsSim::updateOutput ( ETLDigiCollection coll,
const ETLDataFrame rawDataFrame 
) const

Definition at line 81 of file ETLElectronicsSim.cc.

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

Referenced by run().

82  {
83  int itIdx(9);
84  if(rawDataFrame.size()<=itIdx+2) return;
85 
86  ETLDataFrame dataFrame( rawDataFrame.id() );
87  dataFrame.resize(dfSIZE);
88  bool putInEvent(false);
89  for(int it=0;it<dfSIZE; ++it) {
90  dataFrame.setSample(it, rawDataFrame[itIdx-2+it]);
91  if(it==2) putInEvent = rawDataFrame[itIdx-2+it].threshold();
92  }
93 
94  if(putInEvent) {
95  coll.push_back(dataFrame);
96  }
97 }
void push_back(T const &t)
const D & id() const
det id
Definition: FTLDataFrameT.h:32
void resize(size_t s)
allow to set size
Definition: FTLDataFrameT.h:42
int size() const
total number of samples in the digi
Definition: FTLDataFrameT.h:37

Member Data Documentation

const float ETLElectronicsSim::adcLSB_MIP_
private

Definition at line 49 of file ETLElectronicsSim.h.

Referenced by runTrivialShaper().

const uint32_t ETLElectronicsSim::adcNbits_
private

Definition at line 45 of file ETLElectronicsSim.h.

const float ETLElectronicsSim::adcSaturation_MIP_
private

Definition at line 48 of file ETLElectronicsSim.h.

Referenced by runTrivialShaper().

const float ETLElectronicsSim::adcThreshold_MIP_
private

Definition at line 50 of file ETLElectronicsSim.h.

Referenced by runTrivialShaper().

const bool ETLElectronicsSim::debug_
private

Definition at line 42 of file ETLElectronicsSim.h.

Referenced by runTrivialShaper().

int ETLElectronicsSim::dfSIZE = 5
static

Definition at line 38 of file ETLElectronicsSim.h.

Referenced by updateOutput().

const uint32_t ETLElectronicsSim::tdcNbits_
private

Definition at line 45 of file ETLElectronicsSim.h.

const float ETLElectronicsSim::toaLSB_ns_
private

Definition at line 51 of file ETLElectronicsSim.h.

Referenced by runTrivialShaper().