ATLAS Offline Software
ReFitTrackWithTruth.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // ReFitTrackWithTruth.h, (c) ATLAS Detector Software
7 // Take a track and replace the cluster position with the
8 // associated truth particle truth position
10 
11 #ifndef TRKREFITALG_REFITTRACKWITHTRUTH_H
12 #define TRKREFITALG_REFITTRACKWITHTRUTH_H
13 
14 // Base class
16 #include "GaudiKernel/ToolHandle.h"
17 #include "GaudiKernel/ServiceHandle.h"
18 #include "GaudiKernel/MsgStream.h"
22 #include "InDetSimEvent/SiHit.h"
25 #include "StoreGate/WriteHandle.h"
26 #include "TrkTrack/Track.h"
34 
35 class AtlasDetectorID;
36 class PixelID;
37 class TRandom3;
38 
39 namespace Trk{
40 
41 class ITrackFitter;
42 class ITrackSummaryTool;
43 class ITrackSelectorTool;
44 class IPRD_AssociationTool;
45 
55 
56 public:
57 
58  typedef Trk::Track Track;
59 
61  ReFitTrackWithTruth(const std::string &name,ISvcLocator *pSvcLocator);
62 
63  virtual StatusCode initialize() override;
64  virtual StatusCode execute() override;
65 
66 private:
67 
68  std::vector<SiHit> matchSiHitsToCluster( const int uniqueIdToMatch,
69  const InDet::PixelCluster* pixClus,
70  SG::ReadHandle<AtlasHitsVector<SiHit>> &siHitCollection) const;
71 
72  static bool IsClusterFromTruth( const InDet::PixelCluster* pixClus,
73  const int uniqueIdToMatch,
74  const InDetSimDataCollection &sdoCollection) ;
75 
76  HepGeom::Point3D<double> smearTruthPosition( const HepGeom::Point3D<double>& orig,
77  const int bec,
78  const int layer_disk,
79  const InDetDD::SiDetectorDesign* design) const;
80 
81  double getPhiPosResolution(int layer) const;
82  double getEtaPosResolution(int layer) const;
83  double getPhiPosErrorFactor(int layer) const;
84  double getEtaPosErrorFactor(int layer) const;
85 
86  // input/output track container
87  SG::ReadHandleKey<TrackCollection> m_inputTrackColName{this,"InputTrackColName","","collection name for tracks to be refitted"}; // Name of the input Trackcollection
88  SG::WriteHandleKey<TrackCollection> m_outputTrackCollectionName{this,"OutputTrackColName","ReFitted_TracksWithTruth","collection name for output tracks"};
89 
90  // TRandom3 generator for hit-resolution smearing
91  boost::thread_specific_ptr<TRandom3> m_random;
92 
93  // --- fitter steering
94  Trk::RunOutlierRemoval m_runOutlier = false; // switch whether to run outlier logics or not
95  int m_matEffects = 3; // type of material interaction in extrapolation
96 
97  Gaudi::Property<bool> m_saveWrongHits {this, "SaveWrongHits", false}; // If running on Reco Tracks, can have wrong hits
98  Gaudi::Property<bool> m_fixWrongHits {this, "FixWrongHits", false}; // If running on Reco Tracks, fix wrong hits
99  Gaudi::Property<bool> m_rejNoiseHits {this, "RejectNoiseHits", false}; // If running on Reco Tracks, can have noise hits
100 
102 
103  // --- job options
104  SG::ReadHandleKey<SiHitCollection> m_siHitCollectionName{this,"SiHitCollectionName","PixelHits",""}; // SiHitCollection storegate key
105  SG::ReadHandleKey<InDetSimDataCollection> m_SDOContainerName{this,"MC_SDOs","PixelSDO_Map"}; // SDO Container storegate key
106  SG::ReadHandleKey<TrackTruthCollection> m_truthMapName{this,"TruthMap","InDetTracksTruthCollection"}; // TruthMap name storegate key
107 
108  // smearing
109  Gaudi::Property<std::vector<float> > m_resolutionRPhi{this, "ResolutionRPhi", {}}; // per-layer resolution
110  Gaudi::Property<std::vector<float> > m_resolutionZ{this, "ResolutionZ", {}}; // per-layer resolution
111  Gaudi::Property<std::vector<float> > m_errorRPhi{this, "ErrorFactorRPhi", {}}; // per-layer error - multiplicative factor * res.
112  Gaudi::Property<std::vector<float> > m_errorZ{this, "ErrorFactorZ", {}}; // per-layer error - multiplicative factor * res.
113 
114  // -- algorithm members
115  ToolHandle<Trk::ITrackFitter> m_ITrackFitter
116  {this, "FitterTool", "Trk::GlobalChi2Fitter/InDetTrackFitter" };
117  ToolHandle<Trk::IExtendedTrackSummaryTool> m_trkSummaryTool
118  {this, "SummaryTool", "Trk::TrackSummaryTool/InDetTrackSummaryTool" };
119  ToolHandle<Trk::IPRDtoTrackMapTool> m_assoTool
120  {this, "AssociationTool", "Trk::PRDtoTrackMapTool" };
121  const AtlasDetectorID* m_idHelper = nullptr;
122  const PixelID* m_pixelID = nullptr;
123 
124 };
125 
126 }
127 
128 #endif //TRKREFITALG_REFITTRACKWITHTRUTH_H
129 
Trk::ReFitTrackWithTruth::m_resolutionRPhi
Gaudi::Property< std::vector< float > > m_resolutionRPhi
Definition: ReFitTrackWithTruth.h:109
PixelID.h
This is an Identifier helper class for the Pixel subdetector. This class is a factory for creating co...
Trk::ReFitTrackWithTruth::m_SDOContainerName
SG::ReadHandleKey< InDetSimDataCollection > m_SDOContainerName
Definition: ReFitTrackWithTruth.h:105
Trk::ReFitTrackWithTruth::m_trkSummaryTool
ToolHandle< Trk::IExtendedTrackSummaryTool > m_trkSummaryTool
the track summary tool
Definition: ReFitTrackWithTruth.h:118
Trk::ReFitTrackWithTruth::getPhiPosErrorFactor
double getPhiPosErrorFactor(int layer) const
Definition: ReFitTrackWithTruth.cxx:606
Trk::ReFitTrackWithTruth::ReFitTrackWithTruth
ReFitTrackWithTruth(const std::string &name, ISvcLocator *pSvcLocator)
standard Algorithm constructor
Definition: ReFitTrackWithTruth.cxx:35
Trk::ReFitTrackWithTruth::execute
virtual StatusCode execute() override
Definition: ReFitTrackWithTruth.cxx:112
Trk::ReFitTrackWithTruth::IsClusterFromTruth
static bool IsClusterFromTruth(const InDet::PixelCluster *pixClus, const int uniqueIdToMatch, const InDetSimDataCollection &sdoCollection)
Definition: ReFitTrackWithTruth.cxx:537
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
Trk::ReFitTrackWithTruth::m_saveWrongHits
Gaudi::Property< bool > m_saveWrongHits
Definition: ReFitTrackWithTruth.h:97
Trk::ReFitTrackWithTruth::m_inputTrackColName
SG::ReadHandleKey< TrackCollection > m_inputTrackColName
Definition: ReFitTrackWithTruth.h:87
ParticleGun_SamplingFraction.bec
int bec
Definition: ParticleGun_SamplingFraction.py:89
Trk::ReFitTrackWithTruth::m_siHitCollectionName
SG::ReadHandleKey< SiHitCollection > m_siHitCollectionName
Definition: ReFitTrackWithTruth.h:104
SiHit.h
PixelCluster.h
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
Trk::ReFitTrackWithTruth::m_random
boost::thread_specific_ptr< TRandom3 > m_random
smear away!
Definition: ReFitTrackWithTruth.h:91
Trk::ReFitTrackWithTruth::matchSiHitsToCluster
std::vector< SiHit > matchSiHitsToCluster(const int uniqueIdToMatch, const InDet::PixelCluster *pixClus, SG::ReadHandle< AtlasHitsVector< SiHit >> &siHitCollection) const
Definition: ReFitTrackWithTruth.cxx:404
Trk::ReFitTrackWithTruth::initialize
virtual StatusCode initialize() override
Definition: ReFitTrackWithTruth.cxx:42
Trk::ReFitTrackWithTruth::m_pixelID
const PixelID * m_pixelID
Pixel ID.
Definition: ReFitTrackWithTruth.h:122
AtlasHitsVector
Definition: AtlasHitsVector.h:33
Trk::ReFitTrackWithTruth::m_errorRPhi
Gaudi::Property< std::vector< float > > m_errorRPhi
Definition: ReFitTrackWithTruth.h:111
Trk::ReFitTrackWithTruth::getEtaPosErrorFactor
double getEtaPosErrorFactor(int layer) const
Definition: ReFitTrackWithTruth.cxx:607
InDetSimDataCollection
Definition: InDetSimDataCollection.h:25
FitterTypes.h
Trk::ReFitTrackWithTruth::m_resolutionZ
Gaudi::Property< std::vector< float > > m_resolutionZ
Definition: ReFitTrackWithTruth.h:110
Trk::ReFitTrackWithTruth::m_runOutlier
Trk::RunOutlierRemoval m_runOutlier
Definition: ReFitTrackWithTruth.h:94
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
Trk::RunOutlierRemoval
bool RunOutlierRemoval
switch to toggle quality processing after fit
Definition: FitterTypes.h:22
Track.h
AthAlgorithm.h
Trk::ParticleHypothesis
ParticleHypothesis
Definition: ParticleHypothesis.h:25
Trk::ReFitTrackWithTruth::m_ParticleHypothesis
Trk::ParticleHypothesis m_ParticleHypothesis
Definition: ReFitTrackWithTruth.h:101
WriteHandle.h
Handle class for recording to StoreGate.
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
TrackTruthCollection.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
Trk::pion
@ pion
Definition: ParticleHypothesis.h:29
TrackCollection.h
Trk::ReFitTrackWithTruth::m_outputTrackCollectionName
SG::WriteHandleKey< TrackCollection > m_outputTrackCollectionName
Definition: ReFitTrackWithTruth.h:88
Trk::ReFitTrackWithTruth::getEtaPosResolution
double getEtaPosResolution(int layer) const
Definition: ReFitTrackWithTruth.cxx:604
Trk::ReFitTrackWithTruth::m_assoTool
ToolHandle< Trk::IPRDtoTrackMapTool > m_assoTool
Tool to create and populate PRD to track.
Definition: ReFitTrackWithTruth.h:120
ParticleHypothesis.h
Trk::ReFitTrackWithTruth
Algorithm using an instance of a ITrackFitter to refit the tracks of a given pseudotrack collection a...
Definition: ReFitTrackWithTruth.h:54
AthAlgorithm
Definition: AthAlgorithm.h:47
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
IPRDtoTrackMapTool.h
Trk::ReFitTrackWithTruth::m_errorZ
Gaudi::Property< std::vector< float > > m_errorZ
Definition: ReFitTrackWithTruth.h:112
Trk::ReFitTrackWithTruth::m_matEffects
int m_matEffects
Definition: ReFitTrackWithTruth.h:95
Trk::ReFitTrackWithTruth::Track
Trk::Track Track
Definition: ReFitTrackWithTruth.h:58
InDet::PixelCluster
Definition: InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelCluster.h:49
Trk::ReFitTrackWithTruth::m_truthMapName
SG::ReadHandleKey< TrackTruthCollection > m_truthMapName
Definition: ReFitTrackWithTruth.h:106
Trk::ReFitTrackWithTruth::m_rejNoiseHits
Gaudi::Property< bool > m_rejNoiseHits
Definition: ReFitTrackWithTruth.h:99
IExtendedTrackSummaryTool.h
InDetSimDataCollection.h
Trk::ReFitTrackWithTruth::m_fixWrongHits
Gaudi::Property< bool > m_fixWrongHits
Definition: ReFitTrackWithTruth.h:98
Trk::ReFitTrackWithTruth::smearTruthPosition
HepGeom::Point3D< double > smearTruthPosition(const HepGeom::Point3D< double > &orig, const int bec, const int layer_disk, const InDetDD::SiDetectorDesign *design) const
Definition: ReFitTrackWithTruth.cxx:566
InDetDD::SiDetectorDesign
Definition: SiDetectorDesign.h:50
PixelID
Definition: PixelID.h:67
Trk::ReFitTrackWithTruth::getPhiPosResolution
double getPhiPosResolution(int layer) const
Definition: ReFitTrackWithTruth.cxx:603
Trk::ReFitTrackWithTruth::m_ITrackFitter
ToolHandle< Trk::ITrackFitter > m_ITrackFitter
the refit tool
Definition: ReFitTrackWithTruth.h:116
SiDetectorDesign.h
AtlasDetectorID
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
Definition: AtlasDetectorID.h:57
Trk::ReFitTrackWithTruth::m_idHelper
const AtlasDetectorID * m_idHelper
Detector ID helper.
Definition: ReFitTrackWithTruth.h:121
TrkParametersComparisonFunction.h
SiHitCollection.h