9#include "CLHEP/Random/RandGaussZiggurat.h"
10#include "CLHEP/Random/RandFlat.h"
12 constexpr double percentage(
unsigned int numerator,
unsigned int denom) {
13 return 100. * numerator / std::max(denom, 1u);
25 return StatusCode::SUCCESS;
28 ATH_MSG_INFO(
"Tried to convert "<<m_allHits[0]<<
"/"<<m_allHits[1]<<
" hits. In, "
29 <<percentage(m_acceptedHits[0], m_allHits[0]) <<
"/"
30 <<percentage(m_acceptedHits[1], m_allHits[1]) <<
"% of the cases, the conversion was successful");
31 return StatusCode::SUCCESS;
47 for (
const TimedHit& simHit : viewer) {
58 const bool digitizedPhi =
digitizeHit(simHit,
true, efficiencyMap, *digiColl, rndEngine, deadTimes);
59 std::int16_t phiChannel = digitizedPhi ? idHelper.
channel(digiColl->
back()->
identify()) : -1;
60 const bool digitizedEta =
digitizeHit(simHit,
false, efficiencyMap, *digiColl, rndEngine, deadTimes);
62 if (digitizedEta || digitizedPhi) {
65 dec_phiChannel(*sdo) = phiChannel;
67 }
else if (
digitizeHitBI(simHit, efficiencyMap, *digiColl, rndEngine, deadTimes)) {
72 }
while (viewer.
next());
75 return StatusCode::SUCCESS;
78 const bool measuresPhi,
81 CLHEP::HepRandomEngine* rndEngine,
84 ++(m_allHits[measuresPhi]);
103 const double uncert = design.
stripPitch() / std::sqrt(12.);
105 locHitPos[measuresPhi] = CLHEP::RandGaussZiggurat::shoot(rndEngine, locHitPos[measuresPhi], uncert);
107 const Amg::Vector2D locPos2D = layerDesign->to2D(locHitPos, measuresPhi);
110 <<
" is outside of the trapezoid bounds for "<<
m_idHelperSvc->toString(layerId));
116 <<
" cannot trigger any signal in a strip for " <<
m_idHelperSvc->toString(layerId)
117 <<std::endl<<design);
124 idHelper.
gasGap(gasGapId),
134 if (effiMap && effiMap->
getEfficiency(digitId) < CLHEP::RandFlat::shoot(rndEngine,0.,1.)) {
145 const double digitTime = CLHEP::RandGaussZiggurat::shoot(rndEngine, signalTime,
m_stripTimeResolution);
147 <<
", recorded time: "<<digitTime);
149 ++(m_acceptedHits[measuresPhi]);
155 CLHEP::HepRandomEngine* rndEngine,
158 ++(m_allHits[
false]);
167 const double uncert = design.
stripPitch() / std::sqrt(12.);
168 const double smearedX = CLHEP::RandGaussZiggurat::shoot(rndEngine, locPos.x(), uncert);
177 const double smearedTimeL = CLHEP::RandGaussZiggurat::shoot(rndEngine, propagationTimeL,
m_stripTimeResolution);
178 const double smearedTimeR = CLHEP::RandGaussZiggurat::shoot(rndEngine, propagationTimeR,
m_stripTimeResolution);
180 const double smearedDeltaT = smearedTimeR - smearedTimeL;
206 <<
m_idHelperSvc->toStringGasGap(gasGapId) <<std::endl<<design);
215 idHelper.
gasGap(gasGapId),
219 <<
", strip: "<<
strip);
229 const bool effiSignal1 = !effiMap || effiMap->
getEfficiency(gasGapId) >= CLHEP::RandFlat::shoot(rndEngine,0., 1.);
230 const bool effiSignal2 = !effiMap || effiMap->
getEfficiency(gasGapId) >= CLHEP::RandFlat::shoot(rndEngine,0., 1.);
237 if (effiSignal1 || effiSignal2) {
238 ++(m_acceptedHits[
false]);
246 constexpr double tot_mean_narrow = 16.;
247 constexpr double tot_sigma_narrow = 2.;
248 constexpr double tot_mean_wide = 15.;
249 constexpr double tot_sigma_wide = 4.5;
253 if (CLHEP::RandFlat::shoot(rndmEngine)<0.75) {
254 thetot = CLHEP::RandGaussZiggurat::shoot(rndmEngine, tot_mean_narrow, tot_sigma_narrow);
256 thetot = CLHEP::RandGaussZiggurat::shoot(rndmEngine, tot_mean_wide, tot_sigma_wide);
259 return std::max(thetot, 0.);
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
ATLAS-specific HepMC functions.
const T * back() const
Access the last element in the collection as an rvalue.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
This is a "hash" representation of an Identifier.
Identifier identify() const
IdentifierHash measurementHash(const Identifier &measId) const override final
Constructs the identifier hash from the full measurement Identifier.
double distanceToEdge(const IdentifierHash &measHash, const Amg::Vector3D &posInStripPlane, const EdgeSide side) const
Returns the disance to the readout.
IdentifierHash layerHash(const Identifier &measId) const override final
const StripLayerPtr & sensorLayout(const IdentifierHash &measHash) const
Access to the StripLayer associated to a given measurement Hash.
const parameterBook & getParameters() const
double stripPitch() const
Distance between two adjacent strips.
bool insideTrapezoid(const Amg::Vector2D &extPos) const
Checks whether an external point is inside the trapezoidal area.
virtual int stripNumber(const Amg::Vector2D &pos) const
Calculates the number of the strip whose center is closest to the given point.
size_type module_hash_max() const
the maximum hash value
double getEfficiency(const Identifier &channelId, bool isInnerQ1=false) const
Returns the signal generation efficiency of the sTgc channel.
Identifier channelID(int stationName, int stationEta, int stationPhi, int doubletR, int doubletZ, int doubletPhi, int gasGap, int measuresPhi, int strip) const
int gasGap(const Identifier &id) const override
get the hashes
int channel(const Identifier &id) const override
int doubletPhi(const Identifier &id) const
int doubletZ(const Identifier &id) const
Helper class to provide type-safe access to aux data.
bool next() noexcept
Loads the hits from the next chamber.
void setIdentifier(const Identifier &id)
Sets the global ATLAS identifier.
Identifier identify() const
Returns the global ATLAS identifier of the SimHit.
ConstVectorMap< 3 > localPosition() const
Returns the local postion of the traversing particle.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
GeoModel::TransientConstSharedPtr< StripLayer > StripLayerPtr
This header ties the generic definitions in this package.
const std::string & stName(StIndex index)
convert StIndex into a string
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
MuonSimHit_v1 MuonSimHit
Defined the version of the MuonSimHit.
MuonSimHitContainer_v1 MuonSimHitContainer
Define the version of the pixel cluster container.