15 #include "CLHEP/Random/RandGaussZiggurat.h"
16 #include "CLHEP/Random/RandFlat.h"
34 return StatusCode::SUCCESS;
39 return StatusCode::SUCCESS;
43 CLHEP::HepRandomEngine* rndmEngine) {
63 const EventContext& ctx{Gaudi::Hive::currentContext()};
83 for (
auto &[mapId,mapDiode]:chargedDiodes) {
85 InDetDD::SiCellId cellID = chargedDiodes.element()->cellIdFromIdentifier(chargedDiodes.getId( mapId));
87 Identifier gangedID = chargedDiodes.element()->identifierFromCellId(gangedCell);
90 int phiGanged = pixelId->
phi_index(gangedID);
91 int phiThis = pixelId->
phi_index(chargedDiodes.getId( mapId));
93 if (gangedChargeDiode) {
94 bool maskGanged = ((phiGanged > 159) && (phiGanged < 168));
95 bool maskThis = ((phiThis > 159) && (phiThis < 168));
98 if (maskGanged && maskThis) {
99 ATH_MSG_ERROR(
"FEI3SimTool: both ganged pixels are in the mask out region -> BUG!");
105 gangedChargeDiode->
add(mapDiode.totalCharge());
113 i_chargedDiode != chargedDiodes.orderedEnd(); ++i_chargedDiode) {
127 double th0 = thresholds.
value;
128 double ith0 = thresholds.inTimeValue;
136 const std::vector<float> & totCharges = moduleData->
getTimingIndex(barrel_ec, layerIndex);
137 const std::vector<float> & probArray = moduleData->
getTimingProbability(barrel_ec, layerIndex, moduleIndex);
146 double rnd = CLHEP::RandFlat::shoot(rndmEngine, 0.0, 1.0);
148 double timeWalk = 0.0;
149 if (rnd<
prob) { timeWalk = 25.0; }
152 if (selectedTuneYear == 2009) {
153 double intimethreshold = (ith0 / th0) *
threshold;
172 double totsig = calibData->
getTotRes(moduleHash, FE, tot);
173 int nToT =
static_cast<int>(CLHEP::RandGaussZiggurat::shoot(rndmEngine, tot, totsig));
179 if (nToT <= moduleData->getToTThreshold(barrel_ec, layerIndex)) {
201 int bunch = (
flag >> 8) & 0xff;
204 const Identifier id_readout = chargedDiodes.element()->identifierFromCellId(cellId);
213 static constexpr
int smallHitThreshold{7};
214 bool smallHitChk =
false;
215 if (nToT <= smallHitThreshold) {
227 CLHEP::HepRandomEngine* rndmEngine)
const {
229 double myTimeWalkEff = 0.;
230 double overdrive = intimethreshold -
threshold;
238 double p1 = 20. /
std::log(intimethreshold / overdrive);
243 myTimeWalkEff = myTimeWalk + myTimeWalk * 0.2 * CLHEP::RandGaussZiggurat::shoot(rndmEngine);
245 double randomJitter = CLHEP::RandFlat::shoot(rndmEngine, -
limit,
limit);
258 auto pCategory = std::upper_bound(bounds.begin(), bounds.end(),
val);
259 if (pCategory == bounds.end())
return 0.0;