|  | ATLAS Offline Software
    | 
 
 
 
Go to the documentation of this file.
    6 #include "CLHEP/Random/RandGaussZiggurat.h" 
    7 #include "CLHEP/Random/RandFlat.h" 
   10     constexpr 
double percentage(
unsigned int numerator, 
unsigned int denom) {
 
   20         return StatusCode::SUCCESS;
 
   23         ATH_MSG_INFO(
"Tried to convert "<<m_allHits[0]<<
"/"<<m_allHits[1]<<
" hits. In, " 
   24                     <<percentage(m_acceptedHits[0], m_allHits[0]) <<
"/" 
   25                     <<percentage(m_acceptedHits[1], m_allHits[1]) <<
"% of the cases, the conversion was successful");
 
   26         return StatusCode::SUCCESS;
 
   38                                           CLHEP::HepRandomEngine* rndEngine,
 
   47         const Amg::Vector3D locSimHitPos{xAOD::toEigen(timedHit->localPosition())};
 
   53         if (efficiencyMap && efficiencyMap->
getEfficiency(hitId) < CLHEP::RandFlat::shoot(rndEngine,0.,1.)){
 
   55                               << 
m_idHelperSvc->toString(hitId) <<
" is rejected because of efficency modelling");
 
   62         if (!design.insideTrapezoid(locPos2D)) {
 
   64                         <<
" is outside of the trapezoid "<<design);
 
   67         const int wireGrpNum = design.stripNumber(locPos2D);
 
   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, locPos2D.x(), uncert);
 
   80         const int prdWireNum = design.stripNumber(smearedPos);
 
   83             if (design.insideTrapezoid(smearedPos)) {
 
   85                                 <<
Amg::toString(smearedPos)<<
" "<<uncert<<
" is outside of "<<design);
 
  101                       <<
Amg::toString(locSimHitPos, 2)<<
" wire group number: "<<prdWireNum<<
", time: "<<
hitTime(timedHit)
 
  104         ++m_acceptedHits[
false];    
 
  111                                            CLHEP::HepRandomEngine* rndEngine,
 
  114         const Identifier hitId = timedHit->identify();
 
  126         if (efficiencyMap && efficiencyMap->
getEfficiency(hitId) < CLHEP::RandFlat::shoot(rndEngine,0.,1.)){
 
  127                 ATH_MSG_VERBOSE(
"Simulated hit "<<xAOD::toEigen(timedHit->localPosition())
 
  128                               << 
m_idHelperSvc->toString(hitId) <<
" is rejected because of efficency modelling");
 
  133         const Amg::Vector2D locSimHitPos{readOutEle->
sensorLayout(measHash)->to2D(xAOD::toEigen(timedHit->localPosition()),
true)};
 
  137         if (!design.insideTrapezoid(locSimHitPos)) {
 
  139                         <<
" is outside of the trapezoid "<<std::endl<<design);
 
  142         int stripNum = design.stripNumber(locSimHitPos);
 
  153         const double stripPitch = std::abs(*Amg::intersect<2>(design.stripLeftBottom(stripNum), design.stripLeftEdge(stripNum),
 
  154                                                               locSimHitPos, stripNorm)) +
 
  155                                   std::abs(*Amg::intersect<2>(design.stripRightBottom(stripNum), design.stripRightEdge(stripNum),
 
  156                                                               locSimHitPos, stripNorm));
 
  158         const double uncert = stripPitch / std::sqrt(12);
 
  159         const double locX = CLHEP::RandGaussZiggurat::shoot(rndEngine, locSimHitPos.x(), uncert);
 
  163         const int digitStripNum = design.stripNumber(smearedPos);
 
  165         if (digitStripNum < 0) {
 
  166             if (design.insideTrapezoid(smearedPos)) {
 
  168                                 <<
Amg::toString(smearedPos)<<
" "<<uncert<<
" is outside of "<<design);
 
  185                         <<
Amg::toString(locSimHitPos, 2)<<
" phi strip number: "<<digitStripNum<<
", time: "<<
hitTime(timedHit)
 
  190         ++(m_acceptedHits[
true]);
 
  209             for (
const TimedHit& simHit : viewer) {
 
  216                 const bool digitizedEta = 
digitizeWireHit(ctx,simHit, efficiencyMap,*outColl, rndEngine, deadTimes);
 
  217                 const bool digitizedPhi = 
digitizeStripHit(ctx, simHit, efficiencyMap,*outColl, rndEngine, deadTimes);
 
  222                 } 
else if (digitizedPhi) {
 
  228                                                     re->localToGlobalTrans(
getGeoCtx(ctx), 
re->layerHash(simHit->identify()))};
 
  234         } 
while(viewer.next());
 
  237         return StatusCode::SUCCESS;
 
  
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
const WireGroupDesign & wireGangLayout(const IdentifierHash &layHash) const
Returns access to the wire group design of the given gasGap [1-3] If the gap does not have a wires an...
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.
#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.
@ u
Enums for curvilinear frames.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
::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.
static unsigned gasGapNumber(const IdentifierHash &measHash)
Unpacks the gas gap number from the measurement hash.
ConstVectorMap< 3 > localDirection() const
Returns the local direction of the traversing particle.
IdentifierHash measurementHash(const Identifier &measId) const override final
Constructs the identifier hash from the full measurement Identifier.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
void setLocalDirection(MeasVector< 3 > vec)
Sets the local direction of the traversing particle.
const StripLayerPtr & sensorLayout(const IdentifierHash &hash) const
Returns the pointer to the strip layer associated with the gas gap.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
StatusCode initialize(bool used=true)
Eigen::Matrix< double, 3, 1 > Vector3D
This header ties the generic definitions in this package.
Identifier identify() const
unsigned numStrips(const IdentifierHash &layHash) const
Returns the number of strips for a given gasGap [1-3].
#define ATH_MSG_WARNING(x)
unsigned numWireGangs(const IdentifierHash &layHash) const
Returns the number of wire gangs for a given gasGap [1-3].
const boost::regex re(r_e)
ConstVectorMap< 3 > localPosition() const
Returns the local postion of the traversing particle.
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.
const RadialStripDesign & stripLayout(const IdentifierHash &layHash) const
Returns access to the strip design of the given gasGap [1-3] If the gap does not have strips an excep...