CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HGCHEbackDigitizer Class Reference

#include <HGCHEbackDigitizer.h>

Inheritance diagram for HGCHEbackDigitizer:
HGCDigitizerBase< HGCBHDataFrame >

Public Member Functions

 HGCHEbackDigitizer (const edm::ParameterSet &ps)
 
void runDigitizer (std::unique_ptr< HGCBHDigiCollection > &digiColl, hgc::HGCSimHitDataAccumulator &simData, const CaloSubdetectorGeometry *theGeom, const std::unordered_set< DetId > &validIds, uint32_t digitizationType, CLHEP::HepRandomEngine *engine) override
 
 ~HGCHEbackDigitizer ()
 
- Public Member Functions inherited from HGCDigitizerBase< HGCBHDataFrame >
 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 HGCBHDataFrame &rawDataFrame)
 prepares the output according to the number of time samples to produce More...
 
virtual ~HGCDigitizerBase ()
 DTOR. More...
 

Private Member Functions

void runCaliceLikeDigitizer (std::unique_ptr< HGCBHDigiCollection > &digiColl, hgc::HGCSimHitDataAccumulator &simData, const CaloSubdetectorGeometry *theGeom, const std::unordered_set< DetId > &validIds, CLHEP::HepRandomEngine *engine)
 

Private Attributes

float keV2MIP_
 
float noise_MIP_
 
float nPEperMIP_
 
float nTotalPE_
 
float sdPixels_
 
float xTalk_
 

Additional Inherited Members

- Public Types inherited from HGCDigitizerBase< HGCBHDataFrame >
typedef edm::SortedCollection< HGCBHDataFrameDColl
 
typedef HGCBHDataFrame DigiType
 
- Protected Attributes inherited from HGCDigitizerBase< HGCBHDataFrame >
double bxTime_
 
bool doTimeSamples_
 
float keV2fC_
 
edm::ParameterSet myCfg_
 
std::unique_ptr< HGCFEElectronics< HGCBHDataFrame > > myFEelectronics_
 
std::vector< float > noise_fC_
 

Detailed Description

Definition at line 7 of file HGCHEbackDigitizer.h.

Constructor & Destructor Documentation

HGCHEbackDigitizer::HGCHEbackDigitizer ( const edm::ParameterSet ps)

Definition at line 54 of file HGCHEbackDigitizer.cc.

References looper::cfg, edm::ParameterSet::getParameter(), HGCDigitizerBase< HGCBHDataFrame >::keV2fC_, keV2MIP_, noise_MIP_, nPEperMIP_, nTotalPE_, sdPixels_, and xTalk_.

54  : HGCDigitizerBase(ps)
55 {
57  keV2MIP_ = cfg.getParameter<double>("keV2MIP");
58  keV2fC_ = 1.0; //keV2MIP_; // hack for HEB
59  noise_MIP_ = cfg.getParameter<double>("noise_MIP");
60  nPEperMIP_ = cfg.getParameter<double>("nPEperMIP");
61  nTotalPE_ = cfg.getParameter<double>("nTotalPE");
62  xTalk_ = cfg.getParameter<double>("xTalk");
63  sdPixels_ = cfg.getParameter<double>("sdPixels");
64 }
T getParameter(std::string const &) const
HGCDigitizerBase(const edm::ParameterSet &ps)
CTOR.
HGCHEbackDigitizer::~HGCHEbackDigitizer ( )

Definition at line 137 of file HGCHEbackDigitizer.cc.

138 {
139 }

Member Function Documentation

void HGCHEbackDigitizer::runCaliceLikeDigitizer ( std::unique_ptr< HGCBHDigiCollection > &  digiColl,
hgc::HGCSimHitDataAccumulator simData,
const CaloSubdetectorGeometry theGeom,
const std::unordered_set< DetId > &  validIds,
CLHEP::HepRandomEngine *  engine 
)
private

Definition at line 75 of file HGCHEbackDigitizer.cc.

References constexpr, gather_cfg::cout, debug, f, myMath::fast_expf(), myMath::fast_logf(), objects.autophobj::float, hgc_digi::HGCCellInfo::hit_info, mps_fire::i, keV2MIP_, hpstanc_transforms::max, HGCDigitizerBase< HGCBHDataFrame >::myFEelectronics_, noise_MIP_, nPEperMIP_, nTotalPE_, sdPixels_, HGCDigitizerBase< HGCBHDataFrame >::updateOutput(), x, and xTalk_.

Referenced by runDigitizer().

78 {
79  //switch to true if you want to print some details
80  constexpr bool debug(false);
81 
82  HGCSimHitData chargeColl;
83 
84  // this represents a cell with no signal charge
85  HGCCellInfo zeroData;
86  zeroData.hit_info[0].fill(0.f); //accumulated energy
87  zeroData.hit_info[1].fill(0.f); //time-of-flight
88 
89  for( const auto& id : validIds ) {
90  chargeColl.fill(0.f);
91  HGCSimHitDataAccumulator::iterator it = simData.find(id);
92  HGCCellInfo& cell = ( simData.end() == it ? zeroData : it->second );
93  addCellMetadata(cell,theGeom,id);
94 
95  for(size_t i=0; i<cell.hit_info[0].size(); ++i)
96  {
97  //convert total energy keV->MIP, since converted to keV in accumulator
98  const float totalIniMIPs( cell.hit_info[0][i]*keV2MIP_ );
99  //std::cout << "energy in MIP: " << std::scientific << totalIniMIPs << std::endl;
100 
101  //generate random number of photon electrons
102  const uint32_t npe = std::floor(CLHEP::RandPoissonQ::shoot(engine,totalIniMIPs*nPEperMIP_));
103 
104  //number of pixels
105  const float x = vdt::fast_expf( -((float)npe)/nTotalPE_ );
106  uint32_t nPixel(0);
107  if(xTalk_*x!=1) nPixel=(uint32_t) std::max( nTotalPE_*(1.f-x)/(1.f-xTalk_*x), 0.f );
108 
109  //update signal
110  nPixel = (uint32_t)std::max( CLHEP::RandGaussQ::shoot(engine,(double)nPixel,sdPixels_), 0. );
111 
112  //convert to MIP again and saturate
113  float totalMIPs(0.f), xtalk = 0.f;
114  const float peDiff = nTotalPE_ - (float) nPixel;
115  if (peDiff != 0.f) {
116  xtalk = (nTotalPE_-xTalk_*((float)nPixel)) / peDiff;
117  if( xtalk > 0.f && nPEperMIP_ != 0.f)
118  totalMIPs = (nTotalPE_/nPEperMIP_)*vdt::fast_logf(xtalk);
119  }
120 
121  //add noise (in MIPs)
122  chargeColl[i] = totalMIPs+std::max( CLHEP::RandGaussQ::shoot(engine,0.,noise_MIP_), 0. );
123  if(debug && cell.hit_info[0][i]>0)
124  std::cout << "[runCaliceLikeDigitizer] xtalk=" << xtalk << " En=" << cell.hit_info[0][i] << " keV -> " << totalIniMIPs << " raw-MIPs -> " << chargeColl[i] << " digi-MIPs" << std::endl;
125  }
126 
127  //init a new data frame and run shaper
128  HGCBHDataFrame newDataFrame( id );
129  myFEelectronics_->runTrivialShaper( newDataFrame, chargeColl, 1 );
130 
131  //prepare the output
132  updateOutput(digiColl,newDataFrame);
133  }
134 }
void updateOutput(std::unique_ptr< DColl > &coll, const HGCBHDataFrame &rawDataFrame)
prepares the output according to the number of time samples to produce
std::array< HGCSimHitData, 2 > hit_info
#define constexpr
std::array< HGCSimData_t, nSamples > HGCSimHitData
std::unique_ptr< HGCFEElectronics< HGCBHDataFrame > > myFEelectronics_
double f[11][100]
#define debug
Definition: HDRShower.cc:19
float fast_expf(float x)
float fast_logf(float x)
void HGCHEbackDigitizer::runDigitizer ( std::unique_ptr< HGCBHDigiCollection > &  digiColl,
hgc::HGCSimHitDataAccumulator simData,
const CaloSubdetectorGeometry theGeom,
const std::unordered_set< DetId > &  validIds,
uint32_t  digitizationType,
CLHEP::HepRandomEngine *  engine 
)
override

Definition at line 67 of file HGCHEbackDigitizer.cc.

References runCaliceLikeDigitizer().

70 {
71  runCaliceLikeDigitizer(digiColl,simData,theGeom,validIds,engine);
72 }
void runCaliceLikeDigitizer(std::unique_ptr< HGCBHDigiCollection > &digiColl, hgc::HGCSimHitDataAccumulator &simData, const CaloSubdetectorGeometry *theGeom, const std::unordered_set< DetId > &validIds, CLHEP::HepRandomEngine *engine)

Member Data Documentation

float HGCHEbackDigitizer::keV2MIP_
private

Definition at line 20 of file HGCHEbackDigitizer.h.

Referenced by HGCHEbackDigitizer(), and runCaliceLikeDigitizer().

float HGCHEbackDigitizer::noise_MIP_
private

Definition at line 20 of file HGCHEbackDigitizer.h.

Referenced by HGCHEbackDigitizer(), and runCaliceLikeDigitizer().

float HGCHEbackDigitizer::nPEperMIP_
private

Definition at line 21 of file HGCHEbackDigitizer.h.

Referenced by HGCHEbackDigitizer(), and runCaliceLikeDigitizer().

float HGCHEbackDigitizer::nTotalPE_
private

Definition at line 21 of file HGCHEbackDigitizer.h.

Referenced by HGCHEbackDigitizer(), and runCaliceLikeDigitizer().

float HGCHEbackDigitizer::sdPixels_
private

Definition at line 21 of file HGCHEbackDigitizer.h.

Referenced by HGCHEbackDigitizer(), and runCaliceLikeDigitizer().

float HGCHEbackDigitizer::xTalk_
private

Definition at line 21 of file HGCHEbackDigitizer.h.

Referenced by HGCHEbackDigitizer(), and runCaliceLikeDigitizer().