ATLAS Offline Software
JetFitterRoutines.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
34 #ifndef TrkJetFitter_JetFitterRoutines_H
35 #define TrkJetFitter_JetFitterRoutines_H
36 
38 #include "GaudiKernel/ToolHandle.h"
40 
42 
43 namespace Trk {
44 
45  class VxVertexOnJetAxis;
46  class VxJetCandidate;
47  class JetFitterInitializationHelper;
48  class JetFitterHelper;
49  class KalmanVertexOnJetAxisUpdator;
50  class KalmanVertexOnJetAxisSmoother;
51  class TrkDistanceFinderNeutralCharged;
52  class TrkDistanceFinderNeutralNeutral;
53 
54  static const InterfaceID IID_JetFitterRoutines("Trk::JetFitterRoutines", 1, 0);
55 
57  {
58 
59  public:
60 
61  static const InterfaceID& interfaceID() {
62  return IID_JetFitterRoutines;
63  }
64 
65 
66  virtual StatusCode initialize() override;
67 
72  JetFitterRoutines(const std::string& t, const std::string& n, const IInterface* p);
73 
79 
87 
104  void performTheFit(VxJetCandidate* myJetCandidate,
105  int num_maxiterations=30,
106  bool treat_sign_flip=true,
107  int num_signflip_maxiterations=30,
108  double deltachi2_convergence=0.001) const;
109 
116  void smoothAllVertices(VxJetCandidate* myJetCandidate) const;
117 
125  void updateAllVertices(VxJetCandidate* myJetCandidate) const ;
126 
127  // void updateChi2AllVertices(VxJetCandidate* myJetCandidate) const ;
128 
150  std::pair<double,bool> fastProbabilityOfMerging(const VxVertexOnJetAxis*,const VxVertexOnJetAxis*,
151  const VxJetCandidate*) const;
152 
175  double fullProbabilityOfMerging(const VxVertexOnJetAxis* firstVertex,
176  const VxVertexOnJetAxis* secondVertex,
177  const VxJetCandidate* myJetCandidate,
178  int num_maxiterations=20,
179  bool treat_sign_flip=true,
180  int num_signflip_maxiterations=10,
181  double deltachi2_convergence=1e-2) const;
194  void fillTableWithFullProbOfMerging(VxJetCandidate* myJetCandidate,
195  int num_maxiterations=20,
196  bool treat_sign_flip=true,
197  int num_signflip_maxiterations=10,
198  double deltachi2_convergence=1e-3,
199  double threshold_probability=1e-5) const;
200 
201 
214  void fillTableWithFastProbOfMerging(VxJetCandidate* myJetCandidate) const;
215  //please note that in the case of FastProbOfMerging the threshold_probability is always 1e-3
216  //(the default one for the FullProb - see three lines above)
217 
224  void deleteVertexFromJetCandidate(VxVertexOnJetAxis* vertexToDelete,
225  VxJetCandidate* myJetCandidate) const;
226 
227  private:
228 
233  std::pair<double,bool> fastProbabilityOfMergingWithPrimary(const VxVertexOnJetAxis* otherVertex,
234  const VxJetCandidate* myJetCandidate) const;
235 
240  std::pair<double,bool> fastProbabilityOfMergingNoPrimary(const VxVertexOnJetAxis*,
241  const VxVertexOnJetAxis*,
242  const VxJetCandidate* myJetCandidate) const;
243 
249  void fillTableWithProbOfMerging(VxJetCandidate* myJetCandidate,
250  bool fullcomputation,
251  int num_maxiterations=20,
252  bool treat_sign_flip=true,
253  int num_signflip_maxiterations=10,
254  double deltachi2_convergence=1e-2,
255  double threshold_probability=1e-3) const;
261  bool checkJetCandidate(VxJetCandidate*) const;
262 
267  void copyRecoPositionsToLinearizationPositions(VxJetCandidate & myJetCandidate) const;
268 
270  {this, "AtlasFieldCacheCondObj", "fieldCondObj", "Name of the Magnetic Field conditions object key"};
271 
272  ToolHandle<JetFitterInitializationHelper> m_initializationHelper;
273  ToolHandle<JetFitterHelper> m_helper;
274  ToolHandle<KalmanVertexOnJetAxisUpdator> m_updator;
275  ToolHandle<KalmanVertexOnJetAxisSmoother> m_smoother;
276  ToolHandle<TrkDistanceFinderNeutralCharged> m_minDistanceFinder;
277  ToolHandle<TrkDistanceFinderNeutralNeutral> m_minDistanceFinderNeutral;
278 
279 
280  /*
281  * Old option: please do not switch to true.
282  * Will be deleted in future releases.
283  */
284 
285  bool m_fast;
286 
287  /*
288  * Provides a limit to the DR shifht of the direction of the flight axis during
289  * the fast estimation procedure for the probability of merging between to vertices.
290  * If the shift is higher than that, the fastProbabilityOfMerging method informs
291  * the user that the estimation could not be reliable.
292  */
293 
294  double m_maxDRshift;
295 
296  /*
297  * If true, the assumption is made that, whenever tracks are merged to the primary vertex, they were already
298  * contained in the primary vertex fit, for which the prior information about the position and covariance matrix
299  * was already used in initializing the fit.
300  *
301  * This has the problem that if this was not the case and smoothing of the tracks at the primary vertex is requested,
302  * sometimes a negative weight can come out of the removal of the track (is this is particularly affecting the fit).
303  *
304  * Unless you know what you are doing, put this to false.
305  *
306  * Also in this case there is a disadvantage: tracks are refit again into the primary vertex, even if they were
307  * already partecipating in the prior information of the vertex. This will be resolved only when the primary and
308  * secondary vertex fit will be related the one to the other.
309  */
310 
312 
313  /*
314  * Avoid vertex to be initialize outside ID envelope given bu m_maxR and m_maxZ
315  */
316 
317  double m_maxR;
318  double m_maxZ;
319 
320  };//end class declaration
321 
322 }//end namespace Trk
323 
324 
325 #endif
Trk::JetFitterRoutines::smoothAllVertices
void smoothAllVertices(VxJetCandidate *myJetCandidate) const
triggers the smoothing of all vertices (the tracks in the fit are updated using the constraint provid...
Definition: JetFitterRoutines.cxx:529
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
Trk::JetFitterRoutines::m_fieldCacheCondObjInputKey
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCacheCondObjInputKey
Definition: JetFitterRoutines.h:270
AtlasFieldCacheCondObj.h
Trk::JetFitterRoutines::m_helper
ToolHandle< JetFitterHelper > m_helper
Definition: JetFitterRoutines.h:273
Trk::VxVertexOnJetAxis
VxVertexOnJetAxis inherits from Vertex.
Definition: VxVertexOnJetAxis.h:79
Trk::JetFitterRoutines::fillTableWithProbOfMerging
void fillTableWithProbOfMerging(VxJetCandidate *myJetCandidate, bool fullcomputation, int num_maxiterations=20, bool treat_sign_flip=true, int num_signflip_maxiterations=10, double deltachi2_convergence=1e-2, double threshold_probability=1e-3) const
Internal method to fill the VxClusteringTable of the VxJetCandidate object, independently on if the f...
Definition: JetFitterRoutines.cxx:869
Trk::JetFitterRoutines::initialize
virtual StatusCode initialize() override
Definition: JetFitterRoutines.cxx:108
Trk::JetFitterRoutines::m_maxR
double m_maxR
Definition: JetFitterRoutines.h:317
Trk::JetFitterRoutines::fastProbabilityOfMergingWithPrimary
std::pair< double, bool > fastProbabilityOfMergingWithPrimary(const VxVertexOnJetAxis *otherVertex, const VxJetCandidate *myJetCandidate) const
Internal method to calculate fast probability of merging, for merging with primary vertex.
Definition: JetFitterRoutines.cxx:672
Trk::JetFitterRoutines::fullProbabilityOfMerging
double fullProbabilityOfMerging(const VxVertexOnJetAxis *firstVertex, const VxVertexOnJetAxis *secondVertex, const VxJetCandidate *myJetCandidate, int num_maxiterations=20, bool treat_sign_flip=true, int num_signflip_maxiterations=10, double deltachi2_convergence=1e-2) const
Calculates in a complete way the probability two vertices along the jet axis to be compatible with ea...
Definition: JetFitterRoutines.cxx:765
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Trk::JetFitterRoutines::m_maxDRshift
double m_maxDRshift
Definition: JetFitterRoutines.h:294
Trk::JetFitterRoutines::checkJetCandidate
bool checkJetCandidate(VxJetCandidate *) const
Internal method to provide a check if the VxJetCandidate has been initialized in a consistent way.
Definition: JetFitterRoutines.cxx:556
Trk::JetFitterRoutines::performTheFit
void performTheFit(VxJetCandidate *myJetCandidate, int num_maxiterations=30, bool treat_sign_flip=true, int num_signflip_maxiterations=30, double deltachi2_convergence=0.001) const
This is the method where the fit is actually done.
Definition: JetFitterRoutines.cxx:300
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
ReadCondHandleKey.h
Trk::JetFitterRoutines::fillTableWithFullProbOfMerging
void fillTableWithFullProbOfMerging(VxJetCandidate *myJetCandidate, int num_maxiterations=20, bool treat_sign_flip=true, int num_signflip_maxiterations=10, double deltachi2_convergence=1e-3, double threshold_probability=1e-5) const
The VxClusteringTable of the VxJetCandidate provided in input is created, computing all the needed pr...
Definition: JetFitterRoutines.cxx:849
Trk::JetFitterRoutines::m_smoother
ToolHandle< KalmanVertexOnJetAxisSmoother > m_smoother
Definition: JetFitterRoutines.h:275
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::JetFitterRoutines::interfaceID
static const InterfaceID & interfaceID()
Definition: JetFitterRoutines.h:61
Trk::JetFitterRoutines::JetFitterRoutines
JetFitterRoutines(const std::string &t, const std::string &n, const IInterface *p)
Constructor.
Definition: JetFitterRoutines.cxx:74
Trk::JetFitterRoutines::fastProbabilityOfMergingNoPrimary
std::pair< double, bool > fastProbabilityOfMergingNoPrimary(const VxVertexOnJetAxis *, const VxVertexOnJetAxis *, const VxJetCandidate *myJetCandidate) const
Internal method to calculate fast probability of merging, for merging with non primary vertex.
Definition: JetFitterRoutines.cxx:717
Trk::JetFitterRoutines::~JetFitterRoutines
~JetFitterRoutines()
Destructor.
Trk::JetFitterRoutines::initializeToMinDistancesToJetAxis
void initializeToMinDistancesToJetAxis(VxJetCandidate *) const
This method provides the initialization of all the tracks in the fit to the position of minimum dista...
Definition: JetFitterRoutines.cxx:130
Trk::JetFitterRoutines::m_initializationHelper
ToolHandle< JetFitterInitializationHelper > m_initializationHelper
Definition: JetFitterRoutines.h:272
Trk::JetFitterRoutines
Februar 2007 (c) Atlas Detector Reconstruction Software.
Definition: JetFitterRoutines.h:57
Trk::VxJetCandidate
Definition: VxJetCandidate.h:72
Trk::JetFitterRoutines::copyRecoPositionsToLinearizationPositions
void copyRecoPositionsToLinearizationPositions(VxJetCandidate &myJetCandidate) const
Method to copy new reco positions to linearization positions after checking new positions are inside ...
Definition: JetFitterRoutines.cxx:1141
Trk::JetFitterRoutines::m_updator
ToolHandle< KalmanVertexOnJetAxisUpdator > m_updator
Definition: JetFitterRoutines.h:274
Trk::JetFitterRoutines::m_minDistanceFinderNeutral
ToolHandle< TrkDistanceFinderNeutralNeutral > m_minDistanceFinderNeutral
Definition: JetFitterRoutines.h:277
SG::ReadCondHandleKey< AtlasFieldCacheCondObj >
Trk::JetFitterRoutines::m_maxZ
double m_maxZ
Definition: JetFitterRoutines.h:318
Trk::JetFitterRoutines::deleteVertexFromJetCandidate
void deleteVertexFromJetCandidate(VxVertexOnJetAxis *vertexToDelete, VxJetCandidate *myJetCandidate) const
Deltes a vertex from the VxJetCandidate, doing everything is needed to preserve the internal coherenc...
Definition: JetFitterRoutines.cxx:1027
Trk::JetFitterRoutines::m_fast
bool m_fast
Definition: JetFitterRoutines.h:285
AthAlgTool
Definition: AthAlgTool.h:26
Trk::JetFitterRoutines::m_noPrimaryVertexRefit
bool m_noPrimaryVertexRefit
Definition: JetFitterRoutines.h:311
Trk::JetFitterRoutines::fastProbabilityOfMerging
std::pair< double, bool > fastProbabilityOfMerging(const VxVertexOnJetAxis *, const VxVertexOnJetAxis *, const VxJetCandidate *) const
Calculates in a very fast way the probability two vertices along the jet axis to be compatible with e...
Definition: JetFitterRoutines.cxx:652
Trk::JetFitterRoutines::updateAllVertices
void updateAllVertices(VxJetCandidate *myJetCandidate) const
One iteration of the Kalman Updated of all tracks to the actual fit is performed.
Definition: JetFitterRoutines.cxx:457
Trk::JetFitterRoutines::fillTableWithFastProbOfMerging
void fillTableWithFastProbOfMerging(VxJetCandidate *myJetCandidate) const
The VxClusteringTable of the VxJetCandidate provided in input is created, computing all the needed pr...
Definition: JetFitterRoutines.cxx:864
Trk::JetFitterRoutines::m_minDistanceFinder
ToolHandle< TrkDistanceFinderNeutralCharged > m_minDistanceFinder
Definition: JetFitterRoutines.h:276