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

#include <KalmanVertexUpdator.h>

Inheritance diagram for Trk::KalmanVertexUpdator:
Collaboration diagram for Trk::KalmanVertexUpdator:

Public Types

enum  updateMode { removeTrack =-1, addTrack =1 }
 

Public Member Functions

virtual StatusCode initialize () override
 
 KalmanVertexUpdator (const std::string &t, const std::string &n, const IInterface *p)
 Constructor. More...
 
 ~KalmanVertexUpdator ()
 Destructor. More...
 
virtual xAOD::Vertexadd (xAOD::Vertex &vtx, VxTrackAtVertex &trk) const override
 Method adding a single track to the vertex estimate. More...
 
virtual xAOD::Vertexremove (xAOD::Vertex &vtx, VxTrackAtVertex &trk) const override
 Method removing already added track from the vertex estimate. More...
 
virtual IVertexUpdator::positionUpdateOutcome positionUpdate (const xAOD::Vertex &vtx, const LinearizedTrack *trk, double trackWeight, IVertexUpdator::updateMode mode) const override
 Position update method. More...
 
virtual float trackParametersChi2 (const xAOD::Vertex &new_vtx, const LinearizedTrack *trk) const override
 Method calculating the interstep Chi2 increment. More...
 
virtual float trackParametersChi2 (const IVertexUpdator::positionUpdateOutcome &new_vtx, const LinearizedTrack *trk) const override
 
virtual float vertexPositionChi2 (const xAOD::Vertex &old_vtx, const xAOD::Vertex &new_vtx) const override
 Method calculating the vertex displacement-related part of the chi2
More...
 
virtual float vertexPositionChi2 (const xAOD::Vertex &old_vtx, const IVertexUpdator::positionUpdateOutcome &new_vtx) const override
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Static Public Member Functions

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

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

xAOD::Vertexupdate (xAOD::Vertex &vtx, const VxTrackAtVertex &trk, IVertexUpdator::updateMode mode) const
 Method where the fit is actually done. 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...
 

Static Private Member Functions

static float trackParametersChi2 (const Amg::Vector3D &new_position, const LinearizedTrack *trk, const AmgSymMatrix(5) &trkParametersWeight)
 
static float vertexPositionChi2 (const xAOD::Vertex &old_vtx, const Amg::Vector3D &new_position)
 

Private Attributes

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

A concrete implementation of the Vertex Updator using the Kalman filter algorithm. The algorithm adds or removes a single track from the vertex estimate.

Based on R. Fruhwirth et al. Comp. Phys. Comm 96(1996) 189

Author
Kirill Prokofiev, November 2005

Changes:

David Shope david.nosp@m..ric.nosp@m.hard..nosp@m.shop.nosp@m.e@cer.nosp@m.n.ch (2016-04-19)

EDM Migration to xAOD - from Trk::VxCandidate to xAOD::Vertex, from Trk::RecVertex to xAOD::Vertex, from Trk::Vertex to Amg::Vector3D

Definition at line 36 of file KalmanVertexUpdator.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Member Enumeration Documentation

◆ updateMode

Enumerator
removeTrack 
addTrack 

Definition at line 68 of file IVertexUpdator.h.

68  {
69  removeTrack=-1,
70  addTrack=1
71  } updateMode;

Constructor & Destructor Documentation

◆ KalmanVertexUpdator()

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

Constructor.

Definition at line 14 of file KalmanVertexUpdator.cxx.

14  :
15  AthAlgTool(t,n,p)
16  {
17  declareInterface<IVertexUpdator>(this);
18  }

◆ ~KalmanVertexUpdator()

Trk::KalmanVertexUpdator::~KalmanVertexUpdator ( )
default

Destructor.

Member Function Documentation

◆ add()

xAOD::Vertex * Trk::KalmanVertexUpdator::add ( xAOD::Vertex vtx,
VxTrackAtVertex trk 
) const
overridevirtual

Method adding a single track to the vertex estimate.

Implements Trk::IVertexUpdator.

Definition at line 36 of file KalmanVertexUpdator.cxx.

37  {
38  return update(vtx,trk,IVertexUpdator::addTrack);
39  }

◆ 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 Trk::KalmanVertexUpdator::initialize ( )
overridevirtual

Definition at line 23 of file KalmanVertexUpdator.cxx.

24  {
26  if(sc.isFailure())
27  {
28  msg(MSG::ERROR)<<" Unable to initialize the AlgTool"<<endmsg;
29  return StatusCode::FAILURE;
30  }
31 
32  return StatusCode::SUCCESS;
33  }

◆ 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& Trk::IVertexUpdator::interfaceID ( )
inlinestaticinherited

AlgTool interface methods.

Definition at line 56 of file IVertexUpdator.h.

56 { return IID_IVertexUpdator; };

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

◆ positionUpdate()

IVertexUpdator::positionUpdateOutcome Trk::KalmanVertexUpdator::positionUpdate ( const xAOD::Vertex vtx,
const LinearizedTrack trk,
double  trackWeight,
IVertexUpdator::updateMode  mode 
) const
overridevirtual

Position update method.

The 'mode' parameter is used to indicate whether we want to add or remove a track.

Implements Trk::IVertexUpdator.

Definition at line 126 of file KalmanVertexUpdator.cxx.

127  {
128  // linearized track information
129  const AmgMatrix(5,3)& A = trk->positionJacobian();
130  const AmgMatrix(5,3)& B = trk->momentumJacobian();
131  const AmgVector(5) & trackParameters = trk->expectedParametersAtPCA();
132  const AmgVector(5) & constantTerm = trk->constantTerm();
133  const AmgSymMatrix(5) & trackParametersWeight = trk->expectedWeightAtPCA();
134 
135  int sign = (mode == IVertexUpdator::addTrack ? 1 : -1);
136 
137  //vertex to be updated
138  const Amg::Vector3D & old_pos = vtx.position();
139  const AmgSymMatrix(3)& old_vrt_weight = vtx.covariancePosition().inverse();
140  ATH_MSG_VERBOSE ("Old vertex weight " << old_vrt_weight);
141 
142  //making the intermediate quantities:
143  //W_k = (B^T*G*B)^(-1)
144 
145  AmgSymMatrix(3) S = B.transpose()*(trackParametersWeight*B);
146  S = S.inverse().eval();
147 
148  //G_b = G_k - G_k*B_k*W_k*B_k^(T)*G_k
149  AmgSymMatrix(5) gB = trackParametersWeight - trackParametersWeight*(B*(S*B.transpose()))*trackParametersWeight.transpose();
150 
151  //new vertex weight matrix
152  AmgSymMatrix(3) new_vrt_weight_later_cov = old_vrt_weight + trackWeight * sign * A.transpose()*(gB*A);
153 
154  new_vrt_weight_later_cov = new_vrt_weight_later_cov.inverse().eval();
155 
156  //new vertex position
157  Amg::Vector3D new_vrt_position = new_vrt_weight_later_cov*(old_vrt_weight * old_pos + trackWeight * sign * A.transpose() * gB *(trackParameters - constantTerm) );
158 
159  return IVertexUpdator::positionUpdateOutcome{new_vrt_position, new_vrt_weight_later_cov,trackParametersWeight};
160  }//end of position update method

◆ remove()

xAOD::Vertex * Trk::KalmanVertexUpdator::remove ( xAOD::Vertex vtx,
VxTrackAtVertex trk 
) const
overridevirtual

Method removing already added track from the vertex estimate.

Implements Trk::IVertexUpdator.

Definition at line 42 of file KalmanVertexUpdator.cxx.

43  {
44  return update(vtx,trk,IVertexUpdator::removeTrack);
45  }

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

◆ trackParametersChi2() [1/3]

float Trk::KalmanVertexUpdator::trackParametersChi2 ( const Amg::Vector3D new_position,
const LinearizedTrack trk,
const AmgSymMatrix(5) &  trkParametersWeight 
)
staticprivate

Definition at line 175 of file KalmanVertexUpdator.cxx.

175  {
176 
177  // track information
178  const AmgMatrix(5,3)& A = trk->positionJacobian();
179  const AmgMatrix(5,3) & B = trk->momentumJacobian();
180  const AmgVector(5) & trkParameters = trk->expectedParametersAtPCA();
181 
182  //calculation of S matrix
183  AmgSymMatrix(3) Sm = B.transpose()*(trkParametersWeight*B);
184  AmgSymMatrix(3) Sm_inverse;
185  bool invertible;
186  Sm.computeInverseWithCheck(Sm_inverse,invertible);
187  if(!invertible) {
188  return -999.;
189  }
190  Sm= Sm_inverse.eval();
191 
192  const AmgVector(5)& theResidual = trk->constantTerm();
193 
194  //refitted track momentum
195  Amg::Vector3D newTrackMomentum = Sm*B.transpose()*trkParametersWeight*(trkParameters - theResidual - A*new_position);
196 
197  //refitted track parameters
198  AmgVector(5) refTrackParameters = theResidual + A * new_position + B * newTrackMomentum;
199 
200  //parameters difference
201  AmgVector(5) paramDifference = trkParameters - refTrackParameters;
202 
203  return paramDifference.transpose() * ( trkParametersWeight * paramDifference );;
204 
205  }

◆ trackParametersChi2() [2/3]

float Trk::KalmanVertexUpdator::trackParametersChi2 ( const IVertexUpdator::positionUpdateOutcome new_vtx,
const LinearizedTrack trk 
) const
overridevirtual

Implements Trk::IVertexUpdator.

Definition at line 212 of file KalmanVertexUpdator.cxx.

212  {
213  return trackParametersChi2(new_vtx.position, trk, new_vtx.trkParametersWeight);
214  }//end of chi2 increment method

◆ trackParametersChi2() [3/3]

float Trk::KalmanVertexUpdator::trackParametersChi2 ( const xAOD::Vertex new_vtx,
const LinearizedTrack trk 
) const
overridevirtual

Method calculating the interstep Chi2 increment.

Implements Trk::IVertexUpdator.

Definition at line 164 of file KalmanVertexUpdator.cxx.

165  {
166  return trackParametersChi2(new_vtx.position(), trk, trk->expectedWeightAtPCA());
167  }//end of chi2 increment method

◆ update()

xAOD::Vertex * Trk::KalmanVertexUpdator::update ( xAOD::Vertex vtx,
const VxTrackAtVertex trk,
IVertexUpdator::updateMode  mode 
) const
private

Method where the fit is actually done.

Definition at line 48 of file KalmanVertexUpdator.cxx.

49  {
50 
51  //getting tracks at vertex
52  std::vector<Trk::VxTrackAtVertex> & tracksAtVertex = vtx.vxTrackAtVertex();
53 
54  //in case one wants to remove the track, one should be sure that this track
55  //is already fitted to the vertex
56  auto righttrack = std::find(tracksAtVertex.begin(), tracksAtVertex.end(), trk);
57  // if it is not part of the vertex (which includes a possible empty vertex), we either add it or give up
58  // in case we are removing tracks
59  if (righttrack == tracksAtVertex.end())
60  {
61  ATH_MSG_VERBOSE ("The track requested for removal or adding is not found in the vector of tracks");
62  // removal - can not proceed
64  ATH_MSG_ERROR ("During remove track has to be already attached to the vertex");
65  msg(MSG::ERROR) << "The copy of initial xAOD::Vertex returned" << endmsg;
66  return &vtx;
67  }
68  // addition - here this is expected behaviour
69 
70  righttrack = tracksAtVertex.insert(tracksAtVertex.end(),trk);
71  ATH_MSG_VERBOSE ("Updating vertex with new track which is still not attached to vertex. Adding it before updating...");
72 
73  }
74 
75  //all safe, call the position update
76  // chi and ndf
77  // track weight and old vertex
78 
79  double trkWeight = trk.weight();
80 
81  AmgSymMatrix(3) vrt_inverse;
82  bool invertible;
83  vtx.covariancePosition().computeInverseWithCheck(vrt_inverse,invertible);
84 
85  if(!invertible) {
86  ATH_MSG_VERBOSE ("The vertex's cov is not invertible, quit updating.");
87  return &vtx;
88  }
89  const IVertexUpdator::positionUpdateOutcome & fit_vrt = positionUpdate( vtx, trk.linState(), trkWeight, mode);
90 
91  double chi2 = vtx.chiSquared();
92  double trk_chi = trackParametersChi2( fit_vrt, trk.linState() );
93  if(trk_chi==-999.){
94  ATH_MSG_VERBOSE ("The track's cov is not invertible, quit updating.");
95  return &vtx;
96  }
97 
98  const int sign = (mode == IVertexUpdator::addTrack ? 1 : -1);
99  chi2 += sign * (vertexPositionChi2(vtx, fit_vrt) + trkWeight * trk_chi);
100 
101  //number of degrees of freedom
102  double ndf = vtx.numberDoF();
103  ndf += sign * trkWeight * (2.0);
104 
105  //forming a final xAOD::Vertex
106  vtx.setPosition( fit_vrt.position );
107  vtx.setCovariancePosition( fit_vrt.covariancePosition );
108  vtx.setFitQuality( chi2, ndf );
109 
110  //playing with vector of fitted tracks and compatibility
112  {
113  //changes towards fit quality
114  righttrack->setWeight( trkWeight );
115  righttrack->setTrackQuality( Trk::FitQuality(trk_chi, 2 * trkWeight) );
116  }
117  else
118  {
119  tracksAtVertex.erase( righttrack );
120  }
121 
122  return &vtx;
123  }//end of update method

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

◆ vertexPositionChi2() [1/3]

float Trk::KalmanVertexUpdator::vertexPositionChi2 ( const xAOD::Vertex old_vtx,
const Amg::Vector3D new_position 
)
staticprivate

Definition at line 206 of file KalmanVertexUpdator.cxx.

206  {
207  AmgSymMatrix(3) old_wrt_weight = old_vtx.covariancePosition().inverse();
208  Amg::Vector3D posDifference = new_position - old_vtx.position();
209  return posDifference.transpose()*(old_wrt_weight*posDifference);
210  }

◆ vertexPositionChi2() [2/3]

float Trk::KalmanVertexUpdator::vertexPositionChi2 ( const xAOD::Vertex old_vtx,
const IVertexUpdator::positionUpdateOutcome new_vtx 
) const
overridevirtual

Implements Trk::IVertexUpdator.

Definition at line 216 of file KalmanVertexUpdator.cxx.

216  {
217  return vertexPositionChi2(old_vtx, new_vtx.position);
218  }//end of vertex position chi2

◆ vertexPositionChi2() [3/3]

float Trk::KalmanVertexUpdator::vertexPositionChi2 ( const xAOD::Vertex old_vtx,
const xAOD::Vertex new_vtx 
) const
overridevirtual

Method calculating the vertex displacement-related part of the chi2

Implements Trk::IVertexUpdator.

Definition at line 169 of file KalmanVertexUpdator.cxx.

170  {
171  return vertexPositionChi2(old_vtx, new_vtx.position());
172  }//end of vertex position chi2

Member Data Documentation

◆ m_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_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:
covarianceTool.ndf
ndf
Definition: covarianceTool.py:678
Trk::AmgMatrix
AmgMatrix(3, 3) NeutralParticleParameterCalculator
Definition: NeutralParticleParameterCalculator.cxx:233
xAOD::Vertex_v1::setPosition
void setPosition(const Amg::Vector3D &position)
Sets the 3-position.
Trk::IVertexUpdator::updateMode
updateMode
Definition: IVertexUpdator.h:68
xAOD::Vertex_v1::setFitQuality
void setFitQuality(float chiSquared, float numberDoF)
Set the 'Fit Quality' information.
Definition: Vertex_v1.cxx:150
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
initialize
void initialize()
Definition: run_EoverP.cxx:894
Trk::KalmanVertexUpdator::update
xAOD::Vertex * update(xAOD::Vertex &vtx, const VxTrackAtVertex &trk, IVertexUpdator::updateMode mode) const
Method where the fit is actually done.
Definition: KalmanVertexUpdator.cxx:48
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
xAOD::Vertex_v1::position
const Amg::Vector3D & position() const
Returns the 3-pos.
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
JetTiledMap::S
@ S
Definition: TiledEtaPhiMap.h:44
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
dqt_zlumi_alleff_HIST.A
A
Definition: dqt_zlumi_alleff_HIST.py:110
Trk::IVertexUpdator::addTrack
@ addTrack
Definition: IVertexUpdator.h:70
Trk::AmgSymMatrix
AmgSymMatrix(5) &GXFTrackState
Definition: GXFTrackState.h:156
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
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AmgVector
AmgVector(4) T2BSTrackFilterTool
Definition: T2BSTrackFilterTool.cxx:114
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition: comparitor.cxx:522
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:127
Preparation.mode
mode
Definition: Preparation.py:96
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
Trk::KalmanVertexUpdator::positionUpdate
virtual IVertexUpdator::positionUpdateOutcome positionUpdate(const xAOD::Vertex &vtx, const LinearizedTrack *trk, double trackWeight, IVertexUpdator::updateMode mode) const override
Position update method.
Definition: KalmanVertexUpdator.cxx:126
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
Amg
Definition of ATLAS Math & Geometry primitives (Amg)
Definition: AmgStringHelpers.h:19
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
dqt_zlumi_alleff_HIST.B
B
Definition: dqt_zlumi_alleff_HIST.py:110
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
xAOD::Vertex_v1::numberDoF
float numberDoF() const
Returns the number of degrees of freedom of the vertex fit as float.
a
TList * a
Definition: liststreamerinfos.cxx:10
xAOD::Vertex_v1::chiSquared
float chiSquared() const
Returns the of the vertex fit as float.
h
Trk::KalmanVertexUpdator::trackParametersChi2
virtual float trackParametersChi2(const xAOD::Vertex &new_vtx, const LinearizedTrack *trk) const override
Method calculating the interstep Chi2 increment.
Definition: KalmanVertexUpdator.cxx:164
Trk::IVertexUpdator::removeTrack
@ removeTrack
Definition: IVertexUpdator.h:69
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:569
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
Trk::KalmanVertexUpdator::vertexPositionChi2
virtual float vertexPositionChi2(const xAOD::Vertex &old_vtx, const xAOD::Vertex &new_vtx) const override
Method calculating the vertex displacement-related part of the chi2
Definition: KalmanVertexUpdator.cxx:169
xAOD::Vertex_v1::vxTrackAtVertex
std::vector< Trk::VxTrackAtVertex > & vxTrackAtVertex()
Non-const access to the VxTrackAtVertex vector.
Definition: Vertex_v1.cxx:181
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
xAOD::Vertex_v1::setCovariancePosition
void setCovariancePosition(const AmgSymMatrix(3)&covariancePosition)
Sets the vertex covariance matrix.
fitman.k
k
Definition: fitman.py:528