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...
 
std::array< float, 3 > tdcForToAOnset () const
 
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 66 of file HGCDigitizerBase.h.

Member Typedef Documentation

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

Definition at line 71 of file HGCDigitizerBase.h.

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

Definition at line 69 of file HGCDigitizerBase.h.

Constructor & Destructor Documentation

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

CTOR.

Definition at line 9 of file HGCDigitizerBase.cc.

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

9  {
10  bxTime_ = ps.getParameter<double>("bxTime");
11  myCfg_ = ps.getParameter<edm::ParameterSet>("digiCfg");
12  doTimeSamples_ = myCfg_.getParameter< bool >("doTimeSamples");
13  if(myCfg_.exists("keV2fC")) keV2fC_ = myCfg_.getParameter<double>("keV2fC");
14  else keV2fC_ = 1.0;
15 
16  if( myCfg_.existsAs<edm::ParameterSet>( "chargeCollectionEfficiencies" ) ) {
17  cce_ = myCfg_.getParameter<edm::ParameterSet>("chargeCollectionEfficiencies").template getParameter<std::vector<double>>("values");
18  }
19 
20  if(myCfg_.existsAs<double>("noise_fC")) {
21  noise_fC_.reserve(1);
22  noise_fC_.push_back(myCfg_.getParameter<double>("noise_fC"));
23  } else if ( myCfg_.existsAs<std::vector<double> >("noise_fC") ) {
24  const auto& noises = myCfg_.getParameter<std::vector<double> >("noise_fC");
25  noise_fC_ = std::vector<float>(noises.begin(),noises.end());
26  } else if(myCfg_.existsAs<edm::ParameterSet>("noise_fC")) {
27  const auto& noises = myCfg_.getParameter<edm::ParameterSet>("noise_fC").template getParameter<std::vector<double> >("values");
28  noise_fC_ = std::vector<float>(noises.begin(),noises.end());
29  } else {
30  noise_fC_.resize(1,1.f);
31  }
32  edm::ParameterSet feCfg = myCfg_.getParameter<edm::ParameterSet>("feCfg");
33  myFEelectronics_ = std::unique_ptr<HGCFEElectronics<DFr> >( new HGCFEElectronics<DFr>(feCfg) );
34  myFEelectronics_->SetNoiseValues(noise_fC_);
35 }
std::vector< float > noise_fC_
T getParameter(std::string const &) const
edm::ParameterSet myCfg_
std::unique_ptr< HGCFEElectronics< DFr > > myFEelectronics_
double f[11][100]
std::vector< double > cce_
models the behavior of the front-end electronics
template<class DFr>
virtual HGCDigitizerBase< DFr >::~HGCDigitizerBase ( )
inlinevirtual

DTOR.

Definition at line 117 of file HGCDigitizerBase.h.

118  { };

Member Function Documentation

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

getters

Definition at line 87 of file HGCDigitizerBase.h.

87 { 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 38 of file HGCDigitizerBase.cc.

43  {
44  if(digitizationType==0) runSimple(digiColl,simData,theGeom,validIds,engine);
45  else runDigitizer(digiColl,simData,theGeom,validIds,digitizationType,engine);
46 }
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, HFNoseDigitizer, HGCEEDigitizer, and HGCHEfrontDigitizer.

Definition at line 107 of file HGCDigitizerBase.h.

110  {
111  throw cms::Exception("HGCDigitizerBaseException") << " Failed to find specialization of runDigitizer";
112  }
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 49 of file HGCDigitizerBase.cc.

References hgc_digi_utils::addCellMetadata(), f, hgc_digi::HGCCellInfo::hit_info, mps_fire::i, SiStripPI::max, hgc_digi::HGCCellInfo::size, and hgc_digi::HGCCellInfo::thickness.

53  {
54  HGCSimHitData chargeColl,toa;
55 
56  // this represents a cell with no signal charge
57  HGCCellInfo zeroData;
58  zeroData.hit_info[0].fill(0.f); //accumulated energy
59  zeroData.hit_info[1].fill(0.f); //time-of-flight
60 
61  for( const auto& id : validIds ) {
62  chargeColl.fill(0.f);
63  toa.fill(0.f);
64  HGCSimHitDataAccumulator::iterator it = simData.find(id);
65  HGCCellInfo& cell = ( simData.end() == it ? zeroData : it->second );
66  addCellMetadata(cell,theGeom,id);
67 
68  for(size_t i=0; i<cell.hit_info[0].size(); i++) {
69  double rawCharge(cell.hit_info[0][i]);
70 
71  //time of arrival
72  toa[i]=cell.hit_info[1][i];
73  if(myFEelectronics_->toaMode()==HGCFEElectronics<DFr>::WEIGHTEDBYE && rawCharge>0)
74  toa[i]=cell.hit_info[1][i]/rawCharge;
75 
76  //convert total energy in GeV to charge (fC)
77  //double totalEn=rawEn*1e6*keV2fC_;
78  float totalCharge=rawCharge;
79 
80  //add noise (in fC)
81  //we assume it's randomly distributed and won't impact ToA measurement
82  //also assume that it is related to the charge path only and that noise fluctuation for ToA circuit be handled separately
83  if (noise_fC_[cell.thickness-1] != 0)
84  totalCharge += std::max( (float)CLHEP::RandGaussQ::shoot(engine,0.0,cell.size*noise_fC_[cell.thickness-1]) , 0.f );
85  if(totalCharge<0.f) totalCharge=0.f;
86 
87  chargeColl[i]= totalCharge;
88  }
89 
90  //run the shaper to create a new data frame
91  DFr rawDataFrame( id );
92  if( !cce_.empty() )
93  myFEelectronics_->runShaper(rawDataFrame, chargeColl, toa, cell.thickness, engine, cce_[cell.thickness-1]);
94  else
95  myFEelectronics_->runShaper(rawDataFrame, chargeColl, toa, cell.thickness, engine);
96 
97  //update the output according to the final shape
98  updateOutput(coll,rawDataFrame);
99  }
100 }
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
void addCellMetadata(HGCCellInfo &info, const HcalGeometry *geom, const DetId &detid)
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>
std::array<float,3> HGCDigitizerBase< DFr >::tdcForToAOnset ( ) const
inline

Definition at line 90 of file HGCDigitizerBase.h.

90 { return myFEelectronics_->getTDCForToAOnset(); }
std::unique_ptr< HGCFEElectronics< DFr > > myFEelectronics_
template<class DFr>
float HGCDigitizerBase< DFr >::tdcOnset ( ) const
inline

Definition at line 89 of file HGCDigitizerBase.h.

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

Definition at line 88 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 103 of file HGCDigitizerBase.cc.

104  {
105  int itIdx(9);
106  if(rawDataFrame.size()<=itIdx+2) return;
107 
108  DFr dataFrame( rawDataFrame.id() );
109  dataFrame.resize(5);
110  bool putInEvent(false);
111  for(int it=0;it<5; it++) {
112  dataFrame.setSample(it, rawDataFrame[itIdx-2+it]);
113  if(it==2) putInEvent = rawDataFrame[itIdx-2+it].threshold();
114  }
115 
116  if(putInEvent) {
117  coll->push_back(dataFrame);
118  }
119 }
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 140 of file HGCDigitizerBase.h.

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

Definition at line 134 of file HGCDigitizerBase.h.

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

Definition at line 143 of file HGCDigitizerBase.h.

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

Definition at line 128 of file HGCDigitizerBase.h.

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

Definition at line 118 of file HGCDigitizerBase.h.

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

Definition at line 137 of file HGCDigitizerBase.h.

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

Definition at line 131 of file HGCDigitizerBase.h.