125 {
126 ATH_MSG_DEBUG(
"Starting to calculate strips that got fired");
131 const int stripMinID = digiInput.
stripMinID();
132 const int stripMaxID = digiInput.
stripMaxID();
133
135 const float eventTime = digiInput.
eventTime();
136 const float theta = incidentAngleXZ * Gaudi::Units::degree;
137 const float alpha = incidentAngleYZ * Gaudi::Units::degree;
138
139 int nPrimaryIons = 0;
140
142
143
144
145 float lorentzAngle = (
b.y() > 0. ? 1. : -1.) *
m_cfg.lorentzAngleFunction(std::abs(
b.y())) * Gaudi::Units::deg;
146 if (
m_cfg.writeOutputFile) {
147 std::lock_guard guard{fillMutex};
150 }
151
153
155
156 float pathLength =
m_cfg.driftGapWidth / std::cos(
theta);
157 pathLength /= std::cos(alpha);
158
159 if (
m_cfg.writeOutputFile) {
160 std::lock_guard guard{fillMutex};
163
166 else
168 }
169 while (pathLengthTraveled < pathLength) {
170
171 std::unique_ptr<MM_IonizationCluster> IonizationCluster =
172 std::make_unique<MM_IonizationCluster>(hitx, pathLengthTraveled * std::sin(
theta), pathLengthTraveled * std::cos(
theta));
173
174
176 IonizationCluster->createElectrons(nElectrons);
177
178 const Amg::Vector2D& initialPosition = IonizationCluster->getIonizationStart();
179
180 ATH_MSG_DEBUG(
"New interaction starting at x,y, pathLengthTraveled: " << initialPosition.x() <<
" " << initialPosition.y() <<
" "
181 << pathLengthTraveled);
182
183 for (auto& Electron : IonizationCluster->getElectrons()) {
186 }
187
188 IonizationCluster->propagateElectrons(lorentzAngle,
m_cfg.driftVelocity);
189
190 int tmpEffectiveNElectrons = 0;
191
192 for (auto& Electron : IonizationCluster->getElectrons()) {
194
196
197 ATH_MSG_DEBUG(
"Electron's effective charge is " << effectiveCharge);
198
199 if (
m_cfg.writeOutputFile) {
200 std::lock_guard guard{fillMutex};
203 }
204
206
207 tmpEffectiveNElectrons += effectiveCharge;
208 }
209
210 if (
m_cfg.writeOutputFile) {
211 std::lock_guard guard{fillMutex};
213 }
214
215 cache.IonizationClusters.push_back(std::move(IonizationCluster));
216
218
219 ATH_MSG_DEBUG(
"Path length traveled: " << pathLengthTraveled);
220
221 ++nPrimaryIons;
222 if (nPrimaryIons >=
m_cfg.maxPrimaryIons)
break;
223
224 }
225
226 float timeresolution = 0.01;
227
228 MM_StripResponse stripResponseObject(cache.IonizationClusters, timeresolution, stripPitch, stripID, stripMinID, stripMaxID);
229 stripResponseObject.timeOrderElectrons();
230 stripResponseObject.calculateTimeSeries(incidentAngleXZ, digiInput.
gasgap());
231 stripResponseObject.simulateCrossTalk(
m_cfg.crossTalk1,
m_cfg.crossTalk2);
232 stripResponseObject.calculateSummaries(
m_cfg.qThreshold);
233
234
235
236 cache.finalNumberofStrip = stripResponseObject.getStripVec();
237 cache.finalqStrip = stripResponseObject.getTotalChargeVec();
238 cache.finaltStrip = stripResponseObject.getTimeThresholdVec();
239 cache.tStripElectronicsAbThr = stripResponseObject.getTimeMaxChargeVec();
240 cache.qStripElectronics = stripResponseObject.getMaxChargeVec();
241
242
243
244 if (
m_cfg.writeOutputFile) {
245 std::lock_guard guard{fillMutex};
248 m_mapOfHistograms.at(
"totalEffectiveCharge")->Fill(stripResponseObject.totalCharge() * electronsToFC);
250 stripResponseObject.totalCharge() * electronsToFC);
251 ATH_MSG_DEBUG(
"incidentAngleXZ" << incidentAngleXZ <<
"charge [fC]" << stripResponseObject.totalCharge() / 6241.);
253 }
254
256 std::lock_guard guard{fillMutex};
257 static std::atomic<unsigned> written{0};
258 TGraph grIonizationXZ(cache.IonizationClusters.size());
259 for (size_t iIonization = 0; iIonization < cache.IonizationClusters.size(); ++iIonization) {
260 Amg::Vector2D ionizationPosition(cache.IonizationClusters.at(iIonization)->getIonizationStart());
261 grIonizationXZ.SetPoint(iIonization, ionizationPosition.x(), ionizationPosition.y());
262 }
263 m_outputFile->WriteObject(&grIonizationXZ, Form(
"ionizationXZ_%u", ++written));
264
265 TGraph grElectronsXZ(stripResponseObject.getNElectrons());
266 int iElectron = 0;
267 for (const auto& electron : stripResponseObject.getElectrons()) {
269 iElectron++;
270 }
271 m_outputFile->WriteObject(&grElectronsXZ, Form(
"electronsXZ_%u", ++written));
272 }
273
274}
Scalar theta() const
theta method
std::atomic_flag m_initialized ATLAS_THREAD_SAFE
Messaging initialized (initMessaging)
float getTransverseDiffusion(float posY, CLHEP::HepRandomEngine *rndmEngine) const
float getLongitudinalDiffusion(float posY, CLHEP::HepRandomEngine *rndmEngine) const
float getEffectiveCharge(CLHEP::HepRandomEngine *rndmEngine) const
float getPathLengthTraveled(CLHEP::HepRandomEngine *rndmEngine) const
void setCharge(float charge)
set the charge of the object
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
Electron_v1 Electron
Definition of the current "egamma version".