42 {
43 const InDetDD::PixelModuleDesign* p_design =
44 static_cast<const InDetDD::PixelModuleDesign*
>(&(chargedDiodes.
element())->design());
45
47 return;
48 }
49
50 const PixelID* pixelId =
static_cast<const PixelID*
>(chargedDiodes.
element()->
getIdHelper());
53
57
59 return;
60 }
61
62 const EventContext& ctx{Gaudi::Hive::currentContext()};
63 SG::ReadCondHandle<PixelModuleData> moduleDataHandle(
m_moduleDataKey, ctx);
64 const PixelModuleData *moduleData = *moduleDataHandle;
65 SG::ReadCondHandle<PixelChargeCalibCondData> calibDataHandle(
m_chargeDataKey, ctx);
66 const PixelChargeCalibCondData *calibData = *calibDataHandle;
68
70
72
74
75
77 }
78
79
81 const InDetDD::SiDetectorElement * siDetEl =
static_cast<const InDetDD::SiDetectorElement *
>(chargedDiodes.
element());
82 for (auto &[mapId,mapDiode]:chargedDiodes) {
83
84 InDetDD::SiCellId cellID = chargedDiodes.element()->cellIdFromIdentifier(chargedDiodes.getId( mapId));
85 InDetDD::SiCellId gangedCell = siDetEl->
gangedCell(cellID);
86 Identifier gangedID = chargedDiodes.element()->identifierFromCellId(gangedCell);
88 SiChargedDiode* gangedChargeDiode = chargedDiodes.find(gangedID);
89 int phiGanged = pixelId->
phi_index(gangedID);
90 int phiThis = pixelId->
phi_index(chargedDiodes.getId( mapId));
91
92 if (gangedChargeDiode) {
93 bool maskGanged = ((phiGanged > 159) && (phiGanged < 168));
94 bool maskThis = ((phiThis > 159) && (phiThis < 168));
95
96
97 if (maskGanged && maskThis) {
98 ATH_MSG_ERROR(
"FEI3SimTool: both ganged pixels are in the mask out region -> BUG!");
99 }
100 if (maskGanged) {
103 } else {
104 gangedChargeDiode->
add(mapDiode.totalCharge());
106 }
107 }
108 }
109 }
110
112 i_chargedDiode != chargedDiodes.orderedEnd(); ++i_chargedDiode) {
113 SiChargedDiode& diode = **i_chargedDiode;
114
115 Identifier diodeID = chargedDiodes.getId(diode.
diode());
117
121
122
124 const auto thresholds = calibData->
getThresholds(type, moduleHash, FE);
125
126 double th0 = thresholds.
value;
127 double ith0 = thresholds.inTimeValue;
129
130
131
133 int bunchSim = 0;
135 const std::vector<float> & totCharges = moduleData->
getTimingIndex(barrel_ec, layerIndex);
136 const std::vector<float> & probArray = moduleData->
getTimingProbability(barrel_ec, layerIndex, moduleIndex);
137
143
145 double rnd = CLHEP::RandFlat::shoot(rndmEngine, 0.0, 1.0);
146
147 double timeWalk = 0.0;
148 if (
rnd<prob) { timeWalk = 25.0; }
150
151 if (selectedTuneYear == 2009) {
152 double intimethreshold = (ith0 / th0) * threshold;
154 }
155 }
156 else {
159 }
160 }
161
164 } else {
166 }
167 } else {
169 }
170
171 double totsig = calibData->
getTotRes(moduleHash, FE, tot);
172 int nToT = static_cast<int>(CLHEP::RandGaussZiggurat::shoot(rndmEngine, tot, totsig));
173
174 if (nToT < 1) {
175 nToT = 1;
176 }
177
178 if (nToT <= moduleData->getToTThreshold(barrel_ec, layerIndex)) {
180 }
181
184 }
185
186
188 continue;
189 }
191 continue;
192 }
193
196 continue;
197 }
198
200 int bunch = (
flag >> 8) & 0xff;
201
203 const Identifier id_readout = chargedDiodes.element()->identifierFromCellId(cellId);
204
205
207 rdoCollection.
push_back(
new Pixel1RawData(id_readout, nToT, bunch, 0, bunch));
208 }
209
210
212 static constexpr int smallHitThreshold{7};
213 bool smallHitChk = false;
214 if (nToT <= smallHitThreshold) {
215 smallHitChk = true;
216 }
218 rdoCollection.
push_back(
new Pixel1RawData(id_readout, nToT, bunch - 1, 0, bunch - 1));
219 }
220 }
221 }
222 }
double charge(const T &p)
SiChargedDiodeOrderedSet::iterator SiChargedDiodeOrderedIterator
value_type push_back(value_type pElem)
PixelReadoutTechnology getReadoutTechnology() const
bool isValid() const
Test if its in a valid state.
SiCellId gangedCell(const SiCellId &cellId) const
If cell is ganged return the id of the other cell which shares the readout for this cell,...
virtual Identifier identify() const override final
identifier of this detector element (inline)
PixelChargeCalib::Thresholds getThresholds(InDetDD::PixelDiodeType type, unsigned int moduleHash, unsigned int FE) const
float getToT(InDetDD::PixelDiodeType type, unsigned int moduleHash, unsigned int FE, float Q) const
float getTotRes(unsigned int moduleHash, unsigned int FE, float Q) const
int layer_disk(const Identifier &id) const
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module) const
For a single crystal.
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
IdentifierHash wafer_hash(Identifier wafer_id) const
wafer hash from id
int eta_module(const Identifier &id) const
int phi_index(const Identifier &id) const
int getFEI3Latency(int barrel_ec, int layer) const
int getFEI3TimingSimTune(int barrel_ec, int layer) const
std::vector< float > getTimingProbability(int barrel_ec, int layer, int eta) const
std::vector< float > getTimingIndex(int barrel_ec, int layer) const
double getCrossTalk(int barrel_ec, int layer) const
virtual Identifier identify() const override final
const InDetDD::SolidStateDetectorElementBase * element() const
const InDetDD::SiCellId & diode() const
const SiTotalCharge & totalCharge() const
void add(const SiCharge &charge)
const InDetDD::SiReadoutCellId & getReadoutCell() const
static bool isMaskOut(SiChargedDiode &chDiode)
static void SetBunch(SiChargedDiode &chDiode, int bunch, MsgStream *log=nullptr)
static void disabled(SiChargedDiode &chDiode, bool flag, bool mask=false)
static void maskOut(SiChargedDiode &chDiode, bool flag)
static void belowThreshold(SiChargedDiode &chDiode, bool flag, bool mask=false)
static bool isDisabled(SiChargedDiode &chDiode)
constexpr uint32_t invalidFrontEnd
const T * getIdHelper(StoreGateSvc *pDetStore, const std::string &helperName)
void randomDisable(SiChargedDiodeCollection &chargedDiodes, const PixelModuleData *moduleData, CLHEP::HepRandomEngine *rndmEngine)
void crossTalk(double crossTalk, SiChargedDiodeCollection &chargedDiodes)
void thermalNoise(double thermalNoise, SiChargedDiodeCollection &chargedDiodes, CLHEP::HepRandomEngine *rndmEngine)
double randomThreshold(const PixelChargeCalib::Thresholds &t, CLHEP::HepRandomEngine *pEngine)
void randomNoise(SiChargedDiodeCollection &chargedDiodes, const PixelModuleData *moduleData, int nBcid, const PixelChargeCalibCondData *chargeCalibData, CLHEP::HepRandomEngine *rndmEngine, InDetDD::IPixelReadoutManager *pixelReadout)
double getG4Time(const SiTotalCharge &totalCharge)