7 #include "CLHEP/Random/RandGaussZiggurat.h"
8 #include "CLHEP/Random/RandFlat.h"
10 constexpr
double percentage(
unsigned int numerator,
unsigned int denom) {
27 return StatusCode::SUCCESS;
30 ATH_MSG_INFO(
"Tried to convert "<<m_allHits[0]<<
"/"<<m_allHits[1]<<
" hits. In, "
31 <<percentage(m_acceptedHits[0], m_allHits[0]) <<
"/"
32 <<percentage(m_acceptedHits[1], m_allHits[1]) <<
"% of the cases, the conversion was successful");
33 return StatusCode::SUCCESS;
49 for (
const TimedHit& simHit : viewer) {
56 const Amg::Vector3D locPos{xAOD::toEigen(simHit->localPosition())};
61 const bool digitizedEta =
digitizeHit(hitId,
false, *readOutEle,
62 hitTime(simHit), locPos.block<2,1>(0,0),
63 efficiencyMap, *digiColl, rndEngine, deadTimes);
66 etaToPhi*locPos.block<2,1>(0,0),
67 efficiencyMap, *digiColl, rndEngine, deadTimes);
70 const Identifier digitId{(*digiColl)[digiColl->
size() -1 - digitizedPhi]->identify()};
72 }
else if (digitizedPhi) {
76 phiPos.block<2,1>(0,0) = etaToPhi * phiPos.block<2,1>(0,0);
78 locDir.block<2,1>(0,0) = etaToPhi *
locDir.block<2,1>(0,0);
79 const Identifier digitId{(*digiColl)[digiColl->
size() -1]->identify()};
85 efficiencyMap, *digiColl, rndEngine, deadTimes)) {
87 const Identifier digitId{(*digiColl)[digiColl->
size() -1]->identify()};
91 }
while (viewer.next());
94 return StatusCode::SUCCESS;
97 const bool measuresPhi,
103 CLHEP::HepRandomEngine* rndEngine,
106 ++(m_allHits[measuresPhi]);
110 const double uncert = design.stripPitch() / std::sqrt(12.);
111 const double smearedX = CLHEP::RandGaussZiggurat::shoot(rndEngine, locPos.x(), uncert);
114 if (!design.insideTrapezoid(locHitPos)) {
116 <<
m_idHelperSvc->toStringGasGap(gasGapId)<<
", measuresPhi: "<<(measuresPhi ?
"yay" :
"nay"));
119 const int strip = design.stripNumber(locHitPos);
122 <<
m_idHelperSvc->toStringGasGap(gasGapId) <<std::endl<<design<<
123 std::endl<<
", measuresPhi: "<<(measuresPhi ?
"yay" :
"nay"));
130 const Identifier digitId{id_helper.channelID(gasGapId,
131 id_helper.doubletZ(gasGapId),
132 id_helper.doubletPhi(gasGapId),
133 id_helper.gasGap(gasGapId),
138 <<
", eta strip "<<strip<<
" & hit "<<
Amg::toString(locHitPos,2 )
143 if (effiMap && effiMap->
getEfficiency(digitId) < CLHEP::RandFlat::shoot(rndEngine,0.,1.)) {
155 const double digitTime = CLHEP::RandGaussZiggurat::shoot(rndEngine, signalTime,
m_stripTimeResolution);
157 ++(m_acceptedHits[measuresPhi]);
166 CLHEP::HepRandomEngine* rndEngine,
169 ++(m_allHits[
false]);
175 const double uncert = design.stripPitch() / std::sqrt(12.);
176 const double smearedX = CLHEP::RandGaussZiggurat::shoot(rndEngine, locPos.x(), uncert);
185 const double smearedTimeL = CLHEP::RandGaussZiggurat::shoot(rndEngine, propagationTimeL,
m_stripTimeResolution);
186 const double smearedTimeR = CLHEP::RandGaussZiggurat::shoot(rndEngine, propagationTimeR,
m_stripTimeResolution);
188 const double smearedDeltaT = smearedTimeR - smearedTimeL;
205 if (!design.insideTrapezoid(locHitPos)) {
211 const int strip = design.stripNumber(locHitPos);
214 <<
m_idHelperSvc->toStringGasGap(gasGapId) <<std::endl<<design);
220 const Identifier digitId{id_helper.channelID(gasGapId,
221 id_helper.doubletZ(gasGapId),
222 id_helper.doubletPhi(gasGapId),
223 id_helper.gasGap(gasGapId),
227 <<
", strip: "<<strip);
236 const bool effiSignal1 = !effiMap || effiMap->
getEfficiency(gasGapId) >= CLHEP::RandFlat::shoot(rndEngine,0., 1.);
237 const bool effiSignal2 = !effiMap || effiMap->
getEfficiency(gasGapId) >= CLHEP::RandFlat::shoot(rndEngine,0., 1.);
244 if (effiSignal1 || effiSignal2) {
245 ++(m_acceptedHits[
false]);
253 constexpr
double tot_mean_narrow = 16.;
254 constexpr
double tot_sigma_narrow = 2.;
255 constexpr
double tot_mean_wide = 15.;
256 constexpr
double tot_sigma_wide = 4.5;
260 if (CLHEP::RandFlat::shoot(rndmEngine)<0.75) {
261 thetot = CLHEP::RandGaussZiggurat::shoot(rndmEngine, tot_mean_narrow, tot_sigma_narrow);
263 thetot = CLHEP::RandGaussZiggurat::shoot(rndmEngine, tot_mean_wide, tot_sigma_wide);