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< HGCalDataFrame >

Public Member Functions

 HGCHEbackDigitizer (const edm::ParameterSet &ps)
 
void runDigitizer (std::unique_ptr< HGCalDigiCollection > &digiColl, hgc::HGCSimHitDataAccumulator &simData, const CaloSubdetectorGeometry *theGeom, const std::unordered_set< DetId > &validIds, uint32_t digitizationType, CLHEP::HepRandomEngine *engine) override
 to be specialized by top class More...
 
 ~HGCHEbackDigitizer () override
 
- Public Member Functions inherited from HGCDigitizerBase< HGCalDataFrame >
 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...
 
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 HGCalDataFrame &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< HGCalDigiCollection > &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< HGCalDataFrame >
typedef edm::SortedCollection< HGCalDataFrameDColl
 
typedef HGCalDataFrame DigiType
 
- Protected Attributes inherited from HGCDigitizerBase< HGCalDataFrame >
double bxTime_
 
std::vector< double > cce_
 
bool doTimeSamples_
 
float keV2fC_
 
edm::ParameterSet myCfg_
 
std::unique_ptr< HGCFEElectronics< HGCalDataFrame > > 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 15 of file HGCHEbackDigitizer.cc.

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

15  : HGCDigitizerBase(ps)
16 {
18  keV2MIP_ = cfg.getParameter<double>("keV2MIP");
19  this->keV2fC_ = 1.0; //keV2MIP_; // hack for HEB
20  noise_MIP_ = cfg.getParameter<edm::ParameterSet>("noise_MIP").getParameter<double>("value");
21  nPEperMIP_ = cfg.getParameter<double>("nPEperMIP");
22  nTotalPE_ = cfg.getParameter<double>("nTotalPE");
23  xTalk_ = cfg.getParameter<double>("xTalk");
24  sdPixels_ = cfg.getParameter<double>("sdPixels");
25 }
T getParameter(std::string const &) const
HGCDigitizerBase(const edm::ParameterSet &ps)
CTOR.
HGCHEbackDigitizer::~HGCHEbackDigitizer ( )
override

Definition at line 98 of file HGCHEbackDigitizer.cc.

99 {
100 }

Member Function Documentation

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

Definition at line 36 of file HGCHEbackDigitizer.cc.

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

Referenced by runDigitizer().

39 {
40  //switch to true if you want to print some details
41  constexpr bool debug(false);
42 
43  HGCSimHitData chargeColl;
44 
45  // this represents a cell with no signal charge
46  HGCCellInfo zeroData;
47  zeroData.hit_info[0].fill(0.f); //accumulated energy
48  zeroData.hit_info[1].fill(0.f); //time-of-flight
49 
50  for( const auto& id : validIds ) {
51  chargeColl.fill(0.f);
52  HGCSimHitDataAccumulator::iterator it = simData.find(id);
53  HGCCellInfo& cell = ( simData.end() == it ? zeroData : it->second );
54  addCellMetadata(cell,theGeom,id);
55 
56  for(size_t i=0; i<cell.hit_info[0].size(); ++i)
57  {
58  //convert total energy keV->MIP, since converted to keV in accumulator
59  const float totalIniMIPs( cell.hit_info[0][i]*keV2MIP_ );
60  //std::cout << "energy in MIP: " << std::scientific << totalIniMIPs << std::endl;
61 
62  //generate random number of photon electrons
63  const uint32_t npe = std::floor(CLHEP::RandPoissonQ::shoot(engine,totalIniMIPs*nPEperMIP_));
64 
65  //number of pixels
66  const float x = vdt::fast_expf( -((float)npe)/nTotalPE_ );
67  uint32_t nPixel(0);
68  if(xTalk_*x!=1) nPixel=(uint32_t) std::max( nTotalPE_*(1.f-x)/(1.f-xTalk_*x), 0.f );
69 
70  //update signal
71  nPixel = (uint32_t)std::max( CLHEP::RandGaussQ::shoot(engine,(double)nPixel,sdPixels_), 0. );
72 
73  //convert to MIP again and saturate
74  float totalMIPs(0.f), xtalk = 0.f;
75  const float peDiff = nTotalPE_ - (float) nPixel;
76  if (peDiff != 0.f) {
77  xtalk = (nTotalPE_-xTalk_*((float)nPixel)) / peDiff;
78  if( xtalk > 0.f && nPEperMIP_ != 0.f)
79  totalMIPs = (nTotalPE_/nPEperMIP_)*vdt::fast_logf(xtalk);
80  }
81 
82  //add noise (in MIPs)
83  chargeColl[i] = totalMIPs+std::max( CLHEP::RandGaussQ::shoot(engine,0.,noise_MIP_), 0. );
84  if(debug && cell.hit_info[0][i]>0)
85  std::cout << "[runCaliceLikeDigitizer] xtalk=" << xtalk << " En=" << cell.hit_info[0][i] << " keV -> " << totalIniMIPs << " raw-MIPs -> " << chargeColl[i] << " digi-MIPs" << std::endl;
86  }
87 
88  //init a new data frame and run shaper
89  HGCalDataFrame newDataFrame( id );
90  this->myFEelectronics_->runTrivialShaper( newDataFrame, chargeColl, 1 );
91 
92  //prepare the output
93  this->updateOutput(digiColl,newDataFrame);
94  }
95 }
void updateOutput(std::unique_ptr< DColl > &coll, const HGCalDataFrame &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
#define constexpr
std::array< HGCSimData_t, nSamples > HGCSimHitData
std::unique_ptr< HGCFEElectronics< HGCalDataFrame > > 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< HGCalDigiCollection > &  coll,
hgc::HGCSimHitDataAccumulator simData,
const CaloSubdetectorGeometry theGeom,
const std::unordered_set< DetId > &  validIds,
uint32_t  digitizerType,
CLHEP::HepRandomEngine *  engine 
)
overridevirtual

to be specialized by top class

Reimplemented from HGCDigitizerBase< HGCalDataFrame >.

Definition at line 28 of file HGCHEbackDigitizer.cc.

References runCaliceLikeDigitizer().

31 {
32  runCaliceLikeDigitizer(digiColl,simData,theGeom,validIds,engine);
33 }
void runCaliceLikeDigitizer(std::unique_ptr< HGCalDigiCollection > &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().