ATLAS Offline Software
Loading...
Searching...
No Matches
AFPSiDBasicKalmanTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
10#ifndef AFP_LOCRECO_AFPSIDBASICKALMANTOOL_H
11#define AFP_LOCRECO_AFPSIDBASICKALMANTOOL_H 1
12
13
14#include <CLHEP/Matrix/Matrix.h>
15#include <CLHEP/Matrix/Vector.h>
16
17// FrameWork includes
19#include "GaudiKernel/ServiceHandle.h"
20
21// Monitoring includes
24
25// xAOD includes
31
32// AFP_LocReco includes
36
37// STL includes
38#include <string>
39#include <list>
40#include <vector>
41#include <utility> // pair
42#include <algorithm> // sort
43
44
50 : public extends<AthAlgTool, IAFPSiDLocRecoTrackAlgTool>
51{
52public:
53 AFPSiDBasicKalmanTool(const std::string& type,
54 const std::string& name,
55 const IInterface* parent);
56
57 virtual ~AFPSiDBasicKalmanTool() override {}
58
60 virtual StatusCode initialize() override;
61
63 virtual StatusCode finalize() override;
64
73 StatusCode reconstructTracks(std::unique_ptr<xAOD::AFPTrackContainer>& outputContainer, const EventContext& ctx) const override;
74
76 const std::string& outputContainerName () const override {return m_tracksContainerName;}
77
86 void filterTrkCollection(std::list<AFPSiDBasicKalmanToolTrack>& reconstructedTracks) const;
87
89 unsigned int countSharedClusters(const AFPSiDBasicKalmanToolTrack& firstTrack, const AFPSiDBasicKalmanToolTrack& secondTrack) const;
90
92 void clearAllLayers(AFPLocRecoStationBasicObj& my_stationClusters) const
93 {my_stationClusters.clear();}
94
95
96private:
97
99 Gaudi::Property<std::string> m_tracksContainerName{this, "tracksContainerName", "AFPTrackContainer", "Name of the container in which tracks are saved"};
100
102 Gaudi::Property<int> m_stationID{this, "stationID", 0, "ID number of station for which tracks should be reconstructed"};
103
114 CLHEP::HepMatrix m_observationModel;
115
119 Gaudi::Property<std::vector<float> > m_observationModelInit{this, "observationModel", {}, "vector used to initialise observation model matrix (2x4), the first four numbers correspond to the first row of the matrix"};
120
130 CLHEP::HepMatrix m_observationNoise;
131
135 Gaudi::Property<std::vector<float>> m_observationNoiseInit{this, "observationNoise", {}, "vector used to initialise observation noise matrix (2x2), the first two numbers correspond to the first row of the matrix"};
136
137
142 CLHEP::HepMatrix m_processNoiseCov;
143
147 Gaudi::Property<std::vector<float>> m_processNoiseCovInit{this, "processNoiseCov", {}, "A vector used to initialise process noise covariance matrix (4x4).The first 4 numbers correspond to the first row of the matrix."};
148
154 CLHEP::HepMatrix m_aposterioriCov;
155
159 Gaudi::Property<std::vector<float>> m_aposterioriCovInit{this, "aposterioriCov", {}, "A vector used to initialise a posteriori covariance matrix (4x4). The first 4 numbers correspond to the first row of the matrix."};
160
164 Gaudi::Property<int> m_numberOfLayersInStation{this, "numberOfLayersInStations", 4, "The size of the vector sets number of stations. Each element defines number of pixel layers in the station."};
165
167 SG::ReadHandleKey<xAOD::AFPSiHitsClusterContainer> m_hitsClusterContainerKey{this, "AFPSiHitsClusterContainerKey", "AFPSiHitsClusterContainer", "Name of the container with clusters of hits from which tracks are to be reconstructed"};
168
170 Gaudi::Property<double> m_maxAllowedDistance{this, "maxAllowedDistance", 10, "Maximal distance at which cluster can be joined to the track"};
171
173 Gaudi::Property<unsigned int> m_minClustersNumber{this, "minClustersNumber", 3, "Minimal number of clusters in track. If there are less clusters track is rejected"};
174
176 Gaudi::Property<unsigned int> m_maxSharedClusters{this, "maxSharedClusters", 2, "Maximal number of hits that two tracks can share. If they share more one is deleted."};
177
179 Gaudi::Property<float> m_clusterMaxChi2{this, "clusterMaxChi2", 3, "Maximal value of chi2 for which a cluster is added."};
180
182 Gaudi::Property<float> m_trackMaxChi2{this, "trackMaxChi2", 3, "Maximal value of chi2 for the track."};
183
185 Gaudi::Property<double> m_allowedDistanceBetweenClustersInSeed{this, "allowedDistanceBetweenClustersInSeed", 0.5, "Maximum allowed distance between clusters in a seed to be considered coming from the same proton; if the difference between clusters is 2 layers (3 layers), this distance is multiplied by 2 (3)"};
186
188 Gaudi::Property<std::vector<std::pair<int,int>>> m_layersForSeeds{this, "layersForSeeds", {{0,1}}, "Pairs of layers that are used to create seeds."};
189
191 void fillLayersWithClusters(AFPLocRecoStationBasicObj& my_stationClusters, SG::ReadHandle<xAOD::AFPSiHitsClusterContainer>& hitsClusterContainer) const;
192
201 void initMatrixFromVector (CLHEP::HepMatrix& matrix, const std::vector<float>& vec1D) const;
202
204 bool checkMatrixAndVectorSize(const CLHEP::HepMatrix& matrix, const std::vector<float>& vec1D) const
205 {return ((int)vec1D.size()) == matrix.num_row()*matrix.num_col();}
206
209 bool areNeighbours(const xAOD::AFPSiHitsCluster* a, const xAOD::AFPSiHitsCluster* b, const double dist) const;
210
212 void saveToXAOD (const AFPSiDBasicKalmanToolTrack& recoTrack, std::unique_ptr<xAOD::AFPTrackContainer>& containerToFill, SG::ReadHandle<xAOD::AFPSiHitsClusterContainer>& hitsClusterContainer) const;
213
215 ToolHandle<GenericMonitoringTool> m_monTool {this, "MonTool", "", "Monitoring tool"};
216};
217
218
219#endif // > !AFP_LOCRECO_AFPSIDBASICKALMANTOOL_H
Full implementation of class AFPLocRecoStationBasicObj.
Header file for AFPSiDBasicKalmanToolTrack used in tracks reconstruction with Kalman filter.
Definitions of identification numbers of track reconstruction algorithms.
Header file for interface IAFPSiDLocRecoTrackAlgTool.
Header file to be included by clients of the Monitored infrastructure.
Helper class representing an AFP station used in track reconstruction.
void clear()
Clear clusters from each layer.
Class representing a reconstructed track with Kalman filter.
CLHEP::HepMatrix m_observationModel
The observation model which maps the true state space into the observed space ( )
void filterTrkCollection(std::list< AFPSiDBasicKalmanToolTrack > &reconstructedTracks) const
Filters duplicate tracks from the list.
CLHEP::HepMatrix m_aposterioriCov
A posteriori error covariance matrix (a measure of the estimated accuracy of the state estimate) ( )
void initMatrixFromVector(CLHEP::HepMatrix &matrix, const std::vector< float > &vec1D) const
Method that initialises 2D matrix using values from the vector.
void saveToXAOD(const AFPSiDBasicKalmanToolTrack &recoTrack, std::unique_ptr< xAOD::AFPTrackContainer > &containerToFill, SG::ReadHandle< xAOD::AFPSiHitsClusterContainer > &hitsClusterContainer) const
Save reconstructed track to the xAOD container.
Gaudi::Property< std::vector< float > > m_observationNoiseInit
A vector used to initialise m_observationNoise matrix.
Gaudi::Property< std::vector< float > > m_observationModelInit
A vector used to initialise m_observationModel matrix.
virtual ~AFPSiDBasicKalmanTool() override
Gaudi::Property< std::vector< float > > m_aposterioriCovInit
A vector used to initialise m_aposterioriCov matrix.
virtual StatusCode finalize() override
Does nothing.
Gaudi::Property< unsigned int > m_minClustersNumber
Minimal number of clusters in track. If there are less clusters track is rejected (Default = 3)
SG::ReadHandleKey< xAOD::AFPSiHitsClusterContainer > m_hitsClusterContainerKey
Name of the xAOD container with clusters to be used in track reconstruction.
Gaudi::Property< int > m_stationID
AFP station ID for which tracks will be reconstructed.
const std::string & outputContainerName() const override
CLHEP::HepMatrix m_observationNoise
The observation noise matrix.
Gaudi::Property< float > m_clusterMaxChi2
Maximal value of chi2 for which a cluster is added.
void fillLayersWithClusters(AFPLocRecoStationBasicObj &my_stationClusters, SG::ReadHandle< xAOD::AFPSiHitsClusterContainer > &hitsClusterContainer) const
Fills layers with clusters of hits, dividing them into stations and layers.
AFPSiDBasicKalmanTool(const std::string &type, const std::string &name, const IInterface *parent)
bool areNeighbours(const xAOD::AFPSiHitsCluster *a, const xAOD::AFPSiHitsCluster *b, const double dist) const
Checks if clusters are neighbours Compares distance between them to m_allowedDistanceBetweenClustersI...
unsigned int countSharedClusters(const AFPSiDBasicKalmanToolTrack &firstTrack, const AFPSiDBasicKalmanToolTrack &secondTrack) const
Returns number of the same clusters used to reconstruct two tracks.
bool checkMatrixAndVectorSize(const CLHEP::HepMatrix &matrix, const std::vector< float > &vec1D) const
Returns true if vector size equals matrix rows times columns.
Gaudi::Property< std::string > m_tracksContainerName
Name of the xAOD container to which tracks will be saved; actual saving is done in AFPSIDLocRecoTool.
Gaudi::Property< int > m_numberOfLayersInStation
Number of layers used for reconstruction in station If not set in job options 4 stations,...
virtual StatusCode initialize() override
Read parameters from job options and print tool configuration.
Gaudi::Property< float > m_trackMaxChi2
Maximal value of chi2 for the track.
ToolHandle< GenericMonitoringTool > m_monTool
Monitoring.
Gaudi::Property< unsigned int > m_maxSharedClusters
Maximal number of hits that two tracks can share. If they share more one is deleted.
StatusCode reconstructTracks(std::unique_ptr< xAOD::AFPTrackContainer > &outputContainer, const EventContext &ctx) const override
Does actual tracks reconstruction.
void clearAllLayers(AFPLocRecoStationBasicObj &my_stationClusters) const
clear all layers from clusters saved in m_stationsClusters;
Gaudi::Property< std::vector< float > > m_processNoiseCovInit
A vector used to initialise m_processNoiseCov matrix.
Gaudi::Property< std::vector< std::pair< int, int > > > m_layersForSeeds
Vector of pairs of layers. These pairs will be used to make seeds.
Gaudi::Property< double > m_allowedDistanceBetweenClustersInSeed
Maximum allowed distance between clusters to be considered coming from the same proton.
CLHEP::HepMatrix m_processNoiseCov
The covariance matrix of process noise.
Gaudi::Property< double > m_maxAllowedDistance
Maximal distance at which cluster can be joined to the track (Default = 100 - all clusters)
Property holding a SG store/key/clid from which a ReadHandle is made.
AFPSiHitsCluster_v1 AFPSiHitsCluster