CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Public Attributes
HGCDigitizerBase< D > Class Template Reference

#include <HGCDigitizerBase.h>

Public Types

typedef edm::SortedCollection< D > DColl
 

Public Member Functions

 HGCDigitizerBase (const edm::ParameterSet &ps)
 CTOR. More...
 
void run (std::auto_ptr< DColl > &digiColl, HGCSimHitDataAccumulator &simData, uint32_t digitizationType, CLHEP::HepRandomEngine *engine)
 steer digitization mode More...
 
virtual void runDigitizer (std::auto_ptr< DColl > &coll, HGCSimHitDataAccumulator &simData, uint32_t digitizerType, CLHEP::HepRandomEngine *engine)
 to be specialized by top class More...
 
void runShaper (D &dataFrame)
 applies a shape to each time sample and propagates the tails to the subsequent time samples More...
 
void runTrivial (std::auto_ptr< DColl > &coll, HGCSimHitDataAccumulator &simData, CLHEP::HepRandomEngine *engine)
 a trivial digitization: sum energies and digitize without noise More...
 
void updateOutput (std::auto_ptr< DColl > &coll, D rawDataFrame)
 prepares the output according to the number of time samples to produce More...
 
 ~HGCDigitizerBase ()
 DTOR. More...
 

Public Attributes

uint32_t adcThreshold_
 
int bxTime_
 
bool doTimeSamples_
 
double lsbInMIP_
 
double mip2noise_
 
double mipInKeV_
 
edm::ParameterSet myCfg_
 
double shaperN_
 
double shaperTau_
 

Detailed Description

template<class D>
class HGCDigitizerBase< D >

Definition at line 20 of file HGCDigitizerBase.h.

Member Typedef Documentation

template<class D>
typedef edm::SortedCollection<D> HGCDigitizerBase< D >::DColl

Definition at line 24 of file HGCDigitizerBase.h.

Constructor & Destructor Documentation

template<class D>
HGCDigitizerBase< D >::HGCDigitizerBase ( const edm::ParameterSet ps)
inline

CTOR.

Definition at line 29 of file HGCDigitizerBase.h.

29  {
30  myCfg_ = ps.getParameter<edm::ParameterSet>("digiCfg");
31  bxTime_ = ps.getParameter<int32_t>("bxTime");
32  doTimeSamples_ = myCfg_.getParameter< bool >("doTimeSamples");
33  mipInKeV_ = myCfg_.getParameter<double>("mipInKeV");
34  lsbInMIP_ = myCfg_.getParameter<double>("lsbInMIP");
35  mip2noise_ = myCfg_.getParameter<double>("mip2noise");
36  adcThreshold_ = myCfg_.getParameter< uint32_t >("adcThreshold");
37  shaperN_ = myCfg_.getParameter< double >("shaperN");
38  shaperTau_ = myCfg_.getParameter< double >("shaperTau");
39  }
T getParameter(std::string const &) const
edm::ParameterSet myCfg_
template<class D>
HGCDigitizerBase< D >::~HGCDigitizerBase ( )
inline

DTOR.

Definition at line 143 of file HGCDigitizerBase.h.

143 { };

Member Function Documentation

template<class D>
void HGCDigitizerBase< D >::run ( std::auto_ptr< DColl > &  digiColl,
HGCSimHitDataAccumulator simData,
uint32_t  digitizationType,
CLHEP::HepRandomEngine *  engine 
)
inline

steer digitization mode

Definition at line 44 of file HGCDigitizerBase.h.

44  {
45  if(digitizationType==0) runTrivial(digiColl,simData,engine);
46  else runDigitizer(digiColl,simData,digitizationType,engine);
47  }
virtual void runDigitizer(std::auto_ptr< DColl > &coll, HGCSimHitDataAccumulator &simData, uint32_t digitizerType, CLHEP::HepRandomEngine *engine)
to be specialized by top class
void runTrivial(std::auto_ptr< DColl > &coll, HGCSimHitDataAccumulator &simData, CLHEP::HepRandomEngine *engine)
a trivial digitization: sum energies and digitize without noise
template<class D>
virtual void HGCDigitizerBase< D >::runDigitizer ( std::auto_ptr< DColl > &  coll,
HGCSimHitDataAccumulator simData,
uint32_t  digitizerType,
CLHEP::HepRandomEngine *  engine 
)
inlinevirtual

to be specialized by top class

Definition at line 136 of file HGCDigitizerBase.h.

Referenced by HGCDigitizerBase< HGCEEDataFrame >::run().

136  {
137  throw cms::Exception("HGCDigitizerBaseException") << " Failed to find specialization of runDigitizer";
138  }
template<class D>
void HGCDigitizerBase< D >::runShaper ( D &  dataFrame)
inline

applies a shape to each time sample and propagates the tails to the subsequent time samples

Definition at line 113 of file HGCDigitizerBase.h.

Referenced by HGCDigitizerBase< HGCEEDataFrame >::runTrivial().

113  {
114  std::vector<uint16_t> oldADC(dataFrame.size());
115  for(int it=0; it<dataFrame.size(); it++) {
116  uint16_t gain=dataFrame[it].gain();
117  oldADC[it]=dataFrame[it].adc();
118  uint16_t newADC(oldADC[it]);
119 
120  if(shaperN_*shaperTau_>0){
121  for(int jt=0; jt<it; jt++) {
122  float relTime(bxTime_*(it-jt)+shaperN_*shaperTau_);
123  newADC += uint16_t(oldADC[jt]*pow(relTime/(shaperN_*shaperTau_),shaperN_)*exp(-(relTime-shaperN_*shaperTau_)/shaperTau_));
124  }
125  }
126 
127  HGCSample newSample;
128  newSample.set(gain,newADC);
129  dataFrame.setSample(it,newSample);
130  }
131  }
void set(uint16_t gain, uint16_t adc)
Definition: HGCSample.h:30
wrapper for a data word
Definition: HGCSample.h:12
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
template<class D>
void HGCDigitizerBase< D >::runTrivial ( std::auto_ptr< DColl > &  coll,
HGCSimHitDataAccumulator simData,
CLHEP::HepRandomEngine *  engine 
)
inline

a trivial digitization: sum energies and digitize without noise

Definition at line 53 of file HGCDigitizerBase.h.

Referenced by HGCDigitizerBase< HGCEEDataFrame >::run().

53  {
54  for(HGCSimHitDataAccumulator::iterator it=simData.begin();
55  it!=simData.end(); it++) {
56 
57  //create a new data frame
58  D rawDataFrame( it->first );
59 
60  for(size_t i=0; i<it->second.size(); i++) {
61  //convert total energy GeV->keV->ADC counts
62  double totalEn=(it->second)[i]*1e6;
63 
64  //add noise (in keV)
65  double noiseEn=CLHEP::RandGaussQ::shoot(engine,0,mipInKeV_/mip2noise_);
66  totalEn += noiseEn;
67  if(totalEn<0) totalEn=0;
68 
69  //round to integer (sample will saturate the value according to available bits)
70  uint16_t totalEnInt = floor( (totalEn/mipInKeV_) / lsbInMIP_ );
71 
72  //0 gain for the moment
73  HGCSample singleSample;
74  singleSample.set(0, totalEnInt);
75 
76  rawDataFrame.setSample(i, singleSample);
77  }
78 
79  //run the shaper
80  runShaper(rawDataFrame);
81 
82  //update the output according to the final shape
83  updateOutput(coll,rawDataFrame);
84  }
85  }
int i
Definition: DBlmapReader.cc:9
void set(uint16_t gain, uint16_t adc)
Definition: HGCSample.h:30
wrapper for a data word
Definition: HGCSample.h:12
JetCorrectorParametersCollection coll
Definition: classes.h:10
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:150
void runShaper(D &dataFrame)
applies a shape to each time sample and propagates the tails to the subsequent time samples ...
void updateOutput(std::auto_ptr< DColl > &coll, D rawDataFrame)
prepares the output according to the number of time samples to produce
template<class D>
void HGCDigitizerBase< D >::updateOutput ( std::auto_ptr< DColl > &  coll,
rawDataFrame 
)
inline

prepares the output according to the number of time samples to produce

Definition at line 90 of file HGCDigitizerBase.h.

Referenced by HGCDigitizerBase< HGCEEDataFrame >::runTrivial().

90  {
91  size_t itIdx(4); //index to the in-time digi - this could be configurable in a future version
92 
93  //check if in-time sample is above threshold and put result into the event
94  if(doTimeSamples_) {
95  if(rawDataFrame[itIdx].adc() < adcThreshold_ ) return;
96  coll->push_back(rawDataFrame);
97  } else {
98  //create a new data frame containing only the in-time digi
99  D singleRawDataFrame( rawDataFrame.id() );
100  singleRawDataFrame.resize(1);
101 
102  HGCSample singleSample;
103  singleSample.set(rawDataFrame[itIdx].gain(),rawDataFrame[itIdx].adc());
104  singleRawDataFrame.setSample(0, singleSample);
105  if(singleRawDataFrame[0].adc() < adcThreshold_ ) return;
106  coll->push_back(singleRawDataFrame);
107  }
108  }
int adc(sample_type sample)
get the ADC sample (12 bits)
void push_back(key_type i, value_type const &j, label_type const &flav="")
void set(uint16_t gain, uint16_t adc)
Definition: HGCSample.h:30
wrapper for a data word
Definition: HGCSample.h:12
JetCorrectorParametersCollection coll
Definition: classes.h:10
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:150

Member Data Documentation

template<class D>
uint32_t HGCDigitizerBase< D >::adcThreshold_
template<class D>
int HGCDigitizerBase< D >::bxTime_
template<class D>
bool HGCDigitizerBase< D >::doTimeSamples_
template<class D>
double HGCDigitizerBase< D >::lsbInMIP_
template<class D>
double HGCDigitizerBase< D >::mip2noise_
template<class D>
double HGCDigitizerBase< D >::mipInKeV_
template<class D>
edm::ParameterSet HGCDigitizerBase< D >::myCfg_
template<class D>
double HGCDigitizerBase< D >::shaperN_
template<class D>
double HGCDigitizerBase< D >::shaperTau_