ATLAS Offline Software
Loading...
Searching...
No Matches
MuonR4::SpacePointMakerAlg Class Reference

Data preparation algorithm that transforms the uncalibrated measurements into muon space points. More...

#include <SpacePointMakerAlg.h>

Inheritance diagram for MuonR4::SpacePointMakerAlg:

Classes

class  SpacePointStatistics
 Helper class to keep track of how many eta+phi, eta and phi only space points are built in various detector regions. More...
struct  SpacePointsPerChamber
 : Helper struct to collect the space point per muon chamber, which are later sorted into the space point buckets. More...

Public Types

template<Acts::PointerConcept Prd_t>
using PrdVec_t = std::vector<Prd_t>
template<typename T>
using EtaPhi2DHits = std::array<PrdVec_t<T>, 3>
template<typename T>
using EtaPhi2DHitsVec = std::vector<EtaPhi2DHits<T>>

Public Member Functions

 ~SpacePointMakerAlg ()=default
StatusCode execute (const EventContext &ctx) const override
StatusCode initialize () override
StatusCode finalize () override
 ########################################## SpacePointMakerAlg #########################################
template<>
bool passOccupancy2D (const PrdVec_t< const xAOD::TgcStrip * > &etaHits, const PrdVec_t< const xAOD::TgcStrip * > &phiHits) const
template<>
bool passOccupancy2D (const PrdVec_t< const xAOD::RpcMeasurement * > &etaHits, const PrdVec_t< const xAOD::RpcMeasurement * > &phiHits) const
template<>
bool passOccupancy2D (const PrdVec_t< const xAOD::MMCluster * > &, const PrdVec_t< const xAOD::MMCluster * > &) const
template<>
StatusCode loadContainerAndSort (const EventContext &ctx, const SG::ReadHandleKey< xAOD::sTgcMeasContainer > &key, PreSortedSpacePointMap &fillContainer) const
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual unsigned int cardinality () const override
 Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
virtual void setFilterPassed (bool state, const EventContext &ctx) const
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

using PreSortedSpacePointMap = std::unordered_map<const MuonGMR4::SpectrometerSector*, SpacePointsPerChamber>
 Container abrivation of the presorted space point container per MuonChambers.
using SpacePointBucketVec = std::vector<SpacePointBucket>
 Abrivation of a MuonSapcePoint bucket vector.
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

template<typename ContType>
StatusCode loadContainerAndSort (const EventContext &ctx, const SG::ReadHandleKey< ContType > &key, PreSortedSpacePointMap &fillContainer) const
 Retrieve an uncalibrated measurement container <ContType> and fill the hits into the presorted space point map.
template<typename PrdType>
bool passOccupancy2D (const PrdVec_t< PrdType > &etaHits, const PrdVec_t< PrdType > &phiHits) const
 : Check whether the occupancy cuts of hits in a gasGap are surpassed.
template<typename ContType>
EtaPhi2DHitsVec< typename ContType::const_value_type > splitHitsPerGasGap (xAOD::ChamberViewer< ContType > &viewer) const
 Splits the chamber hits of the viewer per gas gap.
template<typename PrdType>
void fillUncombinedSpacePoints (const ActsTrk::GeometryContext &gctx, const Amg::Transform3D &sectorTrans, const PrdVec_t< const PrdType * > &prdsToFill, std::vector< SpacePoint > &outColl) const
 Transform the uncombined space prd measurements to space points.
void distributePointsAndStore (SpacePointsPerChamber &&hitsPerChamber, SpacePointContainer &finalContainer) const
 Distribute the premade spacepoints per chamber into their individual SpacePoint buckets.
void distributePrimaryPoints (std::vector< SpacePoint > &&spacePoints, SpacePointBucketVec &splittedContainer) const
 Distributes the vector of primary eta or eta + phi space points and fills them into the buckets.
void distributePhiPoints (std::vector< SpacePoint > &&spacePoints, SpacePointBucketVec &splittedContainer) const
 Distributs the vector phi space points into the buckets.
bool splitBucket (const SpacePoint &spacePoint, const double firstSpPos, const SpacePointBucketVec &sortedPoints) const
 Returns whether the space point is beyond the bucket boundary.
void newBucket (const SpacePoint &refSp, SpacePointBucketVec &sortedPoints) const
 Closes the current processed bucket and creates a new one.
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadHandleKey< xAOD::MdtDriftCircleContainerm_mdtKey
SG::ReadHandleKey< xAOD::RpcMeasurementContainerm_rpcKey
SG::ReadHandleKey< xAOD::TgcStripContainerm_tgcKey
SG::ReadHandleKey< xAOD::MMClusterContainerm_mmKey
SG::ReadHandleKey< xAOD::sTgcMeasContainerm_stgcKey {this, "sTgcKey", "xAODsTgcMeasurements"}
SG::ReadHandleKey< ActsTrk::GeometryContextm_geoCtxKey {this, "AlignmentKey", "ActsAlignment", "cond handle key"}
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "IdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
SG::WriteHandleKey< SpacePointContainerm_writeKey {this, "WriteKey", "MuonSpacePoints"}
Gaudi::Property< double > m_spacePointWindow
Gaudi::Property< double > m_maxBucketLength
Gaudi::Property< double > m_spacePointOverlap
Gaudi::Property< bool > m_doStat
Gaudi::Property< unsigned > m_capacityBucket {this,"CapacityBucket" , 50}
std::unique_ptr< SpacePointStatistics > m_statCounter ATLAS_THREAD_SAFE {}
Gaudi::Property< double > m_maxOccRpcEta
Gaudi::Property< double > m_maxOccRpcPhi
Gaudi::Property< double > m_maxOccTgcEta
Gaudi::Property< double > m_maxOccTgcPhi
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Data preparation algorithm that transforms the uncalibrated measurements into muon space points.

Mdt, Mm measurements are directly transformed. The remaining three technologies provide eta & phi measurements, each 1D. The measurements are sorted by gas gap and if the occupancy in the gas gap is low enough, then each eta measurement is combined with each phi measurement to a 2D space point. Otherwise, single 1D space points are produced. Space points in the same MS layer & phi-sector are expressed in the common sector frame.

Definition at line 34 of file SpacePointMakerAlg.h.

Member Typedef Documentation

◆ EtaPhi2DHits

template<typename T>
using MuonR4::SpacePointMakerAlg::EtaPhi2DHits = std::array<PrdVec_t<T>, 3>

Definition at line 39 of file SpacePointMakerAlg.h.

◆ EtaPhi2DHitsVec

template<typename T>
using MuonR4::SpacePointMakerAlg::EtaPhi2DHitsVec = std::vector<EtaPhi2DHits<T>>

Definition at line 41 of file SpacePointMakerAlg.h.

◆ PrdVec_t

template<Acts::PointerConcept Prd_t>
using MuonR4::SpacePointMakerAlg::PrdVec_t = std::vector<Prd_t>

Definition at line 37 of file SpacePointMakerAlg.h.

◆ PreSortedSpacePointMap

Container abrivation of the presorted space point container per MuonChambers.

Definition at line 106 of file SpacePointMakerAlg.h.

◆ SpacePointBucketVec

Abrivation of a MuonSapcePoint bucket vector.

Definition at line 109 of file SpacePointMakerAlg.h.

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ ~SpacePointMakerAlg()

MuonR4::SpacePointMakerAlg::~SpacePointMakerAlg ( )
default

Member Function Documentation

◆ cardinality()

unsigned int AthCommonReentrantAlgorithm< Gaudi::Algorithm >::cardinality ( ) const
overridevirtualinherited

Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.

Override this to return 0 for reentrant algorithms.

Definition at line 75 of file AthCommonReentrantAlgorithm.cxx.

62{
63 return 0;
64}

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ distributePhiPoints()

void MuonR4::SpacePointMakerAlg::distributePhiPoints ( std::vector< SpacePoint > && spacePoints,
SpacePointBucketVec & splittedContainer ) const
private

Distributs the vector phi space points into the buckets.

In contrast to the primary distribution no new buckets are created and the points are distributed into the existing ones instead.

Parameters
spacePointVecotr of phi space points to sort into the buckets
splittedContainerOutput vector containing all defined bucket

If maxY is smaller than the lower cov boundary or minY is bigger than the other boundary, there's definetely no overlap

Definition at line 640 of file SpacePointMakerAlg.cxx.

641 {
642 for (SpacePoint& sp : spacePoints) {
643 auto phiPoint = std::make_shared<SpacePoint>(std::move(sp));
644 const double dY = std::sqrt(phiPoint->covariance()[Acts::toUnderlying(CovIdx::etaCov)]);
645 const double minY = phiPoint->localPosition().y() - dY;
646 const double maxY = phiPoint->localPosition().y() + dY;
647 for (SpacePointBucket& bucket : splittedContainer){
650 if (! (maxY < bucket.coveredMin() || bucket.coveredMax() < minY) ) {
651 bucket.emplace_back(phiPoint);
652 }
653 }
654 }
655}
static Double_t sp

◆ distributePointsAndStore()

void MuonR4::SpacePointMakerAlg::distributePointsAndStore ( SpacePointsPerChamber && hitsPerChamber,
SpacePointContainer & finalContainer ) const
private

Distribute the premade spacepoints per chamber into their individual SpacePoint buckets.

A new bucket is created everytime if the hit to fill is along the z-axis farther away from the first point in the bucket than the <spacePointWindowSize>. Hit in the previous bucket which are <spacePointOverlap> away from the first hit in the new bucket are also mirrored. The bucket formation starts with the eta Muon space points and then consumes the phi hits.

Parameters
ctxEvent context of the current event
hitsPerChamberList of all premade space points which have to be sorted
finalContainerOutput SpacePoint bucket container.

Definition at line 608 of file SpacePointMakerAlg.cxx.

609 {
610 SpacePointBucketVec splittedHits{};
611 splittedHits.emplace_back();
612 if (m_statCounter){
613 m_statCounter->addToStat(hitsPerChamber.etaHits);
614 m_statCounter->addToStat(hitsPerChamber.phiHits);
615
616 }
617 distributePrimaryPoints(std::move(hitsPerChamber.etaHits), splittedHits);
618 splittedHits.erase(std::remove_if(splittedHits.begin(), splittedHits.end(),
619 [](const SpacePointBucket& bucket) {
620 return bucket.size() <= 1;
621 }), splittedHits.end());
622 distributePhiPoints(std::move(hitsPerChamber.phiHits), splittedHits);
623
624 for (SpacePointBucket& bucket : splittedHits) {
625
626 std::ranges::sort(bucket, MuonR4::SpacePointPerLayerSorter{});
627
628 if (msgLvl(MSG::VERBOSE)){
629 std::stringstream spStr{};
630 for (const std::shared_ptr<SpacePoint>& sp : bucket){
631 spStr<<"SpacePoint: PrimaryMeas: " <<(*sp)<<std::endl;
632 }
633 ATH_MSG_VERBOSE("Created a bucket, printing all spacepoints..."<<std::endl<<spStr.str());
634 }
635 bucket.populateChamberLocations();
636 finalContainer.push_back(std::make_unique<SpacePointBucket>(std::move(bucket)));
637 }
638
639}
#define ATH_MSG_VERBOSE(x)
bool msgLvl(const MSG::Level lvl) const
void distributePhiPoints(std::vector< SpacePoint > &&spacePoints, SpacePointBucketVec &splittedContainer) const
Distributs the vector phi space points into the buckets.
std::vector< SpacePointBucket > SpacePointBucketVec
Abrivation of a MuonSapcePoint bucket vector.
void distributePrimaryPoints(std::vector< SpacePoint > &&spacePoints, SpacePointBucketVec &splittedContainer) const
Distributes the vector of primary eta or eta + phi space points and fills them into the buckets.
DataModel_detail::iterator< DVL > remove_if(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, Predicate pred)
Specialization of remove_if for DataVector/List.

◆ distributePrimaryPoints()

void MuonR4::SpacePointMakerAlg::distributePrimaryPoints ( std::vector< SpacePoint > && spacePoints,
SpacePointBucketVec & splittedContainer ) const
private

Distributes the vector of primary eta or eta + phi space points and fills them into the buckets.

The buckets are dynamically created based on the distance of the new space point to sort to the previous or the first space point in the bucket.

Parameters
spacePointsVector of space points to sort into the buckets
splittedContainerOutput vector containing all defined bucket

Order the space points by local chamber y which is along the tube-plane.

Definition at line 695 of file SpacePointMakerAlg.cxx.

696 {
697
698 if (spacePoints.empty()) return;
699
701 std::ranges::sort(spacePoints,
702 [] (const SpacePoint& a, const SpacePoint& b) {
703 return a.localPosition().y() < b.localPosition().y();
704 });
705
706 double firstPointPos = spacePoints.front().localPosition().y();
707
708 for (SpacePoint& toSort : spacePoints) {
709 ATH_MSG_VERBOSE("Add new primary space point "<<toSort);
710
711 if (splitBucket(toSort, firstPointPos, splittedHits)){
712 newBucket(toSort, splittedHits);
713 firstPointPos = splittedHits.back().empty() ? toSort.localPosition().y() : splittedHits.back().front()->localPosition().y();
714 ATH_MSG_VERBOSE("New bucket: id " << splittedHits.back().bucketId() << " Coverage: " << firstPointPos);
715 }
716 std::shared_ptr<SpacePoint> spacePoint = std::make_shared<SpacePoint>(std::move(toSort));
717 splittedHits.back().emplace_back(spacePoint);
718 }
719 SpacePointBucket& lastBucket{splittedHits.back()};
720 lastBucket.setCoveredRange(lastBucket.front()->localPosition().y(),
721 lastBucket.back()->localPosition().y());
722}
static Double_t a
void newBucket(const SpacePoint &refSp, SpacePointBucketVec &sortedPoints) const
Closes the current processed bucket and creates a new one.
bool splitBucket(const SpacePoint &spacePoint, const double firstSpPos, const SpacePointBucketVec &sortedPoints) const
Returns whether the space point is beyond the bucket boundary.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode MuonR4::SpacePointMakerAlg::execute ( const EventContext & ctx) const
override

Definition at line 589 of file SpacePointMakerAlg.cxx.

589 {
590 PreSortedSpacePointMap preSortedContainer{};
591 ATH_CHECK(loadContainerAndSort(ctx, m_mdtKey, preSortedContainer));
592 ATH_CHECK(loadContainerAndSort(ctx, m_rpcKey, preSortedContainer));
593 ATH_CHECK(loadContainerAndSort(ctx, m_tgcKey, preSortedContainer));
594 ATH_CHECK(loadContainerAndSort(ctx, m_mmKey, preSortedContainer));
595 ATH_CHECK(loadContainerAndSort(ctx, m_stgcKey, preSortedContainer));
596 std::unique_ptr<SpacePointContainer> outContainer = std::make_unique<SpacePointContainer>();
597
598 for (auto &[chamber, hitsPerChamber] : preSortedContainer){
599 ATH_MSG_DEBUG("Fill space points for chamber "<<chamber->identString() << " with "<<hitsPerChamber.etaHits.size()
600 <<" primary and "<<hitsPerChamber.phiHits.size()<<" phi space points.");
601 distributePointsAndStore(std::move(hitsPerChamber), *outContainer);
602 }
603 SG::WriteHandle writeHandle{m_writeKey, ctx};
604 ATH_CHECK(writeHandle.record(std::move(outContainer)));
605 return StatusCode::SUCCESS;
606}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
SG::ReadHandleKey< xAOD::TgcStripContainer > m_tgcKey
SG::ReadHandleKey< xAOD::MMClusterContainer > m_mmKey
SG::WriteHandleKey< SpacePointContainer > m_writeKey
StatusCode loadContainerAndSort(const EventContext &ctx, const SG::ReadHandleKey< ContType > &key, PreSortedSpacePointMap &fillContainer) const
Retrieve an uncalibrated measurement container <ContType> and fill the hits into the presorted space ...
SG::ReadHandleKey< xAOD::RpcMeasurementContainer > m_rpcKey
SG::ReadHandleKey< xAOD::sTgcMeasContainer > m_stgcKey
void distributePointsAndStore(SpacePointsPerChamber &&hitsPerChamber, SpacePointContainer &finalContainer) const
Distribute the premade spacepoints per chamber into their individual SpacePoint buckets.
std::unordered_map< const MuonGMR4::SpectrometerSector *, SpacePointsPerChamber > PreSortedSpacePointMap
Container abrivation of the presorted space point container per MuonChambers.
SG::ReadHandleKey< xAOD::MdtDriftCircleContainer > m_mdtKey
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthCommonReentrantAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 94 of file AthCommonReentrantAlgorithm.cxx.

88{
89 // If we didn't find any symlinks to add, just return the collection
90 // from the base class. Otherwise, return the extended collection.
91 if (!m_extendedExtraObjects.empty()) {
93 }
95}
An algorithm that can be simultaneously executed in multiple threads.

◆ fillUncombinedSpacePoints()

template<typename PrdType>
void MuonR4::SpacePointMakerAlg::fillUncombinedSpacePoints ( const ActsTrk::GeometryContext & gctx,
const Amg::Transform3D & sectorTrans,
const PrdVec_t< const PrdType * > & prdsToFill,
std::vector< SpacePoint > & outColl ) const
private

Transform the uncombined space prd measurements to space points.

Parameters
gctxGeometry context to fetch the transformation of the measurements
sectorTransTransformation to go from the global -> sector frame
prdsToFillList of uncombined measurements to transform
outCollReference to the mutable output collection to which the 1D space points are appended.

Local coordinate system aligned such that the strips point along local y

The measurement is a phi measurement

Definition at line 202 of file SpacePointMakerAlg.cxx.

205 {
206 if (prdsToFill.empty()) {
207 return;
208 }
209 const PrdType* refMeas = prdsToFill.front();
210 bool allSpArePhi{false};
211
212 const Amg::Transform3D toSectorTrans = toChamberTransform(gctx, sectorTrans, *refMeas);
214 Amg::Vector3D sensorDir{Amg::Vector3D::Zero()}, toNextSen{Amg::Vector3D::Zero()};
216 if constexpr(std::is_same_v<PrdType, xAOD::RpcMeasurement> ||
217 std::is_same_v<PrdType, xAOD::TgcStrip>) {
218 allSpArePhi = refMeas->measuresPhi();
219 const auto& stripLayout = refMeas->readoutElement()->sensorLayout(refMeas->layerHash());
220 const auto& design = stripLayout->design(allSpArePhi);
221 sensorDir = toSectorTrans.linear() * stripLayout->to3D(design.stripDir(), allSpArePhi);
222 toNextSen = toSectorTrans.linear() * stripLayout->to3D(design.stripNormal(), allSpArePhi);
223 ATH_MSG_VERBOSE("Fill space points for "<<m_idHelperSvc->toString(refMeas->identify())
224 <<" -> sensor: "<<Amg::toString(sensorDir)<<", "<<Amg::toString(toNextSen));
225 } else if constexpr (std::is_same_v<PrdType, xAOD::sTgcMeasurement>){
226 allSpArePhi = refMeas->channelType() == xAOD::sTgcMeasurement::sTgcChannelTypes::Wire;
227 const auto& stripLayout = refMeas->readoutElement()->stripLayer(refMeas->measurementHash());
228 const auto& design = stripLayout.design(allSpArePhi);
229 sensorDir = toSectorTrans.linear() * stripLayout.to3D(design.stripDir(), allSpArePhi);
230 toNextSen = toSectorTrans.linear() * stripLayout.to3D(design.stripNormal(), allSpArePhi);
231 } else {
232 sensorDir = toSectorTrans.linear().col(Amg::y);
233 toNextSen = toSectorTrans.linear().col(Amg::x);
234 }
235 outColl.reserve(outColl.size() + prdsToFill.size());
236 for (const PrdType* prd: prdsToFill) {
237 SpacePoint& newSp = outColl.emplace_back(prd);
238 if constexpr (std::is_same_v<PrdType, xAOD::TgcStrip>) {
239 if (allSpArePhi) {
240 const auto& stripLayout = refMeas->readoutElement()->sensorLayout(refMeas->layerHash());
241 const auto& radialDesign = static_cast<const MuonGMR4::RadialStripDesign&>(stripLayout->design(allSpArePhi));
242 toNextSen = toSectorTrans.linear() * stripLayout->to3D(radialDesign.stripNormal(prd->channelNumber()), allSpArePhi);
243 sensorDir = toSectorTrans.linear() * stripLayout->to3D(radialDesign.stripDir(prd->channelNumber()), allSpArePhi);
244 }
245 }
246 newSp.setPosition(toSectorTrans * prd->localMeasurementPos());
247 newSp.setDirection(sensorDir, toNextSen);
248 auto cov = Acts::filledArray<double,3>(0.);
249 if (prd->numDimensions() == 2) {
250 cov[Acts::toUnderlying(CovIdx::etaCov)] = prd->template localCovariance<2>()(0,0);
251 cov[Acts::toUnderlying(CovIdx::phiCov)] = prd->template localCovariance<2>()(1,1);
252 } else {
254 auto covIdx{Acts::toUnderlying(CovIdx::etaCov)},
255 lenIdx{Acts::toUnderlying(CovIdx::phiCov)};
256 if (!newSp.measuresEta()) {
257 std::swap(covIdx, lenIdx);
258 }
259 cov[covIdx] = prd->template localCovariance<1>()[0];
260 cov[lenIdx] = Acts::square(sensorHalfLength(*prd));
261 }
262 newSp.setCovariance(std::move(cov));
263 }
264}
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
void swap(ElementLinkVector< DOBJ > &lhs, ElementLinkVector< DOBJ > &rhs)

◆ filterPassed()

virtual bool AthCommonReentrantAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Definition at line 96 of file AthCommonReentrantAlgorithm.h.

96 {
97 return execState( ctx ).filterPassed();
98 }
virtual bool filterPassed(const EventContext &ctx) const

◆ finalize()

StatusCode MuonR4::SpacePointMakerAlg::finalize ( )
override

########################################## SpacePointMakerAlg #########################################

Definition at line 152 of file SpacePointMakerAlg.cxx.

152 {
153 if (m_statCounter) {
154 m_statCounter->dumpStatisics(msgStream());
155 }
156 return StatusCode::SUCCESS;
157}

◆ initialize()

StatusCode MuonR4::SpacePointMakerAlg::initialize ( )
override

Definition at line 158 of file SpacePointMakerAlg.cxx.

158 {
159 ATH_CHECK(m_geoCtxKey.initialize());
160 ATH_CHECK(m_mdtKey.initialize(!m_mdtKey.empty()));
161 ATH_CHECK(m_rpcKey.initialize(!m_rpcKey.empty()));
162 ATH_CHECK(m_tgcKey.initialize(!m_tgcKey.empty()));
163 ATH_CHECK(m_mmKey.initialize(!m_mmKey.empty()));
164 ATH_CHECK(m_stgcKey.initialize(!m_stgcKey.empty()));
165 ATH_CHECK(m_idHelperSvc.retrieve());
166 ATH_CHECK(m_writeKey.initialize());
167 if (m_doStat) {
168 m_statCounter = std::make_unique<SpacePointStatistics>(m_idHelperSvc.get());
169 }
170 return StatusCode::SUCCESS;
171}
Gaudi::Property< bool > m_doStat
SG::ReadHandleKey< ActsTrk::GeometryContext > m_geoCtxKey

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isClonable()

◆ loadContainerAndSort() [1/2]

template<typename ContType>
StatusCode MuonR4::SpacePointMakerAlg::loadContainerAndSort ( const EventContext & ctx,
const SG::ReadHandleKey< ContType > & key,
PreSortedSpacePointMap & fillContainer ) const
private

Retrieve an uncalibrated measurement container <ContType> and fill the hits into the presorted space point map.

Per associated MuonChamber, hits from Tgc, Rpc, sTgcs are grouped by their gasGap location and then divided into eta & phi measurements. If both are found, each eta measurement is combined with phi measurement into a SpacePoint. In any other case, the measurements are just transformed into a SpacePoint.

Parameters
ctxEvent context of the current event
keyReadHandleKey to access the container of data type <ContType>
fillContainerGlobal container into which all space points are filled.

Loop over the chamber hits to split the hits per gasGap

Fill in the 2D measurements BIL Rpc

Only one dimensional space points can be built

Simple combination by taking the cross-product

There's no valid combination with another phi hit

Tgc measurements with different bunch crossing tags cannot be combined

Definition at line 306 of file SpacePointMakerAlg.cxx.

308 {
309 const ContType* measurementCont{nullptr};
310 ATH_CHECK(SG::get(measurementCont, key, ctx));
311 if (!measurementCont || measurementCont->empty()){
312 ATH_MSG_DEBUG("nothing to do");
313 return StatusCode::SUCCESS;
314 }
315 const ActsTrk::GeometryContext* gctx{nullptr};
316 ATH_CHECK(SG::get(gctx, m_geoCtxKey, ctx));
317
318 xAOD::ChamberViewer viewer{*measurementCont};
319
320 do {
321 SpacePointsPerChamber& pointsInChamb = fillContainer[viewer.at(0)->readoutElement()->msSector()];
322 const Amg::Transform3D sectorTrans = viewer.at(0)->readoutElement()->msSector()->globalToLocalTransform(*gctx);
323 ATH_MSG_DEBUG("Fill space points for chamber "<<m_idHelperSvc->toStringDetEl(viewer.at(0)->identify()));
324 if constexpr( std::is_same_v<ContType, xAOD::MdtDriftCircleContainer>) {
325 pointsInChamb.etaHits.reserve(pointsInChamb.etaHits.capacity() + viewer.size());
326 for (const auto& prd : viewer) {
327 Amg::Transform3D toChamberTrans{toChamberTransform(*gctx, sectorTrans, *prd)};
328 SpacePoint& sp{pointsInChamb.etaHits.emplace_back(prd)};
329 sp.setPosition(toChamberTrans*prd->localMeasurementPos());
330 sp.setDirection(toChamberTrans.linear().col(Amg::z),
331 toChamberTrans.linear().col(Amg::y));
332 std::array<double, 3> cov{Acts::filledArray<double,3>(0.)};
333 cov[Acts::toUnderlying(CovIdx::etaCov)] = prd->driftRadiusCov();
334 cov[Acts::toUnderlying(CovIdx::phiCov)] = Acts::square(sensorHalfLength(*prd));
335 if (ATH_UNLIKELY(prd->numDimensions() == 2)){
336 cov[Acts::toUnderlying(CovIdx::phiCov)] = static_cast<const xAOD::MdtTwinDriftCircle*>(prd)->posAlongWireCov();
337 }
338 sp.setCovariance(std::move(cov));
339 }
340 } else {
342 for (auto& [etaHits, phiHits, two2DHits] : splitHitsPerGasGap(viewer)) {
343 ATH_MSG_DEBUG("Found "<<etaHits.size()<<"/"<<phiHits.size()
344 <<" 1D and "<<two2DHits.size()<<" 2D hits in chamber "
345 <<m_idHelperSvc->toStringDetEl(viewer.at(0)->identify()));
347 fillUncombinedSpacePoints(*gctx, sectorTrans, two2DHits, pointsInChamb.etaHits);
349 // Check if we do not have 2D occupancy (missing phi or eta hits)
350 if (!passOccupancy2D(etaHits, phiHits)) {
351 fillUncombinedSpacePoints(*gctx, sectorTrans, etaHits, pointsInChamb.etaHits);
352 fillUncombinedSpacePoints(*gctx, sectorTrans, phiHits, pointsInChamb.phiHits);
353 continue;
354 }
355
356 std::vector<std::shared_ptr<unsigned>> etaCounts{matchCountVec(etaHits.size())},
357 phiCounts{matchCountVec(phiHits.size())};
358
359 pointsInChamb.etaHits.reserve(pointsInChamb.etaHits.size() + etaHits.size()*phiHits.size());
361 const auto& firstEta{etaHits.front()};
362 const Amg::Transform3D toSectorTrans = toChamberTransform(*gctx, sectorTrans, *firstEta);
363
364 Amg::Vector3D toNextDir{Amg::Vector3D::Zero()}, sensorDir{Amg::Vector3D::Zero()};
365 if constexpr (std::is_same_v<xAOD::RpcMeasurementContainer, ContType> ||
366 std::is_same_v<xAOD::TgcStripContainer, ContType>) {
367 const auto& stripLayout = firstEta->readoutElement()->sensorLayout(firstEta->layerHash());
368 const auto& design = stripLayout->design();
369 sensorDir = toSectorTrans.linear() * stripLayout->to3D(design.stripDir(), false);
370 toNextDir = toSectorTrans.linear() * stripLayout->to3D(design.stripNormal(), false);
371 } else if constexpr (std::is_same_v<xAOD::sTgcMeasContainer, ContType>){
372 const auto& stripLayout = firstEta->readoutElement()->stripLayer(firstEta->measurementHash());
373 const auto& design = stripLayout.design(false);
374 sensorDir = toSectorTrans.linear() * stripLayout.to3D(design.stripDir(), false);
375 toNextDir = toSectorTrans.linear() * stripLayout.to3D(design.stripNormal(), false);
376 } else {
377 ATH_MSG_ERROR("Unsupported container type");
378 return StatusCode::FAILURE;
379 }
380
381 using namespace Acts::detail::LineHelper;
382 for (unsigned etaP = 0; etaP < etaHits.size(); ++etaP) {
384 for (unsigned phiP = 0; phiP < phiHits.size(); ++ phiP) {
386 if constexpr(std::is_same_v<xAOD::TgcStripContainer, ContType>) {
387 if (!(etaHits[etaP]->bcBitMap() & phiHits[phiP]->bcBitMap())){
388 continue;
389 }
390 const auto& stripLay = phiHits[phiP]->readoutElement()->sensorLayout(phiHits[phiP]->layerHash());
391 const auto& radialDesign = static_cast<const MuonGMR4::RadialStripDesign&>(stripLay->design(true));
392 toNextDir = toSectorTrans.linear() * stripLay->to3D(radialDesign.stripDir(phiHits[phiP]->channelNumber()), true);
393 }
394
395 SpacePoint& newSp = pointsInChamb.etaHits.emplace_back(etaHits[etaP], phiHits[phiP]);
396 newSp.setInstanceCounts(etaCounts[etaP], phiCounts[phiP]);
397
398 auto spIsect = lineIntersect(toSectorTrans*etaHits[etaP]->localMeasurementPos(), sensorDir,
399 toSectorTrans*phiHits[phiP]->localMeasurementPos(), toNextDir);
400 newSp.setPosition(spIsect.position());
401 newSp.setDirection(sensorDir, toNextDir);
402 auto cov = Acts::filledArray<double, 3>(0.);
403 cov[Acts::toUnderlying(CovIdx::etaCov)] = etaHits[etaP]->template localCovariance<1>()[0];
404 cov[Acts::toUnderlying(CovIdx::phiCov)] = phiHits[phiP]->template localCovariance<1>()[0];
406 if constexpr(std::is_same_v<xAOD::TgcStripContainer, ContType>) {
407 const auto& stripLay = phiHits[phiP]->readoutElement()->sensorLayout(phiHits[phiP]->layerHash());
408 const auto& radialDesign = static_cast<const MuonGMR4::RadialStripDesign&>(stripLay->design(true));
409 const Amg::Vector2D planePos = stripLay->to2D(toSectorTrans.inverse()*spIsect.position(), true);
410 cov[Acts::toUnderlying(CovIdx::phiCov)] =
411 Acts::square(radialDesign.stripPitch(phiHits[phiP]->channelNumber(), planePos)) / 12.;
412 }
413
414 newSp.setCovariance(std::move(cov));
415 ATH_MSG_VERBOSE("Created new space point "<<newSp);
416 }
417 }
418 }
419 }
420 } while (viewer.next());
421 return StatusCode::SUCCESS;
422}
#define ATH_MSG_ERROR(x)
#define ATH_UNLIKELY(x)
bool passOccupancy2D(const PrdVec_t< PrdType > &etaHits, const PrdVec_t< PrdType > &phiHits) const
: Check whether the occupancy cuts of hits in a gasGap are surpassed.
void fillUncombinedSpacePoints(const ActsTrk::GeometryContext &gctx, const Amg::Transform3D &sectorTrans, const PrdVec_t< const PrdType * > &prdsToFill, std::vector< SpacePoint > &outColl) const
Transform the uncombined space prd measurements to space points.
EtaPhi2DHitsVec< typename ContType::const_value_type > splitHitsPerGasGap(xAOD::ChamberViewer< ContType > &viewer) const
Splits the chamber hits of the viewer per gas gap.
const_ref at(const std::size_t idx) const
Returns the i-the measurement from the current chamber.
std::size_t size() const noexcept
Returns how many hits are in the current chamber.
Eigen::Matrix< double, 2, 1 > Vector2D
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
MdtTwinDriftCircle_v1 MdtTwinDriftCircle
: Helper struct to collect the space point per muon chamber, which are later sorted into the space po...

◆ loadContainerAndSort() [2/2]

template<>
StatusCode MuonR4::SpacePointMakerAlg::loadContainerAndSort ( const EventContext & ctx,
const SG::ReadHandleKey< xAOD::sTgcMeasContainer > & key,
PreSortedSpacePointMap & fillContainer ) const

Helper function combine an eta and a phi collection. The function takes two indices referrring to the indices of the hit vector inside HitColls

Parameters
collIdxAIndex of the collection to put as phi
collIdxBIndex of the collection to put as eta
combFuncLambda function that rejects hits which cannot be combined due to geometry reasons.

Skip if one of collections are empty

Get first hit from the first collection

The hit in the collection has already been used

Definition at line 425 of file SpacePointMakerAlg.cxx.

427 {
428
429 const xAOD::sTgcMeasContainer* measurementCont{nullptr};
430 ATH_CHECK(SG::get(measurementCont, key, ctx));
431 if (!measurementCont || measurementCont->empty()){
432 ATH_MSG_DEBUG("nothing to do");
433 return StatusCode::SUCCESS;
434 }
435 const ActsTrk::GeometryContext* gctx{nullptr};
436 ATH_CHECK(SG::get(gctx, m_geoCtxKey, ctx));
437 xAOD::ChamberViewer viewer{*measurementCont};
438 using namespace Acts::detail::LineHelper;
439 do {
440 SpacePointsPerChamber& pointsInChamb = fillContainer[viewer.at(0)->readoutElement()->msSector()];
441 const Amg::Transform3D sectorTrans = viewer.at(0)->readoutElement()->msSector()->globalToLocalTransform(*gctx);
442 ATH_MSG_DEBUG(__func__<<"() "<<__LINE__<<" - Fill space points for multiplet "<<m_idHelperSvc->toStringDetEl(viewer.at(0)->identify()));
443 for(auto& HitColls: splitHitsPerGasGap(viewer)){
444 auto& [etaHits, phiHits, two2DHits] = HitColls;
445 std::array<std::vector<std::shared_ptr<unsigned>>, 3> instanceCounts{matchCountVec(etaHits.size()),
446 matchCountVec(phiHits.size()),
447 matchCountVec(two2DHits.size())};
448
449 //loop through the Prds and try to combine according` to the hierarchy
450 // Strip+Wire
451 // Strip+Pad
452 // Wire+Pad
453 // Pad
461 auto combineMe = [&](const std::size_t collIdxA,
462 const std::size_t collIdxB,
463 const std::function<bool(const xAOD::sTgcMeasurement*,
464 const xAOD::sTgcMeasurement*)>& combFunc) {
465 std::vector<char> combinedFlagsA{}, combinedFlagsB{};
466 std::ranges::transform(instanceCounts[collIdxA], std::back_inserter(combinedFlagsA),
467 [](const std::shared_ptr<unsigned>& countPtr){
468 return (*countPtr) == 0;
469 });
470 std::ranges::transform(instanceCounts[collIdxB], std::back_inserter(combinedFlagsB),
471 [](const std::shared_ptr<unsigned>& countPtr){
472 return (*countPtr) == 0;
473 });
474
475 const auto& collA = HitColls[collIdxA];
476 const auto& collB = HitColls[collIdxB];
477
479 if(collA.empty() || collB.empty()) {
480 ATH_MSG_DEBUG(__func__<<"() "<<__LINE__<<" - Skipping combination: both collections empty");
481 return;
482 }
483
485 const xAOD::sTgcMeasurement* firstHit = collB.front();
486 const Amg::Transform3D toSectorTrans = toChamberTransform(*gctx, sectorTrans, *firstHit);
487
488 for(std::size_t idxA = 0; idxA < collA.size(); ++idxA) {
490 if(!combinedFlagsA[idxA]) {
491 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - Hit "<<m_idHelperSvc->toString(collA[idxA]->identify())
492 <<" has been used in previous iteration");
493 continue;
494 }
495 for(std::size_t idxB = 0; idxB < collB.size(); ++idxB) {
496 if(!combinedFlagsB[idxB] || !combFunc(collA[idxA], collB[idxB])){
497 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - Hit "<<m_idHelperSvc->toString(collB[idxB]->identify())
498 <<" has been used in previous iteration. Or is incompatible with "
499 <<m_idHelperSvc->toString(collA[idxA]->identify()));
500 continue;
501 }
502 //create space point
503 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - Combine sTgc measurements "
504 <<m_idHelperSvc->toString(collA[idxA]->identify())<<" and "
505 <<m_idHelperSvc->toString(collB[idxB]->identify())<< "with local positions"
506 << Amg::toString(collA[idxA]->localMeasurementPos()) << " and "
507 << Amg::toString(collB[idxB]->localMeasurementPos())
508 <<" to new space point");
509
510 SpacePoint& newSp = pointsInChamb.etaHits.emplace_back(collB[idxB], collA[idxA]);
511 auto crossPoint = lineIntersect<3>(collA[idxA]->localMeasurementPos(),
512 Amg::Vector3D::UnitX(),
513 collB[idxB]->localMeasurementPos(),
514 Amg::Vector3D::UnitY());
515
516 newSp.setPosition(toSectorTrans*crossPoint.position());
517 newSp.setDirection(Amg::Vector3D::UnitX(), Amg::Vector3D::UnitY());
518 auto cov = Acts::filledArray<double, 3>(0.);
519 cov[Acts::toUnderlying(CovIdx::phiCov)] = covElement(*collA[idxA], CovIdx::phiCov);
520 cov[Acts::toUnderlying(CovIdx::etaCov)] = covElement(*collB[idxB], CovIdx::etaCov);
521 newSp.setCovariance(std::move(cov));
522 newSp.setInstanceCounts(instanceCounts[collIdxB][idxB], instanceCounts[collIdxA][idxA]);
523 ATH_MSG_VERBOSE("Created new space point "<<newSp);
524 }
525 }
526 };
527
528 //try to combine strip with wire measurements first
529 combineMe(1, 0, [&](const xAOD::sTgcMeasurement* wire,
531 // do not combine the strips with the wire that are in the etaZero region
532 const MuonGMR4::sTgcReadoutElement* readoutElement = strip->readoutElement();
533 if(readoutElement->isEtaZero(strip->measurementHash(),
534 strip->localMeasurementPos().block<2,1>(0,0))){
535 return false;
536 }
537 //ignore combinations where the wire and the strip are not crossing
538 //check if the projection of the crossing point is within the bounds of the layer
539 Amg::Vector3D crossPoint = strip->localMeasurementPos() + wire->localMeasurementPos();
540 const Acts::Surface& surf = readoutElement->surface(strip->layerHash());
541 return surf.insideBounds(crossPoint.block<2,1>(0,0));
542 });
543
544 //combine strip and pad measurements
545 combineMe(2, 0, [&](const xAOD::sTgcMeasurement* pad,
547 // do not combine the strips with the pads that are not overlayed
548 const MuonGMR4::sTgcReadoutElement* readoutElement = pad ->readoutElement();
549 const MuonGMR4::PadDesign& padDesign = readoutElement->padDesign(pad->measurementHash());
550 double padHeight = padDesign.padHeight();
551 const Amg::Vector3D padCenter = pad->localMeasurementPos();
552
553 return std::abs(strip->localMeasurementPos().x() - padCenter.x()) < 0.5*padHeight;
554 });
555
556 //finally combine wire and pad measurements
557 combineMe(1, 2, [&](const xAOD::sTgcMeasurement* wire,
558 const xAOD::sTgcMeasurement* pad){
559 // do not combine the wires with the pads that are not overlayed
560 const MuonGMR4::sTgcReadoutElement* readoutElement = pad ->readoutElement();
561 const std::array<Amg::Vector2D, 4> localPadCorners = readoutElement->localPadCorners(pad->measurementHash());
562 auto [min,max] = std::ranges::minmax_element(localPadCorners.begin(), localPadCorners.end(),
563 [](const Amg::Vector2D& a, const Amg::Vector2D& b){
564 return a.y() < b.y();
565 });
566 return (wire->localMeasurementPos().y() > min->y() || wire->localMeasurementPos().y() < max->y());
567
568 });
569
570 //fill uncombined strip, wire and pad measurements that have not been used in combination
571 for(std::size_t collIdx = 0; collIdx < HitColls.size(); ++collIdx){
572 const auto& hits = HitColls[collIdx];
573 std::vector<const xAOD::sTgcMeasurement*> unusedHits{};
574 unusedHits.reserve(hits.size());
575
576 for(std::size_t idx = 0; idx < hits.size(); ++idx){
577 if((*instanceCounts[collIdx][idx]) == 0){
578 unusedHits.push_back(hits[idx]);
579 }
580 }
581 fillUncombinedSpacePoints(*gctx, sectorTrans, unusedHits, pointsInChamb.etaHits);
582 }
583 }
584 } while (viewer.next());
585 return StatusCode::SUCCESS;
586}
#define min(a, b)
Definition cfImp.cxx:40
#define max(a, b)
Definition cfImp.cxx:41
bool empty() const noexcept
Returns true if the collection is empty.
const Acts::Surface & surface() const override final
Returns the surface associated with the readout element.
double padHeight() const
Returns the height of all the pads that are not adjacent to the bottom edge of the trapezoid active a...
const PadDesign & padDesign(const IdentifierHash &measHash) const
Retrieves the readoutElement Layer given the Identifier/Hash.
localCornerArray localPadCorners(const IdentifierHash &measHash) const
bool isEtaZero(const IdentifierHash &measurementHash, const Amg::Vector2D &localPosition) const
bool next()
Loads the hits from the next chamber.
const MuonGMR4::sTgcReadoutElement * readoutElement() const override final
Retrieve the associated sTgcReadoutElement.
IdentifierHash measurementHash() const override final
Returns the hash of the measurement channel w.r.t ReadoutElement.
Amg::Vector3D localMeasurementPos() const override final
Returns the local measurement position as 3-vector.
sTgcMeasContainer_v1 sTgcMeasContainer
setBGCode setTAP setLVL2ErrorBits bool
sTgcMeasurement_v1 sTgcMeasurement

◆ msg()

MsgStream & AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ newBucket()

void MuonR4::SpacePointMakerAlg::newBucket ( const SpacePoint & refSp,
SpacePointBucketVec & sortedPoints ) const
private

Closes the current processed bucket and creates a new one.

Space points of the previous bucket within the overlap region to the first space point of the new bucket are copied over

Parameters
refSpFirst new space point which will be added to the new bucket.
sortedPointsList of all processed buckets in the chamber. The list is augmented by 1 element

Set the boundaries from the previous bucket

Copy space points that could be within the overlap region to the next bucket

Definition at line 670 of file SpacePointMakerAlg.cxx.

671 {
672 SpacePointBucket& newContainer = sortedPoints.emplace_back();
673 newContainer.setBucketId(sortedPoints.size() -1);
674
676 SpacePointBucket& overlap{sortedPoints[sortedPoints.size() - 2]};
677 overlap.setCoveredRange(overlap.front()->localPosition().y(),
678 overlap.back()->localPosition().y());
679
680 const double refBound = refSpacePoint.localPosition().y();
681
683 for (const std::shared_ptr<SpacePoint>& pointInBucket : overlap | std::views::reverse) {
684 const double overlapPos = pointInBucket->localPosition().y() +
685 std::sqrt(pointInBucket->covariance()[Acts::toUnderlying(CovIdx::etaCov)]);
686 if (refBound - overlapPos < m_spacePointOverlap) {
687 newContainer.insert(newContainer.begin(), pointInBucket);
688 } else {
689 break;
690 }
691 }
692
693}
Gaudi::Property< double > m_spacePointOverlap

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ passOccupancy2D() [1/4]

template<>
bool MuonR4::SpacePointMakerAlg::passOccupancy2D ( const PrdVec_t< const xAOD::MMCluster * > & ,
const PrdVec_t< const xAOD::MMCluster * > &  ) const

Definition at line 197 of file SpacePointMakerAlg.cxx.

198 {
199 return false;
200 }

◆ passOccupancy2D() [2/4]

template<>
bool MuonR4::SpacePointMakerAlg::passOccupancy2D ( const PrdVec_t< const xAOD::RpcMeasurement * > & etaHits,
const PrdVec_t< const xAOD::RpcMeasurement * > & phiHits ) const

Definition at line 185 of file SpacePointMakerAlg.cxx.

186 {
187 if (etaHits.empty() || phiHits.empty()) {
188 return false;
189 }
190 const MuonGMR4::RpcReadoutElement* re = etaHits[0]->readoutElement();
191 ATH_MSG_VERBOSE("Collected "<<etaHits.size()<<"/"<<phiHits.size()<<" hits in "<<m_idHelperSvc->toStringGasGap(etaHits[0]->identify()));
192 return ((1.*etaHits.size()) / (1.*re->nEtaStrips())) < m_maxOccRpcEta &&
193 ((1.*phiHits.size()) / (1.*re->nPhiStrips())) < m_maxOccRpcPhi;
194 }
const boost::regex re(r_e)
Gaudi::Property< double > m_maxOccRpcEta
Gaudi::Property< double > m_maxOccRpcPhi

◆ passOccupancy2D() [3/4]

template<>
bool MuonR4::SpacePointMakerAlg::passOccupancy2D ( const PrdVec_t< const xAOD::TgcStrip * > & etaHits,
const PrdVec_t< const xAOD::TgcStrip * > & phiHits ) const

Definition at line 174 of file SpacePointMakerAlg.cxx.

175 {
176 if (etaHits.empty() || phiHits.empty()) {
177 return false;
178 }
179 const MuonGMR4::TgcReadoutElement* re = etaHits[0]->readoutElement();
180 ATH_MSG_VERBOSE("Collected "<<etaHits.size()<<"/"<<phiHits.size()<<" hits in "<<m_idHelperSvc->toStringGasGap(etaHits[0]->identify()));
181 return ((1.*etaHits.size()) / ((1.*re->numChannels(etaHits[0]->measurementHash())))) < m_maxOccTgcEta &&
182 ((1.*phiHits.size()) / ((1.*re->numChannels(phiHits[0]->measurementHash())))) < m_maxOccTgcPhi;
183 }
Gaudi::Property< double > m_maxOccTgcEta
Gaudi::Property< double > m_maxOccTgcPhi

◆ passOccupancy2D() [4/4]

template<typename PrdType>
bool MuonR4::SpacePointMakerAlg::passOccupancy2D ( const PrdVec_t< PrdType > & etaHits,
const PrdVec_t< PrdType > & phiHits ) const
private

: Check whether the occupancy cuts of hits in a gasGap are surpassed.

The method is specified for each of the 3 strip technologies, Rpc, Tgc, sTgc and applies a technology-dependent upper bound on the number of phi & eta hits. If the threshold is surpassed, only 1D space points are built intsead of 2D ones

Parameters
etaHitsList of all presorted eta measurements in a gas gap
phiHitsList of all presorted phi measurements in a gas gap

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setFilterPassed()

virtual void AthCommonReentrantAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Definition at line 100 of file AthCommonReentrantAlgorithm.h.

100 {
102 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const

◆ splitBucket()

bool MuonR4::SpacePointMakerAlg::splitBucket ( const SpacePoint & spacePoint,
const double firstSpPos,
const SpacePointBucketVec & sortedPoints ) const
private

Returns whether the space point is beyond the bucket boundary.

Parameters
spacePointSpace point candidate to add to the bucket
sortedPointsContainer of all defined buckets in the chamber

Distance between this point and the first one exceeds the maximum length

Definition at line 656 of file SpacePointMakerAlg.cxx.

658 {
660 const double spY = spacePoint.localPosition().y();
661 if (spY - firstSpPos > m_maxBucketLength){
662 return true;
663 }
664
665 if (sortedPoints.empty() || sortedPoints.back().empty()) {
666 return false;
667 }
668 return spY - sortedPoints.back().back()->localPosition().y() > m_spacePointWindow;
669}
Gaudi::Property< double > m_spacePointWindow
Gaudi::Property< double > m_maxBucketLength

◆ splitHitsPerGasGap()

template<typename ContType>
SpacePointMakerAlg::EtaPhi2DHitsVec< typename ContType::const_value_type > MuonR4::SpacePointMakerAlg::splitHitsPerGasGap ( xAOD::ChamberViewer< ContType > & viewer) const
private

Splits the chamber hits of the viewer per gas gap.

Parameters
viewerChamber viewer containing all hits in the chamber
Returns
Vector of gas gap hit collections. Each entry contains 3 vectors:
  • eta hits
  • phi hits
  • 2D hits

Wires measure the phi coordinate

Tgc & Rpcs have the measuresPhi property

Sort in the hit

Definition at line 269 of file SpacePointMakerAlg.cxx.

269 {
270 std::vector<EtaPhi2DHits<typename ContType::const_value_type>> hitsPerGasGap{};
271 for (const auto& prd : viewer) {
272 ATH_MSG_VERBOSE("Create space point from "<<m_idHelperSvc->toString(prd->identify())
273 <<", hash: "<<prd->identifierHash());
274
275 unsigned gapIdx = prd->gasGap() -1;
276 if constexpr (std::is_same_v<ContType, xAOD::RpcMeasurementContainer>) {
277 gapIdx = prd->readoutElement()->createHash(0, prd->gasGap(), prd->doubletPhi(), false);
278 }
279 if (hitsPerGasGap.size() <= gapIdx) {
280 hitsPerGasGap.resize(gapIdx + 1);
281 }
282 bool measPhi{false};
283 if constexpr(std::is_same_v<ContType, xAOD::sTgcMeasContainer>) {
285 measPhi = prd->channelType() == sTgcIdHelper::sTgcChannelTypes::Wire;
286 } else if constexpr(!std::is_same_v<ContType, xAOD::MMClusterContainer>) {
288 measPhi = prd->measuresPhi();
289 }
290
291 if (prd->numDimensions() == 2) {
292 hitsPerGasGap[gapIdx][2].push_back(prd);
293 continue;
294 }
296 auto& toPush = hitsPerGasGap[gapIdx][measPhi];
297 if (toPush.capacity() == toPush.size()) {
298 toPush.reserve(toPush.size() + m_capacityBucket);
299 }
300 toPush.push_back(prd);
301 }
302 return hitsPerGasGap;
303}
Gaudi::Property< unsigned > m_capacityBucket

◆ sysExecute()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Definition at line 85 of file AthCommonReentrantAlgorithm.cxx.

75{
76 return BaseAlg::sysExecute (ctx);
77}

◆ sysInitialize()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in HypoBase, and InputMakerBase.

Definition at line 61 of file AthCommonReentrantAlgorithm.cxx.

105 {
107
108 if (sc.isFailure()) {
109 return sc;
110 }
111
112 ServiceHandle<ICondSvc> cs("CondSvc",name());
113 for (auto h : outputHandles()) {
114 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
115 // do this inside the loop so we don't create the CondSvc until needed
116 if ( cs.retrieve().isFailure() ) {
117 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
118 return StatusCode::SUCCESS;
119 }
120 if (cs->regHandle(this,*h).isFailure()) {
122 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
123 << " with CondSvc");
124 }
125 }
126 }
127 return sc;
128}
#define ATH_MSG_WARNING(x)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::unique_ptr<SpacePointStatistics> m_statCounter MuonR4::SpacePointMakerAlg::ATLAS_THREAD_SAFE {}
private

Definition at line 225 of file SpacePointMakerAlg.h.

225{};

◆ m_capacityBucket

Gaudi::Property<unsigned> MuonR4::SpacePointMakerAlg::m_capacityBucket {this,"CapacityBucket" , 50}
private

Definition at line 224 of file SpacePointMakerAlg.h.

224{this,"CapacityBucket" , 50};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doStat

Gaudi::Property<bool> MuonR4::SpacePointMakerAlg::m_doStat
private
Initial value:
{this, "doStats", false,
"If enabled the algorithm keeps track how many hits have been made" }

Definition at line 221 of file SpacePointMakerAlg.h.

221 {this, "doStats", false,
222 "If enabled the algorithm keeps track how many hits have been made" };

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonReentrantAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 114 of file AthCommonReentrantAlgorithm.h.

◆ m_geoCtxKey

SG::ReadHandleKey<ActsTrk::GeometryContext> MuonR4::SpacePointMakerAlg::m_geoCtxKey {this, "AlignmentKey", "ActsAlignment", "cond handle key"}
private

Definition at line 205 of file SpacePointMakerAlg.h.

205{this, "AlignmentKey", "ActsAlignment", "cond handle key"};

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> MuonR4::SpacePointMakerAlg::m_idHelperSvc {this, "IdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

Definition at line 207 of file SpacePointMakerAlg.h.

207{this, "IdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

◆ m_maxBucketLength

Gaudi::Property<double> MuonR4::SpacePointMakerAlg::m_maxBucketLength
private
Initial value:
{this, "maxBucketLength", 2.*Gaudi::Units::m,
"Maximal size of a space point bucket"}

Definition at line 214 of file SpacePointMakerAlg.h.

214 {this, "maxBucketLength", 2.*Gaudi::Units::m,
215 "Maximal size of a space point bucket"};

◆ m_maxOccRpcEta

Gaudi::Property<double> MuonR4::SpacePointMakerAlg::m_maxOccRpcEta
private
Initial value:
{this, "maxRpcEtaOccupancy", 0.1,
"Maximum occpancy of Rpc eta hits in a gasGap"}

Definition at line 227 of file SpacePointMakerAlg.h.

227 {this, "maxRpcEtaOccupancy", 0.1,
228 "Maximum occpancy of Rpc eta hits in a gasGap"};

◆ m_maxOccRpcPhi

Gaudi::Property<double> MuonR4::SpacePointMakerAlg::m_maxOccRpcPhi
private
Initial value:
{this, "maxRpcPhiOccupancy", 0.1,
"Maximum occpancy of Rpc phi hits in a gasGap"}

Definition at line 229 of file SpacePointMakerAlg.h.

229 {this, "maxRpcPhiOccupancy", 0.1,
230 "Maximum occpancy of Rpc phi hits in a gasGap"};

◆ m_maxOccTgcEta

Gaudi::Property<double> MuonR4::SpacePointMakerAlg::m_maxOccTgcEta
private
Initial value:
{this, "maxTgcEtaOccupancy", 0.1,
"Maximum occpancy of Tgc eta hits in a gasGap"}

Definition at line 232 of file SpacePointMakerAlg.h.

232 {this, "maxTgcEtaOccupancy", 0.1,
233 "Maximum occpancy of Tgc eta hits in a gasGap"};

◆ m_maxOccTgcPhi

Gaudi::Property<double> MuonR4::SpacePointMakerAlg::m_maxOccTgcPhi
private
Initial value:
{this, "maxTgcPhiOccupancy", 0.1,
"Maximum occpancy of Tgc phi hits in a gasGap"}

Definition at line 234 of file SpacePointMakerAlg.h.

234 {this, "maxTgcPhiOccupancy", 0.1,
235 "Maximum occpancy of Tgc phi hits in a gasGap"};

◆ m_mdtKey

SG::ReadHandleKey<xAOD::MdtDriftCircleContainer> MuonR4::SpacePointMakerAlg::m_mdtKey
private
Initial value:
{this, "MdtKey", "xMdtMeasurements",
"Key to the uncalibrated Drift circle measurements"}

Definition at line 190 of file SpacePointMakerAlg.h.

190 {this, "MdtKey", "xMdtMeasurements",
191 "Key to the uncalibrated Drift circle measurements"};

◆ m_mmKey

SG::ReadHandleKey<xAOD::MMClusterContainer> MuonR4::SpacePointMakerAlg::m_mmKey
private
Initial value:
{this, "MmKey", "xAODMMClusters",
"Key to the uncalibrated 1D Mm hits"}

Definition at line 199 of file SpacePointMakerAlg.h.

199 {this, "MmKey", "xAODMMClusters",
200 "Key to the uncalibrated 1D Mm hits"};

◆ m_rpcKey

SG::ReadHandleKey<xAOD::RpcMeasurementContainer> MuonR4::SpacePointMakerAlg::m_rpcKey
private
Initial value:
{this, "RpcKey", "xRpcMeasurements",
"Key to the uncalibrated 1D rpc hits"}

Definition at line 193 of file SpacePointMakerAlg.h.

193 {this, "RpcKey", "xRpcMeasurements",
194 "Key to the uncalibrated 1D rpc hits"};

◆ m_spacePointOverlap

Gaudi::Property<double> MuonR4::SpacePointMakerAlg::m_spacePointOverlap
private
Initial value:
{this, "spacePointOverlap", 25.*Gaudi::Units::cm,
"Hits that are within <spacePointOverlap> of the bucket margin. "
"Are copied to the next bucket"}

Definition at line 217 of file SpacePointMakerAlg.h.

217 {this, "spacePointOverlap", 25.*Gaudi::Units::cm,
218 "Hits that are within <spacePointOverlap> of the bucket margin. "
219 "Are copied to the next bucket"};

◆ m_spacePointWindow

Gaudi::Property<double> MuonR4::SpacePointMakerAlg::m_spacePointWindow
private
Initial value:
{this, "spacePointWindowSize", 0.8*Gaudi::Units::m,
"Maximal distance between consecutive hits in a bucket"}

Definition at line 211 of file SpacePointMakerAlg.h.

211 {this, "spacePointWindowSize", 0.8*Gaudi::Units::m,
212 "Maximal distance between consecutive hits in a bucket"};

◆ m_stgcKey

SG::ReadHandleKey<xAOD::sTgcMeasContainer> MuonR4::SpacePointMakerAlg::m_stgcKey {this, "sTgcKey", "xAODsTgcMeasurements"}
private

Definition at line 202 of file SpacePointMakerAlg.h.

202{this, "sTgcKey", "xAODsTgcMeasurements"};

◆ m_tgcKey

SG::ReadHandleKey<xAOD::TgcStripContainer> MuonR4::SpacePointMakerAlg::m_tgcKey
private
Initial value:
{this, "TgcKey", "xTgcStrips",
"Key to the uncalibrated 1D tgc hits"}

Definition at line 196 of file SpacePointMakerAlg.h.

196 {this, "TgcKey", "xTgcStrips",
197 "Key to the uncalibrated 1D tgc hits"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.

◆ m_writeKey

SG::WriteHandleKey<SpacePointContainer> MuonR4::SpacePointMakerAlg::m_writeKey {this, "WriteKey", "MuonSpacePoints"}
private

Definition at line 209 of file SpacePointMakerAlg.h.

209{this, "WriteKey", "MuonSpacePoints"};

The documentation for this class was generated from the following files: