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

Tool to calculate the scattering angle significance from the detailed information (parameters, scattering angles) of a track fit. More...

#include <MuonScatteringAngleSignificanceTool.h>

Inheritance diagram for Rec::MuonScatteringAngleSignificanceTool:
Collaboration diagram for Rec::MuonScatteringAngleSignificanceTool:

Public Member Functions

 MuonScatteringAngleSignificanceTool (const std::string &type, const std::string &name, const IInterface *parent)
 
 ~MuonScatteringAngleSignificanceTool ()=default
 
StatusCode initialize ()
 
ScatteringAngleSignificance scatteringAngleSignificance (const xAOD::Muon &muon) const
 Calculate ScatteringAngleSignificance of a muon, stepping down to the relevant track. More...
 
ScatteringAngleSignificance scatteringAngleSignificance (const Trk::Track &track) const
 Calculate ScatteringAngleSignificance of a 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 ()
 

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

bool isSlimmed (const Trk::Track &track) const
 does track have TrackParameters at every TSOS ? Method for compatibility with release < 17, where SlimmedTrack property isn't filled. More...
 
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::ITrackFitterm_fitter
 tool for unslimming via track fit More...
 
ServiceHandle< Trk::ITrackingVolumesSvcm_trackingVolumesSvc
 
const Trk::Volumem_calorimeterVolume
 cache the calo volume pointer More...
 
const Trk::Volumem_indetVolume
 cache the ID volume pointer More...
 
bool m_inDetOnly
 scatterers from ID only (or ID + calo) More...
 
bool m_refitInDetOnly
 steer if to unslim only ID More...
 
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 calculate the scattering angle significance from the detailed information (parameters, scattering angles) of a track fit.

Definition at line 26 of file MuonScatteringAngleSignificanceTool.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

◆ MuonScatteringAngleSignificanceTool()

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

Definition at line 16 of file MuonScatteringAngleSignificanceTool.cxx.

17  :
19  declareInterface<IMuonScatteringAngleSignificance>(this);
20  declareProperty("InDetOnly", m_inDetOnly);
21  declareProperty("RefitInDetOnly", m_refitInDetOnly);
22  }

◆ ~MuonScatteringAngleSignificanceTool()

Rec::MuonScatteringAngleSignificanceTool::~MuonScatteringAngleSignificanceTool ( )
default

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::MuonScatteringAngleSignificanceTool::initialize ( )

Definition at line 25 of file MuonScatteringAngleSignificanceTool.cxx.

25  {
26  ATH_MSG_INFO("Initializing MuonScatAngleSignificanceTool");
27 
28  // tool needed to refit slimmed tracks
29  if (!m_fitter.empty()) {
30  if (m_fitter.retrieve().isFailure()) {
31  ATH_MSG_FATAL("Failed to retrieve tool " << m_fitter);
32  m_fitter.setTypeAndName(""); // Bang!
33  } else {
34  ATH_MSG_DEBUG("Retrieved tool " << m_fitter);
35  }
36  }
37 
38  // need to know which TrackingVolume we are in: indet/calo/spectrometer
39  if (m_trackingVolumesSvc.retrieve().isFailure()) {
40  ATH_MSG_FATAL("Failed to retrieve Svc " << m_trackingVolumesSvc);
41  return StatusCode::FAILURE;
42  } else {
43  ATH_MSG_DEBUG("Retrieved Svc " << m_trackingVolumesSvc);
46  }
47 
48  return StatusCode::SUCCESS;
49  }

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

Definition at line 25 of file IMuonScatteringAngleSignificance.h.

25  {
26  static const InterfaceID IID_IMuonScatteringAngleSignificance("Rec::IMuonScatteringAngleSignificance", 1, 0);
27  return IID_IMuonScatteringAngleSignificance;
28  }

◆ isSlimmed()

bool Rec::MuonScatteringAngleSignificanceTool::isSlimmed ( const Trk::Track track) const
private

does track have TrackParameters at every TSOS ? Method for compatibility with release < 17, where SlimmedTrack property isn't filled.


Definition at line 242 of file MuonScatteringAngleSignificanceTool.cxx.

242  {
243  for (Trk::TrackStates::const_iterator s = track.trackStateOnSurfaces()->begin();
244  s != track.trackStateOnSurfaces()->end(); ++s) {
245  if ((**s).trackParameters()) continue;
246 
247  ATH_MSG_VERBOSE("track is slimmed (found TSOS without trackParameters) ");
248  return true;
249  }
250 
251  ATH_MSG_VERBOSE("track is not slimmed (all TSOS have trackParameters) ");
252 
253  return false;
254  }

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

◆ scatteringAngleSignificance() [1/2]

ScatteringAngleSignificance Rec::MuonScatteringAngleSignificanceTool::scatteringAngleSignificance ( const Trk::Track track) const
virtual

Calculate ScatteringAngleSignificance of a track.

Implements Rec::IMuonScatteringAngleSignificance.

Definition at line 70 of file MuonScatteringAngleSignificanceTool.cxx.

70  {
71  // provide refit for slimmed tracks
72  const Trk::Track* fullTrack = &track;
73  const Trk::Track* refittedTrack = nullptr;
74  // if (track.info().trackProperties(Trk::TrackInfo::SlimmedTrack)) {
75  if (isSlimmed(track)) { // TrackInfo::SlimmedTrack wouldn't detect STACO tracks as (half-)slimmed
76 
77  if (!m_fitter.empty() && track.perigeeParameters() && track.measurementsOnTrack() && track.measurementsOnTrack()->size() > 3) {
78  ATH_MSG_VERBOSE(" perform refit as track has been slimmed");
79  if (m_refitInDetOnly) {
80  std::vector<const Trk::MeasurementBase*> vec;
81  DataVector<const Trk::MeasurementBase>::const_iterator measIter = track.measurementsOnTrack()->begin();
82  for (; measIter != track.measurementsOnTrack()->end(); ++measIter) {
83  const Amg::Vector3D& position = (*measIter)->globalPosition();
84  if (!m_indetVolume->inside(position)) continue;
85  vec.push_back((*measIter));
86  }
87  ATH_MSG_DEBUG("Refitting ID-part of track, meast vector of size " << vec.size());
88  refittedTrack = m_fitter->fit(Gaudi::Hive::currentContext(),
89  vec,
90  *(track.perigeeParameters()),
91  false,
92  Trk::muon).release();
93  } else {
94  refittedTrack = m_fitter->fit(
95  Gaudi::Hive::currentContext(), track, false, Trk::muon).release();
96  }
97  fullTrack = refittedTrack;
98  }
99  ATH_MSG_DEBUG("Detected slimmed track, " << (refittedTrack ? "refit was successful" : "but could not refit it!"));
100 
101  if (!refittedTrack) return ScatteringAngleSignificance(0);
102  }
103 
104  // collect sigma of phi scatterers up to last inDet measurement TSOS or to CaloDeposit TSOS
105  // (according to configuration).
106  // Define scattering in direction of curvature change to be +ve
107  double charge = fullTrack->perigeeParameters()->charge();
108  unsigned measurements = 0;
109  double neighbourRadius = 0.;
110  double neighbourSignificance = 0.;
111  unsigned neighbours = 0;
112  unsigned scatterers = 0;
113  unsigned startMeasurement = 0;
114  std::vector<bool> isMeasurement;
115  std::vector<unsigned> measurementNumber;
116  std::vector<double> radii;
117  std::vector<double> sigmas;
118  double significance = 0.;
119  double totalSigma = 0.;
120  double weightedRadius = 0.;
122  s != fullTrack->trackStateOnSurfaces()->end(); ++s) {
123  // skip leading material
124  if ((**s).measurementOnTrack()) {
125  ++measurements;
126  } else if (!measurements)
127  continue;
128 
129  // select MaterialEffects up to calorimeter energy deposit
130  if (!(**s).materialEffectsOnTrack()) continue;
131  if ((**s).type(Trk::TrackStateOnSurface::CaloDeposit)) break;
132  const Amg::Vector3D& position = (**s).materialEffectsOnTrack()->associatedSurface().globalReferencePoint();
133  if (!m_calorimeterVolume->inside(position)) break;
134 
135  const Trk::MaterialEffectsOnTrack* meot = dynamic_cast<const Trk::MaterialEffectsOnTrack*>((**s).materialEffectsOnTrack());
136  if (!meot) continue;
137 
138  // get scattering angle
139  const Trk::ScatteringAngles* scattering = meot->scatteringAngles();
140  if (!scattering) continue;
141 
142  ++scatterers;
143  double radius = (**s).trackParameters()->position().perp();
144  double sigma = charge * scattering->deltaPhi() / scattering->sigmaDeltaPhi();
145  if ((**s).measurementOnTrack()) {
146  isMeasurement.push_back(true);
147  } else {
148  isMeasurement.push_back(false);
149  }
150  measurementNumber.push_back(measurements);
151 
152  // keep maximum neighbour significance
153  // (summed scattering significance for scatterers spanning neighbouring measurements)
154  ++neighbours;
155  significance += sigma;
156  weightedRadius += sigma * radius;
157  if (neighbours > 1 && measurements > startMeasurement) {
158  double norm = 1. / sqrt(static_cast<double>(neighbours));
159  if (norm * fabs(significance) > fabs(neighbourSignificance)) {
160  if (significance == 0.) {
161  neighbourRadius = radius;
162  } else {
163  neighbourRadius = weightedRadius / significance;
164  }
165  neighbourSignificance = norm * significance;
166  ATH_MSG_VERBOSE(" current maximum for neighbourSignificance " << neighbourSignificance << " from " << neighbours
167  << " scatterers at radius " << neighbourRadius);
168  }
169  ATH_MSG_VERBOSE(" reset neighbour after " << significance << " /sqrt(" << neighbours << ") at radius " << radius);
170  neighbours = 0;
171  significance = 0.;
172  startMeasurement = measurements;
173  weightedRadius = 0.;
174  if (isMeasurement.back()) {
175  ++neighbours;
176  significance += sigma;
177  weightedRadius += sigma * radius;
178  }
179  }
180 
181  radii.push_back(radius);
182  sigmas.push_back(sigma);
183  totalSigma += sigma;
184 
185  ATH_MSG_VERBOSE(scatterers << " " << measurements << " " << isMeasurement.back() << " radius "
186  << (**s).trackParameters()->position().perp() << " deltaPhi " << scattering->deltaPhi()
187  << " significance " << sigma << " integralSignificance " << totalSigma);
188  }
189 
190  // pop_back to last measurement unless configured to use calo
191  delete refittedTrack;
192  if (m_inDetOnly) {
193  while (scatterers && measurementNumber.back() == measurements && !isMeasurement.back()) {
194  --scatterers;
195  totalSigma -= sigmas.back();
196  isMeasurement.pop_back();
197  measurementNumber.pop_back();
198  radii.pop_back();
199  sigmas.pop_back();
200  }
201  }
202 
203  // quit if no scatterers selected
204  if (!scatterers) {
205  ATH_MSG_DEBUG(" no scatterers selected, giving up.");
206  return ScatteringAngleSignificance(0);
207  }
208 
209  // search for discontinuity point (sign change of integral scattering)
210  // maximum value determines curvatureSignificance
211  double curvatureSignificance = totalSigma;
212  double curvatureRadius = *radii.rbegin();
213  unsigned index = scatterers - 1;
214 
215  ATH_MSG_VERBOSE(" scatteringAngleSignificance " << totalSigma << " at radius " << radii[index] << " at scatterer " << scatterers
216  << " sigmas.size() " << sigmas.size());
217 
218  for (std::vector<double>::const_reverse_iterator r = sigmas.rbegin(); r != sigmas.rend(); ++r, --index) {
219  totalSigma -= 2. * (*r);
220  if (index > 1)
221  ATH_MSG_VERBOSE(" scatteringAngleSignificance " << totalSigma << " at radius " << radii[index - 1] << " at scatterer "
222  << index);
223 
224  if (fabs(totalSigma) > fabs(curvatureSignificance) && index > 1) {
225  curvatureSignificance = totalSigma;
226  curvatureRadius = radii[index - 1];
227  }
228  }
229 
230  // normalize final curvature significance
231  curvatureSignificance /= sqrt(static_cast<double>(scatterers));
232 
233  ATH_MSG_DEBUG(" scatteringAngleSignificance" << std::setiosflags(std::ios::fixed) << std::setw(7) << std::setprecision(2)
234  << curvatureSignificance << " at radius " << std::setw(6) << std::setprecision(1)
235  << curvatureRadius << " neighbourSignificance " << std::setw(7) << std::setprecision(2)
236  << neighbourSignificance << " at radius " << std::setw(6) << std::setprecision(1)
237  << neighbourRadius << " from " << scatterers << " scatterers");
238 
239  return ScatteringAngleSignificance(scatterers, curvatureRadius, curvatureSignificance, neighbourRadius, neighbourSignificance);
240  }

◆ scatteringAngleSignificance() [2/2]

ScatteringAngleSignificance Rec::MuonScatteringAngleSignificanceTool::scatteringAngleSignificance ( const xAOD::Muon muon) const
virtual

Calculate ScatteringAngleSignificance of a muon, stepping down to the relevant track.

Implements Rec::IMuonScatteringAngleSignificance.

Definition at line 51 of file MuonScatteringAngleSignificanceTool.cxx.

51  {
52  if (muon.muonType() == xAOD::Muon::MuonStandAlone) return ScatteringAngleSignificance(0);
53 
54  const Trk::Track* theTrack =
55  muon.trackParticle(xAOD::Muon::CombinedTrackParticle) ? muon.trackParticle(xAOD::Muon::CombinedTrackParticle)->track() : nullptr;
56 
57  if (theTrack == nullptr) {
58  theTrack = muon.trackParticle(xAOD::Muon::InnerDetectorTrackParticle)
59  ? muon.trackParticle(xAOD::Muon::InnerDetectorTrackParticle)->track()
60  : nullptr;
61  }
62 
63  if (theTrack == nullptr) {
64  ATH_MSG_DEBUG("No track, returning empty scatterer-significance object.");
65  return ScatteringAngleSignificance(0);
66  } else
67  return scatteringAngleSignificance(*theTrack);
68  }

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

const Trk::Volume* Rec::MuonScatteringAngleSignificanceTool::m_calorimeterVolume
private

cache the calo volume pointer

Definition at line 52 of file MuonScatteringAngleSignificanceTool.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_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_fitter

ToolHandle<Trk::ITrackFitter> Rec::MuonScatteringAngleSignificanceTool::m_fitter
private
Initial value:
{this, "TrackFitter", "",
"tool for unslimming via track fit"}

tool for unslimming via track fit

Definition at line 46 of file MuonScatteringAngleSignificanceTool.h.

◆ m_inDetOnly

bool Rec::MuonScatteringAngleSignificanceTool::m_inDetOnly
private

scatterers from ID only (or ID + calo)

Definition at line 56 of file MuonScatteringAngleSignificanceTool.h.

◆ m_indetVolume

const Trk::Volume* Rec::MuonScatteringAngleSignificanceTool::m_indetVolume
private

cache the ID volume pointer

Definition at line 53 of file MuonScatteringAngleSignificanceTool.h.

◆ m_refitInDetOnly

bool Rec::MuonScatteringAngleSignificanceTool::m_refitInDetOnly
private

steer if to unslim only ID

Definition at line 57 of file MuonScatteringAngleSignificanceTool.h.

◆ m_trackingVolumesSvc

ServiceHandle<Trk::ITrackingVolumesSvc> Rec::MuonScatteringAngleSignificanceTool::m_trackingVolumesSvc
private
Initial value:
{this, "TrackingVolumesSvc", "TrackingVolumesSvc",
"geometry for analysing track lengths"}

Definition at line 48 of file MuonScatteringAngleSignificanceTool.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::ScatteringAngles::deltaPhi
double deltaPhi() const
returns the
Definition: ScatteringAngles.h:82
beamspotman.r
def r
Definition: beamspotman.py:676
xAOD::muon
@ muon
Definition: TrackingPrimitives.h:195
Trk::TrackStateOnSurface::CaloDeposit
@ CaloDeposit
This TSOS contains a CaloEnergy object.
Definition: TrackStateOnSurface.h:135
PlotCalibFromCool.norm
norm
Definition: PlotCalibFromCool.py:100
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
pdg_comparison.sigma
sigma
Definition: pdg_comparison.py:324
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
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::Volume::inside
bool inside(const Amg::Vector3D &gp, double tol=0.) const
Inside() method for checks.
Definition: Volume.cxx:90
index
Definition: index.py:1
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
Trk::Track::trackStateOnSurfaces
const Trk::TrackStates * trackStateOnSurfaces() const
return a pointer to a const DataVector of const TrackStateOnSurfaces.
Rec::MuonScatteringAngleSignificanceTool::m_indetVolume
const Trk::Volume * m_indetVolume
cache the ID volume pointer
Definition: MuonScatteringAngleSignificanceTool.h:53
Trk::ITrackingVolumesSvc::MuonSpectrometerEntryLayer
@ MuonSpectrometerEntryLayer
Tracking Volume which defines the entrance surfaces of the MS.
Definition: ITrackingVolumesSvc.h:41
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::ScatteringAngles
represents a deflection of the track caused through multiple scattering in material.
Definition: ScatteringAngles.h:26
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
Rec::MuonScatteringAngleSignificanceTool::m_inDetOnly
bool m_inDetOnly
scatterers from ID only (or ID + calo)
Definition: MuonScatteringAngleSignificanceTool.h:56
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
Rec::MuonScatteringAngleSignificanceTool::isSlimmed
bool isSlimmed(const Trk::Track &track) const
does track have TrackParameters at every TSOS ? Method for compatibility with release < 17,...
Definition: MuonScatteringAngleSignificanceTool.cxx:242
Rec::MuonScatteringAngleSignificanceTool::m_calorimeterVolume
const Trk::Volume * m_calorimeterVolume
cache the calo volume pointer
Definition: MuonScatteringAngleSignificanceTool.h:52
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
Rec::MuonScatteringAngleSignificanceTool::m_fitter
ToolHandle< Trk::ITrackFitter > m_fitter
tool for unslimming via track fit
Definition: MuonScatteringAngleSignificanceTool.h:46
Trk::ParametersT::associatedSurface
virtual const S & associatedSurface() const override final
Access to the Surface method.
CxxUtils::vec
typename vecDetail::vec_typedef< T, N >::type vec
Define a nice alias for the vectorized type.
Definition: vec.h:207
Trk::MaterialEffectsOnTrack
represents the full description of deflection and e-loss of a track in material.
Definition: MaterialEffectsOnTrack.h:40
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
Rec::MuonScatteringAngleSignificanceTool::m_trackingVolumesSvc
ServiceHandle< Trk::ITrackingVolumesSvc > m_trackingVolumesSvc
Definition: MuonScatteringAngleSignificanceTool.h:48
test_pyathena.parent
parent
Definition: test_pyathena.py:15
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
Trk::muon
@ muon
Definition: ParticleHypothesis.h:28
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
Trk::ITrackingVolumesSvc::CalorimeterEntryLayer
@ CalorimeterEntryLayer
Tracking Volume which defines the entrance srufaces of the calorimeter.
Definition: ITrackingVolumesSvc.h:40
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
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
charge
double charge(const T &p)
Definition: AtlasPID.h:494
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
ParticleGun_SamplingFraction.radius
radius
Definition: ParticleGun_SamplingFraction.py:96
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
a
TList * a
Definition: liststreamerinfos.cxx:10
h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
Trk::MaterialEffectsOnTrack::scatteringAngles
const ScatteringAngles * scatteringAngles() const
returns the MCS-angles object.
Rec::MuonScatteringAngleSignificanceTool::m_refitInDetOnly
bool m_refitInDetOnly
steer if to unslim only ID
Definition: MuonScatteringAngleSignificanceTool.h:57
Trk::ScatteringAngles::sigmaDeltaPhi
double sigmaDeltaPhi() const
returns the
Definition: ScatteringAngles.h:94
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
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
Trk::Volume
Definition: Volume.h:35
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
Rec::MuonScatteringAngleSignificanceTool::scatteringAngleSignificance
ScatteringAngleSignificance scatteringAngleSignificance(const xAOD::Muon &muon) const
Calculate ScatteringAngleSignificance of a muon, stepping down to the relevant track.
Definition: MuonScatteringAngleSignificanceTool.cxx:51
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
fitman.k
k
Definition: fitman.py:528