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 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  myFEelectronics_->SetNoiseValues(noise_fC_);
77 }
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 76 of file HGCDigitizerBase.h.

77  { };

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 80 of file HGCDigitizerBase.cc.

85  {
86  if(digitizationType==0) runSimple(digiColl,simData,theGeom,validIds,engine);
87  else runDigitizer(digiColl,simData,theGeom,validIds,digitizationType,engine);
88 }
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 66 of file HGCDigitizerBase.h.

69  {
70  throw cms::Exception("HGCDigitizerBaseException") << " Failed to find specialization of runDigitizer";
71  }
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 91 of file HGCDigitizerBase.cc.

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

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

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

Definition at line 49 of file HGCDigitizerBase.h.

49 { return myFEelectronics_->getTDCForToAOnset(); }
std::unique_ptr< HGCFEElectronics< DFr > > myFEelectronics_
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 144 of file HGCDigitizerBase.cc.

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

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

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

Definition at line 93 of file HGCDigitizerBase.h.

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

Definition at line 102 of file HGCDigitizerBase.h.

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

Definition at line 87 of file HGCDigitizerBase.h.

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

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

Definition at line 77 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 90 of file HGCDigitizerBase.h.