![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
5 #include "CLHEP/Random/RandGaussZiggurat.h"
6 #include "CLHEP/Random/RandFlat.h"
8 constexpr
double percentage(
unsigned int numerator,
unsigned int denom) {
21 return StatusCode::SUCCESS;
24 ATH_MSG_INFO(
"Tried to convert "<<m_allHits[0]<<
"/"<<m_allHits[1]<<
" hits. In, "
25 <<percentage(m_acceptedHits[0], m_allHits[0]) <<
"/"
26 <<percentage(m_acceptedHits[1], m_allHits[1]) <<
"% of the cases, the conversion was successful");
27 return StatusCode::SUCCESS;
39 CLHEP::HepRandomEngine* rndEngine)
const {
46 const unsigned int gasGap = idHelper.gasGap(hitId);
53 if (efficiencyMap && efficiencyMap->
getEfficiency(hitId) < CLHEP::RandFlat::shoot(rndEngine,0.,1.)){
54 ATH_MSG_VERBOSE(
"Simulated hit "<<xAOD::toEigen(timedHit->localPosition())
55 <<
m_idHelperSvc->toString(hitId) <<
" is rejected because of efficency modelling");
59 const Amg::Vector2D locSimHitPos{xAOD::toEigen(timedHit->localPosition()).block<2,1>(0,0)};
62 if (!design.insideTrapezoid(locSimHitPos)) {
64 <<
" is outside of the trapezoid "<<design);
67 const int wireGrpNum = design.stripNumber(locSimHitPos);
71 <<
" is not covered by any wire gang");
75 const double uncert = design.stripPitch() * design.numWiresInGroup(wireGrpNum) / std::sqrt(12);
76 const double locX = CLHEP::RandGaussZiggurat::shoot(rndEngine, locSimHitPos.x(), uncert);
80 const int prdWireNum = design.stripNumber(smearedPos);
83 if (design.insideTrapezoid(smearedPos)) {
85 <<
Amg::toString(smearedPos)<<
" "<<uncert<<
" is outside of "<<design);
96 <<
Amg::toString(locSimHitPos, 2)<<
" wire group number: "<<prdWireNum
101 ++m_acceptedHits[
false];
108 CLHEP::HepRandomEngine* rndEngine)
const {
110 const Identifier hitId = timedHit->identify();
114 const unsigned int gasGap = idHelper.gasGap(hitId);
122 if (efficiencyMap && efficiencyMap->
getEfficiency(hitId) < CLHEP::RandFlat::shoot(rndEngine,0.,1.)){
123 ATH_MSG_VERBOSE(
"Simulated hit "<<xAOD::toEigen(timedHit->localPosition())
124 <<
m_idHelperSvc->toString(hitId) <<
" is rejected because of efficency modelling");
135 const Amg::Vector2D locSimHitPos{(toPhiRot*xAOD::toEigen(timedHit->localPosition())).block<2,1>(0,0)};
139 if (!design.insideTrapezoid(locSimHitPos)) {
141 <<
" is outside of the trapezoid "<<std::endl<<design);
144 int stripNum = design.stripNumber(locSimHitPos);
155 const double stripPitch = std::abs(*Amg::intersect<2>(design.stripLeftBottom(stripNum), design.stripLeftEdge(stripNum),
156 locSimHitPos, stripNorm)) +
157 std::abs(*Amg::intersect<2>(design.stripRightBottom(stripNum), design.stripRightEdge(stripNum),
158 locSimHitPos, stripNorm));
160 const double uncert = stripPitch / std::sqrt(12);
161 const double locX = CLHEP::RandGaussZiggurat::shoot(rndEngine, locSimHitPos.x(), uncert);
165 const int digitStripNum = design.stripNumber(smearedPos);
167 if (digitStripNum < 0) {
168 if (design.insideTrapezoid(smearedPos)) {
170 <<
Amg::toString(smearedPos)<<
" "<<uncert<<
" is outside of "<<design);
182 <<
Amg::toString(locSimHitPos, 2)<<
" phi strip number: "<<digitStripNum
187 ++(m_acceptedHits[
true]);
204 for (
const TimedHit& simHit : hitsToDigit) {
206 if (std::abs(simHit->pdgId()) != 13)
continue;
209 bool digitized =
digitizeWireHit(ctx,simHit, efficiencyMap,*outColl, rndEngine);
210 digitized |=
digitizeStripHit(ctx, simHit, efficiencyMap,*outColl, rndEngine);
213 addSDO(simHit, sdoContainer);
218 return StatusCode::SUCCESS;
unsigned int numWireGangs(unsigned int gasGap) const
Returns the number of wire gangs for a given gasGap [1-3].
const WireGroupDesign & wireGangLayout(unsigned int gasGap) const
Returns access to the wire group design of the given gasGap [1-3] If the gap does not have a wires an...
Eigen::Matrix< double, 2, 1 > Vector2D
Amg::Transform3D globalToLocalTrans(const ActsGeometryContext &ctx) const
Transformations to translate between local <-> global coordinates.
#define ATH_MSG_VERBOSE(x)
bool empty() const
Test if the key is blank.
static IdentifierHash constructHash(unsigned int measCh, unsigned int gasGap, const bool isStrip)
Constructs the Hash out of the Identifier fields (channel, gasGap, isStrip)
@ u
Enums for curvilinear frames.
unsigned int numStrips(unsigned int gasGap) const
Returns the number of strips for a given gasGap [1-3].
const RadialStripDesign & stripLayout(unsigned int gasGap) const
Returns access to the strip design of the given gasGap [1-3] If the gap does not have strips an excep...
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
::StatusCode StatusCode
StatusCode definition for legacy code.
Eigen::Affine3d Transform3D
double getEfficiency(const Identifier &channelId, bool isInnerQ1=false) const
Returns the signal generation efficiency of the sTgc channel.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Include the GeoPrimitives which need to be put first.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
StatusCode initialize(bool used=true)
The CsvMuonSimHitDumper reads a Simulation Hit container for muons and dumps information to csv files...
#define ATH_MSG_WARNING(x)
const Amg::Transform3D & localToGlobalTrans(const ActsGeometryContext &ctx) const
Returns the local to global transformation into the ATLAS coordinate system.