14 #include "CLHEP/Random/RandGaussZiggurat.h"
15 #include "CLHEP/Random/RandFlat.h"
33 return StatusCode::SUCCESS;
38 return StatusCode::SUCCESS;
42 CLHEP::HepRandomEngine* rndmEngine)
const {
62 const EventContext& ctx{Gaudi::Hive::currentContext()};
82 for (
auto &[mapId,mapDiode]:chargedDiodes) {
84 InDetDD::SiCellId cellID = chargedDiodes.element()->cellIdFromIdentifier(chargedDiodes.getId( mapId));
86 Identifier gangedID = chargedDiodes.element()->identifierFromCellId(gangedCell);
89 int phiGanged = pixelId->
phi_index(gangedID);
90 int phiThis = pixelId->
phi_index(chargedDiodes.getId( mapId));
92 if (gangedChargeDiode) {
93 bool maskGanged = ((phiGanged > 159) && (phiGanged < 168));
94 bool maskThis = ((phiThis > 159) && (phiThis < 168));
97 if (maskGanged && maskThis) {
98 ATH_MSG_ERROR(
"FEI3SimTool: both ganged pixels are in the mask out region -> BUG!");
104 gangedChargeDiode->
add(mapDiode.totalCharge());
112 i_chargedDiode != chargedDiodes.orderedEnd(); ++i_chargedDiode) {
126 double th0 = thresholds.
value;
127 double ith0 = thresholds.inTimeValue;
135 const std::vector<float> & totCharges = moduleData->
getTimingIndex(barrel_ec, layerIndex);
136 const std::vector<float> & probArray = moduleData->
getTimingProbability(barrel_ec, layerIndex, moduleIndex);
145 double rnd = CLHEP::RandFlat::shoot(rndmEngine, 0.0, 1.0);
147 double timeWalk = 0.0;
148 if (rnd<
prob) { timeWalk = 25.0; }
151 if (selectedTuneYear == 2009) {
152 double intimethreshold = (ith0 / th0) *
threshold;
171 double totsig = calibData->
getTotRes(moduleHash, FE, tot);
172 int nToT =
static_cast<int>(CLHEP::RandGaussZiggurat::shoot(rndmEngine, tot, totsig));
178 if (nToT <= moduleData->getToTThreshold(barrel_ec, layerIndex)) {
200 int bunch = (
flag >> 8) & 0xff;
203 const Identifier id_readout = chargedDiodes.element()->identifierFromCellId(cellId);
212 static constexpr
int smallHitThreshold{7};
213 bool smallHitChk =
false;
214 if (nToT <= smallHitThreshold) {
226 CLHEP::HepRandomEngine* rndmEngine)
const {
228 double myTimeWalkEff = 0.;
229 double overdrive = intimethreshold -
threshold;
237 double p1 = 20. /
std::log(intimethreshold / overdrive);
242 myTimeWalkEff = myTimeWalk + myTimeWalk * 0.2 * CLHEP::RandGaussZiggurat::shoot(rndmEngine);
244 double randomJitter = CLHEP::RandFlat::shoot(rndmEngine, -
limit,
limit);
257 auto pCategory = std::upper_bound(bounds.begin(), bounds.end(),
val);
258 if (pCategory == bounds.end())
return 0.0;