ATLAS Offline Software
BeamspotVertexPreProcessor.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 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 
43 namespace Trk {
44  class Track;
45  class AlignTrack;
46  class AlignVertex;
47  class VertexOnTrack;
48  class VxTrackAtVertex;
49 
51  {
52 
53  public:
54 
55  BeamspotVertexPreProcessor(const std::string & type, const std::string & name, const IInterface * parent);
57 
58  virtual StatusCode initialize() override;
59  virtual StatusCode finalize() override;
60 
61  virtual DataVector<Track> * processTrackCollection(const DataVector<Track> * trks) override;
62 
63  void accumulateVTX(AlignTrack* alignTrack) override;
64 
65  void solveVTX() override;
66 
68  virtual void printSummary() override;
69 
70 
71 
72  private:
73 
75 
76  bool isAssociatedToPV(const Track * track, const xAOD::VertexContainer* vertices);
77  bool isAssociatedToVertex(const Track * track, const xAOD::Vertex * vertex);
78 
79  bool selectVertices(const xAOD::Vertex * vtx) const;
80  bool selectUpdatedVertices(const xAOD::Vertex * updatedVtx) const;
81 
82  const xAOD::Vertex* findVertexCandidate(const Track* track) const; // MD: changed to be now only a vertex
83  const VertexOnTrack* provideVotFromVertex(const Track* track, const xAOD::Vertex* &vtx) const;
84  const VertexOnTrack* provideVotFromBeamspot(const Track* track) const;
85  void provideVtxBeamspot(const AlignVertex* b, AmgSymMatrix(3)* q, Amg::Vector3D* v) const;
86 
87 
88  const Track* doConstraintRefit(ToolHandle<IGlobalTrackFitter>& fitter, const Track* track, const VertexOnTrack* vot, const ParticleHypothesis& particleHypothesis) const;
91 
92 
93  ToolHandle<IGlobalTrackFitter> m_trackFitter{
94  this, "TrackFitter", "Trk::GlobalChi2Fitter/InDetTrackFitter",
95  "normal track fitter"};
96  ToolHandle<IGlobalTrackFitter> m_SLTrackFitter{
97  this, "SLTrackFitter", "", "straight line track fitter"};
98  ToolHandle<IExtrapolator> m_extrapolator{
99  this, "Extrapolator", "Trk::Extrapolator/AtlasExtrapolator"};
100  ToolHandle<InDet::IInDetTrackSelectionTool> m_trkSelector{
101  this, "TrackSelector", "", "new track selector tool"};
102  ToolHandle<InDet::IInDetTrackSelectionTool> m_BSTrackSelector{
103  this, "BSConstraintTrackSelector", "",
104  "new track selector tool for tracks to be used with beam-spot constraint"};
105  ToolHandle<ITrackToVertexIPEstimator> m_trackToVertexIPEstimatorTool{
106  this, "TrackToVertexIPEstimatorTool", ""};
107 
109  PublicToolHandle<IAlignModuleTool> m_alignModuleTool{
110  this, "AlignModuleTool", "InDet::InDetAlignModuleTool/InDetAlignModuleTool"};
111 
113  this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };
114 
116  this, "PVContainerName", "PrimaryVertices"};
117 
118  BooleanProperty m_runOutlierRemoval{this, "RunOutlierRemoval", false,
119  "switch whether to run outlier logics or not"};
120  IntegerProperty m_particleNumber{this, "ParticleNumber", 3,
121  "type of material interaction in extrapolation, 3=pion, 0=non-interacting"};
122  BooleanProperty m_doTrkSelection{this, "DoTrackSelection", true,
123  "to activate the preprocessor track selection"};
124  BooleanProperty m_doBSTrackSelection{this, "DoBSTrackSelection", false,
125  "the selection mechanism which is based on cutting the perigee parameters, pt, etc."};
127  this, "DoAssociatedToPVSelection", true,
128  "the selection mechanism that only use the tracks associated to PV"};
129 
130  UnsignedIntegerProperty m_constraintMode{this, "ConstraintMode", 0};
131 
132  std::vector< std::pair< const xAOD::Vertex*, std::vector<VxTrackAtVertex> > > m_allTracksVector;
133 
134  BooleanProperty m_doBeamspotConstraint{this, "DoBSConstraint", true,
135  "Constrain tracks to the beamspot (x,y) position"};
136  BooleanProperty m_doPrimaryVertexConstraint{this, "DoPVConstraint", false,
137  "Constrain tracks to the associated primary vertex (x,y,z) position"};
138  BooleanProperty m_doFullVertexConstraint{this, "DoFullVertex", false,
139  "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"};
140  BooleanProperty m_doNormalRefit{this, "doNormalRefit", true,
141  "provide tracks in the case failed BS, PV and FullVertex constraints."};
142 
143  DoubleProperty m_maxPt{this, "maxPt", 0.,
144  "Max pT range for refitting tracks"};
145 
146  BooleanProperty m_refitTracks{this, "RefitTracks", true,
147  "flag to refit tracks"};
148  BooleanProperty m_storeFitMatrices{this, "StoreFitMatrices", true,
149  "flag to store derivative and covariance matrices after refit"};
150  BooleanProperty m_useSingleFitter{this, "UseSingleFitter", false,
151  "only use 1 fitter for refitting track"};
152  DoubleProperty m_BSScalingFactor{this, "BeamspotScalingFactor", 1.,
153  "scaling factor on beasmpot width"};
154  DoubleProperty m_PVScalingFactor{this, "PrimaryVertexScalingFactor", 1.,
155  "scaling factor on primary vertex position error"};
156 
157  IntegerProperty m_minTrksInVtx{this, "MinTrksInVtx", 3,
158  "requirement to the minimal number of tracks in the vertex"};
159 
160  int m_nTracks = 0;
161  std::vector<int> m_trackTypeCounter{};
165 
167 
168 
169  };
170 
171 
172 
174 
175  public:
176  CompareTwoTracks(const Track* track, const std::string& compareMethod)
177  :m_method(compareMethod)
178  ,m_track(track)
179  { //std::cout <<"compareMethod: "<< m_method <<std::endl;
180  }
181 
182  bool operator()(VxTrackAtVertex vtxTrk);
183 
184  private:
185  std::string m_method;
186  const Track* m_track;
187  };
188 
189 
190 }
191 
192 #endif // TRKALIGNGENTOOLS_BEAMSPOTVERTEXPREPROCESSOR_H
193 
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
LArSamples::FitterData::fitter
const ShapeFitter * fitter
Definition: ShapeFitter.cxx:23
Trk::AlignVertex
Definition: AlignVertex.h:39
Trk::BeamspotVertexPreProcessor::m_minTrksInVtx
IntegerProperty m_minTrksInVtx
Definition: BeamspotVertexPreProcessor.h:157
Trk::BeamspotVertexPreProcessor::m_refitTracks
BooleanProperty m_refitTracks
Definition: BeamspotVertexPreProcessor.h:146
Trk::VxTrackAtVertex
The VxTrackAtVertex is a common class for all present TrkVertexFitters The VxTrackAtVertex is designe...
Definition: VxTrackAtVertex.h:77
Trk::BeamspotVertexPreProcessor::m_AlignVertices
DataVector< AlignVertex > m_AlignVertices
collection of AlignVertices used in FullVertex constraint option
Definition: BeamspotVertexPreProcessor.h:166
IAlignTrackPreProcessor.h
Trk::BeamspotVertexPreProcessor::isAssociatedToPV
bool isAssociatedToPV(const Track *track, const xAOD::VertexContainer *vertices)
Definition: BeamspotVertexPreProcessor.cxx:218
Trk::BeamspotVertexPreProcessor::m_BSScalingFactor
DoubleProperty m_BSScalingFactor
Definition: BeamspotVertexPreProcessor.h:152
Trk::BeamspotVertexPreProcessor::finalize
virtual StatusCode finalize() override
Definition: BeamspotVertexPreProcessor.cxx:1032
Trk::BeamspotVertexPreProcessor::m_doTrkSelection
BooleanProperty m_doTrkSelection
Definition: BeamspotVertexPreProcessor.h:122
Trk::BeamspotVertexPreProcessor::m_trackToVertexIPEstimatorTool
ToolHandle< ITrackToVertexIPEstimator > m_trackToVertexIPEstimatorTool
Definition: BeamspotVertexPreProcessor.h:105
Trk::BeamspotVertexPreProcessor
Definition: BeamspotVertexPreProcessor.h:51
Trk::BeamspotVertexPreProcessor::m_doFullVertexConstraint
BooleanProperty m_doFullVertexConstraint
Definition: BeamspotVertexPreProcessor.h:138
Trk::BeamspotVertexPreProcessor::provideVotFromBeamspot
const VertexOnTrack * provideVotFromBeamspot(const Track *track) const
Definition: BeamspotVertexPreProcessor.cxx:404
Trk::BeamspotVertexPreProcessor::provideVtxBeamspot
void provideVtxBeamspot(const AlignVertex *b, AmgSymMatrix(3) *q, Amg::Vector3D *v) const
Definition: BeamspotVertexPreProcessor.cxx:491
IExtrapolator.h
Trk::BeamspotVertexPreProcessor::m_trkSelector
ToolHandle< InDet::IInDetTrackSelectionTool > m_trkSelector
Definition: BeamspotVertexPreProcessor.h:100
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
Trk::BeamspotVertexPreProcessor::m_allTracksVector
std::vector< std::pair< const xAOD::Vertex *, std::vector< VxTrackAtVertex > > > m_allTracksVector
Definition: BeamspotVertexPreProcessor.h:132
Trk::BeamspotVertexPreProcessor::doConstraintRefit
const Track * doConstraintRefit(ToolHandle< IGlobalTrackFitter > &fitter, const Track *track, const VertexOnTrack *vot, const ParticleHypothesis &particleHypothesis) const
Definition: BeamspotVertexPreProcessor.cxx:518
Trk::BeamspotVertexPreProcessor::m_runOutlierRemoval
BooleanProperty m_runOutlierRemoval
Definition: BeamspotVertexPreProcessor.h:118
Trk::BeamspotVertexPreProcessor::m_doPrimaryVertexConstraint
BooleanProperty m_doPrimaryVertexConstraint
Definition: BeamspotVertexPreProcessor.h:136
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
Trk::BeamspotVertexPreProcessor::provideVotFromVertex
const VertexOnTrack * provideVotFromVertex(const Track *track, const xAOD::Vertex *&vtx) const
Definition: BeamspotVertexPreProcessor.cxx:297
Trk::BeamspotVertexPreProcessor::m_nFailedPVRefits
int m_nFailedPVRefits
Definition: BeamspotVertexPreProcessor.h:164
Trk::BeamspotVertexPreProcessor::m_alignModuleTool
PublicToolHandle< IAlignModuleTool > m_alignModuleTool
Pointer to AlignModuleTool.
Definition: BeamspotVertexPreProcessor.h:109
Trk::AmgSymMatrix
AmgSymMatrix(5) &GXFTrackState
Definition: GXFTrackState.h:156
Trk::ParticleHypothesis
ParticleHypothesis
Definition: ParticleHypothesis.h:28
Trk::BeamspotVertexPreProcessor::initialize
virtual StatusCode initialize() override
Definition: BeamspotVertexPreProcessor.cxx:49
Trk::BeamspotVertexPreProcessor::m_extrapolator
ToolHandle< IExtrapolator > m_extrapolator
Definition: BeamspotVertexPreProcessor.h:98
Trk::BeamspotVertexPreProcessor::m_maxPt
DoubleProperty m_maxPt
Definition: BeamspotVertexPreProcessor.h:143
Trk::CompareTwoTracks::operator()
bool operator()(VxTrackAtVertex vtxTrk)
Definition: BeamspotVertexPreProcessor.cxx:143
Trk::BeamspotVertexPreProcessor::printSummary
virtual void printSummary() override
Print processing summary to logfile.
Definition: BeamspotVertexPreProcessor.cxx:1008
Trk::BeamspotVertexPreProcessor::m_beamSpotKey
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
Definition: BeamspotVertexPreProcessor.h:112
Trk::CompareTwoTracks::m_method
std::string m_method
Definition: BeamspotVertexPreProcessor.h:185
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
Trk::BeamspotVertexPreProcessor::m_trackTypeCounter
std::vector< int > m_trackTypeCounter
Definition: BeamspotVertexPreProcessor.h:161
Trk::BeamspotVertexPreProcessor::accumulateVTX
void accumulateVTX(AlignTrack *alignTrack) override
methods added for the full VTX fit:
Definition: BeamspotVertexPreProcessor.cxx:831
test_pyathena.parent
parent
Definition: test_pyathena.py:15
Trk::BeamspotVertexPreProcessor::isAssociatedToVertex
bool isAssociatedToVertex(const Track *track, const xAOD::Vertex *vertex)
Definition: BeamspotVertexPreProcessor.cxx:232
Trk::BeamspotVertexPreProcessor::processTrackCollection
virtual DataVector< Track > * processTrackCollection(const DataVector< Track > *trks) override
Main processing of track collection.
Definition: BeamspotVertexPreProcessor.cxx:761
Trk::BeamspotVertexPreProcessor::prepareAllTracksVector
void prepareAllTracksVector()
Definition: BeamspotVertexPreProcessor.cxx:248
Trk::BeamspotVertexPreProcessor::m_PVContainerName
SG::ReadHandleKey< xAOD::VertexContainer > m_PVContainerName
Definition: BeamspotVertexPreProcessor.h:115
Trk::BeamspotVertexPreProcessor::m_nFailedBSRefits
int m_nFailedBSRefits
Definition: BeamspotVertexPreProcessor.h:163
Trk::BeamspotVertexPreProcessor::m_doAssociatedToPVSelection
BooleanProperty m_doAssociatedToPVSelection
Definition: BeamspotVertexPreProcessor.h:126
Trk::BeamspotVertexPreProcessor::m_particleNumber
IntegerProperty m_particleNumber
Definition: BeamspotVertexPreProcessor.h:120
Trk::BeamspotVertexPreProcessor::m_nFailedNormalRefits
int m_nFailedNormalRefits
Definition: BeamspotVertexPreProcessor.h:162
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
ParticleHypothesis.h
IInDetTrackSelectionTool.h
Trk::VertexOnTrack
Definition: VertexOnTrack.h:45
Trk::CompareTwoTracks::CompareTwoTracks
CompareTwoTracks(const Track *track, const std::string &compareMethod)
Definition: BeamspotVertexPreProcessor.h:176
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:178
Trk::BeamspotVertexPreProcessor::BeamspotVertexPreProcessor
BeamspotVertexPreProcessor(const std::string &type, const std::string &name, const IInterface *parent)
Definition: BeamspotVertexPreProcessor.cxx:35
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:76
Trk::BeamspotVertexPreProcessor::m_useSingleFitter
BooleanProperty m_useSingleFitter
Definition: BeamspotVertexPreProcessor.h:150
Trk::BeamspotVertexPreProcessor::m_doNormalRefit
BooleanProperty m_doNormalRefit
Definition: BeamspotVertexPreProcessor.h:140
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:275
Trk::AlignTrack
Definition: AlignTrack.h:41
Trk::BeamspotVertexPreProcessor::m_storeFitMatrices
BooleanProperty m_storeFitMatrices
Definition: BeamspotVertexPreProcessor.h:148
Trk::BeamspotVertexPreProcessor::m_constraintMode
UnsignedIntegerProperty m_constraintMode
Definition: BeamspotVertexPreProcessor.h:130
SG::ReadCondHandleKey< InDet::BeamSpotData >
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
VertexContainer.h
Trk::BeamspotVertexPreProcessor::m_doBeamspotConstraint
BooleanProperty m_doBeamspotConstraint
Definition: BeamspotVertexPreProcessor.h:134
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
Trk::BeamspotVertexPreProcessor::m_trackFitter
ToolHandle< IGlobalTrackFitter > m_trackFitter
Definition: BeamspotVertexPreProcessor.h:93
IAlignModuleTool.h
Trk::BeamspotVertexPreProcessor::doBeamspotConstraintTrackSelection
bool doBeamspotConstraintTrackSelection(const Track *track)
Definition: BeamspotVertexPreProcessor.cxx:556
extractSporadic.q
list q
Definition: extractSporadic.py:97
ITrackToVertexIPEstimator.h
Trk::CompareTwoTracks
Definition: BeamspotVertexPreProcessor.h:173
Track
Definition: TriggerChamberClusterOnTrackCreator.h:21
Trk::CompareTwoTracks::m_track
const Track * m_track
Definition: BeamspotVertexPreProcessor.h:186
BeamSpotData.h
xAOD::track
@ track
Definition: TrackingPrimitives.h:513
AthAlgTool
Definition: AthAlgTool.h:26
Trk::BeamspotVertexPreProcessor::solveVTX
void solveVTX() override
Definition: BeamspotVertexPreProcessor.cxx:990
Trk::IAlignTrackPreProcessor
Definition: IAlignTrackPreProcessor.h:36
Trk::BeamspotVertexPreProcessor::m_nTracks
int m_nTracks
Definition: BeamspotVertexPreProcessor.h:160
AlignVertex
AlignVertex is a simple structure to store objects belonging to a vertex. Contains a pointer to the o...
Trk::BeamspotVertexPreProcessor::m_PVScalingFactor
DoubleProperty m_PVScalingFactor
Definition: BeamspotVertexPreProcessor.h:154
Trk::BeamspotVertexPreProcessor::m_SLTrackFitter
ToolHandle< IGlobalTrackFitter > m_SLTrackFitter
Definition: BeamspotVertexPreProcessor.h:96
Trk::BeamspotVertexPreProcessor::m_BSTrackSelector
ToolHandle< InDet::IInDetTrackSelectionTool > m_BSTrackSelector
Definition: BeamspotVertexPreProcessor.h:102
IGlobalTrackFitter.h
Trk::BeamspotVertexPreProcessor::doTrackRefit
AlignTrack * doTrackRefit(const Track *track)
Definition: BeamspotVertexPreProcessor.cxx:614
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::m_doBSTrackSelection
BooleanProperty m_doBSTrackSelection
Definition: BeamspotVertexPreProcessor.h:124
Trk::BeamspotVertexPreProcessor::selectUpdatedVertices
bool selectUpdatedVertices(const xAOD::Vertex *updatedVtx) const
Definition: BeamspotVertexPreProcessor.cxx:196