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

#include <KalmanVertexTrackUpdator.h>

Inheritance diagram for Trk::KalmanVertexTrackUpdator:
Collaboration diagram for Trk::KalmanVertexTrackUpdator:

Public Member Functions

virtual StatusCode initialize () override
 
 KalmanVertexTrackUpdator (const std::string &t, const std::string &n, const IInterface *p)
 Constructor. More...
 
 ~KalmanVertexTrackUpdator ()=default
 Destructor. More...
 
virtual void update (VxTrackAtVertex &trk, const xAOD::Vertex &vtx) const override
 Update method
More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 AlgTool 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

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< IVertexUpdatorm_Updator
 
DoubleProperty m_maxWeight
 
BooleanProperty m_skipInvertibleCheck
 
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 VertexTrackUpdator using the Kalman filter algorithm. The algorithm refits a single track with the knowledge of the production vertex.

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 40 of file KalmanVertexTrackUpdator.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

◆ KalmanVertexTrackUpdator()

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

Constructor.

Definition at line 27 of file KalmanVertexTrackUpdator.cxx.

27  :
28  AthAlgTool(t,n,p)
29  {
30  declareInterface<IVertexTrackUpdator>(this);
31  }

◆ ~KalmanVertexTrackUpdator()

Trk::KalmanVertexTrackUpdator::~KalmanVertexTrackUpdator ( )
default

Destructor.

Member Function Documentation

◆ declareGaudiProperty() [1/4]

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

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

Definition at line 170 of file AthCommonDataStore.h.

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

◆ declareGaudiProperty() [2/4]

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

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

Definition at line 156 of file AthCommonDataStore.h.

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

◆ declareGaudiProperty() [3/4]

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

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

Definition at line 184 of file AthCommonDataStore.h.

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

◆ declareGaudiProperty() [4/4]

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

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

Definition at line 199 of file AthCommonDataStore.h.

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

◆ declareProperty() [1/6]

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

Declare a new Gaudi property.

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

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

Definition at line 245 of file AthCommonDataStore.h.

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

◆ declareProperty() [2/6]

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

Declare a new Gaudi property.

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

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

Definition at line 221 of file AthCommonDataStore.h.

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

◆ declareProperty() [3/6]

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

Definition at line 259 of file AthCommonDataStore.h.

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

◆ declareProperty() [4/6]

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

Declare a new Gaudi property.

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

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

Definition at line 333 of file AthCommonDataStore.h.

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

◆ declareProperty() [5/6]

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

Declare a new Gaudi property.

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

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

Definition at line 352 of file AthCommonDataStore.h.

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

◆ declareProperty() [6/6]

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

Definition at line 145 of file AthCommonDataStore.h.

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

◆ detStore()

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

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

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

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

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

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

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

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ initialize()

StatusCode Trk::KalmanVertexTrackUpdator::initialize ( )
overridevirtual

Definition at line 12 of file KalmanVertexTrackUpdator.cxx.

13  {
14  //uploading the corresponding tools
15  //updator
16  if ( m_Updator.retrieve().isFailure() )
17  {
18  ATH_MSG_FATAL("Failed to retrieve tool " << m_Updator);
19  return StatusCode::FAILURE;
20  }
21  ATH_MSG_INFO("Retrieved tool " << m_Updator);
22 
23 
24  return StatusCode::SUCCESS;
25  }

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

AlgTool interface methods.

Definition at line 53 of file IVertexTrackUpdator.h.

53 { return IID_IVertexTrackUpdator; };

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

◆ update()

void Trk::KalmanVertexTrackUpdator::update ( VxTrackAtVertex trk,
const xAOD::Vertex vtx 
) const
overridevirtual

Update method

Implements Trk::IVertexTrackUpdator.

Definition at line 33 of file KalmanVertexTrackUpdator.cxx.

34  {
35  const Amg::Vector3D & fit_vrt_pos = vtx.position();
36  Trk::LinearizedTrack * linTrack = trk.linState();
37 
38  //protection check
39  if(linTrack == nullptr)
40  {
41  if(trk.weight() > m_maxWeight)
42  {
43  //actual error case
44  msg(MSG::INFO) << "The VxTrackAtVertex passed does not have a Linearized Track" << endmsg;
45  msg(MSG::INFO) << "Please produce one with corresponding LinearizedTrackFactory"<< endmsg;
46  msg(MSG::INFO) << "The VxTrackAtVertex returned not refitted"<< endmsg;
47  // std::cout<<"Weight of the track: "<<trk.weight()<<std::endl;
48  }else{
49  if (msgLvl(MSG::DEBUG))
50  {
51  msg(MSG::DEBUG) << "The VxTrackAtVertex passed does not have a Linearized Track" << endmsg;
52  msg(MSG::DEBUG) << "However the weight of this track is less than " << m_maxWeight << endmsg;
53  msg(MSG::DEBUG) << "The VxTrackAtVertex returned not refitted"<< endmsg;
54  }
55  }//end of absent linTrack case
56 
57  return;
58  }//end of no lintrack check
59 
60  //getting Jacobians and track information
61  const AmgMatrix(5,3) & A = linTrack->positionJacobian();
62  const AmgMatrix(5,3) & B = linTrack->momentumJacobian();
63  const AmgVector(5) & trkParameters = linTrack->expectedParametersAtPCA();
64  // std::cout << "Perigee before refit " << trkParameters << std::endl;
65  // std::cout << "Track covariance before refit " << linTrack->expectedPerigeeCovarianceAtPCA() << std::endl;
66 
67  const AmgSymMatrix(5) & trkParametersWeight = linTrack->expectedWeightAtPCA();
68 
69  //calculation of S matrix
70  AmgSymMatrix(3) Sm = B.transpose()*(trkParametersWeight*B);
71 
72  if (Sm.determinant() == 0.0) {
73  ATH_MSG_WARNING("Matrix can not be inverted, new type of check as part of Eigen, please monitor."
74  << endmsg << "Matrix Sm = " << Sm);
75  return;
76  }
77  Sm = Sm.inverse().eval();
78  const AmgVector(5) & theResidual = linTrack->constantTerm();
79 
80  //refitted track momentum
81  Amg::Vector3D newTrackMomentum = Sm*B.transpose() * trkParametersWeight
82  * (trkParameters - theResidual - A*fit_vrt_pos);
83 
84  //refitted track parameters
85  AmgVector(5) refTrkPar; refTrkPar.setZero();
86  refTrkPar(Trk::phi) = newTrackMomentum(0);//phi
87  refTrkPar(Trk::theta) = newTrackMomentum(1);//theta
88  refTrkPar(Trk::qOverP)= newTrackMomentum(2);//qoverP
89 
90  //bring parameter phi again in the limits, if
91  //phi is slightly outside (as can be expected
92  //due to refitting)
93  // if (refTrkPar[2]<-M_PI) {
94  // refTrkPar[2] = refTrkPar[2]+M_PI;
95  // } else if (refTrkPar[2]>M_PI) {
96  // refTrkPar[2] = refTrkPar[2]-M_PI;
97  // }
98 
99  if (refTrkPar[Trk::phi0] > M_PI)
100  {
101  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG)<< "-U- phi = " << refTrkPar[Trk::phi0];
102  refTrkPar[Trk::phi0] = fmod(refTrkPar[Trk::phi0]+M_PI,2*M_PI)-M_PI;
103  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG)<< " out of range, now "
104  << "corrected to " << refTrkPar[Trk::phi0] << endmsg;
105  } else if(refTrkPar[Trk::phi0]<-M_PI) {
106  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG)<< "-U- phi = " << refTrkPar[Trk::phi0];
107  refTrkPar[Trk::phi0] = fmod(refTrkPar[Trk::phi0]-M_PI,2*M_PI)+M_PI;
108  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG)<< " out of range, now "
109  << "corrected to " << refTrkPar[Trk::phi0] << endmsg;
110  }
111 
112  if (refTrkPar[Trk::theta] > M_PI)
113  {
114  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG)<< " Theta out of range: correcting theta: " << refTrkPar[Trk::theta];
115  refTrkPar[Trk::theta]=fmod(refTrkPar[Trk::theta]+M_PI,2*M_PI)-M_PI;
116  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG)<< " to: " << refTrkPar[Trk::theta] << endmsg;
117  }
118  else if (refTrkPar[Trk::theta]<0)
119  {
120  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG)<< " Theta out of range: correcting theta: " << refTrkPar[Trk::theta];
121  refTrkPar[Trk::theta]=fmod(refTrkPar[Trk::theta]-M_PI,2*M_PI)+M_PI;
122  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG)<< " to: " << refTrkPar[Trk::theta] << endmsg;
123  }
124 
125  if (refTrkPar[Trk::theta] < 0)
126  {
127  refTrkPar[Trk::theta] =
128  - refTrkPar[Trk::theta];
129  refTrkPar[Trk::phi0] +=
130  (refTrkPar[Trk::phi0] > 0 ? -M_PI : M_PI);
131  } else if (refTrkPar[Trk::theta] > M_PI) {//this in principle should not be needed anymore
132  refTrkPar[Trk::theta] =
133  2*M_PI - refTrkPar[Trk::theta];
134  refTrkPar[Trk::phi0] +=
135  (refTrkPar[Trk::phi0] > 0 ? -M_PI : M_PI);
136  }
137 
138  //temporary hack to check the consistence of the frame
139  // std::cout<<"New track parameters "<<refTrkPar<<std::endl;
140 
141  //vertex covariance and weight
142  const AmgSymMatrix(3)& vrt_cov = vtx.covariancePosition();
143  if (vrt_cov.determinant() == 0.0) {
144  ATH_MSG_WARNING("Matrix can not be inverted, new type of check as part of Eigen, please monitor."
145  << endmsg << "Matrix vrt_cov = " << vrt_cov);
146  return;
147  }
148  AmgSymMatrix(3) vrt_weight;
149  bool invertible;
151  vrt_weight = vtx.covariancePosition().inverse();
152  invertible = true;
153  } else
154  vtx.covariancePosition().computeInverseWithCheck(vrt_weight,invertible);
155 
156  if(!invertible) {
157  ATH_MSG_VERBOSE ("The vertex's cov is not invertible, quit updating the track.");
158  return;
159  }
160 
161  //making a new track covariance matrix
162  AmgSymMatrix(3) posMomentumCovariance = -vrt_cov * A.transpose() * trkParametersWeight * B *Sm;
163 
164  //--------------------------------------------------------------------------------------------------------
165  //correction to what was forgotten before: making the smoothed chi2 of track
166  //this operation invokes removing of the track from the vertex
167  const IVertexUpdator::positionUpdateOutcome & reducedVrt = m_Updator->positionUpdate( vtx, linTrack, trk.weight(), IVertexUpdator::removeTrack );
168 
169  AmgSymMatrix(3) reduced_vrt_weight;
171  reduced_vrt_weight = reducedVrt.covariancePosition.inverse();
172  } else
173  reducedVrt.covariancePosition.computeInverseWithCheck(reduced_vrt_weight,invertible);
174  if(!invertible) {
175  ATH_MSG_VERBOSE ("The vertex's cov is not invertible, quit updating the track.");
176  return;
177  }
178  // const CLHEP::HepSymMatrix & reduced_vrt_cov = reducedVrt.covariancePosition();
179 
180  Amg::Vector3D posDifference = vtx.position() - reducedVrt.position;
181 
182  //now making the second part of the chi2 calculation: smoothed parameters
183  AmgVector(5) smRes = trkParameters - (theResidual + A*vtx.position() + B*newTrackMomentum);
184 
185  double chi2 = posDifference.dot(reduced_vrt_weight*posDifference) + smRes.dot(trkParametersWeight*smRes);
186 
187  // std::cout<<"Smoothed chi2 in the fit "<<chi2<<std::endl;
188  //-------------------------------------------------------------------------------------
189  //new momentum covariance
190  AmgSymMatrix(3) momentumCovariance = Sm + posMomentumCovariance.transpose()*(vrt_weight*posMomentumCovariance);
191 
192  //full (x,y,z,phi, theta, q/p) covariance matrix
193  AmgSymMatrix (6) fullTrkCov;
194  fullTrkCov.setZero();
195 
196  fullTrkCov.block<3,3>(0,0) = vrt_cov;
197  fullTrkCov.block<3,3>(0,3) = posMomentumCovariance;
198  fullTrkCov.block<3,3>(3,0) = posMomentumCovariance.transpose();
199  fullTrkCov.block<3,3>(3,3) = momentumCovariance;
200 
201  //debug hacking
202  AmgMatrix(5,6) trJac;
203  trJac.setZero();
204  trJac(4,5) = 1.;
205  trJac(3,4) = 1.;
206  trJac(2,3) = 1.;
207 
208  //first row
209  trJac(0,0) = - sin(refTrkPar[2]);
210  trJac(0,1) = cos(refTrkPar[2]);
211 
212  //second row
213  trJac(1,0) = -cos(refTrkPar[2])/tan(refTrkPar[3]);
214  trJac(1,1) = -sin(refTrkPar[2])/tan(refTrkPar[3]);
215  trJac(1,2) = 1.;
216 
217  AmgSymMatrix(5) perFullTrkCov = AmgSymMatrix(5)(trJac*(fullTrkCov*trJac.transpose()));
218 
219  //temporary hack: returning the state with incorrect covariance matrix, to see
220  //how general infrastructure works.
221 
222 
223  Trk::Perigee * refittedPerigee = new Trk::Perigee(refTrkPar[0],
224  refTrkPar[1],
225  refTrkPar[2],
226  refTrkPar[3],
227  refTrkPar[4],
228  fit_vrt_pos,
229  std::move(perFullTrkCov));
230 
231  trk.setPerigeeAtVertex(refittedPerigee);
232  const FitQuality trkQuality(chi2,2*trk.weight());
233  // std::cout<<"Tracks at vertex are assigned with chi2 "<<trkQuality.chiSquared()<<std::endl;
234  // std::cout<<"Tracks at vertex are assigned with ndf "<<trkQuality.numberDoF()<<std::endl;
235  trk.setTrackQuality(trkQuality);
236 
237  }//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  }

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_maxWeight

DoubleProperty Trk::KalmanVertexTrackUpdator::m_maxWeight
private
Initial value:
{
this, "MaximalWeight", 0.001, "Max weight of a given track in the vertex reconstruction"}

Definition at line 66 of file KalmanVertexTrackUpdator.h.

◆ m_skipInvertibleCheck

BooleanProperty Trk::KalmanVertexTrackUpdator::m_skipInvertibleCheck
private
Initial value:
{
this, "SkipInvertibleCheck", false, "skip the invertible check for the track CovMat and the vertex CovMat"}

Definition at line 68 of file KalmanVertexTrackUpdator.h.

◆ m_Updator

ToolHandle< IVertexUpdator > Trk::KalmanVertexTrackUpdator::m_Updator
private
Initial value:
{
this, "VertexUpdator", "Trk::KalmanVertexUpdator"}

Definition at line 63 of file KalmanVertexTrackUpdator.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::AmgMatrix
AmgMatrix(3, 3) NeutralParticleParameterCalculator
Definition: NeutralParticleParameterCalculator.cxx:233
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
Trk::KalmanVertexTrackUpdator::m_Updator
ToolHandle< IVertexUpdator > m_Updator
Definition: KalmanVertexTrackUpdator.h:63
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
CSV_InDetExporter.new
new
Definition: CSV_InDetExporter.py:145
M_PI
#define M_PI
Definition: ActiveFraction.h:11
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
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
xAOD::Vertex_v1::position
const Amg::Vector3D & position() const
Returns the 3-pos.
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
Trk::Perigee
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
Definition: Tracking/TrkEvent/TrkParameters/TrkParameters/TrackParameters.h:33
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
Trk::AmgSymMatrix
AmgSymMatrix(5) &GXFTrackState
Definition: GXFTrackState.h:156
A
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
Trk::KalmanVertexTrackUpdator::m_maxWeight
DoubleProperty m_maxWeight
Definition: KalmanVertexTrackUpdator.h:66
beamspotman.n
n
Definition: beamspotman.py:731
Trk::theta
@ theta
Definition: ParamDefs.h:66
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
AmgVector
AmgVector(4) T2BSTrackFilterTool
Definition: T2BSTrackFilterTool.cxx:114
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition: comparitor.cxx:523
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Trk::KalmanVertexTrackUpdator::m_skipInvertibleCheck
BooleanProperty m_skipInvertibleCheck
Definition: KalmanVertexTrackUpdator.h:68
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
a
TList * a
Definition: liststreamerinfos.cxx:10
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
DEBUG
#define DEBUG
Definition: page_access.h:11
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
Trk::qOverP
@ qOverP
perigee
Definition: ParamDefs.h:67
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
dot
Definition: dot.py:1
Trk::phi
@ phi
Definition: ParamDefs.h:75
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
Trk::phi0
@ phi0
Definition: ParamDefs.h:65
python.Dumpers.FitQuality
FitQuality
Definition: Dumpers.py:63
fitman.k
k
Definition: fitman.py:528
Trk::LinearizedTrack
Definition: LinearizedTrack.h:43