15 #include "CLHEP/Random/RandGaussZiggurat.h"
16 #include "CLHEP/Random/RandFlat.h"
29 constexpr std::array<double,17> sigmas{0.0,0.50,0.50,0.50,0.50,0.50,0.60,0.60,0.60,0.60,0.65,0.70,0.75,0.80,0.80,0.80,0.80};
30 return sigmas.at(
tot);
48 return StatusCode::SUCCESS;
53 return StatusCode::SUCCESS;
57 CLHEP::HepRandomEngine* rndmEngine) {
76 const EventContext& ctx{Gaudi::Hive::currentContext()};
82 int maxFEI4SmallHit = 2;
85 std::vector<std::unique_ptr<Pixel1RawData>> p_rdo_small_fei4;
86 int nSmallHitsFEI4 = 0;
90 std::vector<std::vector<int> > FEI4Map(maxRow + 16, std::vector<int>(maxCol + 16));
107 i_chargedDiode != chargedDiodes.
orderedEnd(); ++i_chargedDiode) {
110 Identifier diodeID = chargedDiodes.
getId(diode.
diode());
115 double corrQ = 1.11 *
116 (1.0 - (-7.09 * 1000.0) / (23.72 * 1000.0 +
charge) + (-0.22 * 1000.0) /
117 (-0.42 * 1000.0 +
charge));
130 double th0 = thresholds.
value;
132 double thrand1 = CLHEP::RandGaussZiggurat::shoot(rndmEngine);
133 double thrand2 = CLHEP::RandGaussZiggurat::shoot(rndmEngine);
135 + thresholds.sigma * thrand1
136 + thresholds.noise * thrand2;
161 double totsig = calibData->
getTotRes(moduleHash, FE,
tot);
162 int nToT =
static_cast<int>(CLHEP::RandGaussZiggurat::shoot(rndmEngine,
tot, totsig));
166 double totIBLsig = getSigma(nToT);
168 if (CLHEP::RandFlat::shoot(rndmEngine,0.0,1.0)<
std::exp(-0.5/totIBLsig/totIBLsig)) {
169 if (CLHEP::RandFlat::shoot(rndmEngine,0.0,1.0)<0.5) { nToT--; }
178 if (nToT == 2 && maxFEI4SmallHit == 2) {
182 nToT=std::clamp(nToT, 1, overflowToT);
184 if (nToT <= moduleData->getToTThreshold(barrel_ec, layerIndex)) {
202 int bunch = (
flag >> 8) & 0xff;
209 if (iicol >= maxCol) {
210 iicol = iicol - maxCol;
215 auto p_rdo = std::make_unique<Pixel1RawData>(id_readout, nToT, bunch, 0, bunch);
216 if (nToT > maxFEI4SmallHit) {
217 rdoCollection.
push_back(p_rdo.release());
218 FEI4Map[iirow][iicol] = 2;
220 p_rdo_small_fei4.push_back(std::move(p_rdo));
221 row.push_back(iirow);
222 col.push_back(iicol);
223 FEI4Map[iirow][iicol] = 1;
230 if (nSmallHitsFEI4 > 0) {
234 for (
int ismall = 0; ismall < nSmallHitsFEI4; ismall++) {
235 int rowPDR =
row[ismall] / 2;
236 int colPDR =
col[ismall] / 2;
237 for (
int rowBigHit = 2 * rowPDR; rowBigHit != 2 * rowPDR + 2 && rowBigHit < maxRow; ++rowBigHit) {
238 for (
int colBigHit = 2 * colPDR; colBigHit != 2 * colPDR + 2 && colBigHit < maxCol; ++colBigHit) {
240 "rowBig = " << rowBigHit <<
" colBig = " << colBigHit <<
" Map Content = " <<
241 FEI4Map[rowBigHit][colBigHit]);
242 if (FEI4Map[rowBigHit][colBigHit] == 2 && !
recorded) {
251 if (FEI4Map[
row[ismall] + 1][
col[ismall]] == 2) {
257 if (FEI4Map[
row[ismall] - 1][
col[ismall]] == 2) {