14 #include "CLHEP/Random/RandGaussZiggurat.h"
15 #include "CLHEP/Random/RandFlat.h"
33 return StatusCode::SUCCESS;
38 return StatusCode::SUCCESS;
42 CLHEP::HepRandomEngine* rndmEngine) {
62 const EventContext& ctx{Gaudi::Hive::currentContext()};
86 (*i_chargedDiode).first));
92 int phiGanged = pixelId->
phi_index(gangedID);
93 int phiThis = pixelId->
phi_index(chargedDiodes.
getId((*i_chargedDiode).first));
95 if (gangedChargeDiode) {
96 bool maskGanged = ((phiGanged > 159) && (phiGanged < 168));
97 bool maskThis = ((phiThis > 159) && (phiThis < 168));
100 if (maskGanged && maskThis) {
101 ATH_MSG_ERROR(
"FEI3SimTool: both ganged pixels are in the mask out region -> BUG!");
104 (*i_chargedDiode).second.add(gangedChargeDiode->
totalCharge());
107 gangedChargeDiode->
add((*i_chargedDiode).second.totalCharge());
115 i_chargedDiode != chargedDiodes.
orderedEnd(); ++i_chargedDiode) {
118 Identifier diodeID = chargedDiodes.
getId(diode.
diode());
128 double th0 = thresholds.
value;
129 double ith0 = thresholds.inTimeValue;
131 double thrand1 = CLHEP::RandGaussZiggurat::shoot(rndmEngine);
132 double thrand2 = CLHEP::RandGaussZiggurat::shoot(rndmEngine);
134 + thresholds.sigma * thrand1
135 + thresholds.noise * thrand2;
142 std::vector<float> totCharges = moduleData->
getTimingIndex(barrel_ec, layerIndex);
143 std::vector<float> probArray = moduleData->
getTimingProbability(barrel_ec, layerIndex, moduleIndex);
152 double rnd = CLHEP::RandFlat::shoot(rndmEngine, 0.0, 1.0);
154 double timeWalk = 0.0;
155 if (rnd<
prob) { timeWalk = 25.0; }
158 if (selectedTuneYear == 2009) {
159 double intimethreshold = (ith0 / th0) *
threshold;
178 double totsig = calibData->
getTotRes(moduleHash, FE,
tot);
179 int nToT =
static_cast<int>(CLHEP::RandGaussZiggurat::shoot(rndmEngine,
tot, totsig));
185 if (nToT <= moduleData->getToTThreshold(barrel_ec, layerIndex)) {
207 int bunch = (
flag >> 8) & 0xff;
219 static constexpr
int smallHitThreshold{7};
220 bool smallHitChk =
false;
221 if (nToT <= smallHitThreshold) {
233 CLHEP::HepRandomEngine* rndmEngine)
const {
235 double myTimeWalkEff = 0.;
236 double overdrive = intimethreshold -
threshold;
244 double p1 = 20. /
std::log(intimethreshold / overdrive);
249 myTimeWalkEff = myTimeWalk + myTimeWalk * 0.2 * CLHEP::RandGaussZiggurat::shoot(rndmEngine);
251 double randomJitter = CLHEP::RandFlat::shoot(rndmEngine, -
limit,
limit);
264 auto pCategory = std::upper_bound(bounds.begin(), bounds.end(),
val);
265 if (pCategory == bounds.end())
return 0.0;