CMS 3D CMS Logo

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
 
typedef DFr DigiType
 

Public Member Functions

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

Protected Attributes

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

Detailed Description

template<class DFr>
class HGCDigitizerBase< DFr >

Definition at line 25 of file HGCDigitizerBase.h.

Member Typedef Documentation

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

Definition at line 30 of file HGCDigitizerBase.h.

template<class DFr>
typedef DFr HGCDigitizerBase< DFr >::DigiType

Definition at line 28 of file HGCDigitizerBase.h.

Constructor & Destructor Documentation

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

CTOR.

Definition at line 49 of file HGCDigitizerBase.cc.

References hgcalDigitizer_cfi::feCfg, and edm::ParameterSet::getParameter().

49  {
50  bxTime_ = ps.getParameter<double>("bxTime");
51  myCfg_ = ps.getParameter<edm::ParameterSet>("digiCfg");
52  doTimeSamples_ = myCfg_.getParameter< bool >("doTimeSamples");
53  if(myCfg_.exists("keV2fC")) keV2fC_ = myCfg_.getParameter<double>("keV2fC");
54  else keV2fC_ = 1.0;
55  if(myCfg_.existsAs<double>("noise_fC")) {
56  noise_fC_.resize(1);
57  noise_fC_[0] = myCfg_.getParameter<double>("noise_fC");
58  } else if ( myCfg_.existsAs<std::vector<double> >("noise_fC") ) {
59  const auto& noises = myCfg_.getParameter<std::vector<double> >("noise_fC");
60  noise_fC_.resize(0);
61  noise_fC_.reserve(noises.size());
62  for( auto noise : noises ) { noise_fC_.push_back( noise ); }
63  } else {
64  noise_fC_.resize(1);
65  noise_fC_[0] = 1.f;
66  }
67  edm::ParameterSet feCfg = myCfg_.getParameter<edm::ParameterSet>("feCfg");
68  myFEelectronics_ = std::unique_ptr<HGCFEElectronics<DFr> >( new HGCFEElectronics<DFr>(feCfg) );
69 }
std::vector< float > noise_fC_
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>
virtual HGCDigitizerBase< DFr >::~HGCDigitizerBase ( )
inlinevirtual

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 46 of file HGCDigitizerBase.h.

46 { return keV2fC_; }
template<class DFr >
void HGCDigitizerBase< DFr >::run ( std::unique_ptr< DColl > &  digiColl,
hgc::HGCSimHitDataAccumulator simData,
const CaloSubdetectorGeometry theGeom,
const std::unordered_set< DetId > &  validIds,
uint32_t  digitizationType,
CLHEP::HepRandomEngine *  engine 
)

steer digitization mode

Definition at line 72 of file HGCDigitizerBase.cc.

77  {
78  if(digitizationType==0) runSimple(digiColl,simData,theGeom,validIds,engine);
79  else runDigitizer(digiColl,simData,theGeom,validIds,digitizationType,engine);
80 }
void runSimple(std::unique_ptr< DColl > &coll, hgc::HGCSimHitDataAccumulator &simData, const CaloSubdetectorGeometry *theGeom, const std::unordered_set< DetId > &validIds, CLHEP::HepRandomEngine *engine)
a trivial digitization: sum energies and digitize without noise
virtual void runDigitizer(std::unique_ptr< DColl > &coll, hgc::HGCSimHitDataAccumulator &simData, const CaloSubdetectorGeometry *theGeom, const std::unordered_set< DetId > &validIds, uint32_t digitizerType, CLHEP::HepRandomEngine *engine)
to be specialized by top class
template<class DFr>
virtual void HGCDigitizerBase< DFr >::runDigitizer ( std::unique_ptr< DColl > &  coll,
hgc::HGCSimHitDataAccumulator simData,
const CaloSubdetectorGeometry theGeom,
const std::unordered_set< DetId > &  validIds,
uint32_t  digitizerType,
CLHEP::HepRandomEngine *  engine 
)
inlinevirtual

to be specialized by top class

Reimplemented in HGCEEDigitizer, and HGCHEfrontDigitizer.

Definition at line 65 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::unique_ptr< DColl > &  coll,
hgc::HGCSimHitDataAccumulator simData,
const CaloSubdetectorGeometry theGeom,
const std::unordered_set< DetId > &  validIds,
CLHEP::HepRandomEngine *  engine 
)

a trivial digitization: sum energies and digitize without noise

Definition at line 83 of file HGCDigitizerBase.cc.

References f, hgc_digi::HGCCellInfo::hit_info, mps_fire::i, hpstanc_transforms::max, hgc_digi::HGCCellInfo::size, and hgc_digi::HGCCellInfo::thickness.

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

87  {
88  HGCSimHitData chargeColl,toa;
89 
90  // this represents a cell with no signal charge
91  HGCCellInfo zeroData;
92  zeroData.hit_info[0].fill(0.f); //accumulated energy
93  zeroData.hit_info[1].fill(0.f); //time-of-flight
94 
95  for( const auto& id : validIds ) {
96  chargeColl.fill(0.f);
97  toa.fill(0.f);
98  HGCSimHitDataAccumulator::iterator it = simData.find(id);
99  HGCCellInfo& cell = ( simData.end() == it ? zeroData : it->second );
100  addCellMetadata(cell,theGeom,id);
101 
102  for(size_t i=0; i<cell.hit_info[0].size(); i++) {
103  double rawCharge(cell.hit_info[0][i]);
104 
105  //time of arrival
106  toa[i]=cell.hit_info[1][i];
107  if(myFEelectronics_->toaMode()==HGCFEElectronics<DFr>::WEIGHTEDBYE && rawCharge>0)
108  toa[i]=cell.hit_info[1][i]/rawCharge;
109 
110  //convert total energy in GeV to charge (fC)
111  //double totalEn=rawEn*1e6*keV2fC_;
112  float totalCharge=rawCharge;
113 
114  //add noise (in fC)
115  //we assume it's randomly distributed and won't impact ToA measurement
116  totalCharge += std::max( (float)CLHEP::RandGaussQ::shoot(engine,0.0,cell.size*noise_fC_[cell.thickness-1]) , 0.f );
117  if(totalCharge<0.f) totalCharge=0.f;
118 
119  chargeColl[i]= totalCharge;
120  }
121 
122  //run the shaper to create a new data frame
123  DFr rawDataFrame( id );
124  myFEelectronics_->runShaper(rawDataFrame, chargeColl, toa, cell.thickness, engine);
125 
126  //update the output according to the final shape
127  updateOutput(coll,rawDataFrame);
128  }
129 }
std::vector< float > noise_fC_
void updateOutput(std::unique_ptr< DColl > &coll, const DFr &rawDataFrame)
prepares the output according to the number of time samples to produce
std::array< HGCSimHitData, 2 > hit_info
std::array< HGCSimData_t, nSamples > HGCSimHitData
std::unique_ptr< HGCFEElectronics< DFr > > myFEelectronics_
double f[11][100]
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 48 of file HGCDigitizerBase.h.

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

Definition at line 47 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::unique_ptr< DColl > &  coll,
const DFr &  rawDataFrame 
)

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

Definition at line 132 of file HGCDigitizerBase.cc.

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

133  {
134  int itIdx(9);
135  if(rawDataFrame.size()<=itIdx+2) return;
136 
137  DFr dataFrame( rawDataFrame.id() );
138  dataFrame.resize(5);
139  bool putInEvent(false);
140  for(int it=0;it<5; it++) {
141  dataFrame.setSample(it, rawDataFrame[itIdx-2+it]);
142  if(it==2) putInEvent = rawDataFrame[itIdx-2+it].threshold();
143  }
144 
145  if(putInEvent) {
146  coll->push_back(dataFrame);
147  }
148 }
void push_back(key_type i, value_type const &j, label_type const &flav="")
JetCorrectorParametersCollection coll
Definition: classes.h:10

Member Data Documentation

template<class DFr>
double HGCDigitizerBase< DFr >::bxTime_
protected

Definition at line 95 of file HGCDigitizerBase.h.

template<class DFr>
bool HGCDigitizerBase< DFr >::doTimeSamples_
protected

Definition at line 98 of file HGCDigitizerBase.h.

template<class DFr>
float HGCDigitizerBase< DFr >::keV2fC_
protected

Definition at line 86 of file HGCDigitizerBase.h.

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

template<class DFr>
edm::ParameterSet HGCDigitizerBase< DFr >::myCfg_
protected

Definition at line 76 of file HGCDigitizerBase.h.

template<class DFr>
std::unique_ptr<HGCFEElectronics<DFr> > HGCDigitizerBase< DFr >::myFEelectronics_
protected
template<class DFr>
std::vector<float> HGCDigitizerBase< DFr >::noise_fC_
protected

Definition at line 89 of file HGCDigitizerBase.h.