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_
 
std::vector< double > cce_
 
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, edm::ParameterSet::getParameter(), and edm::swap().

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 
56  if( myCfg_.existsAs<std::vector<double> >( "chargeCollectionEfficiencies" ) ) {
57  cce_ = myCfg_.getParameter<std::vector<double> >("chargeCollectionEfficiencies");
58  } else {
59  std::vector<double>().swap(cce_);
60  }
61 
62  if(myCfg_.existsAs<double>("noise_fC")) {
63  noise_fC_.resize(1);
64  noise_fC_[0] = myCfg_.getParameter<double>("noise_fC");
65  } else if ( myCfg_.existsAs<std::vector<double> >("noise_fC") ) {
66  const auto& noises = myCfg_.getParameter<std::vector<double> >("noise_fC");
67  noise_fC_.resize(0);
68  noise_fC_.reserve(noises.size());
69  for( auto noise : noises ) { noise_fC_.push_back( noise ); }
70  } else {
71  noise_fC_.resize(1);
72  noise_fC_[0] = 1.f;
73  }
74  edm::ParameterSet feCfg = myCfg_.getParameter<edm::ParameterSet>("feCfg");
75  myFEelectronics_ = std::unique_ptr<HGCFEElectronics<DFr> >( new HGCFEElectronics<DFr>(feCfg) );
76 }
std::vector< float > noise_fC_
T getParameter(std::string const &) const
edm::ParameterSet myCfg_
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:116
std::unique_ptr< HGCFEElectronics< DFr > > myFEelectronics_
std::vector< double > cce_
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 79 of file HGCDigitizerBase.cc.

84  {
85  if(digitizationType==0) runSimple(digiColl,simData,theGeom,validIds,engine);
86  else runDigitizer(digiColl,simData,theGeom,validIds,digitizationType,engine);
87 }
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 HGCHEbackDigitizer, 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 90 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().

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

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

143  {
144  int itIdx(9);
145  if(rawDataFrame.size()<=itIdx+2) return;
146 
147  DFr dataFrame( rawDataFrame.id() );
148  dataFrame.resize(5);
149  bool putInEvent(false);
150  for(int it=0;it<5; it++) {
151  dataFrame.setSample(it, rawDataFrame[itIdx-2+it]);
152  if(it==2) putInEvent = rawDataFrame[itIdx-2+it].threshold();
153  }
154 
155  if(putInEvent) {
156  coll->push_back(dataFrame);
157  }
158 }
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 98 of file HGCDigitizerBase.h.

template<class DFr>
std::vector<double> HGCDigitizerBase< DFr >::cce_
protected

Definition at line 92 of file HGCDigitizerBase.h.

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

Definition at line 101 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.