ATLAS Offline Software
Loading...
Searching...
No Matches
BeamspotVertexPreProcessor.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRKALIGNGENTOOLS_BEAMSPOTVERTEXPREPROCESSOR_H
6#define TRKALIGNGENTOOLS_BEAMSPOTVERTEXPREPROCESSOR_H
7
8#include "GaudiKernel/ToolHandle.h"
9#include "GaudiKernel/IAlgTool.h"
12
14
20
22
25#include <string>
26#include <string_view>
27
43
44
45namespace Trk {
46 class Track;
47 class AlignTrack;
48 class AlignVertex;
49 class VertexOnTrack;
50 class VxTrackAtVertex;
51
53 {
54
55 public:
56
57 BeamspotVertexPreProcessor(const std::string & type, const std::string & name, const IInterface * parent);
59
60 virtual StatusCode initialize() override;
61 virtual StatusCode finalize() override;
62
63 virtual DataVector<Track> * processTrackCollection(const DataVector<Track> * trks) override;
64
65 void accumulateVTX(AlignTrack* alignTrack) override;
66
67 void solveVTX() override;
68
70 virtual void printSummary() override;
71
72
73
74 private:
75
77
78 bool isAssociatedToPV(const Track * track, const xAOD::VertexContainer* vertices);
79 bool isAssociatedToVertex(const Track * track, const xAOD::Vertex * vertex);
80
81 bool selectVertices(const xAOD::Vertex * vtx) const;
82 bool selectUpdatedVertices(const xAOD::Vertex * updatedVtx) const;
83
84 const xAOD::Vertex* findVertexCandidate(const Track* track) const; // MD: changed to be now only a vertex
85 const VertexOnTrack* provideVotFromVertex(const Track* track, const xAOD::Vertex* &vtx) const;
86 const VertexOnTrack* provideVotFromBeamspot(const Track* track) const;
87 void provideVtxBeamspot(const AlignVertex* b, AmgSymMatrix(3)* q, Amg::Vector3D* v) const;
88
89
90 const Track* doConstraintRefit(ToolHandle<IGlobalTrackFitter>& fitter, const Track* track, const VertexOnTrack* vot, const ParticleHypothesis& particleHypothesis) const;
92 AlignTrack* doTrackRefit(const Track* track);
93
94
95 ToolHandle<IGlobalTrackFitter> m_trackFitter{
96 this, "TrackFitter", "Trk::GlobalChi2Fitter/InDetTrackFitter",
97 "normal track fitter"};
98 ToolHandle<IGlobalTrackFitter> m_SLTrackFitter{
99 this, "SLTrackFitter", "", "straight line track fitter"};
100 ToolHandle<IExtrapolator> m_extrapolator{
101 this, "Extrapolator", "Trk::Extrapolator/AtlasExtrapolator"};
102 ToolHandle<InDet::IInDetTrackSelectionTool> m_trkSelector{
103 this, "TrackSelector", "", "new track selector tool"};
104 ToolHandle<InDet::IInDetTrackSelectionTool> m_BSTrackSelector{
105 this, "BSConstraintTrackSelector", "",
106 "new track selector tool for tracks to be used with beam-spot constraint"};
107 ToolHandle<ITrackToVertexIPEstimator> m_trackToVertexIPEstimatorTool{
108 this, "TrackToVertexIPEstimatorTool", ""};
109
111 PublicToolHandle<IAlignModuleTool> m_alignModuleTool{
112 this, "AlignModuleTool", "InDet::InDetAlignModuleTool/InDetAlignModuleTool"};
113
115 this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };
116
118 this, "PVContainerName", "PrimaryVertices"};
119
120 BooleanProperty m_runOutlierRemoval{this, "RunOutlierRemoval", false,
121 "switch whether to run outlier logics or not"};
122 IntegerProperty m_particleNumber{this, "ParticleNumber", 3,
123 "type of material interaction in extrapolation, 3=pion, 0=non-interacting"};
124 BooleanProperty m_doTrkSelection{this, "DoTrackSelection", true,
125 "to activate the preprocessor track selection"};
126 BooleanProperty m_doBSTrackSelection{this, "DoBSTrackSelection", false,
127 "the selection mechanism which is based on cutting the perigee parameters, pt, etc."};
129 this, "DoAssociatedToPVSelection", true,
130 "the selection mechanism that only use the tracks associated to PV"};
131
132 UnsignedIntegerProperty m_constraintMode{this, "ConstraintMode", 0};
133
134 std::vector< std::pair< const xAOD::Vertex*, std::vector<VxTrackAtVertex> > > m_allTracksVector;
135
136 BooleanProperty m_doBeamspotConstraint{this, "DoBSConstraint", true,
137 "Constrain tracks to the beamspot (x,y) position"};
138 BooleanProperty m_doPrimaryVertexConstraint{this, "DoPVConstraint", false,
139 "Constrain tracks to the associated primary vertex (x,y,z) position"};
140 BooleanProperty m_doFullVertexConstraint{this, "DoFullVertex", false,
141 "Full 3D vertex constraint. Note DoPVConstraint needs to be set to true to use this option. If DoBSConstraint vertex position will be constrained to the BS"};
142 BooleanProperty m_doNormalRefit{this, "doNormalRefit", true,
143 "provide tracks in the case failed BS, PV and FullVertex constraints."};
144
145 DoubleProperty m_maxPt{this, "maxPt", 0.,
146 "Max pT range for refitting tracks"};
147
148 BooleanProperty m_refitTracks{this, "RefitTracks", true,
149 "flag to refit tracks"};
150 BooleanProperty m_storeFitMatrices{this, "StoreFitMatrices", true,
151 "flag to store derivative and covariance matrices after refit"};
152 BooleanProperty m_useSingleFitter{this, "UseSingleFitter", false,
153 "only use 1 fitter for refitting track"};
154 DoubleProperty m_BSScalingFactor{this, "BeamspotScalingFactor", 1.,
155 "scaling factor on beasmpot width"};
156 DoubleProperty m_PVScalingFactor{this, "PrimaryVertexScalingFactor", 1.,
157 "scaling factor on primary vertex position error"};
158
159 IntegerProperty m_minTrksInVtx{this, "MinTrksInVtx", 3,
160 "requirement to the minimal number of tracks in the vertex"};
161
162 int m_nTracks = 0;
163 std::vector<int> m_trackTypeCounter{};
167
169
170
171 };
172
173
174
176
177 public:
178 CompareTwoTracks(const Track* track, std::string_view compareMethod)
179 :m_method(compareMethod)
180 ,m_track(track)
181 {
182 }
183
184 bool operator()(VxTrackAtVertex vtxTrk);
185
186 private:
187 std::string m_method;
188 const Track* m_track{};
189 };
190
191
192}
193
194#endif // TRKALIGNGENTOOLS_BEAMSPOTVERTEXPREPROCESSOR_H
195
#define AmgSymMatrix(dim)
Property holding a SG store/key/clid from which a ReadHandle is made.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Derived DataVector<T>.
Definition DataVector.h:795
Property holding a SG store/key/clid from which a ReadHandle is made.
bool doBeamspotConstraintTrackSelection(const Track *track)
PublicToolHandle< IAlignModuleTool > m_alignModuleTool
Pointer to AlignModuleTool.
SG::ReadHandleKey< xAOD::VertexContainer > m_PVContainerName
void accumulateVTX(AlignTrack *alignTrack) override
methods added for the full VTX fit:
const VertexOnTrack * provideVotFromVertex(const Track *track, const xAOD::Vertex *&vtx) const
bool selectVertices(const xAOD::Vertex *vtx) const
bool isAssociatedToVertex(const Track *track, const xAOD::Vertex *vertex)
ToolHandle< InDet::IInDetTrackSelectionTool > m_trkSelector
bool isAssociatedToPV(const Track *track, const xAOD::VertexContainer *vertices)
ToolHandle< IGlobalTrackFitter > m_trackFitter
const xAOD::Vertex * findVertexCandidate(const Track *track) const
AlignTrack * doTrackRefit(const Track *track)
virtual DataVector< Track > * processTrackCollection(const DataVector< Track > *trks) override
Main processing of track collection.
void provideVtxBeamspot(const AlignVertex *b, AmgSymMatrix(3) *q, Amg::Vector3D *v) const
ToolHandle< IExtrapolator > m_extrapolator
DataVector< AlignVertex > m_AlignVertices
collection of AlignVertices used in FullVertex constraint option
std::vector< std::pair< const xAOD::Vertex *, std::vector< VxTrackAtVertex > > > m_allTracksVector
const Track * doConstraintRefit(ToolHandle< IGlobalTrackFitter > &fitter, const Track *track, const VertexOnTrack *vot, const ParticleHypothesis &particleHypothesis) const
ToolHandle< IGlobalTrackFitter > m_SLTrackFitter
virtual StatusCode initialize() override
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
ToolHandle< InDet::IInDetTrackSelectionTool > m_BSTrackSelector
ToolHandle< ITrackToVertexIPEstimator > m_trackToVertexIPEstimatorTool
virtual void printSummary() override
Print processing summary to logfile.
bool selectUpdatedVertices(const xAOD::Vertex *updatedVtx) const
BeamspotVertexPreProcessor(const std::string &type, const std::string &name, const IInterface *parent)
const VertexOnTrack * provideVotFromBeamspot(const Track *track) const
CompareTwoTracks(const Track *track, std::string_view compareMethod)
bool operator()(VxTrackAtVertex vtxTrk)
Class to handle Vertex On Tracks, it inherits from the common MeasurementBase.
The VxTrackAtVertex is a common class for all present TrkVertexFitters The VxTrackAtVertex is designe...
Eigen::Matrix< double, 3, 1 > Vector3D
Ensure that the ATLAS eigen extensions are properly loaded.
@ v
Definition ParamDefs.h:78
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.