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

Tool to extrapolate tracks in the muon system to the IP. More...

#include <ExtrapolateMuonToIPTool.h>

Inheritance diagram for ExtrapolateMuonToIPTool:
Collaboration diagram for ExtrapolateMuonToIPTool:

Public Member Functions

 ExtrapolateMuonToIPTool (const std::string &, const std::string &, const IInterface *)
 Constructors. More...
 
virtual ~ExtrapolateMuonToIPTool ()=default
 Destructor. More...
 
virtual StatusCode initialize () override
 initialize More...
 
virtual StatusCode finalize () override
 initialize More...
 
std::unique_ptr< TrackCollectionextrapolate (const TrackCollection &muonTracks, const EventContext &ctx) const override
 extrapolate all tracks in the track collection to the IP More...
 
std::unique_ptr< Trk::Trackextrapolate (const Trk::Track &muonTrack, const EventContext &ctx) const override
 extrapolate a muon track the IP, will return 0 if the back extrapolation fails 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 ()
 

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

const Trk::TrackParametersfindMeasuredParametersClosestToIP (const Trk::Track &track) const
 find measured parameters closest to IP to start back extrapolation More...
 
std::unique_ptr< const Trk::PerigeecreatePerigee (const Trk::TrackParameters &pars, 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< Trk::IExtrapolatorm_extrapolator
 Extrapolator. More...
 
ToolHandle< Trk::IExtrapolatorm_muonExtrapolator
 MuonExtrapolator. More...
 
PublicToolHandle< Muon::MuonEDMPrinterToolm_printer
 muon EDM printer tool More...
 
ToolHandle< Trk::ITrackSummaryToolm_trackSummary
 
ServiceHandle< Muon::IMuonEDMHelperSvcm_edmHelperSvc
 muon EDM helper tool More...
 
std::atomic_uint m_nextrapolations {0}
 
std::atomic_uint m_failedClosestPars {0}
 
std::atomic_uint m_failedExtrapolationLowMom {0}
 
std::atomic_uint m_failedExtrapolationHighMom {0}
 
std::atomic_uint m_failedPerigeeCreation {0}
 
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

Tool to extrapolate tracks in the muon system to the IP.

Internally uses IMuonTrackThroughCalo for the back extrapolation.

Author
Camilla Maiani

Definition at line 25 of file ExtrapolateMuonToIPTool.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

◆ ExtrapolateMuonToIPTool()

ExtrapolateMuonToIPTool::ExtrapolateMuonToIPTool ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Constructors.

Definition at line 11 of file ExtrapolateMuonToIPTool.cxx.

11  : AthAlgTool(t, n, p) {
12  declareInterface<Muon::IMuonTrackExtrapolationTool>(this);
13 }

◆ ~ExtrapolateMuonToIPTool()

virtual ExtrapolateMuonToIPTool::~ExtrapolateMuonToIPTool ( )
virtualdefault

Destructor.

Member Function Documentation

◆ createPerigee()

std::unique_ptr< const Trk::Perigee > ExtrapolateMuonToIPTool::createPerigee ( const Trk::TrackParameters pars,
const EventContext &  ctx 
) const
private

Definition at line 222 of file ExtrapolateMuonToIPTool.cxx.

223  {
224  std::unique_ptr<const Trk::Perigee> perigee;
225  if (m_muonExtrapolator.empty()) { return perigee; }
226  Trk::PerigeeSurface persurf(pars.position());
227  const Trk::TrackParameters* exPars = m_muonExtrapolator->extrapolateDirectly(ctx, pars, persurf).release();
228  const Trk::Perigee* pp = dynamic_cast<const Trk::Perigee*>(exPars);
229  if (!pp) {
230  ATH_MSG_WARNING(" Extrapolation to Perigee surface did not return a perigee!! ");
231  delete exPars;
232  return perigee;
233  }
234  perigee.reset(pp);
235  return perigee;
236 }

◆ 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

◆ extrapolate() [1/2]

std::unique_ptr< TrackCollection > ExtrapolateMuonToIPTool::extrapolate ( const TrackCollection muonTracks,
const EventContext &  ctx 
) const
overridevirtual

extrapolate all tracks in the track collection to the IP

Parameters
muonTracksthe track collection with muon tracks to be extrapolated to the IP
Returns
TrackCollection with the tracks at the IP, ownership is passed to the caller

Implements Muon::IMuonTrackExtrapolationTool.

Definition at line 43 of file ExtrapolateMuonToIPTool.cxx.

43  {
44  std::unique_ptr<TrackCollection> extrapolateTracks = std::make_unique<TrackCollection>();
45  extrapolateTracks->reserve(muonTracks.size());
46 
47  ATH_MSG_DEBUG("Extrapolated tracks: " << muonTracks.size());
48 
49  // loop over muon tracks and extrapolate them to the IP
50  for (const Trk::Track* trk : muonTracks) {
51  std::unique_ptr<Trk::Track> extrapolateTrack = extrapolate(*trk, ctx);
52  if (!extrapolateTrack) {
53  ATH_MSG_DEBUG("Extrapolation of muon to IP failed");
54  continue;
55  }
56 
57  ATH_MSG_DEBUG("Extrapolated track " << m_printer->print(*extrapolateTrack));
58 
59  extrapolateTracks->push_back(std::move(extrapolateTrack));
60  }
61  return extrapolateTracks;
62 }

◆ extrapolate() [2/2]

std::unique_ptr< Trk::Track > ExtrapolateMuonToIPTool::extrapolate ( const Trk::Track muonTrack,
const EventContext &  ctx 
) const
overridevirtual

extrapolate a muon track the IP, will return 0 if the back extrapolation fails

Parameters
muonTrackthe moun inpu track
Returns
Track at the IP, ownership is passed to the caller, return zero if back extrapolation failed

Implements Muon::IMuonTrackExtrapolationTool.

Definition at line 64 of file ExtrapolateMuonToIPTool.cxx.

64  {
65  const Trk::TrackInfo& trackInfo = track.info();
68  ATH_MSG_DEBUG("Extrapolating track " << m_printer->print(track) << " type " << particleType << std::endl
69  << m_printer->printStations(track));
70 
71  if (!closestPars) {
72  ATH_MSG_WARNING("Failed to find closest parameters ");
74  return nullptr;
75  }
76 
77  {
78  // get perigee parameters
79  const Trk::Perigee* perigee = track.perigeeParameters();
80 
81  if (!perigee) {
82  ATH_MSG_WARNING("Muon Track without perigee, skipping ");
83  } else {
84  ATH_MSG_DEBUG("Closest parameters " << m_printer->print(*closestPars) << endmsg << " perigee "
85  << m_printer->print(*perigee));
86  }
87  }
88 
89  double dirPosProduct = closestPars->position().dot(closestPars->momentum());
90  Trk::PropDirection propDir = dirPosProduct < 0. ? Trk::alongMomentum : Trk::oppositeMomentum;
91 
92  if (propDir == Trk::alongMomentum) {
93  ATH_MSG_DEBUG(" scalar product " << dirPosProduct << " extrapolating "
94  << " along momentum");
95  } else {
96  ATH_MSG_DEBUG(" scalar product " << dirPosProduct << " extrapolating "
97  << " opposite momentum");
98  }
99 
100  Trk::PerigeeSurface perigeeSurface(Amg::Vector3D(0., 0., 0.));
101  // extrapolate back to IP
102  std::unique_ptr<const Trk::TrackParameters> ipPars{m_extrapolator->extrapolate(ctx, *closestPars, perigeeSurface, propDir, false)};
103  if (!ipPars) {
104  // if extrapolation failed go in other direction
106  ipPars = m_extrapolator->extrapolate(ctx, *closestPars, perigeeSurface, propDir, false, particleType);
107 
108  if (propDir == Trk::alongMomentum) {
109  ATH_MSG_DEBUG(" retrying opposite momentum extrapolating "
110  << " along momentum");
111  } else {
112  ATH_MSG_DEBUG(" retrying opposite momentum extrapolating "
113  << " opposite momentum");
114  }
115 
116  if (!ipPars) {
117  if (closestPars->momentum().mag() > 5000.)
119  else
121  return nullptr;
122  }
123  }
124 
125  // create the new track
126  // create new perigee
127  std::unique_ptr<const Trk::Perigee> ipPerigee_unique;
128  const Trk::Perigee* ipPerigee = dynamic_cast<const Trk::Perigee*>(ipPars.get());
129 
130  if (!ipPerigee) {
131  //cppcheck-suppress nullPointerRedundantCheck
132  ipPerigee_unique = createPerigee(*ipPars, ctx);
133  ipPerigee = ipPerigee_unique.get();
134  }
135 
136  if (!ipPerigee) {
137  ATH_MSG_WARNING("Failed to create perigee for extrapolate track, skipping ");
139  return nullptr;
140  }
141 
142  // create new TSOS DataVector and reserve enough space to fit all old TSOS + one new TSOS
143  const Trk::TrackStates* oldTSOT = track.trackStateOnSurfaces();
144  auto trackStateOnSurfaces = std::make_unique<Trk::TrackStates>();
145  unsigned int newSize = oldTSOT->size() + 1;
146  trackStateOnSurfaces->reserve(newSize);
147 
148  Amg::Vector3D perDir = ipPerigee->momentum().unit();
149 
150  for (const Trk::TrackStateOnSurface* tsit : *oldTSOT) {
151  // remove old perigee if we didn't start from a parameter in the muon system
152  if (tsit->type(Trk::TrackStateOnSurface::Perigee)) continue;
153 
154  const Trk::TrackParameters* pars = tsit->trackParameters();
155  if (!pars) continue;
156 
157  if (ipPerigee) {
158  double distanceOfPerigeeToCurrent = perDir.dot(pars->position() - ipPerigee->position());
159 
160  if (distanceOfPerigeeToCurrent > 0.) {
161  std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern;
162  typePattern.set(Trk::TrackStateOnSurface::Perigee);
163  trackStateOnSurfaces->push_back(
164  new Trk::TrackStateOnSurface(nullptr, ipPerigee->uniqueClone(), nullptr, typePattern));
165  }
166  }
167 
168  // copy remainging TSOS
169  trackStateOnSurfaces->push_back(tsit->clone());
170  }
171 
172  if (ipPerigee) {
173  std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern;
174  typePattern.set(Trk::TrackStateOnSurface::Perigee);
175  trackStateOnSurfaces->push_back(new Trk::TrackStateOnSurface(nullptr, ipPerigee->uniqueClone(), nullptr, typePattern));
176  }
177  ATH_MSG_DEBUG(" creating new track ");
178 
179  Trk::TrackInfo info(track.info().trackFitter(), track.info().particleHypothesis());
180  info.setPatternRecognitionInfo(Trk::TrackInfo::MuidStandAlone);
181  // create new track
182  std::unique_ptr<Trk::Track> extrapolateTrack =
183  std::make_unique<Trk::Track>(info, std::move(trackStateOnSurfaces), track.fitQuality() ? track.fitQuality()->uniqueClone() : nullptr);
184  // create track summary
185  m_trackSummary->updateTrack(ctx, *extrapolateTrack);
186  return extrapolateTrack;
187 }

◆ finalize()

StatusCode ExtrapolateMuonToIPTool::finalize ( )
overridevirtual

initialize

Definition at line 32 of file ExtrapolateMuonToIPTool.cxx.

32  {
33  double scale = m_nextrapolations != 0 ? 1. / m_nextrapolations : 1.;
34  ATH_MSG_INFO("Total number of extrapolations " << m_nextrapolations << " good fraction " << scale * m_nextrapolations
35  << " listing failures");
36  ATH_MSG_INFO(" no closest parameters " << scale * m_failedClosestPars);
37  ATH_MSG_INFO(" no extrapolation, low pt " << scale * m_failedExtrapolationLowMom);
38  ATH_MSG_INFO(" no extrapolation, high pt " << scale * m_failedExtrapolationHighMom);
39  ATH_MSG_INFO(" problem with perigee creations " << scale * m_failedPerigeeCreation);
40  return StatusCode::SUCCESS;
41 }

◆ findMeasuredParametersClosestToIP()

const Trk::TrackParameters * ExtrapolateMuonToIPTool::findMeasuredParametersClosestToIP ( const Trk::Track track) const
private

find measured parameters closest to IP to start back extrapolation

Definition at line 189 of file ExtrapolateMuonToIPTool.cxx.

189  {
190  // create new TSOS DataVector and reserve enough space to fit all old TSOS + one new TSOS
191  const Trk::TrackStates* states = track.trackStateOnSurfaces();
192  if (!states) return nullptr;
193 
194  Trk::PerigeeSurface persurf;
195  double rmin{1e9}, rminMeas{1e9};
196  const Trk::TrackParameters* closestPars = nullptr;
197  const Trk::TrackParameters* closestParsMeas = nullptr;
198  for (const Trk::TrackStateOnSurface* tsit : *states) {
199  const Trk::TrackParameters* pars = tsit->trackParameters();
200  if (!pars) continue;
201 
202  double rpars = pars->position().perp();
203  if (!closestPars || rpars < rmin) {
204  rmin = rpars;
205  closestPars = pars;
206  }
207 
208  if (pars->covariance() && (!closestParsMeas || rpars < rminMeas)) {
209  rminMeas = rpars;
210  closestParsMeas = pars;
211  }
212  }
213 
214  if (closestParsMeas) {
215  return closestParsMeas;
216  } else {
217  ATH_MSG_DEBUG(" No measured closest parameters found, using none measured parameters");
218  }
219  return closestPars;
220 }

◆ initialize()

StatusCode ExtrapolateMuonToIPTool::initialize ( )
overridevirtual

initialize

Definition at line 16 of file ExtrapolateMuonToIPTool.cxx.

16  {
17  ATH_CHECK(m_extrapolator.retrieve());
18  ATH_CHECK(m_muonExtrapolator.retrieve());
19  if (!m_edmHelperSvc.empty()) {
20  ATH_CHECK(m_edmHelperSvc.retrieve());
21  ATH_MSG_DEBUG("Retrieved helper " << m_edmHelperSvc);
22  }
23  if (!m_printer.empty()) {
24  ATH_CHECK(m_printer.retrieve());
25  ATH_MSG_DEBUG("Retrieved printer " << m_printer);
26  }
27  ATH_CHECK(m_trackSummary.retrieve());
28  return StatusCode::SUCCESS;
29 }

◆ 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::IMuonTrackExtrapolationTool::interfaceID ( )
inlinestaticinherited

Definition at line 18 of file IMuonTrackExtrapolationTool.h.

18  {
19  static const InterfaceID IID_IMuonTrackExtrapolationTool("Muon::IMuonTrackExtrapolationTool", 1, 0);
20  return IID_IMuonTrackExtrapolationTool;
21  }

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

◆ 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_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<Muon::IMuonEDMHelperSvc> ExtrapolateMuonToIPTool::m_edmHelperSvc
private
Initial value:
{
this,
"edmHelper",
"Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
"Handle to the service providing the IMuonEDMHelperSvc interface",
}

muon EDM helper tool

Definition at line 81 of file ExtrapolateMuonToIPTool.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> ExtrapolateMuonToIPTool::m_extrapolator
private
Initial value:
{
this,
"Extrapolator",
"Trk::Extrapolator/AtlasExtrapolator",
"Extrapolator",
}

Extrapolator.

Definition at line 57 of file ExtrapolateMuonToIPTool.h.

◆ m_failedClosestPars

std::atomic_uint ExtrapolateMuonToIPTool::m_failedClosestPars {0}
mutableprivate

Definition at line 89 of file ExtrapolateMuonToIPTool.h.

◆ m_failedExtrapolationHighMom

std::atomic_uint ExtrapolateMuonToIPTool::m_failedExtrapolationHighMom {0}
mutableprivate

Definition at line 91 of file ExtrapolateMuonToIPTool.h.

◆ m_failedExtrapolationLowMom

std::atomic_uint ExtrapolateMuonToIPTool::m_failedExtrapolationLowMom {0}
mutableprivate

Definition at line 90 of file ExtrapolateMuonToIPTool.h.

◆ m_failedPerigeeCreation

std::atomic_uint ExtrapolateMuonToIPTool::m_failedPerigeeCreation {0}
mutableprivate

Definition at line 92 of file ExtrapolateMuonToIPTool.h.

◆ m_muonExtrapolator

ToolHandle<Trk::IExtrapolator> ExtrapolateMuonToIPTool::m_muonExtrapolator
private
Initial value:
{
this,
"MuonExtrapolator",
"Trk::Extrapolator/MuonExtrapolator",
"MuonExtrapolator",
}

MuonExtrapolator.

Definition at line 63 of file ExtrapolateMuonToIPTool.h.

◆ m_nextrapolations

std::atomic_uint ExtrapolateMuonToIPTool::m_nextrapolations {0}
mutableprivate

Definition at line 88 of file ExtrapolateMuonToIPTool.h.

◆ m_printer

PublicToolHandle<Muon::MuonEDMPrinterTool> ExtrapolateMuonToIPTool::m_printer
private
Initial value:
{
this,
"Printer",
"Muon::MuonEDMPrinterTool/MuonEDMPrinterTool",
"muon EDM printer tool",
}

muon EDM printer tool

Definition at line 69 of file ExtrapolateMuonToIPTool.h.

◆ m_trackSummary

ToolHandle<Trk::ITrackSummaryTool> ExtrapolateMuonToIPTool::m_trackSummary
private
Initial value:
{
this,
"TrackSummaryTool",
"Trk::TrackSummaryTool/MuidTrackSummaryTool",
}

Definition at line 75 of file ExtrapolateMuonToIPTool.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:
DataVector::reserve
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
grepfile.info
info
Definition: grepfile.py:38
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
Trk::TrackInfo
Contains information about the 'fitter' of this track.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/TrackInfo.h:32
Trk::TrackStateOnSurface::Perigee
@ Perigee
This represents a perigee, and so will contain a Perigee object only.
Definition: TrackStateOnSurface.h:117
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
Trk::PerigeeSurface
Definition: PerigeeSurface.h:43
Trk::ParametersBase::position
const Amg::Vector3D & position() const
Access method for the position.
Trk::oppositeMomentum
@ oppositeMomentum
Definition: PropDirection.h:21
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
ExtrapolateMuonToIPTool::m_trackSummary
ToolHandle< Trk::ITrackSummaryTool > m_trackSummary
Definition: ExtrapolateMuonToIPTool.h:75
Trk::TrackInfo::MuidStandAlone
@ MuidStandAlone
MuidStandalone.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/TrackInfo.h:165
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::alongMomentum
@ alongMomentum
Definition: PropDirection.h:20
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
yodamerge_tmp.scale
scale
Definition: yodamerge_tmp.py:138
particleType
Definition: particleType.h:29
ExtrapolateMuonToIPTool::createPerigee
std::unique_ptr< const Trk::Perigee > createPerigee(const Trk::TrackParameters &pars, const EventContext &ctx) const
Definition: ExtrapolateMuonToIPTool.cxx:222
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
ExtrapolateMuonToIPTool::m_extrapolator
ToolHandle< Trk::IExtrapolator > m_extrapolator
Extrapolator.
Definition: ExtrapolateMuonToIPTool.h:57
Trk::TrackInfo::StraightTrack
@ StraightTrack
A straight track.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/TrackInfo.h:84
Trk::PropDirection
PropDirection
Definition: PropDirection.h:19
ExtrapolateMuonToIPTool::findMeasuredParametersClosestToIP
const Trk::TrackParameters * findMeasuredParametersClosestToIP(const Trk::Track &track) const
find measured parameters closest to IP to start back extrapolation
Definition: ExtrapolateMuonToIPTool.cxx:189
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
beamspotman.n
n
Definition: beamspotman.py:731
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ExtrapolateMuonToIPTool::m_failedExtrapolationLowMom
std::atomic_uint m_failedExtrapolationLowMom
Definition: ExtrapolateMuonToIPTool.h:90
urldecode::states
states
Definition: urldecode.h:39
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
Trk::ParametersBase
Definition: ParametersBase.h:55
ExtrapolateMuonToIPTool::m_nextrapolations
std::atomic_uint m_nextrapolations
Definition: ExtrapolateMuonToIPTool.h:88
Trk::muon
@ muon
Definition: ParticleHypothesis.h:28
DataVector< const Trk::TrackStateOnSurface >
trackInfo
Definition: TrigInDetUtils.h:13
ExtrapolateMuonToIPTool::m_edmHelperSvc
ServiceHandle< Muon::IMuonEDMHelperSvc > m_edmHelperSvc
muon EDM helper tool
Definition: ExtrapolateMuonToIPTool.h:81
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
ExtrapolateMuonToIPTool::m_failedExtrapolationHighMom
std::atomic_uint m_failedExtrapolationHighMom
Definition: ExtrapolateMuonToIPTool.h:91
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
ExtrapolateMuonToIPTool::m_printer
PublicToolHandle< Muon::MuonEDMPrinterTool > m_printer
muon EDM printer tool
Definition: ExtrapolateMuonToIPTool.h:69
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
Trk::TrackStateOnSurface
represents the track state (measurement, material, fit parameters and quality) at a surface.
Definition: TrackStateOnSurface.h:71
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
Trk::nonInteracting
@ nonInteracting
Definition: ParticleHypothesis.h:25
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::ParametersBase::momentum
const Amg::Vector3D & momentum() const
Access method for the momentum.
a
TList * a
Definition: liststreamerinfos.cxx:10
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
ExtrapolateMuonToIPTool::m_failedPerigeeCreation
std::atomic_uint m_failedPerigeeCreation
Definition: ExtrapolateMuonToIPTool.h:92
ExtrapolateMuonToIPTool::m_failedClosestPars
std::atomic_uint m_failedClosestPars
Definition: ExtrapolateMuonToIPTool.h:89
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
ExtrapolateMuonToIPTool::extrapolate
std::unique_ptr< TrackCollection > extrapolate(const TrackCollection &muonTracks, const EventContext &ctx) const override
extrapolate all tracks in the track collection to the IP
Definition: ExtrapolateMuonToIPTool.cxx:43
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
ExtrapolateMuonToIPTool::m_muonExtrapolator
ToolHandle< Trk::IExtrapolator > m_muonExtrapolator
MuonExtrapolator.
Definition: ExtrapolateMuonToIPTool.h:63
fitman.k
k
Definition: fitman.py:528