36 {
37 const InDetDD::PixelModuleDesign* p_design =
38 static_cast<const InDetDD::PixelModuleDesign*
>(&(chargedDiodes.
element())->design());
39
41 return;
42 }
43
44 const PixelID* pixelId =
static_cast<const PixelID*
>(chargedDiodes.
element()->
getIdHelper());
47
51
53 return;
54 }
55
56 SG::ReadCondHandle<PixelModuleData> moduleDataHandle(
m_moduleDataKey, ctx);
57 const PixelModuleData *moduleData = *moduleDataHandle;
58 SG::ReadCondHandle<PixelChargeCalibCondData> calibDataHandle(
m_chargeDataKey, ctx);
59 const PixelChargeCalibCondData *calibData = *calibDataHandle;
61
63
65
67
68
70 }
71
72
74 const InDetDD::SiDetectorElement * siDetEl =
static_cast<const InDetDD::SiDetectorElement *
>(chargedDiodes.
element());
75 for (auto &[mapId,mapDiode]:chargedDiodes) {
76
77 InDetDD::SiCellId cellID = chargedDiodes.element()->cellIdFromIdentifier(chargedDiodes.getId( mapId));
78 InDetDD::SiCellId gangedCell = siDetEl->
gangedCell(cellID);
79 Identifier gangedID = chargedDiodes.element()->identifierFromCellId(gangedCell);
81 SiChargedDiode* gangedChargeDiode = chargedDiodes.find(gangedID);
82 int phiGanged = pixelId->
phi_index(gangedID);
83 int phiThis = pixelId->
phi_index(chargedDiodes.getId( mapId));
84
85 if (gangedChargeDiode) {
86 bool maskGanged = ((phiGanged > 159) && (phiGanged < 168));
87 bool maskThis = ((phiThis > 159) && (phiThis < 168));
88
89
90 if (maskGanged && maskThis) {
91 ATH_MSG_ERROR(
"FEI3SimTool: both ganged pixels are in the mask out region -> BUG!");
92 }
93 if (maskGanged) {
96 } else {
97 gangedChargeDiode->
add(mapDiode.totalCharge());
99 }
100 }
101 }
102 }
103
105 i_chargedDiode != chargedDiodes.orderedEnd(); ++i_chargedDiode) {
106 SiChargedDiode& diode = **i_chargedDiode;
107
108 Identifier diodeID = chargedDiodes.getId(diode.
diode());
110
114
115
117 const auto thresholds = calibData->
getThresholds(type, moduleHash, FE);
118
119 double th0 = thresholds.
value;
120 double ith0 = thresholds.inTimeValue;
122
123
124
126 int bunchSim = 0;
128 const std::vector<float> & totCharges = moduleData->
getTimingIndex(barrel_ec, layerIndex);
129 const std::vector<float> & probArray = moduleData->
getTimingProbability(barrel_ec, layerIndex, moduleIndex);
130
136
138 double rnd = CLHEP::RandFlat::shoot(rndmEngine, 0.0, 1.0);
139
140 double timeWalk = 0.0;
141 if (
rnd<prob) { timeWalk = 25.0; }
143
144 if (selectedTuneYear == 2009) {
145 double intimethreshold = (ith0 / th0) * threshold;
147 }
148 }
149 else {
152 }
153 }
154
157 } else {
159 }
160 } else {
162 }
163
164 double totsig = calibData->
getTotRes(moduleHash, FE, tot);
165 int nToT = static_cast<int>(CLHEP::RandGaussZiggurat::shoot(rndmEngine, tot, totsig));
166
167 if (nToT < 1) {
168 nToT = 1;
169 }
170
171 if (nToT <= moduleData->getToTThreshold(barrel_ec, layerIndex)) {
173 }
174
177 }
178
179
181 continue;
182 }
184 continue;
185 }
186
189 continue;
190 }
191
193 int bunch = (
flag >> 8) & 0xff;
194
196 const Identifier id_readout = chargedDiodes.element()->identifierFromCellId(cellId);
197
198
200 rdoCollection.
push_back(
new Pixel1RawData(id_readout, nToT, bunch, 0, bunch));
201 }
202
203
205 static constexpr int smallHitThreshold{7};
206 bool smallHitChk = false;
207 if (nToT <= smallHitThreshold) {
208 smallHitChk = true;
209 }
211 rdoCollection.
push_back(
new Pixel1RawData(id_readout, nToT, bunch - 1, 0, bunch - 1));
212 }
213 }
214 }
215 }
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)