CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
HGCHEbackDigitizer Class Reference

#include <HGCHEbackDigitizer.h>

Inheritance diagram for HGCHEbackDigitizer:
HGCDigitizerBase< HGCHEDataFrame >

Public Member Functions

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

Private Member Functions

void runCaliceLikeDigitizer (std::auto_ptr< HGCHEDigiCollection > &digiColl, hgc::HGCSimHitDataAccumulator &simData, 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< HGCHEDataFrame >
typedef edm::SortedCollection
< HGCHEDataFrame
DColl
 
- Protected Attributes inherited from HGCDigitizerBase< HGCHEDataFrame >
double bxTime_
 
bool doTimeSamples_
 
float keV2fC_
 
edm::ParameterSet myCfg_
 
std::unique_ptr
< HGCFEElectronics
< HGCHEDataFrame > > 
myFEelectronics_
 
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 11 of file HGCHEbackDigitizer.cc.

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

11  : HGCDigitizerBase(ps)
12 {
14  keV2MIP_ = cfg.getParameter<double>("keV2MIP");
15  keV2fC_ = 1.0; //keV2MIP_; // hack for HEB
16  noise_MIP_ = cfg.getParameter<double>("noise_MIP");
17  nPEperMIP_ = cfg.getParameter<double>("nPEperMIP");
18  nTotalPE_ = cfg.getParameter<double>("nTotalPE");
19  xTalk_ = cfg.getParameter<double>("xTalk");
20  sdPixels_ = cfg.getParameter<double>("sdPixels");
21 }
T getParameter(std::string const &) const
tuple cfg
Definition: looper.py:293
HGCDigitizerBase(const edm::ParameterSet &ps)
CTOR.
HGCHEbackDigitizer::~HGCHEbackDigitizer ( )

Definition at line 83 of file HGCHEbackDigitizer.cc.

84 {
85 }

Member Function Documentation

void HGCHEbackDigitizer::runCaliceLikeDigitizer ( std::auto_ptr< HGCHEDigiCollection > &  digiColl,
hgc::HGCSimHitDataAccumulator simData,
CLHEP::HepRandomEngine *  engine 
)
private

Definition at line 30 of file HGCHEbackDigitizer.cc.

References constexpr, gather_cfg::cout, debug, f, myMath::fast_expf(), myMath::fast_logf(), i, keV2MIP_, bookConverter::max, HGCDigitizerBase< HGCHEDataFrame >::myFEelectronics_, noise_MIP_, nPEperMIP_, nTotalPE_, sdPixels_, HGCDigitizerBase< HGCHEDataFrame >::updateOutput(), x, and xTalk_.

Referenced by runDigitizer().

31 {
32 
33  //switch to true if you want to print some details
34  constexpr bool debug(false);
35 
36  HGCSimHitData chargeColl;
37  for(HGCSimHitDataAccumulator::iterator it=simData.begin();
38  it!=simData.end();
39  it++)
40  {
41  chargeColl.fill(0.f);
42  for(size_t i=0; i<it->second[0].size(); ++i)
43  {
44  //convert total energy keV->MIP, since converted to keV in accumulator
45  float totalIniMIPs( (it->second)[0][i]*keV2MIP_ );
46  //std::cout << "energy in MIP: " << std::scientific << totalIniMIPs << std::endl;
47 
48  //generate random number of photon electrons
49  uint32_t npe = std::floor(CLHEP::RandPoissonQ::shoot(engine,totalIniMIPs*nPEperMIP_));
50 
51  //number of pixels
52  float x = vdt::fast_expf( -((float)npe)/nTotalPE_ );
53  uint32_t nPixel(0);
54  if(xTalk_*x!=1) nPixel=(uint32_t) std::max( nTotalPE_*(1.f-x)/(1.f-xTalk_*x), 0.f );
55 
56  //update signal
57  nPixel = (uint32_t)std::max( CLHEP::RandGaussQ::shoot(engine,(double)nPixel,sdPixels_), 0. );
58 
59  //convert to MIP again and saturate
60  float totalMIPs(totalIniMIPs);
61  const float xtalk = (nTotalPE_-xTalk_*((float)nPixel))/(nTotalPE_-((float)nPixel));
62  if( nTotalPE_ != nPixel && xtalk > 0. )
63  totalMIPs = (nTotalPE_/nPEperMIP_)*vdt::fast_logf(xtalk);
64  else
65  totalMIPs = 0.f;
66 
67  //add noise (in MIPs)
68  chargeColl[i] = totalMIPs+std::max( CLHEP::RandGaussQ::shoot(engine,0.,noise_MIP_), 0. );
69  if(debug && (it->second)[0][i]>0)
70  std::cout << "[runCaliceLikeDigitizer] xtalk=" << xtalk << " En=" << (it->second)[0][i] << " keV -> " << totalIniMIPs << " raw-MIPs -> " << chargeColl[i] << " digi-MIPs" << std::endl;
71  }
72 
73  //init a new data frame and run shaper
74  HGCHEDataFrame newDataFrame( it->first );
75  myFEelectronics_->runTrivialShaper( newDataFrame, chargeColl );
76 
77  //prepare the output
78  updateOutput(digiColl,newDataFrame);
79  }
80 }
int i
Definition: DBlmapReader.cc:9
#define constexpr
std::array< HGCSimData_t, nSamples > HGCSimHitData
std::unique_ptr< HGCFEElectronics< HGCHEDataFrame > > myFEelectronics_
double f[11][100]
void updateOutput(std::auto_ptr< DColl > &coll, const HGCHEDataFrame &rawDataFrame)
prepares the output according to the number of time samples to produce
#define debug
Definition: HDRShower.cc:19
float fast_expf(float x)
tuple cout
Definition: gather_cfg.py:145
float fast_logf(float x)
void HGCHEbackDigitizer::runDigitizer ( std::auto_ptr< HGCHEDigiCollection > &  digiColl,
hgc::HGCSimHitDataAccumulator simData,
uint32_t  digitizationType,
CLHEP::HepRandomEngine *  engine 
)

Definition at line 24 of file HGCHEbackDigitizer.cc.

References runCaliceLikeDigitizer().

25 {
26  runCaliceLikeDigitizer(digiColl,simData,engine);
27 }
void runCaliceLikeDigitizer(std::auto_ptr< HGCHEDigiCollection > &digiColl, hgc::HGCSimHitDataAccumulator &simData, CLHEP::HepRandomEngine *engine)

Member Data Documentation

float HGCHEbackDigitizer::keV2MIP_
private

Definition at line 18 of file HGCHEbackDigitizer.h.

Referenced by HGCHEbackDigitizer(), and runCaliceLikeDigitizer().

float HGCHEbackDigitizer::noise_MIP_
private

Definition at line 18 of file HGCHEbackDigitizer.h.

Referenced by HGCHEbackDigitizer(), and runCaliceLikeDigitizer().

float HGCHEbackDigitizer::nPEperMIP_
private

Definition at line 19 of file HGCHEbackDigitizer.h.

Referenced by HGCHEbackDigitizer(), and runCaliceLikeDigitizer().

float HGCHEbackDigitizer::nTotalPE_
private

Definition at line 19 of file HGCHEbackDigitizer.h.

Referenced by HGCHEbackDigitizer(), and runCaliceLikeDigitizer().

float HGCHEbackDigitizer::sdPixels_
private

Definition at line 19 of file HGCHEbackDigitizer.h.

Referenced by HGCHEbackDigitizer(), and runCaliceLikeDigitizer().

float HGCHEbackDigitizer::xTalk_
private

Definition at line 19 of file HGCHEbackDigitizer.h.

Referenced by HGCHEbackDigitizer(), and runCaliceLikeDigitizer().