ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Muon::MuonErrorOptimisationTool Class Reference

#include <MuonErrorOptimisationTool.h>

Inheritance diagram for Muon::MuonErrorOptimisationTool:
Collaboration diagram for Muon::MuonErrorOptimisationTool:

Public Member Functions

 MuonErrorOptimisationTool (const std::string &ty, const std::string &na, const IInterface *pa)
 Constructor with parameters: More...
 
virtual ~MuonErrorOptimisationTool ()=default
 Destructor: More...
 
virtual StatusCode initialize () override
 
virtual StatusCode finalize () override
 
virtual std::unique_ptr< Trk::TrackoptimiseErrors (Trk::Track &track, const EventContext &ctx) const override
 optimise the error strategy used for the track 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 ()
 access to tool interface 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

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

ServiceHandle< IMuonEDMHelperSvcm_edmHelperSvc
 
PublicToolHandle< MuonEDMPrinterToolm_printer
 
ToolHandle< Trk::ITrackSummaryHelperToolm_trackSummaryTool
 
ToolHandle< IMuonRefitToolm_refitTool {this, "RefitTool", "Muon::MuonRefitTool/MuonRefitTool"}
 
Gaudi::Property< double > m_chi2NdofCutRefit {this, "Chi2NDofCutRefit", 5.}
 
Gaudi::Property< double > m_lowPtThreshold {this, "LowPtThreshold", 5000.}
 
std::atomic_uint m_nrefitAll {0}
 
std::atomic_uint m_nrefitAllLowPt {0}
 
std::atomic_uint m_nrefitOk {0}
 
std::atomic_uint m_nrefit {0}
 
std::atomic_uint m_nrefitLowPt {0}
 
std::atomic_uint m_nrefitPrecise {0}
 
std::atomic_uint m_nrefitPreciseLowPt {0}
 
std::atomic_uint m_nbetterPreciseFit {0}
 
std::atomic_uint m_nbetterFit {0}
 
IMuonRefitTool::Settings m_refitSettings
 
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 19 of file MuonErrorOptimisationTool.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

◆ MuonErrorOptimisationTool()

Muon::MuonErrorOptimisationTool::MuonErrorOptimisationTool ( const std::string &  ty,
const std::string &  na,
const IInterface *  pa 
)

Constructor with parameters:

Definition at line 17 of file MuonErrorOptimisationTool.cxx.

17  :
18  AthAlgTool(ty, na, pa) {
19  declareProperty("PrepareForFit", m_refitSettings.prepareForFit = true);
20  declareProperty("RecreateStartingParameters", m_refitSettings.recreateStartingParameters = true);
21  declareProperty("UpdateErrors", m_refitSettings.updateErrors = true);
22  declareProperty("RemoveOutliers", m_refitSettings.removeOutliers = false);
23  declareProperty("RemoveOtherSectors", m_refitSettings.removeOtherSectors = false);
24  declareProperty("RemoveBarrelEndcapOverlap", m_refitSettings.removeBarrelEndcapOverlap = false);
25  declareProperty("RemoveBEE", m_refitSettings.removeBEE = false);
26  declareProperty("DeweightOtherSectors", m_refitSettings.deweightOtherSectors = true);
27 
28  declareInterface<IMuonErrorOptimisationTool>(this);
29  }

◆ ~MuonErrorOptimisationTool()

virtual Muon::MuonErrorOptimisationTool::~MuonErrorOptimisationTool ( )
virtualdefault

Destructor:

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

◆ finalize()

StatusCode Muon::MuonErrorOptimisationTool::finalize ( )
overridevirtual

Definition at line 42 of file MuonErrorOptimisationTool.cxx.

42  {
43  if (m_nrefitAll > 0) {
44  double scale = 1. / m_nrefitAll;
45  double scaleLowPt = m_nrefitAllLowPt > 0 ? 1. / m_nrefitAllLowPt : 1.;
46  ATH_MSG_INFO(" Number of all refits " << m_nrefitAll << " fraction of total calls "
47  << scale * m_nrefitAll);
48  ATH_MSG_INFO(" Number of refits with precise errors " << m_nrefitPrecise << " fraction of total calls "
49  << scale * m_nrefitPrecise);
50  ATH_MSG_INFO(" Number of refits with large errors " << m_nrefit << " fraction of total calls " << scale * m_nrefit);
51  ATH_MSG_INFO(" Number of all refits (low pt) " << m_nrefitAllLowPt << " fraction of total calls "
52  << scaleLowPt * m_nrefitAllLowPt);
53  ATH_MSG_INFO(" Number of refits with precise errors (low pt) " << m_nrefitPreciseLowPt << " fraction of total calls "
54  << scaleLowPt * m_nrefitPreciseLowPt);
55  ATH_MSG_INFO(" Number of refits with large errors (low pt) " << m_nrefitLowPt << " fraction of total calls "
56  << scaleLowPt * m_nrefitLowPt);
57  ATH_MSG_INFO(" Precise refit bad but better than input " << m_nbetterPreciseFit << " fraction of total calls "
59  ATH_MSG_INFO(" Large error refit bad but better than input " << m_nbetterFit << " fraction of total calls "
60  << scale * m_nbetterFit);
61  }
62 
63  return StatusCode::SUCCESS;
64  }

◆ initialize()

StatusCode Muon::MuonErrorOptimisationTool::initialize ( )
overridevirtual

Definition at line 31 of file MuonErrorOptimisationTool.cxx.

31  {
32  ATH_MSG_INFO("Initializing MuonErrorOptimisationTool");
33 
34  ATH_CHECK(m_printer.retrieve());
35  ATH_CHECK(m_edmHelperSvc.retrieve());
36  ATH_CHECK(m_trackSummaryTool.retrieve());
37  if (!m_refitTool.empty()) ATH_CHECK(m_refitTool.retrieve());
38 
39  return StatusCode::SUCCESS;
40  }

◆ 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& Muon::IMuonErrorOptimisationTool::interfaceID ( )
inlinestaticinherited

access to tool interface

Definition at line 20 of file IMuonErrorOptimisationTool.h.

20  {
21  static const InterfaceID IID_IMuonErrorOptimisationTool("Muon::IMuonErrorOptimisationTool", 1, 0);
22  return IID_IMuonErrorOptimisationTool;
23  }

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

◆ optimiseErrors()

std::unique_ptr< Trk::Track > Muon::MuonErrorOptimisationTool::optimiseErrors ( Trk::Track track,
const EventContext &  ctx 
) const
overridevirtual

optimise the error strategy used for the track

Implements Muon::IMuonErrorOptimisationTool.

Definition at line 66 of file MuonErrorOptimisationTool.cxx.

66  {
67  if (m_refitTool.empty()) return nullptr;
68  const Trk::Perigee* pp = track.perigeeParameters();
69  bool isLowPt = false;
70  if (pp && pp->momentum().mag() < m_lowPtThreshold) isLowPt = true;
71  if (isLowPt)
73  else
74  ++m_nrefitAll;
75 
76  std::unique_ptr<Trk::Track> result1;
77  std::unique_ptr<Trk::Track> result2;
78 
79  // first refit with precise errors
80  IMuonRefitTool::Settings settings = m_refitSettings;
81  settings.broad = false;
82  std::unique_ptr<Trk::Track> refittedTrack = m_refitTool->refit(track, ctx, &settings);
83  if (refittedTrack) {
84  // check whether it is ok
85  if (!m_edmHelperSvc->goodTrack(*refittedTrack, m_chi2NdofCutRefit)) {
86  ATH_MSG_VERBOSE("Precise fit bad " << std::endl
87  << m_printer->print(*refittedTrack) << std::endl
88  << m_printer->printStations(*refittedTrack));
89 
90  // if not delete track
91  result1.swap(refittedTrack);
92  } else {
93  ATH_MSG_VERBOSE("Precise fit ok " << std::endl
94  << m_printer->print(*refittedTrack) << std::endl
95  << m_printer->printStations(*refittedTrack));
96  if (isLowPt)
98  else
100  }
101  } else {
102  ATH_MSG_VERBOSE("Precise fit failed");
103  }
104 
105  // only do second fit if first is not ok
106  if (!refittedTrack) {
107  // second refit track
108  settings.broad = true;
109  refittedTrack = m_refitTool->refit(track, ctx, &settings);
110  if (refittedTrack) {
111  // check whether it is ok
112  if (!m_edmHelperSvc->goodTrack(*refittedTrack, m_chi2NdofCutRefit)) {
113  ATH_MSG_VERBOSE("Loose fit bad " << std::endl
114  << m_printer->print(*refittedTrack) << std::endl
115  << m_printer->printStations(*refittedTrack));
116  // if not delete track
117  result2.swap(refittedTrack);
118  } else {
119  ATH_MSG_VERBOSE("Loose fit ok " << std::endl
120  << m_printer->print(*refittedTrack) << std::endl
121  << m_printer->printStations(*refittedTrack));
122  if (isLowPt)
123  ++m_nrefitLowPt;
124  else
125  ++m_nrefit;
126  ++m_nrefit;
127  }
128  } else {
129  ATH_MSG_VERBOSE("Loose fit failed");
130  }
131  }
132 
133  // if failed to refit or refit returned original track, return 0
134  if (!refittedTrack || *refittedTrack->perigeeParameters() == *track.perigeeParameters()) {
135  // check if any refit succeeded
136  if (!result1 && !result2) return nullptr;
137 
138  // now compare chi2
139  const Trk::FitQuality* fq0 = track.fitQuality();
140  const Trk::FitQuality* fq1 = result1 ? result1->fitQuality() : nullptr;
141  const Trk::FitQuality* fq2 = result2 ? result2->fitQuality() : nullptr;
142 
143  bool doSelection = true;
144 
145  // ensure that each track if present has a fit quality
146  if (!fq0 || (result1 && !fq1) || (result2 && !fq2)) {
147  ATH_MSG_WARNING("track without fit quality after refit");
148  doSelection = false;
149  // chech that ndof didn't change
150  } else if ((fq1 && fq0->numberDoF() != fq1->numberDoF()) || (fq2 && fq0->numberDoF() != fq2->numberDoF())) {
151  doSelection = false;
152  // ugly bit of code to get the hit counts for the three tracks
153  int nhits0 = -1;
154  Trk::TrackSummary* summary0 = track.trackSummary();
155  Trk::MuonTrackSummary* muonSummary0 = nullptr;
156  if (summary0) {
157  if (summary0->muonTrackSummary()) {
158  muonSummary0 = summary0->muonTrackSummary();
159  if (muonSummary0) nhits0 = muonSummary0->netaHits() + muonSummary0->nphiHits();
160  } else {
161  Trk::TrackSummary tmpSum(*summary0);
162  m_trackSummaryTool->addDetailedTrackSummary(track, tmpSum);
163  muonSummary0 = tmpSum.muonTrackSummary();
164  if (muonSummary0) nhits0 = muonSummary0->netaHits() + muonSummary0->nphiHits();
165  }
166  } else {
167  Trk::TrackSummary tmpSummary;
168  m_trackSummaryTool->addDetailedTrackSummary(track, tmpSummary);
169  if (tmpSummary.muonTrackSummary()) muonSummary0 = tmpSummary.muonTrackSummary();
170  if (muonSummary0) nhits0 = muonSummary0->netaHits() + muonSummary0->nphiHits();
171  }
172 
173  int nhits1 = -1;
174  Trk::TrackSummary* summary1 = track.trackSummary();
175  Trk::MuonTrackSummary* muonSummary1 = nullptr;
176  if (summary1) {
177  if (summary1->muonTrackSummary())
178  muonSummary1 = summary1->muonTrackSummary();
179  else {
180  Trk::TrackSummary* tmpSum = summary1;
181  if (tmpSum) m_trackSummaryTool->addDetailedTrackSummary(track, *tmpSum);
182  if (tmpSum->muonTrackSummary()) muonSummary1 = tmpSum->muonTrackSummary();
183  }
184  if (muonSummary1) nhits1 = muonSummary1->netaHits() + muonSummary1->nphiHits();
185  } else {
186  Trk::TrackSummary tmpSummary;
187  m_trackSummaryTool->addDetailedTrackSummary(track, tmpSummary);
188  if (tmpSummary.muonTrackSummary()) muonSummary1 = tmpSummary.muonTrackSummary();
189  if (muonSummary1) nhits1 = muonSummary1->netaHits() + muonSummary1->nphiHits();
190  }
191 
192  int nhits2 = -1;
193  Trk::TrackSummary* summary2 = track.trackSummary();
194  Trk::MuonTrackSummary* muonSummary2 = nullptr;
195  if (summary2) {
196  if (summary2->muonTrackSummary())
197  muonSummary2 = summary2->muonTrackSummary();
198  else {
199  Trk::TrackSummary* tmpSum = summary2;
200  if (tmpSum) m_trackSummaryTool->addDetailedTrackSummary(track, *tmpSum);
201  if (tmpSum->muonTrackSummary()) muonSummary2 = tmpSum->muonTrackSummary();
202  }
203  if (muonSummary2) nhits2 = muonSummary2->netaHits() + muonSummary2->nphiHits();
204  } else {
205  Trk::TrackSummary tmpSummary;
206  m_trackSummaryTool->addDetailedTrackSummary(track, tmpSummary);
207  if (tmpSummary.muonTrackSummary()) muonSummary2 = tmpSummary.muonTrackSummary();
208  if (muonSummary2) nhits2 = muonSummary2->netaHits() + muonSummary2->nphiHits();
209  }
210 
211  if (nhits0 != -1 && nhits1 != -1 && nhits2 != -1) {
212  if (nhits0 == nhits1 && nhits0 == nhits2) doSelection = true;
213  }
214 
215  if (!doSelection) ATH_MSG_WARNING("Ndof changed after refit");
216  }
217 
218  if (doSelection) {
219  // check whether the chi2 after refit is smaller than original even if above threshold. If so use refit
220  bool firstIsBest = true;
221  if (!fq1 && fq2) firstIsBest = false;
222  if (fq1 && fq2) firstIsBest = fq1->chiSquared() < fq2->chiSquared();
223 
224  double chi2Refit = firstIsBest ? fq1->chiSquared() : fq2->chiSquared();
225  if (chi2Refit < fq0->chiSquared()) {
226  if (firstIsBest) {
227  ATH_MSG_DEBUG("Keeping precise refit");
229  return result1;
230  } else {
231  ATH_MSG_DEBUG("Keeping loose refit");
232  ++m_nbetterFit;
233  return result2;
234  }
235  }
236  }
237  return nullptr;
238  }
239  return refittedTrack;
240  }

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

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

Gaudi::Property<double> Muon::MuonErrorOptimisationTool::m_chi2NdofCutRefit {this, "Chi2NDofCutRefit", 5.}
private

Definition at line 43 of file MuonErrorOptimisationTool.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_edmHelperSvc

ServiceHandle<IMuonEDMHelperSvc> Muon::MuonErrorOptimisationTool::m_edmHelperSvc
private
Initial value:
{this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
"Handle to the service providing the IMuonEDMHelperSvc interface"}

Definition at line 34 of file MuonErrorOptimisationTool.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_lowPtThreshold

Gaudi::Property<double> Muon::MuonErrorOptimisationTool::m_lowPtThreshold {this, "LowPtThreshold", 5000.}
private

Definition at line 44 of file MuonErrorOptimisationTool.h.

◆ m_nbetterFit

std::atomic_uint Muon::MuonErrorOptimisationTool::m_nbetterFit {0}
mutableprivate

Definition at line 53 of file MuonErrorOptimisationTool.h.

◆ m_nbetterPreciseFit

std::atomic_uint Muon::MuonErrorOptimisationTool::m_nbetterPreciseFit {0}
mutableprivate

Definition at line 52 of file MuonErrorOptimisationTool.h.

◆ m_nrefit

std::atomic_uint Muon::MuonErrorOptimisationTool::m_nrefit {0}
mutableprivate

Definition at line 48 of file MuonErrorOptimisationTool.h.

◆ m_nrefitAll

std::atomic_uint Muon::MuonErrorOptimisationTool::m_nrefitAll {0}
mutableprivate

Definition at line 45 of file MuonErrorOptimisationTool.h.

◆ m_nrefitAllLowPt

std::atomic_uint Muon::MuonErrorOptimisationTool::m_nrefitAllLowPt {0}
mutableprivate

Definition at line 46 of file MuonErrorOptimisationTool.h.

◆ m_nrefitLowPt

std::atomic_uint Muon::MuonErrorOptimisationTool::m_nrefitLowPt {0}
mutableprivate

Definition at line 49 of file MuonErrorOptimisationTool.h.

◆ m_nrefitOk

std::atomic_uint Muon::MuonErrorOptimisationTool::m_nrefitOk {0}
mutableprivate

Definition at line 47 of file MuonErrorOptimisationTool.h.

◆ m_nrefitPrecise

std::atomic_uint Muon::MuonErrorOptimisationTool::m_nrefitPrecise {0}
mutableprivate

Definition at line 50 of file MuonErrorOptimisationTool.h.

◆ m_nrefitPreciseLowPt

std::atomic_uint Muon::MuonErrorOptimisationTool::m_nrefitPreciseLowPt {0}
mutableprivate

Definition at line 51 of file MuonErrorOptimisationTool.h.

◆ m_printer

PublicToolHandle<MuonEDMPrinterTool> Muon::MuonErrorOptimisationTool::m_printer
private
Initial value:
{this, "EDMPrinter", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool",
"helper to nicely print out tracks"}

Definition at line 37 of file MuonErrorOptimisationTool.h.

◆ m_refitSettings

IMuonRefitTool::Settings Muon::MuonErrorOptimisationTool::m_refitSettings
private

Definition at line 55 of file MuonErrorOptimisationTool.h.

◆ m_refitTool

ToolHandle<IMuonRefitTool> Muon::MuonErrorOptimisationTool::m_refitTool {this, "RefitTool", "Muon::MuonRefitTool/MuonRefitTool"}
private

Definition at line 41 of file MuonErrorOptimisationTool.h.

◆ m_trackSummaryTool

ToolHandle<Trk::ITrackSummaryHelperTool> Muon::MuonErrorOptimisationTool::m_trackSummaryTool
private
Initial value:
{this, "TrackSummaryTool",
"Muon::MuonTrackSummaryHelperTool/MuonTrackSummaryHelperTool"}

Definition at line 39 of file MuonErrorOptimisationTool.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:
Trk::Track::fitQuality
const FitQuality * fitQuality() const
return a pointer to the fit quality const-overload
Muon::IMuonRefitTool::Settings::recreateStartingParameters
bool recreateStartingParameters
prepare the input track for a refit
Definition: IMuonRefitTool.h:47
Muon::MuonErrorOptimisationTool::m_nbetterFit
std::atomic_uint m_nbetterFit
Definition: MuonErrorOptimisationTool.h:53
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< AlgTool > >::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
Muon::IMuonRefitTool::Settings::broad
bool broad
Definition: IMuonRefitTool.h:39
Muon::IMuonRefitTool::Settings::removeBarrelEndcapOverlap
bool removeBarrelEndcapOverlap
all trigger eta hits are turned into outliers
Definition: IMuonRefitTool.h:52
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
Muon::MuonErrorOptimisationTool::m_edmHelperSvc
ServiceHandle< IMuonEDMHelperSvc > m_edmHelperSvc
Definition: MuonErrorOptimisationTool.h:34
Muon::MuonErrorOptimisationTool::m_trackSummaryTool
ToolHandle< Trk::ITrackSummaryHelperTool > m_trackSummaryTool
Definition: MuonErrorOptimisationTool.h:39
Muon::MuonErrorOptimisationTool::m_nbetterPreciseFit
std::atomic_uint m_nbetterPreciseFit
Definition: MuonErrorOptimisationTool.h:52
Muon::IMuonRefitTool::Settings::removeOtherSectors
bool removeOtherSectors
recreate starting parameters by extrapolating from first hit on track
Definition: IMuonRefitTool.h:48
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Trk::MuonTrackSummary::netaHits
unsigned int netaHits() const
number of eta hits on the track
Definition: MuonTrackSummary.cxx:18
Muon::MuonErrorOptimisationTool::m_nrefitAllLowPt
std::atomic_uint m_nrefitAllLowPt
Definition: MuonErrorOptimisationTool.h:46
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
Muon::MuonErrorOptimisationTool::m_nrefitAll
std::atomic_uint m_nrefitAll
Definition: MuonErrorOptimisationTool.h:45
yodamerge_tmp.scale
scale
Definition: yodamerge_tmp.py:138
Muon::MuonErrorOptimisationTool::m_lowPtThreshold
Gaudi::Property< double > m_lowPtThreshold
Definition: MuonErrorOptimisationTool.h:44
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
Muon::MuonErrorOptimisationTool::m_nrefitLowPt
std::atomic_uint m_nrefitLowPt
Definition: MuonErrorOptimisationTool.h:49
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
Muon::IMuonRefitTool::Settings::removeOutliers
bool removeOutliers
toogle on/off refit of the track
Definition: IMuonRefitTool.h:41
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Trk::MuonTrackSummary
Detailed track summary for the muon system Give access to hit counts per chamber.
Definition: MuonTrackSummary.h:26
Trk::FitQuality
Class to represent and store fit qualities from track reconstruction in terms of and number of degre...
Definition: FitQuality.h:97
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
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
Muon::MuonErrorOptimisationTool::m_nrefitPreciseLowPt
std::atomic_uint m_nrefitPreciseLowPt
Definition: MuonErrorOptimisationTool.h:51
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
Trk::TrackSummary
A summary of the information contained by a track.
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:287
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Muon::IMuonRefitTool::Settings::prepareForFit
bool prepareForFit
update the errors of the trigger hits
Definition: IMuonRefitTool.h:46
Trk::MuonTrackSummary::nphiHits
unsigned int nphiHits() const
number of phi hits on the track
Definition: MuonTrackSummary.cxx:32
Muon::MuonErrorOptimisationTool::m_refitTool
ToolHandle< IMuonRefitTool > m_refitTool
Definition: MuonErrorOptimisationTool.h:41
IDTPM::chiSquared
float chiSquared(const U &p)
Definition: TrackParametersHelper.h:128
Muon::MuonErrorOptimisationTool::m_nrefitPrecise
std::atomic_uint m_nrefitPrecise
Definition: MuonErrorOptimisationTool.h:50
a
TList * a
Definition: liststreamerinfos.cxx:10
h
Muon::MuonErrorOptimisationTool::m_refitSettings
IMuonRefitTool::Settings m_refitSettings
Definition: MuonErrorOptimisationTool.h:55
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Muon::IMuonRefitTool::Settings::updateErrors
bool updateErrors
recalibrate the hits
Definition: IMuonRefitTool.h:44
Muon::IMuonRefitTool::Settings::removeBEE
bool removeBEE
turn all hits in the barrel/endcap part of the track with least hits into outliers
Definition: IMuonRefitTool.h:53
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
Trk::FitQuality::chiSquared
double chiSquared() const
returns the of the overall track fit
Definition: FitQuality.h:56
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
Trk::FitQuality::numberDoF
int numberDoF() const
returns the number of degrees of freedom of the overall track or vertex fit as integer
Definition: FitQuality.h:60
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
Muon::MuonErrorOptimisationTool::m_chi2NdofCutRefit
Gaudi::Property< double > m_chi2NdofCutRefit
Definition: MuonErrorOptimisationTool.h:43
Trk::TrackSummary::muonTrackSummary
const MuonTrackSummary * muonTrackSummary() const
returns a pointer to the MuonTrackSummary if available
Muon::MuonErrorOptimisationTool::m_printer
PublicToolHandle< MuonEDMPrinterTool > m_printer
Definition: MuonErrorOptimisationTool.h:37
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
Muon::IMuonRefitTool::Settings::deweightOtherSectors
bool deweightOtherSectors
remove all hits in sectors that are not the main sector
Definition: IMuonRefitTool.h:49
fitman.k
k
Definition: fitman.py:528
Muon::MuonErrorOptimisationTool::m_nrefit
std::atomic_uint m_nrefit
Definition: MuonErrorOptimisationTool.h:48