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 | Protected Attributes
HGCDigitizerBase< DFr > Class Template Reference

#include <HGCDigitizerBase.h>

Public Types

typedef edm::SortedCollection
< DFr > 
DColl
 

Public Member Functions

 HGCDigitizerBase (const edm::ParameterSet &ps)
 CTOR. More...
 
float keV2fC () const
 getters More...
 
void run (std::auto_ptr< DColl > &digiColl, hgc::HGCSimHitDataAccumulator &simData, uint32_t digitizationType, CLHEP::HepRandomEngine *engine)
 steer digitization mode More...
 
virtual void runDigitizer (std::auto_ptr< DColl > &coll, hgc::HGCSimHitDataAccumulator &simData, uint32_t digitizerType, CLHEP::HepRandomEngine *engine)
 to be specialized by top class More...
 
void runSimple (std::auto_ptr< DColl > &coll, hgc::HGCSimHitDataAccumulator &simData, CLHEP::HepRandomEngine *engine)
 a trivial digitization: sum energies and digitize without noise More...
 
float tdcOnset () const
 
bool toaModeByEnergy () const
 
void updateOutput (std::auto_ptr< DColl > &coll, const DFr &rawDataFrame)
 prepares the output according to the number of time samples to produce More...
 
 ~HGCDigitizerBase ()
 DTOR. More...
 

Protected Attributes

double bxTime_
 
bool doTimeSamples_
 
float keV2fC_
 
edm::ParameterSet myCfg_
 
std::unique_ptr
< HGCFEElectronics< DFr > > 
myFEelectronics_
 
float noise_fC_
 

Detailed Description

template<class DFr>
class HGCDigitizerBase< DFr >

Definition at line 22 of file HGCDigitizerBase.h.

Member Typedef Documentation

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

Definition at line 25 of file HGCDigitizerBase.h.

Constructor & Destructor Documentation

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

CTOR.

Definition at line 30 of file HGCDigitizerBase.h.

30  {
31  bxTime_ = ps.getParameter<double>("bxTime");
32  myCfg_ = ps.getParameter<edm::ParameterSet>("digiCfg");
33  doTimeSamples_ = myCfg_.getParameter< bool >("doTimeSamples");
34  if(myCfg_.exists("keV2fC")) keV2fC_ = myCfg_.getParameter<double>("keV2fC");
35  else keV2fC_ = 1.0;
36  if(myCfg_.exists("noise_fC")) noise_fC_ = myCfg_.getParameter<double>("noise_fC");
37  else noise_fC_ = 1.0;
38  edm::ParameterSet feCfg = myCfg_.getParameter<edm::ParameterSet>("feCfg");
39  myFEelectronics_ = std::unique_ptr<HGCFEElectronics<DFr> >( new HGCFEElectronics<DFr>(feCfg) );
40  }
T getParameter(std::string const &) const
edm::ParameterSet myCfg_
std::unique_ptr< HGCFEElectronics< DFr > > myFEelectronics_
models the behavior of the front-end electronics
template<class DFr>
HGCDigitizerBase< DFr >::~HGCDigitizerBase ( )
inline

DTOR.

Definition at line 75 of file HGCDigitizerBase.h.

76  { };

Member Function Documentation

template<class DFr>
float HGCDigitizerBase< DFr >::keV2fC ( ) const
inline

getters

Definition at line 50 of file HGCDigitizerBase.h.

50 { return keV2fC_; }
template<class DFr>
void HGCDigitizerBase< DFr >::run ( std::auto_ptr< DColl > &  digiColl,
hgc::HGCSimHitDataAccumulator simData,
uint32_t  digitizationType,
CLHEP::HepRandomEngine *  engine 
)

steer digitization mode

Definition at line 6 of file HGCDigitizerBase.cc.

9  {
10  if(digitizationType==0) runSimple(digiColl,simData,engine);
11  else runDigitizer(digiColl,simData,digitizationType,engine);
12 }
virtual void runDigitizer(std::auto_ptr< DColl > &coll, hgc::HGCSimHitDataAccumulator &simData, uint32_t digitizerType, CLHEP::HepRandomEngine *engine)
to be specialized by top class
void runSimple(std::auto_ptr< DColl > &coll, hgc::HGCSimHitDataAccumulator &simData, CLHEP::HepRandomEngine *engine)
a trivial digitization: sum energies and digitize without noise
template<class DFr>
virtual void HGCDigitizerBase< DFr >::runDigitizer ( std::auto_ptr< DColl > &  coll,
hgc::HGCSimHitDataAccumulator simData,
uint32_t  digitizerType,
CLHEP::HepRandomEngine *  engine 
)
inlinevirtual

to be specialized by top class

Definition at line 67 of file HGCDigitizerBase.h.

68  {
69  throw cms::Exception("HGCDigitizerBaseException") << " Failed to find specialization of runDigitizer";
70  }
template<class DFr>
void HGCDigitizerBase< DFr >::runSimple ( std::auto_ptr< DColl > &  coll,
hgc::HGCSimHitDataAccumulator simData,
CLHEP::HepRandomEngine *  engine 
)

a trivial digitization: sum energies and digitize without noise

Definition at line 15 of file HGCDigitizerBase.cc.

References f, i, and bookConverter::max.

17  {
18  HGCSimHitData chargeColl,toa;
19  for(HGCSimHitDataAccumulator::iterator it=simData.begin();
20  it!=simData.end();
21  it++) {
22  chargeColl.fill(0.f);
23  toa.fill(0.f);
24  for(size_t i=0; i<it->second[0].size(); i++) {
25  double rawCharge((it->second)[0][i]);
26 
27  //time of arrival
28  toa[i]=(it->second)[1][i];
29  if(myFEelectronics_->toaMode()==HGCFEElectronics<DFr>::WEIGHTEDBYE && rawCharge>0)
30  toa[i]=(it->second)[1][i]/rawCharge;
31 
32  //convert total energy in GeV to charge (fC)
33  //double totalEn=rawEn*1e6*keV2fC_;
34  double totalCharge=rawCharge;
35 
36  //add noise (in fC)
37  //we assume it's randomly distributed and won't impact ToA measurement
38  totalCharge += std::max( CLHEP::RandGaussQ::shoot(engine,0,noise_fC_) , 0. );
39  if(totalCharge<0) totalCharge=0;
40 
41  chargeColl[i]= totalCharge;
42  }
43 
44  //run the shaper to create a new data frame
45  DFr rawDataFrame( it->first );
46  myFEelectronics_->runShaper(rawDataFrame, chargeColl, toa, engine);
47 
48  //update the output according to the final shape
49  updateOutput(coll,rawDataFrame);
50  }
51 }
int i
Definition: DBlmapReader.cc:9
std::array< HGCSimData_t, nSamples > HGCSimHitData
std::unique_ptr< HGCFEElectronics< DFr > > myFEelectronics_
double f[11][100]
void updateOutput(std::auto_ptr< DColl > &coll, const DFr &rawDataFrame)
prepares the output according to the number of time samples to produce
JetCorrectorParametersCollection coll
Definition: classes.h:10
models the behavior of the front-end electronics
template<class DFr>
float HGCDigitizerBase< DFr >::tdcOnset ( ) const
inline

Definition at line 52 of file HGCDigitizerBase.h.

52 { return myFEelectronics_->getTDCOnset(); }
std::unique_ptr< HGCFEElectronics< DFr > > myFEelectronics_
template<class DFr>
bool HGCDigitizerBase< DFr >::toaModeByEnergy ( ) const
inline

Definition at line 51 of file HGCDigitizerBase.h.

std::unique_ptr< HGCFEElectronics< DFr > > myFEelectronics_
models the behavior of the front-end electronics
template<class DFr>
void HGCDigitizerBase< DFr >::updateOutput ( std::auto_ptr< DColl > &  coll,
const DFr &  rawDataFrame 
)

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

Definition at line 54 of file HGCDigitizerBase.cc.

References data, alignBH_cfg::mode, HGCSample::set(), and dtDQMClient_cfg::threshold.

55  {
56  int itIdx(9);
57  if(rawDataFrame.size()<=itIdx+2) return;
58 
59  DFr dataFrame( rawDataFrame.id() );
60  dataFrame.resize(5);
61  bool putInEvent(false);
62  HGCSample singleSample;
63  for(int it=0;it<5; it++) {
64  singleSample.set(rawDataFrame[itIdx-2+it].threshold(),
65  rawDataFrame[itIdx-2+it].mode(),
66  rawDataFrame[itIdx-2+it].toa(),
67  rawDataFrame[itIdx-2+it].data());
68  dataFrame.setSample(it, singleSample);
69  if(it==2) { putInEvent=rawDataFrame[itIdx-2+it].threshold(); }
70  }
71  if(putInEvent) coll->push_back(dataFrame);
72 }
void push_back(key_type i, value_type const &j, label_type const &flav="")
wrapper for a data word
Definition: HGCSample.h:13
JetCorrectorParametersCollection coll
Definition: classes.h:10
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void set(bool thr, bool mode, uint16_t toa, uint16_t data)
Definition: HGCSample.h:33

Member Data Documentation

template<class DFr>
double HGCDigitizerBase< DFr >::bxTime_
protected
template<class DFr>
bool HGCDigitizerBase< DFr >::doTimeSamples_
protected
template<class DFr>
float HGCDigitizerBase< DFr >::keV2fC_
protected
template<class DFr>
edm::ParameterSet HGCDigitizerBase< DFr >::myCfg_
protected
template<class DFr>
std::unique_ptr<HGCFEElectronics<DFr> > HGCDigitizerBase< DFr >::myFEelectronics_
protected
template<class DFr>
float HGCDigitizerBase< DFr >::noise_fC_
protected