6 #include "CLHEP/Random/RandGaussZiggurat.h"
7 #include "CLHEP/Random/RandFlat.h"
9 constexpr
double percentage(
unsigned int numerator,
unsigned int denom) {
26 return StatusCode::SUCCESS;
29 ATH_MSG_INFO(
"Tried to convert "<<m_allHits[0]<<
"/"<<m_allHits[1]<<
" hits. In, "
30 <<percentage(m_acceptedHits[0], m_allHits[0]) <<
"/"
31 <<percentage(m_acceptedHits[1], m_allHits[1]) <<
"% of the cases, the conversion was successful");
32 return StatusCode::SUCCESS;
48 for (
const TimedHit& simHit : viewer) {
55 const Amg::Vector3D locPos{xAOD::toEigen(simHit->localPosition())};
60 const bool digitizedEta =
digitizeHit(hitId,
false, *readOutEle,
61 hitTime(simHit), locPos.block<2,1>(0,0),
62 efficiencyMap, *digiColl, rndEngine, deadTimes);
65 etaToPhi*locPos.block<2,1>(0,0),
66 efficiencyMap, *digiColl, rndEngine, deadTimes);
69 const Identifier digitId{(*digiColl)[digiColl->
size() -1 - digitizedPhi]->identify()};
71 }
else if (digitizedPhi) {
75 phiPos.block<2,1>(0,0) = etaToPhi * phiPos.block<2,1>(0,0);
77 locDir.block<2,1>(0,0) = etaToPhi *
locDir.block<2,1>(0,0);
78 const Identifier digitId{(*digiColl)[digiColl->
size() -1]->identify()};
84 efficiencyMap, *digiColl, rndEngine, deadTimes)) {
86 const Identifier digitId{(*digiColl)[digiColl->
size() -1]->identify()};
90 }
while (viewer.next());
93 return StatusCode::SUCCESS;
96 const bool measuresPhi,
102 CLHEP::HepRandomEngine* rndEngine,
105 ++(m_allHits[measuresPhi]);
109 const double uncert = design.stripPitch() / std::sqrt(12.);
110 const double smearedX = CLHEP::RandGaussZiggurat::shoot(rndEngine, locPos.x(), uncert);
113 if (!design.insideTrapezoid(locHitPos)) {
115 <<
m_idHelperSvc->toStringGasGap(gasGapId)<<
", measuresPhi: "<<(measuresPhi ?
"yay" :
"nay"));
118 const int strip = design.stripNumber(locHitPos);
121 <<
m_idHelperSvc->toStringGasGap(gasGapId) <<std::endl<<design<<
122 std::endl<<
", measuresPhi: "<<(measuresPhi ?
"yay" :
"nay"));
129 const Identifier digitId{id_helper.channelID(gasGapId,
130 id_helper.doubletZ(gasGapId),
131 id_helper.doubletPhi(gasGapId),
132 id_helper.gasGap(gasGapId),
137 <<
", eta strip "<<strip<<
" & hit "<<
Amg::toString(locHitPos,2 )
142 if (effiMap && effiMap->
getEfficiency(digitId) < CLHEP::RandFlat::shoot(rndEngine,0.,1.)) {
154 const double digitTime = CLHEP::RandGaussZiggurat::shoot(rndEngine, signalTime,
m_stripTimeResolution);
156 ++(m_acceptedHits[measuresPhi]);
165 CLHEP::HepRandomEngine* rndEngine,
168 ++(m_allHits[
false]);
174 const double uncert = design.stripPitch() / std::sqrt(12.);
175 const double smearedX = CLHEP::RandGaussZiggurat::shoot(rndEngine, locPos.x(), uncert);
184 const double smearedTimeL = CLHEP::RandGaussZiggurat::shoot(rndEngine, propagationTimeL,
m_stripTimeResolution);
185 const double smearedTimeR = CLHEP::RandGaussZiggurat::shoot(rndEngine, propagationTimeR,
m_stripTimeResolution);
187 const double smearedDeltaT = smearedTimeR - smearedTimeL;
204 if (!design.insideTrapezoid(locHitPos)) {
210 const int strip = design.stripNumber(locHitPos);
213 <<
m_idHelperSvc->toStringGasGap(gasGapId) <<std::endl<<design);
219 const Identifier digitId{id_helper.channelID(gasGapId,
220 id_helper.doubletZ(gasGapId),
221 id_helper.doubletPhi(gasGapId),
222 id_helper.gasGap(gasGapId),
226 <<
", strip: "<<strip);
235 const bool effiSignal1 = !effiMap || effiMap->
getEfficiency(gasGapId) >= CLHEP::RandFlat::shoot(rndEngine,0., 1.);
236 const bool effiSignal2 = !effiMap || effiMap->
getEfficiency(gasGapId) >= CLHEP::RandFlat::shoot(rndEngine,0., 1.);
243 if (effiSignal1 || effiSignal2) {
244 ++(m_acceptedHits[
false]);
252 constexpr
double tot_mean_narrow = 16.;
253 constexpr
double tot_sigma_narrow = 2.;
254 constexpr
double tot_mean_wide = 15.;
255 constexpr
double tot_sigma_wide = 4.5;
259 if (CLHEP::RandFlat::shoot(rndmEngine)<0.75) {
260 thetot = CLHEP::RandGaussZiggurat::shoot(rndmEngine, tot_mean_narrow, tot_sigma_narrow);
262 thetot = CLHEP::RandGaussZiggurat::shoot(rndmEngine, tot_mean_wide, tot_sigma_wide);