ATLAS Offline Software
Loading...
Searching...
No Matches
Muon::MuonLayerSegmentMatchingTool Class Reference

#include <MuonLayerSegmentMatchingTool.h>

Inheritance diagram for Muon::MuonLayerSegmentMatchingTool:
Collaboration diagram for Muon::MuonLayerSegmentMatchingTool:

Public Member Functions

 MuonLayerSegmentMatchingTool (const std::string &type, const std::string &name, const IInterface *parent)
 Default AlgTool functions.
virtual ~MuonLayerSegmentMatchingTool ()=default
StatusCode initialize () override
void select (const EventContext &ctx, const MuonSystemExtension::Intersection &intersection, const std::vector< std::shared_ptr< const Muon::MuonSegment > > &segments, std::vector< std::shared_ptr< const Muon::MuonSegment > > &selectedSegments) const override
 IMuonLayerSegmentMatchingTool interface: select.
bool match (const EventContext &ctx, const MuonSystemExtension::Intersection &intersection, const MuonSegment &segment) const override
 match segment to intersection
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 sysInitialize () override
 Perform system initialization for an algorithm.
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

Static Public Member Functions

static const InterfaceID & interfaceID ()
 IAlgTool interface.

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

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

PublicToolHandle< MuonEDMPrinterToolm_printer {this, "MuonEDMPrinterTool", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"}
 Helper tool for debugging purposes.
ToolHandle< Trk::IExtrapolatorm_extrapolator {this, "Extrapolator", "Trk::Extrapolation/AtlasExtrapolator"}
ToolHandle< IMuTagMatchingToolm_matchingTool {this, "MatchTool", "MuTagMatchingTool/MuTagMatchingTool"}
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

Definition at line 24 of file MuonLayerSegmentMatchingTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ MuonLayerSegmentMatchingTool()

Muon::MuonLayerSegmentMatchingTool::MuonLayerSegmentMatchingTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Default AlgTool functions.

Definition at line 13 of file MuonLayerSegmentMatchingTool.cxx.

13 :
14 AthAlgTool(type, name, parent) {
15 declareInterface<IMuonLayerSegmentMatchingTool>(this);
16 }
AthAlgTool()
Default constructor:

◆ ~MuonLayerSegmentMatchingTool()

virtual Muon::MuonLayerSegmentMatchingTool::~MuonLayerSegmentMatchingTool ( )
virtualdefault

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::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< AlgTool > >::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< AlgTool > >::detStore ( ) const
inlineinherited

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

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

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

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

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::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

◆ initialize()

StatusCode Muon::MuonLayerSegmentMatchingTool::initialize ( )
override

Definition at line 18 of file MuonLayerSegmentMatchingTool.cxx.

18 {
19 ATH_CHECK(m_printer.retrieve());
20 ATH_CHECK(m_extrapolator.retrieve());
21 ATH_CHECK(m_matchingTool.retrieve());
22 return StatusCode::SUCCESS;
23 }
#define ATH_CHECK
Evaluate an expression and check for errors.
ToolHandle< Trk::IExtrapolator > m_extrapolator
ToolHandle< IMuTagMatchingTool > m_matchingTool
PublicToolHandle< MuonEDMPrinterTool > m_printer
Helper tool for debugging purposes.

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::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.

◆ interfaceID()

const InterfaceID & Muon::IMuonLayerSegmentMatchingTool::interfaceID ( )
inlinestaticinherited

IAlgTool interface.

Definition at line 22 of file IMuonLayerSegmentMatchingTool.h.

22 {
23 static const InterfaceID IID_IMuonLayerSegmentMatchingTool("Muon::IMuonLayerSegmentMatchingTool", 1, 0);
24 return IID_IMuonLayerSegmentMatchingTool;
25 }

◆ match()

bool Muon::MuonLayerSegmentMatchingTool::match ( const EventContext & ctx,
const MuonSystemExtension::Intersection & intersection,
const MuonSegment & segment ) const
overridevirtual

match segment to intersection

Implements Muon::IMuonLayerSegmentMatchingTool.

Definition at line 25 of file MuonLayerSegmentMatchingTool.cxx.

26 {
27 if (msgLvl(MSG::VERBOSE)) {
28 std::shared_ptr<const Trk::TrackParameters> pars = intersection.trackParameters;
29 msg(MSG::VERBOSE) << " startPars: phi " << pars->position().phi() << " r " << pars->position().perp() << " z "
30 << pars->position().z() << " local " << pars->parameters()[Trk::locX] << " " << pars->parameters()[Trk::locY];
31 if (pars->covariance())
32 msg(MSG::VERBOSE) << " err " << Amg::error(*pars->covariance(), Trk::locX) << " "
33 << Amg::error(*pars->covariance(), Trk::locY);
34 msg(MSG::VERBOSE) << endmsg;
35 }
36
37 std::shared_ptr<Trk::TrackParameters> exPars(m_extrapolator->extrapolate(
38 ctx, *intersection.trackParameters, segment.associatedSurface(), Trk::anyDirection, false, Trk::muon));
39 if (!exPars) {
40 ATH_MSG_VERBOSE(" extrapolation failed ");
41 return false;
42 }
43
44 std::shared_ptr<Trk::AtaPlane> ataPlane = std::dynamic_pointer_cast<Trk::AtaPlane>(exPars);
45 if (!ataPlane) {
46 Trk::TrackParameters* p = exPars.get(); // avoid clang warning.
47 ATH_MSG_WARNING(" dynamic_cast<> failed "<<typeid(*p).name()<<std::endl<<segment.associatedSurface()<<std::endl<<std::endl<<(*intersection.trackParameters));
48 return false;
49 }
50 if (msgLvl(MSG::VERBOSE)) {
51 msg(MSG::VERBOSE) << " Segment r " << segment.globalPosition().perp() << " z " << segment.globalPosition().z() << " local "
52 << segment.localParameters()[Trk::locX] << " " << segment.localParameters()[Trk::locY] << " err "
53 << Amg::error(segment.localCovariance(), Trk::locX) << " " << Amg::error(segment.localCovariance(), Trk::locY)
54 << " extrapolation r " << ataPlane->position().perp() << " z " << ataPlane->position().z() << " local "
55 << ataPlane->parameters()[Trk::locX] << " " << ataPlane->parameters()[Trk::locY];
56 if (ataPlane->covariance())
57 msg(MSG::VERBOSE) << " err " << Amg::error(*ataPlane->covariance(), Trk::locX) << " "
58 << Amg::error(*ataPlane->covariance(), Trk::locY);
59 msg(MSG::VERBOSE) << endmsg;
60 }
61
62 MuonCombined::MuonSegmentInfo segmentInfo = m_matchingTool->muTagSegmentInfo(ctx, nullptr, segment, ataPlane);
63 if (!m_matchingTool->matchSegmentPosition(segmentInfo, true)) {
64 ATH_MSG_DEBUG(" position match failed ");
65 return false;
66 }
67 if (!m_matchingTool->matchSegmentDirection(segmentInfo, true)) {
68 ATH_MSG_DEBUG(" direction match failed ");
69 return false;
70 }
71 if (!m_matchingTool->matchDistance(segmentInfo)) {
72 ATH_MSG_DEBUG(" distance match failed ");
73 return false;
74 }
75 if (!m_matchingTool->matchCombinedPull(segmentInfo)) {
76 ATH_MSG_DEBUG(" combined pull match failed ");
77 return false;
78 }
79 return true;
80 }
#define endmsg
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
bool msgLvl(const MSG::Level lvl) const
MsgStream & msg() const
virtual const Amg::Vector3D & globalPosition() const override final
global position
virtual const Trk::PlaneSurface & associatedSurface() const override final
returns the surface for the local to global transformation
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
std::vector< std::string > intersection(std::vector< std::string > &v1, std::vector< std::string > &v2)
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
@ anyDirection
@ locY
local cartesian
Definition ParamDefs.h:38
@ locX
Definition ParamDefs.h:37
ParametersBase< TrackParametersDim, Charged > TrackParameters

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

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

Definition at line 30 of file AthCommonMsg.h.

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

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::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.

◆ 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< AlgTool > >::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< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ select()

void Muon::MuonLayerSegmentMatchingTool::select ( const EventContext & ctx,
const MuonSystemExtension::Intersection & intersection,
const std::vector< std::shared_ptr< const Muon::MuonSegment > > & segments,
std::vector< std::shared_ptr< const Muon::MuonSegment > > & selectedSegments ) const
overridevirtual

IMuonLayerSegmentMatchingTool interface: select.

Implements Muon::IMuonLayerSegmentMatchingTool.

Definition at line 82 of file MuonLayerSegmentMatchingTool.cxx.

84 {
85 // loop over segments and match them to the intersection
86 for (const std::shared_ptr<const Muon::MuonSegment>& segment : segments) {
87 if (match(ctx, intersection, *segment)) { selectedSegments.push_back(segment); }
88 }
89 ATH_MSG_DEBUG("Selected segments: " << selectedSegments.size());
90 }
bool match(const EventContext &ctx, const MuonSystemExtension::Intersection &intersection, const MuonSegment &segment) const override
match segment to intersection

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::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< AlgTool > >::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 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extrapolator

ToolHandle<Trk::IExtrapolator> Muon::MuonLayerSegmentMatchingTool::m_extrapolator {this, "Extrapolator", "Trk::Extrapolation/AtlasExtrapolator"}
private

Definition at line 44 of file MuonLayerSegmentMatchingTool.h.

44{this, "Extrapolator", "Trk::Extrapolation/AtlasExtrapolator"};

◆ m_matchingTool

ToolHandle<IMuTagMatchingTool> Muon::MuonLayerSegmentMatchingTool::m_matchingTool {this, "MatchTool", "MuTagMatchingTool/MuTagMatchingTool"}
private

Definition at line 46 of file MuonLayerSegmentMatchingTool.h.

46{this, "MatchTool", "MuTagMatchingTool/MuTagMatchingTool"};

◆ m_printer

PublicToolHandle<MuonEDMPrinterTool> Muon::MuonLayerSegmentMatchingTool::m_printer {this, "MuonEDMPrinterTool", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"}
private

Helper tool for debugging purposes.

Definition at line 42 of file MuonLayerSegmentMatchingTool.h.

42{this, "MuonEDMPrinterTool", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


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