6 #include "CLHEP/Random/RandGeneral.h"
7 #include "CLHEP/Random/RandPoissonQ.h"
8 #include "CLHEP/Random/RandFlat.h"
10 #include <gsl/gsl_sf_erf.h>
11 #include <gsl/gsl_sf_result.h>
16 m_ranGeneral(nullptr),
50 refFile =
"SimCalorimetry/EcalSimProducers/data/esRefHistosFile_LG.txt";
53 refFile =
"SimCalorimetry/EcalSimProducers/data/esRefHistosFile_HG.txt";
59 std::cerr <<
"ESDigitizer::could not compute gaussian tail probability for the threshold chosen" << std::endl;
61 const double probabilityLeft(
result.val);
71 while (0 == thisLine) {
75 sscanf(
buffer,
"%f", &histoBin);
81 const uint32_t histoBin2(histoBin1 * histoBin1);
85 std::vector<double> t_refHistos;
86 t_refHistos.reserve(2500);
94 sscanf(
buffer,
"%f", &histoInf);
99 sscanf(
buffer,
"%f", &histoSup);
100 t_histoSup = (double)histoSup;
104 sscanf(
buffer,
"%f", &refBin);
106 t_refHistos.push_back((
double)refBin);
107 const uint32_t
i2(thisBin / histoBin2);
108 const uint32_t off(
i2 * histoBin2);
109 const uint32_t
i1((thisBin - off) / histoBin1);
110 const uint32_t i0(thisBin - off -
i1 * histoBin1);
122 m_ranGeneral =
new CLHEP::RandGeneral(
nullptr, &t_refHistos.front(), t_refHistos.size(), 0);
139 std::vector<DetId> abThreshCh;
144 for (std::vector<DetId>::const_iterator idItr(abThreshCh.begin()); idItr != abThreshCh.end(); ++idItr) {
149 if (myBin ==
m_trip.size())
157 const_cast<ESElectronicsSimFast*>(
elecSim())->analogToDigital(engine, analogSignal, digi,
true);
165 CLHEP::RandPoissonQ randPoissonQ(*engine,
m_meanNoisy);
166 const unsigned int nChan(randPoissonQ.fire());
167 abThreshCh.reserve(nChan);
169 for (
unsigned int i(0);
i != nChan; ++
i) {
170 std::vector<DetId>::const_iterator idItr(abThreshCh.end());
174 iChan = (uint32_t)CLHEP::RandFlat::shoot(engine,
m_detIds->size());
178 id = (*m_detIds)[iChan];
179 idItr =
find(abThreshCh.begin(), abThreshCh.end(),
id);
180 }
while (idItr != abThreshCh.end());