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);
24 return StatusCode::SUCCESS;
27 ATH_MSG_INFO(
"Tried to convert "<<m_allHits[0]<<
"/"<<m_allHits[1]<<
" hits. In, "
28 <<percentage(m_acceptedHits[0], m_allHits[0]) <<
"/"
29 <<percentage(m_acceptedHits[1], m_allHits[1]) <<
"% of the cases, the conversion was successful");
30 return StatusCode::SUCCESS;
46 for (
const TimedHit& simHit : viewer) {
57 const bool digitizedEta =
digitizeHit(simHit,
false, efficiencyMap, *digiColl, rndEngine, deadTimes);
59 const bool digitizedPhi =
digitizeHit(simHit,
true, efficiencyMap, *digiColl, rndEngine, deadTimes);
61 if (digitizedEta || digitizedPhi) {
65 }
else if (
digitizeHitBI(simHit, efficiencyMap, *digiColl, rndEngine, deadTimes)) {
70 }
while (viewer.
next());
73 return StatusCode::SUCCESS;
76 const bool measuresPhi,
79 CLHEP::HepRandomEngine* rndEngine,
82 ++(m_allHits[measuresPhi]);
101 const double uncert = design.
stripPitch() / std::sqrt(12.);
103 locHitPos[measuresPhi] = CLHEP::RandGaussZiggurat::shoot(rndEngine, locHitPos[measuresPhi], uncert);
105 const Amg::Vector2D locPos2D = layerDesign->to2D(locHitPos, measuresPhi);
108 <<
" is outside of the trapezoid bounds for "<<
m_idHelperSvc->toString(layerId));
114 <<
" cannot trigger any signal in a strip for " <<
m_idHelperSvc->toString(layerId)
115 <<std::endl<<design);
122 idHelper.
gasGap(gasGapId),
132 if (effiMap && effiMap->
getEfficiency(digitId) < CLHEP::RandFlat::shoot(rndEngine,0.,1.)) {
143 const double digitTime = CLHEP::RandGaussZiggurat::shoot(rndEngine, signalTime,
m_stripTimeResolution);
145 <<
", recorded time: "<<digitTime);
147 ++(m_acceptedHits[measuresPhi]);
153 CLHEP::HepRandomEngine* rndEngine,
156 ++(m_allHits[
false]);
165 const double uncert = design.
stripPitch() / std::sqrt(12.);
166 const double smearedX = CLHEP::RandGaussZiggurat::shoot(rndEngine, locPos.x(), uncert);
175 const double smearedTimeL = CLHEP::RandGaussZiggurat::shoot(rndEngine, propagationTimeL,
m_stripTimeResolution);
176 const double smearedTimeR = CLHEP::RandGaussZiggurat::shoot(rndEngine, propagationTimeR,
m_stripTimeResolution);
178 const double smearedDeltaT = smearedTimeR - smearedTimeL;
204 <<
m_idHelperSvc->toStringGasGap(gasGapId) <<std::endl<<design);
213 idHelper.
gasGap(gasGapId),
217 <<
", strip: "<<
strip);
227 const bool effiSignal1 = !effiMap || effiMap->
getEfficiency(gasGapId) >= CLHEP::RandFlat::shoot(rndEngine,0., 1.);
228 const bool effiSignal2 = !effiMap || effiMap->
getEfficiency(gasGapId) >= CLHEP::RandFlat::shoot(rndEngine,0., 1.);
235 if (effiSignal1 || effiSignal2) {
236 ++(m_acceptedHits[
false]);
244 constexpr double tot_mean_narrow = 16.;
245 constexpr double tot_sigma_narrow = 2.;
246 constexpr double tot_mean_wide = 15.;
247 constexpr double tot_sigma_wide = 4.5;
251 if (CLHEP::RandFlat::shoot(rndmEngine)<0.75) {
252 thetot = CLHEP::RandGaussZiggurat::shoot(rndmEngine, tot_mean_narrow, tot_sigma_narrow);
254 thetot = CLHEP::RandGaussZiggurat::shoot(rndmEngine, tot_mean_wide, tot_sigma_wide);
257 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 * at(size_type n) const
Access an element, as an rvalue.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
size_type size() const noexcept
Returns the number of elements in 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 doubletPhi(const Identifier &id) const
int doubletZ(const Identifier &id) const
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.