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::JetFitterHelper Class Reference

Februar 2007 (c) Atlas Detector Reconstruction Software. More...

#include <JetFitterHelper.h>

Inheritance diagram for Trk::JetFitterHelper:
Collaboration diagram for Trk::JetFitterHelper:

Public Member Functions

 JetFitterHelper (const std::string &t, const std::string &n, const IInterface *p)
 Constructor. More...
 
 ~JetFitterHelper ()
 Destructor. More...
 
void addTracksOfFirstVertexToSecondVertex (const VxVertexOnJetAxis &first, VxVertexOnJetAxis &second) const
 Adds tracks from the second VxVertexOnJetAxis to the first one. More...
 
void performKalmanConstraintToBePrimaryVertex (RecVertexPositions &positionToUpdate, const VxVertexOnJetAxis &vertexToConstraint) const
 Performs a Kalman Update constraining the VxVertexOnJetAxis specified to be merged with the primary vertex. More...
 
void performKalmanConstraintToMergeVertices (RecVertexPositions &positionToUpdate, const VxVertexOnJetAxis &vertexToConstraint1, const VxVertexOnJetAxis &vertexToConstraint2) const
 Performs a Kalman Update constraining the two VxVertexOnJetAxis specified to be merged. More...
 
VxVertexOnJetAxismergeVerticesInJetCandidate (VxVertexOnJetAxis &vertex1, VxVertexOnJetAxis &vertex2, VxJetCandidate &myJetCandidate) const
 Modifies the VxJetCandidate provided, merging the two provided VxVertexOnJetAxis into a single vertex along the jet axis. More...
 
void mergeVertexToPrimaryInJetCandidate (VxVertexOnJetAxis &vertex, VxJetCandidate &myJetCandidate) const
 Modifies the VxJetCandidate provided, merging the provided VxVertexOnJetAxis into the primary vertex. 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

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

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

Februar 2007 (c) Atlas Detector Reconstruction Software.

Author
Giacinto Piacquadio (University of Freiburg)

(In case of problems, please contact: nicol.nosp@m.a.gi.nosp@m.acint.nosp@m.o.pi.nosp@m.acqua.nosp@m.dio@.nosp@m.cern..nosp@m.ch)

This class provides utilities for the JetFitter algorithm, mainly to manipulate the JetVxCandidate object during the fit, but also to perform linearization and similar tasks...

One very interesting feature is the application of exact constraints through the Kalman Filter formalism, a possibility illustrated for the first time in Babar with TreeFitter by Wouter Hulsbergen. This helps to have a fast estimation of the probability of forming a common cluster between two vertices. (reference will be put here)

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

◆ JetFitterHelper()

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

Constructor.

Definition at line 52 of file JetFitterHelper.cxx.

◆ ~JetFitterHelper()

Trk::JetFitterHelper::~JetFitterHelper ( )
default

Destructor.

Member Function Documentation

◆ addTracksOfFirstVertexToSecondVertex()

void Trk::JetFitterHelper::addTracksOfFirstVertexToSecondVertex ( const VxVertexOnJetAxis first,
VxVertexOnJetAxis second 
) const

Adds tracks from the second VxVertexOnJetAxis to the first one.

Definition at line 62 of file JetFitterHelper.cxx.

64  {
65 
66  if (*tracksIter!=nullptr) {
67 
68  tracksOfSecondVertex.push_back(*tracksIter);
69 
70  } else {
71  ATH_MSG_WARNING( " addTracksOfFirstVertexToSecondVertex method found an empty pointer for a track of the first vertex. Skipping it..." );
72  // continue;
73  }
74 
75  }
76 
77  second.setTracksAtVertex(std::move(tracksOfSecondVertex));
78 
79  }
80 
81  void JetFitterHelper::performKalmanConstraintToBePrimaryVertex(RecVertexPositions & positionToUpdate,
82  const VxVertexOnJetAxis & vertexToConstraint) const {
83 
84  //you need to copy the object... safeness here...
85  const Amg::VectorX position(positionToUpdate.position());
86  const Amg::MatrixX Ckm1(positionToUpdate.covariancePosition());
87 
88  if (position.rows()!=Ckm1.rows()) {
89  ATH_MSG_WARNING ("Error in performKalmanConstraintToBePrimaryVertex method:" <<
90  " covariance matrix of size " << Ckm1.rows() <<
91  " and vector of VertexPositions do not match. Not performing " <<
92  "any constraint... ");
93  return;
94  }

◆ 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

◆ 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::JetFitterHelper::interfaceID ( )
inlinestatic

Definition at line 48 of file JetFitterHelper.h.

48  {
49  return IID_JetFitterHelper;
50  }

◆ mergeVertexToPrimaryInJetCandidate()

void Trk::JetFitterHelper::mergeVertexToPrimaryInJetCandidate ( VxVertexOnJetAxis vertex,
VxJetCandidate myJetCandidate 
) const

Modifies the VxJetCandidate provided, merging the provided VxVertexOnJetAxis into the primary vertex.

Use this method in order to perform the merging in a coherent way (RecVertexPositions, list of VxVertexOnJetAxis, tracks in the VxVertexOnJetAxis representing the primary vertex, numbering of clusters, everything is updated in a coherent way). Afterwards the modified VxJetCandidate is ready for a new full fit.

Definition at line 283 of file JetFitterHelper.cxx.

316  {
317  if ((*VerticesIter)==&vertex) {
318  delete *VerticesIter;
319  VerticesIter=copyOfVerticesAtJetCandidate.erase(VerticesIter);
320  VerticesEnd=copyOfVerticesAtJetCandidate.end();
321  found=true;
322  } else {
323  ++VerticesIter;
324  }
325  }
326 
327  if (!found) {
328  ATH_MSG_WARNING ("Could not find second vertex from which a cluster with the primary vertex was created to delete it... Very strange... Check!!! ");
329  }
330 
331  //update myJetCandidate with the new vector of tracks
332  myJetCandidate.setVerticesOnJetAxis(copyOfVerticesAtJetCandidate);
333  myJetCandidate.setPrimaryVertex(&primaryVertex);
334 
335  //now you should update the numbering scheme... CHECK CHECK... WHEN TO DO IT???????
336  }
337 
338 }

◆ mergeVerticesInJetCandidate()

VxVertexOnJetAxis & Trk::JetFitterHelper::mergeVerticesInJetCandidate ( VxVertexOnJetAxis vertex1,
VxVertexOnJetAxis vertex2,
VxJetCandidate myJetCandidate 
) const

Modifies the VxJetCandidate provided, merging the two provided VxVertexOnJetAxis into a single vertex along the jet axis.

Use this method in order to perform the merging in a coherent way (RecVertexPositions, list of VxVertexOnJetAxis, tracks in the merged VxVertexOnJetAxis, numbering of clusters, everything is updated in a coherent way). Afterwards the modified VxJetCandidate is ready for a new full fit.

Definition at line 198 of file JetFitterHelper.cxx.

211  {
212  linPosition(numbVertex1)=(recPosition(numbVertex1)/covPosition(numbVertex1,numbVertex1)+
213  recPosition(numbVertex2)/covPosition(numbVertex2,numbVertex2))/
214  (1./covPosition(numbVertex1,numbVertex1)+1./covPosition(numbVertex2,numbVertex2));
215  } else {
216  ATH_MSG_WARNING ("one of the vertices to merge has error on position 0. should not happen, however: --> proceeding...");
217  }
218 
219  //call the function which deletes a single row (they're in the anonymous namespace, in Utilities.h)
220  Amg::VectorX reducedRecPositions=deleteRowFromVector(recPosition,numbVertex2);
221  Amg::VectorX reducedLinPositions=deleteRowFromVector(linPosition,numbVertex2);
222  Amg::VectorX reducedConstraintPositions=deleteRowFromVector(constraintPosition,numbVertex2);
223  Amg::MatrixX reducedCovPositions=deleteRowFromSymMatrix(covPosition,numbVertex2);
224  Amg::MatrixX reducedConstraintCovPositions=deleteRowFromSymMatrix(covConstraintPosition,numbVertex2);
225 
226  myJetCandidate.setRecVertexPositions(RecVertexPositions(reducedRecPositions,
227  reducedCovPositions,
228  0.,0.));
229  myJetCandidate.setConstraintVertexPositions(RecVertexPositions(reducedConstraintPositions,
230  reducedConstraintCovPositions,
231  0.,0.));
232 
233 
234  myJetCandidate.setLinearizationVertexPositions(VertexPositions(reducedLinPositions));
235 
236  //now as a last step you need to delete the vertex you're not using anymore...
237 
238  std::vector<VxVertexOnJetAxis*> copyOfVerticesAtJetCandidate=myJetCandidate.getVerticesOnJetAxis();
239 
240  const std::vector<VxVertexOnJetAxis*>::iterator VerticesBegin=copyOfVerticesAtJetCandidate.begin();
241  std::vector<VxVertexOnJetAxis*>::iterator VerticesEnd=copyOfVerticesAtJetCandidate.end();
242 
243  bool found=false;
244 
245  for (std::vector<VxVertexOnJetAxis*>::iterator VerticesIter=VerticesBegin;VerticesIter!=VerticesEnd;) {
246  if ((*VerticesIter)==&vertex2) {
247  delete *VerticesIter;
248  VerticesIter=copyOfVerticesAtJetCandidate.erase(VerticesIter);
249  VerticesEnd=copyOfVerticesAtJetCandidate.end();
250  found=true;
251  } else {
252  ++VerticesIter;
253  }
254  }
255 
256  if (!found) {
257  ATH_MSG_WARNING ("Could not find second vertex from which a cluster was created to delete it... Very strange... Check!!! ");
258  }
259 
260  //update myJetCandidate with the new vector of tracks
261  myJetCandidate.setVerticesOnJetAxis(copyOfVerticesAtJetCandidate);
262 
263  //now you should update the numbering scheme... CHECK CHECK... WHEN TO DO IT???????
264  return vertex1;//return the merged vertex
265 
266  }
267 
268  void JetFitterHelper::mergeVertexToPrimaryInJetCandidate(VxVertexOnJetAxis & vertex,VxJetCandidate & myJetCandidate) const {
269 
270  VxVertexOnJetAxis* primaryVertexPtr(myJetCandidate.getPrimaryVertex());
271 
272  if (primaryVertexPtr==nullptr) {
273  ATH_MSG_WARNING ("Pointer to the primary vertex is 0. No merging with primary vertex possible.");
274  return;
275  }
276 
277  VxVertexOnJetAxis primaryVertex(*primaryVertexPtr);
278 
280 
281  //now you need to *delete* the second vertex in copyOfRecVertexPositions and

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

◆ performKalmanConstraintToBePrimaryVertex()

void Trk::JetFitterHelper::performKalmanConstraintToBePrimaryVertex ( RecVertexPositions positionToUpdate,
const VxVertexOnJetAxis vertexToConstraint 
) const

Performs a Kalman Update constraining the VxVertexOnJetAxis specified to be merged with the primary vertex.

You need to provide a copy of the RecVertexPositions, because this will be updated with the new constraint directly.

Definition at line 96 of file JetFitterHelper.cxx.

105  {
106  ATH_MSG_WARNING ("The Rk_k-1 matrix inversion will fail - det(Rk)=0 detected."
107  " Constraint to primary vertex failed...");
108  return;
109  }
110  Amg::MatrixX Rk_km1_inverse=Rk_km1.inverse().eval();
111 
112  //kalman gain matrix
113  Amg::MatrixX Kk=Ckm1*Gk.transpose()*Rk_km1_inverse;
114 
115  //in this case the linearized constraint is just a scalar!
116  AmgVector(1) ConstraintInOldPosition;
117  ConstraintInOldPosition(0)=position[numbRow];
118 
119  Amg::VectorX newPosition=position-Kk*ConstraintInOldPosition;
120 
121  Amg::MatrixX newCovPosition=Ckm1-Kk*(2*Gk*Ckm1-Rk_km1*Kk.transpose());
122 
123  double newChi2=positionToUpdate.fitQuality().chiSquared()+Rk_km1_inverse.similarityT(ConstraintInOldPosition).determinant();
124 
125  double newNDF=positionToUpdate.fitQuality().numberDoF()+1;
126  //double newNDF=positionToUpdate.doubleNdf()+1.;//fitQuality().numberDoF()+1;
127 
128  const Amg::MatrixX& symmetrizedMatrix(newCovPosition);
129  positionToUpdate=Trk::RecVertexPositions(newPosition, symmetrizedMatrix, newNDF, newChi2);
130  }
131 
132  void JetFitterHelper::performKalmanConstraintToMergeVertices(RecVertexPositions & positionToUpdate,
133  const VxVertexOnJetAxis & vertexToConstraint1,
134  const VxVertexOnJetAxis & vertexToConstraint2) const {
135 
136  //you need to copy the object... safeness here...
137  const Amg::VectorX & position(positionToUpdate.position());
138  const Amg::MatrixX & Ckm1(positionToUpdate.covariancePosition());
139 
140  if (position.rows()!=Ckm1.rows()) {
141  ATH_MSG_WARNING("Error in performKalmanConstraintToBePrimaryVertex method: " <<
142  "covariance matrix dim " << Ckm1.rows() << " and vector of " <<
143  "VertexPositions dim " << position.rows() << " do not match."<<
144  " Not performing any constraint... ");
145  return;

◆ performKalmanConstraintToMergeVertices()

void Trk::JetFitterHelper::performKalmanConstraintToMergeVertices ( RecVertexPositions positionToUpdate,
const VxVertexOnJetAxis vertexToConstraint1,
const VxVertexOnJetAxis vertexToConstraint2 
) const

Performs a Kalman Update constraining the two VxVertexOnJetAxis specified to be merged.

You need to provide a copy of the RecVertexPositions, because this will be updated with the new constraint directly.

Definition at line 147 of file JetFitterHelper.cxx.

159  {
160  ATH_MSG_WARNING ("The Rk_k-1 matrix inversion will fail - Rk_k=0 detected."
161  " Constraint to primary vertex failed...");
162  return;
163  }
164  AmgMatrix(1,1) Rk_km1_inverse=Rk_km1.inverse();
165 
166  //kalman gain matrix
167  Amg::MatrixX Kk=Ckm1*Gk.transpose()*Rk_km1_inverse;
168 
169  //in this case the linearized constraint is just a scalar!
170  AmgVector(1) ConstraintInOldPosition(1);
171  ConstraintInOldPosition(0)=position[numbRow1]-position[numbRow2];
172 
173  Amg::VectorX newPosition=position-Kk*ConstraintInOldPosition;
174 
175  Amg::MatrixX newCovPosition=Ckm1-Kk*(2*Gk*Ckm1-Rk_km1*Kk.transpose());
176 
177  double newChi2=positionToUpdate.fitQuality().chiSquared()+Rk_km1_inverse.similarityT(ConstraintInOldPosition).determinant();
178  double newNDF=positionToUpdate.fitQuality().numberDoF()+1;
179 
180  positionToUpdate=Trk::RecVertexPositions(newPosition,newCovPosition,newNDF,newChi2);
181  }
182 
183  VxVertexOnJetAxis & JetFitterHelper::mergeVerticesInJetCandidate(VxVertexOnJetAxis & vertex1,
184  VxVertexOnJetAxis & vertex2,
185  VxJetCandidate & myJetCandidate) const {
186 
187  if (&vertex1==myJetCandidate.getPrimaryVertex()) {
188  mergeVertexToPrimaryInJetCandidate(vertex2,myJetCandidate);
189  return *myJetCandidate.getPrimaryVertex();
190  }
191  if (&vertex2 == myJetCandidate.getPrimaryVertex()) {
192  mergeVertexToPrimaryInJetCandidate(vertex1, myJetCandidate);
193  return *myJetCandidate.getPrimaryVertex();
194  }
195 
196  addTracksOfFirstVertexToSecondVertex(vertex2,vertex1);

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_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:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
Trk::AmgMatrix
AmgMatrix(3, 3) NeutralParticleParameterCalculator
Definition: NeutralParticleParameterCalculator.cxx:233
Amg::VectorX
Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorX
Dynamic Vector - dynamic allocation.
Definition: EventPrimitives.h:30
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
Trk::JetFitterHelper::performKalmanConstraintToBePrimaryVertex
void performKalmanConstraintToBePrimaryVertex(RecVertexPositions &positionToUpdate, const VxVertexOnJetAxis &vertexToConstraint) const
Performs a Kalman Update constraining the VxVertexOnJetAxis specified to be merged with the primary v...
Definition: JetFitterHelper.cxx:96
Trk::JetFitterHelper::addTracksOfFirstVertexToSecondVertex
void addTracksOfFirstVertexToSecondVertex(const VxVertexOnJetAxis &first, VxVertexOnJetAxis &second) const
Adds tracks from the second VxVertexOnJetAxis to the first one.
Definition: JetFitterHelper.cxx:62
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
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
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
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::JetFitterHelper::JetFitterHelper
JetFitterHelper(const std::string &t, const std::string &n, const IInterface *p)
Constructor.
Definition: JetFitterHelper.cxx:52
MuonR4::inverse
CalibratedSpacePoint::Covariance_t inverse(const CalibratedSpacePoint::Covariance_t &mat)
Inverts the parsed matrix.
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/src/UtilFunctions.cxx:65
AmgVector
AmgVector(4) T2BSTrackFilterTool
Definition: T2BSTrackFilterTool.cxx:114
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
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
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:228
IDTPM::chiSquared
float chiSquared(const U &p)
Definition: TrackParametersHelper.h:128
Trk::GsfMeasurementUpdator::fitQuality
FitQualityOnSurface fitQuality(const MultiComponentState &, const MeasurementBase &)
Method for determining the chi2 of the multi-component state and the number of degrees of freedom.
Definition: GsfMeasurementUpdator.cxx:845
similarityT
Matrix< Scalar, OtherDerived::RowsAtCompileTime, OtherDerived::RowsAtCompileTime > similarityT(const MatrixBase< OtherDerived > &m) const
similarityT method : yields ms = m^T*s*m
Definition: AmgMatrixBasePlugin.h:141
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
a
TList * a
Definition: liststreamerinfos.cxx:10
h
CondAlgsOpts.found
int found
Definition: CondAlgsOpts.py:101
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Trk::JetFitterHelper::mergeVertexToPrimaryInJetCandidate
void mergeVertexToPrimaryInJetCandidate(VxVertexOnJetAxis &vertex, VxJetCandidate &myJetCandidate) const
Modifies the VxJetCandidate provided, merging the provided VxVertexOnJetAxis into the primary vertex.
Definition: JetFitterHelper.cxx:283
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
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::JetFitterHelper::performKalmanConstraintToMergeVertices
void performKalmanConstraintToMergeVertices(RecVertexPositions &positionToUpdate, const VxVertexOnJetAxis &vertexToConstraint1, const VxVertexOnJetAxis &vertexToConstraint2) const
Performs a Kalman Update constraining the two VxVertexOnJetAxis specified to be merged.
Definition: JetFitterHelper.cxx:147
fitman.k
k
Definition: fitman.py:528
Trk::JetFitterHelper::mergeVerticesInJetCandidate
VxVertexOnJetAxis & mergeVerticesInJetCandidate(VxVertexOnJetAxis &vertex1, VxVertexOnJetAxis &vertex2, VxJetCandidate &myJetCandidate) const
Modifies the VxJetCandidate provided, merging the two provided VxVertexOnJetAxis into a single vertex...
Definition: JetFitterHelper.cxx:198