ATLAS Offline Software
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Rec::MuonMatchQuality Class Reference

#include <MuonMatchQuality.h>

Inheritance diagram for Rec::MuonMatchQuality:
Collaboration diagram for Rec::MuonMatchQuality:

Classes

struct  CacheAll
 

Public Member Functions

 MuonMatchQuality (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual ~MuonMatchQuality ()=default
 
StatusCode initialize () override
 
double innerMatchChi2 (const Trk::Track &track1, const Trk::Track &track2, const EventContext &ctx) const override
 IMuonMatchQuality interface: match chiSquared between two tracks expressed at same inner (IP) surface, expected to handle indet with extrapolated spectrometer track or combined with constituent track. More...
 
int innerMatchDOF (const Trk::Track &track1, const Trk::Track &track2) const override
 IMuonMatchQuality interface: degrees of freedom for chi2 match at IP. More...
 
double innerMatchProbability (const Trk::Track &track1, const Trk::Track &track2, const EventContext &ctx) const override
 IMuonMatchQuality interface: match probability for chi2 match at IP. More...
 
std::pair< int, std::pair< double, double > > innerMatchAll (const Trk::Track &track1, const Trk::Track &track2, const EventContext &ctx) const override
 IMuonMatchQuality interface: degrees of freedom, chi2, probability for chi2 match at IP. More...
 
double outerMatchChi2 (const Trk::Track &track1, const Trk::Track &track2, const EventContext &ctx) const override
 IMuonMatchQuality interface: match chiSquared between two tracks expressed at first muon spectrometer hit, extrapolates indet to first hit of spectrometer track. More...
 
virtual int outerMatchDOF (const Trk::Track &track1, const Trk::Track &track2) const override
 IMuonMatchQuality interface: degrees of freedom for chi2 match at first MS hit. More...
 
double outerMatchProbability (const Trk::Track &track1, const Trk::Track &track2, const EventContext &ctx) const override
 IMuonMatchQuality interface: match probability for chi2 match at first MS hit. More...
 
virtual bool shareOrigin (const Trk::Track &track1, const Trk::Track &track2) const override
 IMuonMatchQuality interface: check the track perigee parameters are expressed at the same surface. More...
 
double simpleChi2 (const Trk::Track &track1, const Trk::Track &track2, const EventContext &ctx) const override
 IMuonMatchQuality interface: as inner match chiSquared but simplified to just use diagonal errors. More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 AlgTool and IAlgTool interface methods. More...
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
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. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

CacheAll setCache (const Trk::Track &track1, const Trk::Track &track2, const EventContext &ctx) const
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

ToolHandle< MuonCombined::IMuonTrackTagToolm_tagTool
 
ToolHandle< IMuonTrackQuerym_trackQuery
 
std::unique_ptr< AmgSymMatrix(5)> m_alignmentUncertainty
 
Gaudi::Property< double > m_directionUncertainty
 
Gaudi::Property< double > m_positionUncertainty
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Definition at line 23 of file MuonMatchQuality.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

◆ MuonMatchQuality()

Rec::MuonMatchQuality::MuonMatchQuality ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 20 of file MuonMatchQuality.cxx.

20  :
22  declareInterface<IMuonMatchQuality>(this);
23  }

◆ ~MuonMatchQuality()

virtual Rec::MuonMatchQuality::~MuonMatchQuality ( )
virtualdefault

Member Function Documentation

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

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

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

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

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

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

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

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ 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.

95 { return m_detStore; }

◆ evtStore() [1/2]

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.

85 { return m_evtStore; }

◆ evtStore() [2/2]

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

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

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ 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 Rec::MuonMatchQuality::initialize ( )
override

Definition at line 25 of file MuonMatchQuality.cxx.

25  {
26  ATH_MSG_DEBUG("MuonMatchQuality::initialize().");
27 
28  // get the tools
29  if (!m_tagTool.name().empty()) { ATH_CHECK(m_tagTool.retrieve()); }
30  ATH_CHECK(m_trackQuery.retrieve());
31 
32  // set up alignment uncertainty between ID and MS tracking systems
33  m_alignmentUncertainty = std::make_unique<AmgSymMatrix(5)>();
34  m_alignmentUncertainty->setZero();
35  (*m_alignmentUncertainty)(0, 0) = m_positionUncertainty * m_positionUncertainty;
36  (*m_alignmentUncertainty)(1, 1) = m_positionUncertainty * m_positionUncertainty;
37  (*m_alignmentUncertainty)(2, 2) = m_directionUncertainty * m_directionUncertainty;
38  (*m_alignmentUncertainty)(3, 3) = m_directionUncertainty * m_directionUncertainty;
39 
40  return StatusCode::SUCCESS;
41  }

◆ innerMatchAll()

std::pair< int, std::pair< double, double > > Rec::MuonMatchQuality::innerMatchAll ( const Trk::Track track1,
const Trk::Track track2,
const EventContext &  ctx 
) const
overridevirtual

IMuonMatchQuality interface: degrees of freedom, chi2, probability for chi2 match at IP.

Implements Rec::IMuonMatchQuality.

Definition at line 72 of file MuonMatchQuality.cxx.

73  {
74  MuonMatchQuality::CacheAll CA = setCache(track1, track2, ctx);
75 
76  std::pair<int, std::pair<double, double> > aTriad =
77  std::make_pair(CA.innerMatchDOF, std::make_pair(CA.innerMatchChi2, CA.innerMatchProbability));
78 
79  return aTriad;
80  }

◆ innerMatchChi2()

double Rec::MuonMatchQuality::innerMatchChi2 ( const Trk::Track track1,
const Trk::Track track2,
const EventContext &  ctx 
) const
overridevirtual

IMuonMatchQuality interface: match chiSquared between two tracks expressed at same inner (IP) surface, expected to handle indet with extrapolated spectrometer track or combined with constituent track.

Implements Rec::IMuonMatchQuality.

Definition at line 45 of file MuonMatchQuality.cxx.

45  {
46  MuonMatchQuality::CacheAll CA = setCache(track1, track2, ctx);
47  return CA.innerMatchChi2;
48  }

◆ innerMatchDOF()

int Rec::MuonMatchQuality::innerMatchDOF ( const Trk::Track track1,
const Trk::Track track2 
) const
overridevirtual

IMuonMatchQuality interface: degrees of freedom for chi2 match at IP.

Implements Rec::IMuonMatchQuality.

Definition at line 51 of file MuonMatchQuality.cxx.

51  {
52  int matchDOF = 0;
53 
54  const Trk::Perigee* perigee1 = track1.perigeeParameters();
55  const Trk::Perigee* perigee2 = track2.perigeeParameters();
56 
57  if (perigee1 && perigee2 && (*perigee1).associatedSurface().center() == (*perigee2).associatedSurface().center()) {
58  if (m_trackQuery->isLineFit(track1) || m_trackQuery->isLineFit(track2)) {
59  matchDOF = 4;
60  } else {
61  matchDOF = 5;
62  }
63  }
64 
65  return matchDOF;
66  }

◆ innerMatchProbability()

double Rec::MuonMatchQuality::innerMatchProbability ( const Trk::Track track1,
const Trk::Track track2,
const EventContext &  ctx 
) const
overridevirtual

IMuonMatchQuality interface: match probability for chi2 match at IP.

Implements Rec::IMuonMatchQuality.

Definition at line 67 of file MuonMatchQuality.cxx.

67  {
68  MuonMatchQuality::CacheAll CA = setCache(track1, track2, ctx);
69  return CA.innerMatchProbability;
70  }

◆ 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()

static const InterfaceID& Rec::IMuonMatchQuality::interfaceID ( )
inlinestaticinherited

AlgTool and IAlgTool interface methods.

Definition at line 29 of file IMuonMatchQuality.h.

29  {
30  static const InterfaceID IID_IMuonMatchQuality("IMuonMatchQuality", 1, 0);
31  return IID_IMuonMatchQuality;
32  }

◆ msg() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

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

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ 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  }

◆ outerMatchChi2()

double Rec::MuonMatchQuality::outerMatchChi2 ( const Trk::Track track1,
const Trk::Track track2,
const EventContext &  ctx 
) const
overridevirtual

IMuonMatchQuality interface: match chiSquared between two tracks expressed at first muon spectrometer hit, extrapolates indet to first hit of spectrometer track.

Implements Rec::IMuonMatchQuality.

Definition at line 81 of file MuonMatchQuality.cxx.

81  {
82  // caching needs some development...
83  // setCache(track1,track2);
84  double outerMatchChi2 = 999999.;
85  if (!m_tagTool.empty()) { outerMatchChi2 = m_tagTool->chi2(track1, track2, ctx); }
86 
87  return outerMatchChi2;
88  }

◆ outerMatchDOF()

int Rec::MuonMatchQuality::outerMatchDOF ( const Trk::Track track1,
const Trk::Track track2 
) const
overridevirtual

IMuonMatchQuality interface: degrees of freedom for chi2 match at first MS hit.

Implements Rec::IMuonMatchQuality.

Definition at line 91 of file MuonMatchQuality.cxx.

91 { return 4; }

◆ outerMatchProbability()

double Rec::MuonMatchQuality::outerMatchProbability ( const Trk::Track track1,
const Trk::Track track2,
const EventContext &  ctx 
) const
overridevirtual

IMuonMatchQuality interface: match probability for chi2 match at first MS hit.

Implements Rec::IMuonMatchQuality.

Definition at line 92 of file MuonMatchQuality.cxx.

92  {
93  double outerMatchProbability = 0.;
94  if (!m_tagTool.empty()) {
95  double outer_chi2 = outerMatchChi2(track1, track2, ctx);
96 
97  // probability of MS chi2
98  if (outer_chi2 > 0. && outer_chi2 < 1000.) {
99  Genfun::CumulativeChiSquare func(4);
100  outerMatchProbability = 1. - func(outer_chi2);
101  }
102  }
103  return outerMatchProbability;
104  }

◆ 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();
383  PBASE::renounce (h);
384  }

◆ 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  {
365  handlesArray.renounce();
366  }

◆ setCache()

MuonMatchQuality::CacheAll Rec::MuonMatchQuality::setCache ( const Trk::Track track1,
const Trk::Track track2,
const EventContext &  ctx 
) const
private

Definition at line 119 of file MuonMatchQuality.cxx.

120  {
121  MuonMatchQuality::CacheAll CA;
122  // set match degrees of freedom
123  CA.innerMatchDOF = innerMatchDOF(track1, track2);
124  if (!CA.innerMatchDOF) return CA;
125 
126  // parameter difference
127  const Trk::Perigee* perigee1 = track1.perigeeParameters();
128  const Trk::Perigee* perigee2 = track2.perigeeParameters();
129 
130  // coverity false positive (as null pointers cause innerMatchDOF failure)
131  if (!perigee1 || !perigee2) return CA;
132 
133  double deltaD0 = perigee1->parameters()[Trk::d0] - perigee2->parameters()[Trk::d0];
134  double deltaZ0 = perigee1->parameters()[Trk::z0] - perigee2->parameters()[Trk::z0];
135  double deltaPhi0 = xAOD::P4Helpers::deltaPhi(perigee1->parameters()[Trk::phi0], perigee2->parameters()[Trk::phi0]);
136  double deltaTheta = perigee1->parameters()[Trk::theta] - perigee2->parameters()[Trk::theta];
137  double deltaQoverP = perigee1->parameters()[Trk::qOverP] - perigee2->parameters()[Trk::qOverP];
138 
139  // weight matrix for differences
140  const AmgSymMatrix(5)* cov1 = perigee1->covariance();
141  const AmgSymMatrix(5)* cov2 = perigee2->covariance();
142 
143  AmgSymMatrix(5) covariance;
144  covariance.setZero();
145 
146  if (m_trackQuery->isCombined(track1, ctx)) {
147  // FIXME: should take weighted difference etc -
148  // but this is anyway unreliable due to rounding errors
149  ATH_MSG_WARNING("track1 isCombined: results unreliable ");
150  } else if (m_trackQuery->isCombined(track2, ctx)) {
151  // FIXME: weighted difference etc
152  ATH_MSG_WARNING("track2 isCombined: results unreliable ");
153  }
154 
155  covariance = *cov1 + *cov2 + *m_alignmentUncertainty;
156  if (CA.innerMatchDOF < 5) {
157  deltaQoverP = 0.;
158  for (int i = 0; i != Trk::qOverP; ++i) {
159  covariance(i, Trk::qOverP) = covariance(Trk::qOverP, i) = 0.;
160  }
161  covariance(Trk::qOverP, Trk::qOverP) = 1.;
162  } else {
163  deltaQoverP /= Units::TeV;
164  for (int i = 0; i != Trk::qOverP; ++i) {
165  covariance(i, Trk::qOverP) /= Units::TeV;
166  covariance(Trk::qOverP, i) /= Units::TeV;
167  }
168  covariance(Trk::qOverP, Trk::qOverP) /= (Units::TeV * Units::TeV);
169  }
170 
171  // invert summed covariance
172  AmgMatrix(5, 5) weight = covariance.inverse().eval();
173 
174  AmgMatrix(5, 1) paramDifference;
175  paramDifference.setZero();
176  paramDifference(Trk::d0, 0) = deltaD0;
177  paramDifference(Trk::z0, 0) = deltaZ0;
178  paramDifference(Trk::phi0, 0) = deltaPhi0;
179  paramDifference(Trk::theta, 0) = deltaTheta;
180  paramDifference(Trk::qOverP, 0) = deltaQoverP;
181 
182  double matchChi2 = paramDifference.dot(weight * paramDifference);
183  CA.innerMatchChi2 = matchChi2;
184 
185  // probability of chi2
186  if (CA.innerMatchChi2 >= 0. && CA.innerMatchChi2 < 1000.) {
187  CA.innerMatchProbability = 1. - Genfun::CumulativeChiSquare(CA.innerMatchDOF)(CA.innerMatchChi2);
188  }
189 
190  // Protect against zero division
191  bool nonzerocov = true;
192  for (int k = 0; k < covariance.cols(); k++) {
193  if (covariance(k, k) == 0) nonzerocov = false;
194  }
195 
196  if (nonzerocov) {
197  // simple chi2 as sometimes correlations overestimated
198  CA.simpleChi2 = deltaD0 * deltaD0 / covariance(Trk::d0, Trk::d0) + deltaZ0 * deltaZ0 / covariance(Trk::z0, Trk::z0) +
199  deltaPhi0 * deltaPhi0 / covariance(Trk::phi0, Trk::phi0) +
200  deltaTheta * deltaTheta / covariance(Trk::theta, Trk::theta) +
201  deltaQoverP * deltaQoverP / covariance(Trk::qOverP, Trk::qOverP);
202 
203  if (CA.simpleChi2 + 5. < CA.innerMatchChi2) {
204  ATH_MSG_DEBUG("problem with matchChi2 " << CA.innerMatchChi2 << ", simpleChi2 " << CA.simpleChi2);
205  }
206  } else {
207  ATH_MSG_WARNING("Could not compute simpleChi2. Covariance matrix contains zeros");
208  }
209 
210  ATH_MSG_VERBOSE(std::setiosflags(std::ios::fixed)
211  << "matchDOF" << std::setw(2) << CA.innerMatchDOF << " matchChi2:" << std::setw(6) << std::setprecision(1)
212  << CA.innerMatchChi2 << " simpleChi2:" << std::setw(6) << std::setprecision(1) << CA.simpleChi2 << " pullD0 "
213  << std::setw(5) << std::setprecision(1) << deltaD0 / std::sqrt(covariance(0, 0)) << " pullZ0 " << std::setw(5)
214  << std::setprecision(1) << deltaZ0 / std::sqrt(covariance(1, 1)) << " pullPhi0 " << std::setw(5)
215  << std::setprecision(1) << deltaPhi0 / std::sqrt(covariance(2, 2)) << " pullTheta " << std::setw(5)
216  << std::setprecision(1) << deltaTheta / std::sqrt(covariance(3, 3)) << " pullQoverP " << std::setw(5)
217  << std::setprecision(1) << deltaQoverP / std::sqrt(covariance(4, 4)));
218 
219  return CA;
220  }

◆ shareOrigin()

bool Rec::MuonMatchQuality::shareOrigin ( const Trk::Track track1,
const Trk::Track track2 
) const
overridevirtual

IMuonMatchQuality interface: check the track perigee parameters are expressed at the same surface.

Implements Rec::IMuonMatchQuality.

Definition at line 107 of file MuonMatchQuality.cxx.

107  {
108  const Trk::Perigee* perigee1 = track1.perigeeParameters();
109  const Trk::Perigee* perigee2 = track2.perigeeParameters();
110 
111  return perigee1 && perigee2 && (*perigee1).associatedSurface().center() == (*perigee2).associatedSurface().center();
112  }

◆ simpleChi2()

double Rec::MuonMatchQuality::simpleChi2 ( const Trk::Track track1,
const Trk::Track track2,
const EventContext &  ctx 
) const
overridevirtual

IMuonMatchQuality interface: as inner match chiSquared but simplified to just use diagonal errors.

Implements Rec::IMuonMatchQuality.

Definition at line 113 of file MuonMatchQuality.cxx.

113  {
114  MuonMatchQuality::CacheAll CA = setCache(track1, track2, ctx);
115  return CA.simpleChi2;
116  }

◆ 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 DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ 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) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_alignmentUncertainty

std::unique_ptr<AmgSymMatrix(5)> Rec::MuonMatchQuality::m_alignmentUncertainty
private

Definition at line 97 of file MuonMatchQuality.h.

◆ 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_directionUncertainty

Gaudi::Property<double> Rec::MuonMatchQuality::m_directionUncertainty
private
Initial value:
{
this,
"ID_MS_DirectionUncertainty",
0.000001,
}

Definition at line 98 of file MuonMatchQuality.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_positionUncertainty

Gaudi::Property<double> Rec::MuonMatchQuality::m_positionUncertainty
private
Initial value:
{
this,
"ID_MS_PositionUncertainty",
0.01 * Units::mm,
}

Definition at line 104 of file MuonMatchQuality.h.

◆ m_tagTool

ToolHandle<MuonCombined::IMuonTrackTagTool> Rec::MuonMatchQuality::m_tagTool
private
Initial value:
{
this,
"TagTool",
"",
"Track tag tool",
}

Definition at line 82 of file MuonMatchQuality.h.

◆ m_trackQuery

ToolHandle<IMuonTrackQuery> Rec::MuonMatchQuality::m_trackQuery
private
Initial value:
{
this,
"TrackQuery",
"Rec::MuonTrackQuery/MuonTrackQuery",
"Track query tool",
}

Definition at line 89 of file MuonMatchQuality.h.

◆ 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:
Rec::MuonMatchQuality::innerMatchDOF
int innerMatchDOF(const Trk::Track &track1, const Trk::Track &track2) const override
IMuonMatchQuality interface: degrees of freedom for chi2 match at IP.
Definition: MuonMatchQuality.cxx:51
xAOD::EgammaParameters::deltaPhi0
@ deltaPhi0
difference between the cluster phi (presampler) and the eta of the track extrapolated to the presampl...
Definition: EgammaEnums.h:193
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
InDetAccessor::phi0
@ phi0
Definition: InDetAccessor.h:33
theta
Scalar theta() const
theta method
Definition: AmgMatrixBasePlugin.h:71
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
Trk::z0
@ z0
Definition: ParamDefs.h:70
xAOD::P4Helpers::deltaPhi
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
Definition: xAODP4Helpers.h:69
python.SystemOfUnits.TeV
int TeV
Definition: SystemOfUnits.py:158
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
InDetAccessor::qOverP
@ qOverP
perigee
Definition: InDetAccessor.h:35
Rec::MuonMatchQuality::m_positionUncertainty
Gaudi::Property< double > m_positionUncertainty
Definition: MuonMatchQuality.h:104
AmgSymMatrix
#define AmgSymMatrix(dim)
Definition: EventPrimitives.h:52
AmgMatrix
#define AmgMatrix(rows, cols)
Definition: EventPrimitives.h:51
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:200
Rec::MuonMatchQuality::setCache
CacheAll setCache(const Trk::Track &track1, const Trk::Track &track2, const EventContext &ctx) const
Definition: MuonMatchQuality.cxx:119
Rec::MuonMatchQuality::outerMatchChi2
double outerMatchChi2(const Trk::Track &track1, const Trk::Track &track2, const EventContext &ctx) const override
IMuonMatchQuality interface: match chiSquared between two tracks expressed at first muon spectrometer...
Definition: MuonMatchQuality.cxx:81
Rec::MuonMatchQuality::m_tagTool
ToolHandle< MuonCombined::IMuonTrackTagTool > m_tagTool
Definition: MuonMatchQuality.h:82
Trk::ParametersT::associatedSurface
virtual const S & associatedSurface() const override final
Access to the Surface method.
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:92
Trk::theta
@ theta
Definition: ParamDefs.h:72
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TRT::Track::d0
@ d0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:62
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
athena.CA
CA
Definition: athena.py:98
TRT::Track::z0
@ z0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:63
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
Rec::MuonMatchQuality::m_alignmentUncertainty
std::unique_ptr< AmgSymMatrix(5)> m_alignmentUncertainty
Definition: MuonMatchQuality.h:97
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
Trk::Track::perigeeParameters
const Perigee * perigeeParameters() const
return Perigee.
Definition: Tracking/TrkEvent/TrkTrack/src/Track.cxx:163
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
Trk::d0
@ d0
Definition: ParamDefs.h:69
Rec::MuonMatchQuality::m_trackQuery
ToolHandle< IMuonTrackQuery > m_trackQuery
Definition: MuonMatchQuality.h:89
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
a
TList * a
Definition: liststreamerinfos.cxx:10
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
Trk::qOverP
@ qOverP
perigee
Definition: ParamDefs.h:73
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:569
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
dot
Definition: dot.py:1
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
Rec::MuonMatchQuality::outerMatchProbability
double outerMatchProbability(const Trk::Track &track1, const Trk::Track &track2, const EventContext &ctx) const override
IMuonMatchQuality interface: match probability for chi2 match at first MS hit.
Definition: MuonMatchQuality.cxx:92
Rec::MuonMatchQuality::innerMatchChi2
double innerMatchChi2(const Trk::Track &track1, const Trk::Track &track2, const EventContext &ctx) const override
IMuonMatchQuality interface: match chiSquared between two tracks expressed at same inner (IP) surface...
Definition: MuonMatchQuality.cxx:45
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
Trk::phi0
@ phi0
Definition: ParamDefs.h:71
Rec::MuonMatchQuality::m_directionUncertainty
Gaudi::Property< double > m_directionUncertainty
Definition: MuonMatchQuality.h:98
fitman.k
k
Definition: fitman.py:528