|
ATLAS Offline Software
|
Go to the documentation of this file.
5 #include "CLHEP/Random/RandGaussZiggurat.h"
6 #include "CLHEP/Random/RandFlat.h"
9 constexpr
double percentage(
unsigned int numerator,
unsigned int denom) {
22 return StatusCode::SUCCESS;
25 ATH_MSG_INFO(
"Tried to convert "<<m_allHits[0]<<
"/"<<m_allHits[1]<<
" hits. In, "
26 <<percentage(m_acceptedHits[0], m_allHits[0]) <<
"/"
27 <<percentage(m_acceptedHits[1], m_allHits[1]) <<
"% of the cases, the conversion was successful");
28 return StatusCode::SUCCESS;
40 CLHEP::HepRandomEngine* rndEngine,
48 const unsigned int gasGap = idHelper.gasGap(hitId);
55 if (efficiencyMap && efficiencyMap->
getEfficiency(hitId) < CLHEP::RandFlat::shoot(rndEngine,0.,1.)){
56 ATH_MSG_VERBOSE(
"Simulated hit "<<xAOD::toEigen(timedHit->localPosition())
57 <<
m_idHelperSvc->toString(hitId) <<
" is rejected because of efficency modelling");
61 const Amg::Vector2D locSimHitPos{xAOD::toEigen(timedHit->localPosition()).block<2,1>(0,0)};
64 if (!design.insideTrapezoid(locSimHitPos)) {
66 <<
" is outside of the trapezoid "<<design);
69 const int wireGrpNum = design.stripNumber(locSimHitPos);
73 <<
" is not covered by any wire gang");
77 const double uncert = design.stripPitch() * design.numWiresInGroup(wireGrpNum) / std::sqrt(12);
78 const double locX = CLHEP::RandGaussZiggurat::shoot(rndEngine, locSimHitPos.x(), uncert);
82 const int prdWireNum = design.stripNumber(smearedPos);
85 if (design.insideTrapezoid(smearedPos)) {
87 <<
Amg::toString(smearedPos)<<
" "<<uncert<<
" is outside of "<<design);
103 <<
Amg::toString(locSimHitPos, 2)<<
" wire group number: "<<prdWireNum<<
", time: "<<
hitTime(timedHit)
106 ++m_acceptedHits[
false];
113 CLHEP::HepRandomEngine* rndEngine,
116 const Identifier hitId = timedHit->identify();
120 const unsigned int gasGap = idHelper.gasGap(hitId);
128 if (efficiencyMap && efficiencyMap->
getEfficiency(hitId) < CLHEP::RandFlat::shoot(rndEngine,0.,1.)){
129 ATH_MSG_VERBOSE(
"Simulated hit "<<xAOD::toEigen(timedHit->localPosition())
130 <<
m_idHelperSvc->toString(hitId) <<
" is rejected because of efficency modelling");
141 const Amg::Vector2D locSimHitPos{(toPhiRot*xAOD::toEigen(timedHit->localPosition())).block<2,1>(0,0)};
145 if (!design.insideTrapezoid(locSimHitPos)) {
147 <<
" is outside of the trapezoid "<<std::endl<<design);
150 int stripNum = design.stripNumber(locSimHitPos);
161 const double stripPitch = std::abs(*Amg::intersect<2>(design.stripLeftBottom(stripNum), design.stripLeftEdge(stripNum),
162 locSimHitPos, stripNorm)) +
163 std::abs(*Amg::intersect<2>(design.stripRightBottom(stripNum), design.stripRightEdge(stripNum),
164 locSimHitPos, stripNorm));
166 const double uncert = stripPitch / std::sqrt(12);
167 const double locX = CLHEP::RandGaussZiggurat::shoot(rndEngine, locSimHitPos.x(), uncert);
171 const int digitStripNum = design.stripNumber(smearedPos);
173 if (digitStripNum < 0) {
174 if (design.insideTrapezoid(smearedPos)) {
176 <<
Amg::toString(smearedPos)<<
" "<<uncert<<
" is outside of "<<design);
193 <<
Amg::toString(locSimHitPos, 2)<<
" phi strip number: "<<digitStripNum<<
", time: "<<
hitTime(timedHit)
198 ++(m_acceptedHits[
true]);
217 for (
const TimedHit& simHit : viewer) {
224 const bool digitizedEta =
digitizeWireHit(ctx,simHit, efficiencyMap,*outColl, rndEngine, deadTimes);
225 const bool digitizedPhi =
digitizeStripHit(ctx, simHit, efficiencyMap,*outColl, rndEngine, deadTimes);
230 }
else if (digitizedPhi) {
236 re->localToGlobalTrans(
getGeoCtx(ctx),
re->layerHash(simHit->identify()))};
242 }
while(viewer.next());
245 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...
void setIdentifier(const Identifier &id)
Sets the global ATLAS identifier.
Identifier identify() const
Returns the global ATLAS identifier of the SimHit.
Eigen::Matrix< double, 2, 1 > Vector2D
MeasVector< N > toStorage(const AmgVector(N)&amgVec)
Converts the double precision of the AmgVector into the floating point storage precision of the MeasV...
void setLocalPosition(MeasVector< 3 > vec)
Sets the local position of the traversing particle.
Amg::Transform3D globalToLocalTrans(const ActsGeometryContext &ctx) const
Transformations to translate between local <-> global coordinates.
#define ATH_MSG_VERBOSE(x)
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
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.
ConstVectorMap< 3 > localDirection() const
Returns the local direction of the traversing particle.
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.
void setLocalDirection(MeasVector< 3 > vec)
Sets the local direction of the traversing particle.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
StatusCode initialize(bool used=true)
This header ties the generic definitions in this package.
Identifier identify() const
#define ATH_MSG_WARNING(x)
const boost::regex re(r_e)
ConstVectorMap< 3 > localPosition() const
Returns the local postion of the traversing particle.
const Amg::Transform3D & localToGlobalTrans(const ActsGeometryContext &ctx) const
Returns the local to global transformation into the ATLAS coordinate system.
const T * at(size_type n) const
Access an element, as an rvalue.
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
size_type size() const noexcept
Returns the number of elements in the collection.