CMS 3D CMS Logo

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

#include <SimpleElectronicsSimInMIPs.h>

Public Member Functions

void getEvent (const edm::Event &evt)
 
void getEventSetup (const edm::EventSetup &evt)
 
void run (const ftl::FTLSimHitDataAccumulator &input, FTLDigiCollection &output) const
 
void runTrivialShaper (FTLDataFrame &dataFrame, const ftl::FTLSimHitData &chargeColl, const ftl::FTLSimHitData &toa) const
 
 SimpleElectronicsSimInMIPs (const edm::ParameterSet &pset)
 
void updateOutput (FTLDigiCollection &coll, const FTLDataFrame &rawDataFrame) const
 

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 15 of file SimpleElectronicsSimInMIPs.h.

Constructor & Destructor Documentation

SimpleElectronicsSimInMIPs::SimpleElectronicsSimInMIPs ( const edm::ParameterSet pset)

Definition at line 7 of file SimpleElectronicsSimInMIPs.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
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40

Member Function Documentation

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

Definition at line 19 of file SimpleElectronicsSimInMIPs.h.

19 { }
void SimpleElectronicsSimInMIPs::getEventSetup ( const edm::EventSetup evt)
inline
void SimpleElectronicsSimInMIPs::run ( const ftl::FTLSimHitDataAccumulator input,
FTLDigiCollection output 
) const

Definition at line 17 of file SimpleElectronicsSimInMIPs.cc.

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

Referenced by getEventSetup().

18  {
19 
20  FTLSimHitData chargeColl,toa;
21 
22  for(FTLSimHitDataAccumulator::const_iterator it=input.begin();
23  it!=input.end();
24  it++) {
25 
26  chargeColl.fill(0.f);
27  toa.fill(0.f);
28  for(size_t i=0; i<it->second.hit_info[0].size(); i++) {
29  //time of arrival
30  float finalToA = (it->second).hit_info[1][i];
31  while(finalToA < 0.f) finalToA+=25.f;
32  while(finalToA > 25.f) finalToA-=25.f;
33  toa[i]=finalToA;
34 
35  // collected charge (in this case in MIPs)
36  chargeColl[i] = (it->second).hit_info[0][i];
37  }
38 
39  //run the shaper to create a new data frame
40  FTLDataFrame rawDataFrame( it->first );
41  runTrivialShaper(rawDataFrame,chargeColl,toa);
42  updateOutput(output,rawDataFrame);
43 
44  }
45 
46 }
std::array< FTLSimData_t, nSamples > FTLSimHitData
static std::string const input
Definition: EdmProvDump.cc:45
double f[11][100]
void updateOutput(FTLDigiCollection &coll, const FTLDataFrame &rawDataFrame) const
void runTrivialShaper(FTLDataFrame &dataFrame, const ftl::FTLSimHitData &chargeColl, const ftl::FTLSimHitData &toa) const
void SimpleElectronicsSimInMIPs::runTrivialShaper ( FTLDataFrame dataFrame,
const ftl::FTLSimHitData chargeColl,
const ftl::FTLSimHitData toa 
) const

Definition at line 49 of file SimpleElectronicsSimInMIPs.cc.

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

Referenced by getEventSetup(), and run().

51  {
52  bool debug = debug_;
53 #ifdef EDM_ML_DEBUG
54  for(int it=0; it<(int)(chargeColl.size()); it++) debug |= (chargeColl[it]>adcThreshold_fC_);
55 #endif
56 
57  if(debug) edm::LogVerbatim("FTLSimpleElectronicsSimInMIPs") << "[runTrivialShaper]" << std::endl;
58 
59  //set new ADCs
60  for(int it=0; it<(int)(chargeColl.size()); it++)
61  {
62  //brute force saturation, maybe could to better with an exponential like saturation
63  const uint32_t adc=std::floor( std::min(chargeColl[it],adcSaturation_MIP_) / adcLSB_MIP_ );
64  const uint32_t tdc_time=std::floor( toa[it] / toaLSB_ns_ );
65  FTLSample newSample;
66  newSample.set(chargeColl[it] > adcThreshold_MIP_,false,tdc_time,adc);
67  dataFrame.setSample(it,newSample);
68 
69  if(debug) edm::LogVerbatim("FTLSimpleElectronicsSimInMIPs") << adc << " (" << chargeColl[it] << "/" << adcLSB_MIP_ << ") ";
70  }
71 
72  if(debug) {
73  std::ostringstream msg;
74  dataFrame.print(msg);
75  edm::LogVerbatim("FTLSimpleElectronicsSimInMIPs") << msg.str() << std::endl;
76  }
77 }
int adc(sample_type sample)
get the ADC sample (12 bits)
wrapper for a data word
Definition: FTLSample.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
void print(std::ostream &out=std::cout)
Definition: FTLDataFrameT.h:60
void set(bool thr, bool mode, uint16_t toa, uint16_t data)
Definition: FTLSample.h:34
void SimpleElectronicsSimInMIPs::updateOutput ( FTLDigiCollection coll,
const FTLDataFrame rawDataFrame 
) const

Definition at line 79 of file SimpleElectronicsSimInMIPs.cc.

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

Referenced by getEventSetup(), and run().

80  {
81  int itIdx(9);
82  if(rawDataFrame.size()<=itIdx+2) return;
83 
84  FTLDataFrame dataFrame( rawDataFrame.id() );
85  dataFrame.resize(5);
86  bool putInEvent(false);
87  for(int it=0;it<5; ++it) {
88  dataFrame.setSample(it, rawDataFrame[itIdx-2+it]);
89  if(it==2) putInEvent = rawDataFrame[itIdx-2+it].threshold();
90  }
91 
92  if(putInEvent) {
93  coll.push_back(dataFrame);
94  }
95 }
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 SimpleElectronicsSimInMIPs::adcLSB_MIP_
private

Definition at line 42 of file SimpleElectronicsSimInMIPs.h.

Referenced by runTrivialShaper().

const uint32_t SimpleElectronicsSimInMIPs::adcNbits_
private

Definition at line 38 of file SimpleElectronicsSimInMIPs.h.

const float SimpleElectronicsSimInMIPs::adcSaturation_MIP_
private

Definition at line 41 of file SimpleElectronicsSimInMIPs.h.

Referenced by runTrivialShaper().

const float SimpleElectronicsSimInMIPs::adcThreshold_MIP_
private

Definition at line 43 of file SimpleElectronicsSimInMIPs.h.

Referenced by runTrivialShaper().

const bool SimpleElectronicsSimInMIPs::debug_
private

Definition at line 35 of file SimpleElectronicsSimInMIPs.h.

Referenced by runTrivialShaper().

const uint32_t SimpleElectronicsSimInMIPs::tdcNbits_
private

Definition at line 38 of file SimpleElectronicsSimInMIPs.h.

const float SimpleElectronicsSimInMIPs::toaLSB_ns_
private

Definition at line 44 of file SimpleElectronicsSimInMIPs.h.

Referenced by runTrivialShaper().