ATLAS Offline Software
BeamspotVertexPreProcessor.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRKALIGNGENTOOLS_BEAMSPOTVERTEXPREPROCESSOR_H
6 #define TRKALIGNGENTOOLS_BEAMSPOTVERTEXPREPROCESSOR_H
7 
9 #include "GaudiKernel/ToolHandle.h"
10 #include "GaudiKernel/IAlgTool.h"
14 #include <limits>
15 #include "VxVertex/VxContainer.h"
16 #include <functional>
17 
19 
21 #include "xAODTracking/Vertex.h"
24 
42 namespace Trk {
43  class IGlobalTrackFitter;
44  class IExtrapolator;
45  //class ITrackSelectorTool;
46  class Track;
47  class AlignTrack;
48  class AlignVertex;
49  class VxCandidate;
50  class VertexOnTrack;
51  class VxTrackAtVertex;
52  class IAlignModuleTool;
53 
55  {
56 
57  public:
58 
59  BeamspotVertexPreProcessor(const std::string & type, const std::string & name, const IInterface * parent);
61 
62  virtual StatusCode initialize();
63  virtual StatusCode finalize();
64 
66 
67  void accumulateVTX(AlignTrack* alignTrack);
68 
69  void solveVTX();
70 
72  virtual void printSummary();
73 
74 
75 
76  private:
77 
79 
80  bool isAssociatedToPV(const Track * track, const xAOD::VertexContainer* vertices);
81  bool isAssociatedToVertex(const Track * track, const xAOD::Vertex * vertex);
82 
83  bool selectVertices(const xAOD::Vertex * vtx) const;
84  bool selectUpdatedVertices(const xAOD::Vertex * updatedVtx) const;
85 
86  const xAOD::Vertex* findVertexCandidate(const Track* track) const; // MD: changed to be now only a vertex
87  const VertexOnTrack* provideVotFromVertex(const Track* track, const xAOD::Vertex* &vtx) const;
88  const VertexOnTrack* provideVotFromBeamspot(const Track* track) const;
89  void provideVtxBeamspot(const AlignVertex* b, AmgSymMatrix(3)* q, Amg::Vector3D* v) const;
90 
91 
92  const Track* doConstraintRefit(ToolHandle<IGlobalTrackFitter>& fitter, const Track* track, const VertexOnTrack* vot, const ParticleHypothesis& particleHypothesis) const;
95 
96 
97 
98  ToolHandle<IGlobalTrackFitter> m_trackFitter;
99  ToolHandle<IGlobalTrackFitter> m_SLTrackFitter;
100  ToolHandle<IExtrapolator> m_extrapolator;
101  //ToolHandle<ITrackSelectorTool> m_trkSelector; //!< track selector tool
102  ToolHandle<InDet::IInDetTrackSelectionTool> m_trkSelector;
103  //ToolHandle<ITrackSelectorTool> m_BSTrackSelector; //!< track selector tool for tracks to be used with beam-spot constraint
104  ToolHandle<InDet::IInDetTrackSelectionTool> m_BSTrackSelector;
105  //MD:
106  ToolHandle<ITrackToVertexIPEstimator> m_trackToVertexIPEstimatorTool;
107 
109  ToolHandle <Trk::IAlignModuleTool> m_alignModuleTool;
110 
111  SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };
112 
113  std::string m_PVContainerName;
120 
121  unsigned int m_constraintMode;
122 
123  std::string m_compareMethod;
124  std::vector<std::string> m_interestedVertexContainers;
125  std::vector< std::pair< const xAOD::Vertex*, std::vector<VxTrackAtVertex> > > m_allTracksVector;
130 
131  double m_maxPt;
132 
138 
141  std::vector<int> m_trackTypeCounter;
145 
147 
148 
149  };
150 
151 
152 
154 
155  public:
156  CompareTwoTracks(const Track* track, const std::string& compareMethod)
157  :m_method(compareMethod)
158  ,m_track(track)
159  { //std::cout <<"compareMethod: "<< m_method <<std::endl;
160  }
161 
162  bool operator()(VxTrackAtVertex vtxTrk);
163 
164  private:
165  std::string m_method;
166  const Track* m_track;
167  };
168 
169 
170 }
171 
172 #endif // TRKALIGNGENTOOLS_BEAMSPOTVERTEXPREPROCESSOR_H
173 
LArSamples::FitterData::fitter
const ShapeFitter * fitter
Definition: ShapeFitter.cxx:23
Trk::AlignVertex
Definition: AlignVertex.h:39
Trk::BeamspotVertexPreProcessor::m_storeFitMatrices
bool m_storeFitMatrices
flag to store derivative and covariance matrices after refit
Definition: BeamspotVertexPreProcessor.h:134
Trk::BeamspotVertexPreProcessor::m_maxPt
double m_maxPt
Max pT range for refitting tracks.
Definition: BeamspotVertexPreProcessor.h:131
Trk::BeamspotVertexPreProcessor::m_interestedVertexContainers
std::vector< std::string > m_interestedVertexContainers
Definition: BeamspotVertexPreProcessor.h:124
Trk::BeamspotVertexPreProcessor::m_compareMethod
std::string m_compareMethod
the method used to judge whether two tracks are the same track
Definition: BeamspotVertexPreProcessor.h:123
Trk::BeamspotVertexPreProcessor::m_doBeamspotConstraint
bool m_doBeamspotConstraint
do beamspot constraint
Definition: BeamspotVertexPreProcessor.h:126
Trk::BeamspotVertexPreProcessor::solveVTX
void solveVTX()
Definition: BeamspotVertexPreProcessor.cxx:1125
Trk::VxTrackAtVertex
The VxTrackAtVertex is a common class for all present TrkVertexFitters The VxTrackAtVertex is designe...
Definition: VxTrackAtVertex.h:77
Trk::BeamspotVertexPreProcessor::m_refitTracks
bool m_refitTracks
flag to refit tracks
Definition: BeamspotVertexPreProcessor.h:133
Trk::BeamspotVertexPreProcessor::m_AlignVertices
DataVector< AlignVertex > m_AlignVertices
collection of AlignVertices used in FullVertex constraint option
Definition: BeamspotVertexPreProcessor.h:146
IAlignTrackPreProcessor.h
Trk::BeamspotVertexPreProcessor::isAssociatedToPV
bool isAssociatedToPV(const Track *track, const xAOD::VertexContainer *vertices)
Definition: BeamspotVertexPreProcessor.cxx:295
Trk::BeamspotVertexPreProcessor::m_trackToVertexIPEstimatorTool
ToolHandle< ITrackToVertexIPEstimator > m_trackToVertexIPEstimatorTool
Definition: BeamspotVertexPreProcessor.h:106
Trk::BeamspotVertexPreProcessor::m_particleNumber
int m_particleNumber
type of material interaction in extrapolation
Definition: BeamspotVertexPreProcessor.h:116
Trk::BeamspotVertexPreProcessor
Definition: BeamspotVertexPreProcessor.h:55
Trk::BeamspotVertexPreProcessor::m_doBSTrackSelection
bool m_doBSTrackSelection
the selection mechanism which is based on cutting the perigee parameters, pt, etc.
Definition: BeamspotVertexPreProcessor.h:118
Trk::BeamspotVertexPreProcessor::m_BSScalingFactor
double m_BSScalingFactor
scaling factor on beasmpot width
Definition: BeamspotVertexPreProcessor.h:136
Trk::BeamspotVertexPreProcessor::m_selectVertices
bool m_selectVertices
do vertex selection
Definition: BeamspotVertexPreProcessor.h:115
Trk::BeamspotVertexPreProcessor::provideVotFromBeamspot
const VertexOnTrack * provideVotFromBeamspot(const Track *track) const
Definition: BeamspotVertexPreProcessor.cxx:518
Trk::BeamspotVertexPreProcessor::provideVtxBeamspot
void provideVtxBeamspot(const AlignVertex *b, AmgSymMatrix(3) *q, Amg::Vector3D *v) const
Definition: BeamspotVertexPreProcessor.cxx:610
Trk::BeamspotVertexPreProcessor::accumulateVTX
void accumulateVTX(AlignTrack *alignTrack)
methods added for the full VTX fit:
Definition: BeamspotVertexPreProcessor.cxx:954
Trk::BeamspotVertexPreProcessor::m_doNormalRefit
bool m_doNormalRefit
provide tracks in the case failed BS, PV and FullVertex constraints.
Definition: BeamspotVertexPreProcessor.h:129
Trk::BeamspotVertexPreProcessor::m_trkSelector
ToolHandle< InDet::IInDetTrackSelectionTool > m_trkSelector
new track selector tool
Definition: BeamspotVertexPreProcessor.h:102
Trk::BeamspotVertexPreProcessor::m_allTracksVector
std::vector< std::pair< const xAOD::Vertex *, std::vector< VxTrackAtVertex > > > m_allTracksVector
Definition: BeamspotVertexPreProcessor.h:125
Trk::BeamspotVertexPreProcessor::doConstraintRefit
const Track * doConstraintRefit(ToolHandle< IGlobalTrackFitter > &fitter, const Track *track, const VertexOnTrack *vot, const ParticleHypothesis &particleHypothesis) const
Definition: BeamspotVertexPreProcessor.cxx:638
Trk::BeamspotVertexPreProcessor::m_doPrimaryVertexConstraint
bool m_doPrimaryVertexConstraint
do vertex constraint
Definition: BeamspotVertexPreProcessor.h:127
Trk::BeamspotVertexPreProcessor::provideVotFromVertex
const VertexOnTrack * provideVotFromVertex(const Track *track, const xAOD::Vertex *&vtx) const
Definition: BeamspotVertexPreProcessor.cxx:405
Trk::BeamspotVertexPreProcessor::processTrackCollection
virtual DataVector< Track > * processTrackCollection(const DataVector< Track > *trks)
Main processing of track collection.
Definition: BeamspotVertexPreProcessor.cxx:880
Trk::BeamspotVertexPreProcessor::m_nFailedPVRefits
int m_nFailedPVRefits
Definition: BeamspotVertexPreProcessor.h:144
Trk::AmgSymMatrix
AmgSymMatrix(5) &GXFTrackState
Definition: GXFTrackState.h:156
Trk::ParticleHypothesis
ParticleHypothesis
Definition: ParticleHypothesis.h:25
Trk::BeamspotVertexPreProcessor::m_alignModuleTool
ToolHandle< Trk::IAlignModuleTool > m_alignModuleTool
Pointer to AlignModuleTool.
Definition: BeamspotVertexPreProcessor.h:109
Trk::BeamspotVertexPreProcessor::m_minTrksInVtx
int m_minTrksInVtx
requirement to the minimal number of tracks in the vertex
Definition: BeamspotVertexPreProcessor.h:139
Trk::BeamspotVertexPreProcessor::m_extrapolator
ToolHandle< IExtrapolator > m_extrapolator
straight line track fitter
Definition: BeamspotVertexPreProcessor.h:100
Trk::CompareTwoTracks::operator()
bool operator()(VxTrackAtVertex vtxTrk)
Definition: BeamspotVertexPreProcessor.cxx:218
Trk::BeamspotVertexPreProcessor::m_beamSpotKey
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
Definition: BeamspotVertexPreProcessor.h:111
Trk::CompareTwoTracks::m_method
std::string m_method
Definition: BeamspotVertexPreProcessor.h:165
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Trk::BeamspotVertexPreProcessor::m_doAssociatedToPVSelection
bool m_doAssociatedToPVSelection
the selection mechanism that only use the tracks associated to PV
Definition: BeamspotVertexPreProcessor.h:119
AthAlgTool.h
Trk::BeamspotVertexPreProcessor::m_trackTypeCounter
std::vector< int > m_trackTypeCounter
Definition: BeamspotVertexPreProcessor.h:141
Trk::BeamspotVertexPreProcessor::initialize
virtual StatusCode initialize()
Definition: BeamspotVertexPreProcessor.cxx:125
Trk::BeamspotVertexPreProcessor::m_doTrkSelection
bool m_doTrkSelection
to activate the preprocessor track selection
Definition: BeamspotVertexPreProcessor.h:117
test_pyathena.parent
parent
Definition: test_pyathena.py:15
Trk::BeamspotVertexPreProcessor::isAssociatedToVertex
bool isAssociatedToVertex(const Track *track, const xAOD::Vertex *vertex)
Definition: BeamspotVertexPreProcessor.cxx:311
Trk::BeamspotVertexPreProcessor::prepareAllTracksVector
void prepareAllTracksVector()
Definition: BeamspotVertexPreProcessor.cxx:328
Trk::BeamspotVertexPreProcessor::finalize
virtual StatusCode finalize()
Definition: BeamspotVertexPreProcessor.cxx:1167
VxContainer.h
Trk::BeamspotVertexPreProcessor::m_nFailedBSRefits
int m_nFailedBSRefits
Definition: BeamspotVertexPreProcessor.h:143
Trk::BeamspotVertexPreProcessor::m_doFullVertexConstraint
bool m_doFullVertexConstraint
do GX full vertex constraint
Definition: BeamspotVertexPreProcessor.h:128
Trk::BeamspotVertexPreProcessor::m_nFailedNormalRefits
int m_nFailedNormalRefits
Definition: BeamspotVertexPreProcessor.h:142
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
Vertex.h
ParticleHypothesis.h
IInDetTrackSelectionTool.h
Trk::VertexOnTrack
Definition: VertexOnTrack.h:45
Trk::CompareTwoTracks::CompareTwoTracks
CompareTwoTracks(const Track *track, const std::string &compareMethod)
Definition: BeamspotVertexPreProcessor.h:156
Trk::BeamspotVertexPreProcessor::m_constraintMode
unsigned int m_constraintMode
Definition: BeamspotVertexPreProcessor.h:121
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::BeamspotVertexPreProcessor::selectVertices
bool selectVertices(const xAOD::Vertex *vtx) const
Definition: BeamspotVertexPreProcessor.cxx:255
Trk::BeamspotVertexPreProcessor::BeamspotVertexPreProcessor
BeamspotVertexPreProcessor(const std::string &type, const std::string &name, const IInterface *parent)
Definition: BeamspotVertexPreProcessor.cxx:48
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::MeasurementBaseType::VertexOnTrack
@ VertexOnTrack
Definition: MeasurementBase.h:52
Trk::BeamspotVertexPreProcessor::~BeamspotVertexPreProcessor
virtual ~BeamspotVertexPreProcessor()
Trk::BeamspotVertexPreProcessor::findVertexCandidate
const xAOD::Vertex * findVertexCandidate(const Track *track) const
Definition: BeamspotVertexPreProcessor.cxx:372
Trk::AlignTrack
Definition: AlignTrack.h:41
Trk::BeamspotVertexPreProcessor::m_useSingleFitter
bool m_useSingleFitter
only use 1 fitter for refitting track
Definition: BeamspotVertexPreProcessor.h:135
SG::ReadCondHandleKey< InDet::BeamSpotData >
TrackParticle.h
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
VertexContainer.h
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
Trk::BeamspotVertexPreProcessor::m_trackFitter
ToolHandle< IGlobalTrackFitter > m_trackFitter
normal track fitter
Definition: BeamspotVertexPreProcessor.h:98
Trk::BeamspotVertexPreProcessor::m_PVScalingFactor
double m_PVScalingFactor
scaling factor on primary vertex position error
Definition: BeamspotVertexPreProcessor.h:137
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
Trk::BeamspotVertexPreProcessor::m_runOutlierRemoval
bool m_runOutlierRemoval
switch whether to run outlier logics or not
Definition: BeamspotVertexPreProcessor.h:114
Trk::BeamspotVertexPreProcessor::printSummary
virtual void printSummary()
Print processing summary to logfile.
Definition: BeamspotVertexPreProcessor.cxx:1143
Trk::BeamspotVertexPreProcessor::doBeamspotConstraintTrackSelection
bool doBeamspotConstraintTrackSelection(const Track *track)
Definition: BeamspotVertexPreProcessor.cxx:677
extractSporadic.q
list q
Definition: extractSporadic.py:98
ITrackToVertexIPEstimator.h
Trk::CompareTwoTracks
Definition: BeamspotVertexPreProcessor.h:153
Track
Definition: TriggerChamberClusterOnTrackCreator.h:21
Trk::CompareTwoTracks::m_track
const Track * m_track
Definition: BeamspotVertexPreProcessor.h:166
BeamSpotData.h
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
AthAlgTool
Definition: AthAlgTool.h:26
Trk::BeamspotVertexPreProcessor::m_PVContainerName
std::string m_PVContainerName
the name of the primary vertex container
Definition: BeamspotVertexPreProcessor.h:113
Trk::IAlignTrackPreProcessor
Definition: IAlignTrackPreProcessor.h:36
Trk::BeamspotVertexPreProcessor::m_nTracks
int m_nTracks
Definition: BeamspotVertexPreProcessor.h:140
AlignVertex
AlignVertex is a simple structure to store objects belonging to a vertex. Contains a pointer to the o...
Trk::BeamspotVertexPreProcessor::m_SLTrackFitter
ToolHandle< IGlobalTrackFitter > m_SLTrackFitter
Definition: BeamspotVertexPreProcessor.h:99
Trk::BeamspotVertexPreProcessor::m_BSTrackSelector
ToolHandle< InDet::IInDetTrackSelectionTool > m_BSTrackSelector
new track selector tool for tracks to be used with beam-spot constraint
Definition: BeamspotVertexPreProcessor.h:104
Trk::BeamspotVertexPreProcessor::doTrackRefit
AlignTrack * doTrackRefit(const Track *track)
Definition: BeamspotVertexPreProcessor.cxx:731
Trk::v
@ v
Definition: ParamDefs.h:78
AlignTrack
AlignTrack is a generalization of a Trk::Track, used as the basic object to contain track information...
Trk::BeamspotVertexPreProcessor::selectUpdatedVertices
bool selectUpdatedVertices(const xAOD::Vertex *updatedVtx) const
Definition: BeamspotVertexPreProcessor.cxx:273