3 #include "CLHEP/Random/RandPoissonQ.h" 4 #include "CLHEP/Random/RandGaussQ.h" 9 #include "vdt/vdtMath.h" 41 const std::unordered_set<DetId>& validIds,
43 CLHEP::HepRandomEngine* engine) {
55 const std::unordered_set<DetId>& validIds,
56 CLHEP::HepRandomEngine* engine) {
63 for (
const auto&
id : validIds) {
66 HGCSimHitDataAccumulator::iterator it = simData.find(
id);
67 HGCCellInfo& cell = (simData.end() == it ? zeroData : it->second);
70 for (
size_t i = 0;
i < cell.
hit_info[0].size(); ++
i) {
75 chargeColl[
i] = totalIniMIPs;
90 const std::unordered_set<DetId>& validIds,
91 CLHEP::HepRandomEngine* engine) {
104 for (
const auto&
id : validIds) {
105 chargeColl.fill(0.
f);
107 HGCSimHitDataAccumulator::iterator it = simData.find(
id);
108 HGCCellInfo& cell = (simData.end() == it ? zeroData : it->second);
113 float sipmFactor = 1.;
128 scaledPePerMip *= dosePair.first;
129 tunedNoise = dosePair.second;
133 if (scaleBySipmArea_) {
135 scaledPePerMip *= sipmFactor;
136 tunedNoise *=
sqrt(sipmFactor);
141 float meanN =
std::pow(tunedNoise, 2);
143 for (
size_t i = 0;
i < cell.
hit_info[0].size(); ++
i) {
148 const uint32_t npeS = std::floor(CLHEP::RandPoissonQ::shoot(engine, totalIniMIPs * scaledPePerMip) + 0.5);
151 const uint32_t npeN = std::floor(CLHEP::RandPoissonQ::shoot(engine, meanN) + 0.5);
154 const uint32_t npe = npeS + npeN;
157 float nTotalPixels =
nTotalPE_ * sipmFactor;
169 if (debug && totalIniMIPs > 0) {
170 LogDebug(
"HGCHEbackDigitizer") <<
"npeS: " << npeS <<
" npeN: " << npeN <<
" npe: " << npe
171 <<
" meanN: " << meanN <<
" noise_MIP_: " << noise_MIP_
172 <<
" nPEperMIP_: " <<
nPEperMIP_ <<
" scaledPePerMip: " << scaledPePerMip
173 <<
" nPixel: " << nPixel;
174 LogDebug(
"HGCHEbackDigitizer") <<
"totalIniMIPs: " << totalIniMIPs <<
" totalMIPs: " << totalMIPs << std::endl;
178 chargeColl[
i] = totalMIPs;
191 : std::floor(adcThr / adcLsb));
193 this->
myFEelectronics_->runShaper(newDataFrame, chargeColl, toa, engine, thrADC);
204 const std::unordered_set<DetId>& validIds,
205 CLHEP::HepRandomEngine* engine) {
216 for (
const auto&
id : validIds) {
217 chargeColl.fill(0.
f);
218 HGCSimHitDataAccumulator::iterator it = simData.find(
id);
219 HGCCellInfo& cell = (simData.end() == it ? zeroData : it->second);
222 for (
size_t i = 0;
i < cell.
hit_info[0].size(); ++
i) {
227 const uint32_t npe = std::floor(CLHEP::RandPoissonQ::shoot(engine, totalIniMIPs *
nPEperMIP_));
237 nPixel = (uint32_t)
std::max(CLHEP::RandGaussQ::shoot(engine, (
double)nPixel,
sdPixels_), 0.);
240 float totalMIPs(0.
f), xtalk = 0.f;
244 if (xtalk > 0.
f && nPEperMIP_ != 0.
f)
249 chargeColl[
i] = totalMIPs;
254 <<
" keV -> " << totalIniMIPs <<
" raw-MIPs -> " << chargeColl[
i]
void runRealisticDigitizer(std::unique_ptr< HGCalDigiCollection > &digiColl, hgc::HGCSimHitDataAccumulator &simData, const CaloSubdetectorGeometry *theGeom, const std::unordered_set< DetId > &validIds, CLHEP::HepRandomEngine *engine)
T getParameter(std::string const &) const
~HGCHEbackDigitizer() override
std::array< double, 8 > radiiVec
void updateOutput(std::unique_ptr< DColl > &coll, const HGCalDataFrame &rawDataFrame)
prepares the output according to the number of time samples to produce
void runEmptyDigitizer(std::unique_ptr< HGCalDigiCollection > &digiColl, hgc::HGCSimHitDataAccumulator &simData, const CaloSubdetectorGeometry *theGeom, const std::unordered_set< DetId > &validIds, CLHEP::HepRandomEngine *engine)
void setSipmMap(const std::string &)
void setGeometry(const CaloSubdetectorGeometry *)
std::unordered_map< uint32_t, HGCCellInfo > HGCSimHitDataAccumulator
void addCellMetadata(HGCCellInfo &info, const HcalGeometry *geom, const DetId &detid)
radiiVec computeRadius(const HGCScintillatorDetId &)
std::array< HGCSimData_t, nSamples > HGCSimHitData
HGCHEbackDigitizer(const edm::ParameterSet &ps)
double scaleByTileArea(const HGCScintillatorDetId &, const radiiVec &)
returns the signal scaling and the noise
double scaleBySipmArea(const HGCScintillatorDetId &, const double &)
std::array< HGCSimHitData, 2 > hit_info
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
bool thresholdFollowsMIP_
std::unique_ptr< HGCFEElectronics< HGCalDataFrame > > myFEelectronics_
void setDoseMap(const std::string &, const unsigned int)
std::pair< double, double > scaleByDose(const HGCScintillatorDetId &, const radiiVec &)
void runCaliceLikeDigitizer(std::unique_ptr< HGCalDigiCollection > &digiColl, hgc::HGCSimHitDataAccumulator &simData, const CaloSubdetectorGeometry *theGeom, const std::unordered_set< DetId > &validIds, CLHEP::HepRandomEngine *engine)
models the behavior of the front-end electronics
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
Power< A, B >::type pow(const A &a, const B &b)