ATLAS Offline Software
EMTrackMatchBuilder.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef EGAMMATOOLS_EMTRACKMATCHBUILDER_H
6 #define EGAMMATOOLS_EMTRACKMATCHBUILDER_H
7 
19 // INCLUDE HEADER FILES:
22 
24 #include "GaudiKernel/EventContext.h"
25 #include "GaudiKernel/ToolHandle.h"
27 
32 
33 namespace Reco {
34 class ITrackToVertex;
35 }
36 
38 
40  : public AthAlgTool
41  , virtual public IEMTrackMatchBuilder
42 {
43 
44 public:
46  EMTrackMatchBuilder(const std::string& type,
47  const std::string& name,
48  const IInterface* parent);
49 
51  virtual ~EMTrackMatchBuilder() = default;
52 
54  StatusCode initialize() override final;
56  virtual StatusCode executeRec(
57  const EventContext& ctx,
58  EgammaRecContainer* egammas) const override final;
59 
60 private:
62  StatusCode trackExecute(const EventContext& ctx,
63  egammaRec* eg,
66 
68  struct TrackMatch
69  {
70  public:
71  bool hasPix;
73  int hitsScore;
74  double dR;
75  double seconddR;
76  double deltaPhiLast;
77  std::array<double, 4> deltaEta;
78  std::array<double, 4> deltaPhi;
79  std::array<double, 4> deltaPhiRescaled;
80  };
81 
84  {
85  public:
86  TrackMatchSorter(double distance = 0.0)
87  : m_distance(distance){};
88  bool operator()(const TrackMatch& match1, const TrackMatch& match2) const;
89 
90  private:
91  double m_distance;
92  };
93 
96  bool inBroadWindow(const EventContext& ctx,
97  std::vector<TrackMatch>& trackMatches,
98  const xAOD::CaloCluster& cluster,
99  int trackNumber,
100  const xAOD::TrackParticle& trkPB,
101  const CaloDetDescrManager& caloDD) const;
102 
104  bool isCandidateMatch(const xAOD::CaloCluster* cluster,
105  const xAOD::TrackParticle* track,
106  bool flip) const;
107 
108  // configuration:
111  this,
112  "TrackParticlesName",
113  "",
114  "Name of the input track particle container"
115  };
116 
118  this,
119  "CaloDetDescrManager",
120  "CaloDetDescrManager",
121  "SG Key for CaloDetDescrManager in the Condition Store"
122  };
123 
125  Gaudi::Property<double> m_broadDeltaEta{ this,
126  "broadDeltaEta",
127  0.1,
128  "Value of broad cut for delta eta" };
129 
131  Gaudi::Property<double> m_broadDeltaPhi{ this,
132  "broadDeltaPhi",
133  0.1,
134  "Value of broad cut for delta phi" };
135 
137  Gaudi::Property<double> m_narrowDeltaEta{
138  this,
139  "narrowDeltaEta",
140  0.05,
141  "Value of narrow cut for delta eta"
142  };
143 
145  Gaudi::Property<double> m_narrowDeltaPhi{
146  this,
147  "narrowDeltaPhi",
148  0.05,
149  "Value of the narrowd cut for delta phi"
150  };
151 
153  Gaudi::Property<double> m_narrowDeltaPhiBrem{
154  this,
155  "narrowDeltaPhiBrem",
156  0.1,
157  "Value of the narrow cut for delta phi Brem"
158  };
159 
161  Gaudi::Property<double> m_narrowDeltaPhiRescale{
162  this,
163  "narrowDeltaPhiRescale",
164  0.05,
165  "Value of the narrow cut for delta phi Rescale"
166  };
167 
169  Gaudi::Property<double> m_narrowDeltaPhiRescaleBrem{
170  this,
171  "narrowDeltaPhiRescaleBrem",
172  0.1,
173  "Value of the narrow cut for delta phi Rescale Brem"
174  };
175 
177  Gaudi::Property<double> m_MaxDeltaPhiRescale{
178  this,
179  "MaxDeltaPhiRescale",
180  0.25,
181  "Maximum Value of the deltaPhi rescale"
182  };
183 
185  Gaudi::Property<bool> m_useCandidateMatch{
186  this,
187  "useCandidateMatch",
188  true,
189  "Boolean to use candidate matching"
190  };
191 
193  Gaudi::Property<bool> m_useScoring{
194  this,
195  "useScoring",
196  true,
197  "Boolean to apply heuristic when tracks have close deltaR"
198  };
199 
201  Gaudi::Property<bool> m_useRescaleMetric{ this,
202  "UseRescaleMetric",
203  true,
204  "Use Rescale Metric" };
205 
207  Gaudi::Property<bool> m_SecondPassRescale{ this,
208  "SecondPassRescale",
209  true,
210  "Do second pass with rescale" };
211 
213  Gaudi::Property<float> m_deltaEtaResolution{ this,
214  "DeltaEtaResolution",
215  1.0,
216  "The deltaEta resolution" };
217 
218  Gaudi::Property<float> m_deltaPhiResolution{ this,
219  "DeltaPhiResolution",
220  1.0,
221  "The deltaPhi resolution" };
222 
223  Gaudi::Property<float> m_deltaPhiRescaleResolution{
224  this,
225  "DeltaPhiRescaleResolution",
226  1.0,
227  "The deltaPhiRescale resolution"
228  };
229 
235  Gaudi::Property<float> m_distanceForScore{
236  this,
237  "DistanceForScore",
238  0.01,
239  "The distance from which one goes from using better deltaR to using score."
240  };
241 
242  ToolHandle<IEMExtrapolationTools> m_extrapolationTool{
243  this,
244  "ExtrapolationTool",
245  "EMExtrapolationTools",
246  "Name of the extrapolation tool"
247  };
248 
250  Gaudi::Property<bool> m_isCosmics{ this,
251  "isCosmics",
252  false,
253  "Boolean for use of cosmics" };
254 
255  // Calculated values based on resolutions
259 
261 };
262 
263 #endif
264 
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
EMTrackMatchBuilder::TrackMatch::deltaPhiRescaled
std::array< double, 4 > deltaPhiRescaled
Definition: EMTrackMatchBuilder.h:79
EMTrackMatchBuilder::m_deltaPhiWeight
double m_deltaPhiWeight
Definition: EMTrackMatchBuilder.h:257
EMTrackMatchBuilder::inBroadWindow
bool inBroadWindow(const EventContext &ctx, std::vector< TrackMatch > &trackMatches, const xAOD::CaloCluster &cluster, int trackNumber, const xAOD::TrackParticle &trkPB, const CaloDetDescrManager &caloDD) const
Compute for tracks passing the loose matching the distance between track extrapolated to 2nd sampling...
Definition: EMTrackMatchBuilder.cxx:152
ParticleTest.eg
eg
Definition: ParticleTest.py:29
AthCUDAExamples::TrackParticleContainer
vecmem::edm::container< TrackParticleInterface, vecmem::edm::type::vector< float >, vecmem::edm::type::vector< float >, vecmem::edm::type::vector< float > > TrackParticleContainer
SoA, GPU friendly TrackParticleContainer.
Definition: Control/AthenaExamples/AthExCUDA/src/TrackParticleContainer.h:46
EMTrackMatchBuilder::m_caloDetDescrMgrKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloDetDescrMgrKey
Definition: EMTrackMatchBuilder.h:117
EMTrackMatchBuilder::m_useRescaleMetric
Gaudi::Property< bool > m_useRescaleMetric
Boolean to use Rescale in the metric.
Definition: EMTrackMatchBuilder.h:201
EMTrackMatchBuilder::TrackMatch::deltaPhi
std::array< double, 4 > deltaPhi
Definition: EMTrackMatchBuilder.h:78
EMTrackMatchBuilder::m_TrackParticlesKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_TrackParticlesKey
name of TrackParticle container in TDS
Definition: EMTrackMatchBuilder.h:110
EMTrackMatchBuilder::trackExecute
StatusCode trackExecute(const EventContext &ctx, egammaRec *eg, const xAOD::TrackParticleContainer *trackPC, const CaloDetDescrManager &caloDD) const
execute method
Definition: EMTrackMatchBuilder.cxx:85
EMTrackMatchBuilder::TrackMatch::dR
double dR
Definition: EMTrackMatchBuilder.h:74
EMTrackMatchBuilder::m_deltaEtaResolution
Gaudi::Property< float > m_deltaEtaResolution
The resolutions: might be good to split in barrel/end-cap in the future.
Definition: EMTrackMatchBuilder.h:213
EMTrackMatchBuilder::TrackMatch::deltaPhiLast
double deltaPhiLast
Definition: EMTrackMatchBuilder.h:76
EMTrackMatchBuilder::m_isCosmics
Gaudi::Property< bool > m_isCosmics
Definition: EMTrackMatchBuilder.h:250
EMTrackMatchBuilder::m_deltaPhiRescaleResolution
Gaudi::Property< float > m_deltaPhiRescaleResolution
Definition: EMTrackMatchBuilder.h:223
EMTrackMatchBuilder::m_deltaEtaWeight
double m_deltaEtaWeight
Definition: EMTrackMatchBuilder.h:256
PropDirection.h
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
IEMTrackMatchBuilder
Definition: IEMTrackMatchBuilder.h:34
EMTrackMatchBuilder::m_SecondPassRescale
Gaudi::Property< bool > m_SecondPassRescale
Boolean to do second pass with Rescale.
Definition: EMTrackMatchBuilder.h:207
EMTrackMatchBuilder::m_sorter
TrackMatchSorter m_sorter
Definition: EMTrackMatchBuilder.h:260
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
SG::ReadHandleKey< xAOD::TrackParticleContainer >
EMTrackMatchBuilder::m_narrowDeltaPhiRescale
Gaudi::Property< double > m_narrowDeltaPhiRescale
narrow cut on deltaPhiRescale
Definition: EMTrackMatchBuilder.h:161
EMTrackMatchBuilder::m_narrowDeltaPhiBrem
Gaudi::Property< double > m_narrowDeltaPhiBrem
narrow cut on deltaPhi for electrons
Definition: EMTrackMatchBuilder.h:153
IEMExtrapolationTools.h
EMTrackMatchBuilder::m_deltaPhiResolution
Gaudi::Property< float > m_deltaPhiResolution
Definition: EMTrackMatchBuilder.h:218
EMTrackMatchBuilder::executeRec
virtual StatusCode executeRec(const EventContext &ctx, EgammaRecContainer *egammas) const override final
execute method
Definition: EMTrackMatchBuilder.cxx:56
EMTrackMatchBuilder::m_deltaPhiRescaleWeight
double m_deltaPhiRescaleWeight
Definition: EMTrackMatchBuilder.h:258
EMTrackMatchBuilder::TrackMatch::hitsScore
int hitsScore
Definition: EMTrackMatchBuilder.h:73
EMTrackMatchBuilder::~EMTrackMatchBuilder
virtual ~EMTrackMatchBuilder()=default
Destructor.
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
CaloClusterFwd.h
EMTrackMatchBuilder::initialize
StatusCode initialize() override final
Gaudi algorithm hooks.
Definition: EMTrackMatchBuilder.cxx:39
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
EMTrackMatchBuilder::m_MaxDeltaPhiRescale
Gaudi::Property< double > m_MaxDeltaPhiRescale
@Maximum deltaPhi (Res) allowed for a match
Definition: EMTrackMatchBuilder.h:177
EMTrackMatchBuilder::m_broadDeltaPhi
Gaudi::Property< double > m_broadDeltaPhi
broad cut on deltaPhi
Definition: EMTrackMatchBuilder.h:131
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
EMTrackMatchBuilder::EMTrackMatchBuilder
EMTrackMatchBuilder(const std::string &type, const std::string &name, const IInterface *parent)
Default constructor.
Definition: EMTrackMatchBuilder.cxx:29
EMTrackMatchBuilder::TrackMatch::hasPix
bool hasPix
Definition: EMTrackMatchBuilder.h:71
EMTrackMatchBuilder::m_narrowDeltaPhiRescaleBrem
Gaudi::Property< double > m_narrowDeltaPhiRescaleBrem
narrow cut on deltaPhiRescale for electrons
Definition: EMTrackMatchBuilder.h:169
private
#define private
Definition: DetDescrConditionsDict_dict_fixes.cxx:13
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
EMTrackMatchBuilder::TrackMatch::deltaEta
std::array< double, 4 > deltaEta
Definition: EMTrackMatchBuilder.h:77
EMTrackMatchBuilder::TrackMatchSorter::TrackMatchSorter
TrackMatchSorter(double distance=0.0)
Definition: EMTrackMatchBuilder.h:86
Reco
Definition: TrackCounting.h:24
EMTrackMatchBuilder::isCandidateMatch
bool isCandidateMatch(const xAOD::CaloCluster *cluster, const xAOD::TrackParticle *track, bool flip) const
Loose track-cluster matching.
Definition: EMTrackMatchBuilder.cxx:351
SG::ReadCondHandleKey< CaloDetDescrManager >
EMTrackMatchBuilder::m_narrowDeltaEta
Gaudi::Property< double > m_narrowDeltaEta
narrow cut on deltaEta
Definition: EMTrackMatchBuilder.h:137
EMTrackMatchBuilder::m_useScoring
Gaudi::Property< bool > m_useScoring
Boolean to apply heuristic when tracks have close deltaR.
Definition: EMTrackMatchBuilder.h:193
EMTrackMatchBuilder::m_distanceForScore
Gaudi::Property< float > m_distanceForScore
The distance from which one goes from using better deltaR to using score.
Definition: EMTrackMatchBuilder.h:235
EMTrackMatchBuilder::TrackMatch::seconddR
double seconddR
Definition: EMTrackMatchBuilder.h:75
CaloDetDescrManager
This class provides the client interface for accessing the detector description information common to...
Definition: CaloDetDescrManager.h:473
EMTrackMatchBuilder
Definition: EMTrackMatchBuilder.h:42
EMTrackMatchBuilder::TrackMatch
A structure for keeping track match information.
Definition: EMTrackMatchBuilder.h:69
TRT::Track::trackNumber
@ trackNumber
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:75
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
EMTrackMatchBuilder::m_useCandidateMatch
Gaudi::Property< bool > m_useCandidateMatch
flag to turn on/off use of isCandidateMatch
Definition: EMTrackMatchBuilder.h:185
egammaRec
Definition: egammaRec.h:31
EMTrackMatchBuilder::TrackMatchSorter::operator()
bool operator()(const TrackMatch &match1, const TrackMatch &match2) const
Definition: EMTrackMatchBuilder.cxx:437
egammaRecContainer.h
IEMTrackMatchBuilder.h
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
AthAlgTool
Definition: AthAlgTool.h:26
EMTrackMatchBuilder::TrackMatchSorter
function object to sort track matches based on quality
Definition: EMTrackMatchBuilder.h:84
EMTrackMatchBuilder::m_narrowDeltaPhi
Gaudi::Property< double > m_narrowDeltaPhi
narrow cut on deltaPhiRescale
Definition: EMTrackMatchBuilder.h:145
EMTrackMatchBuilder::TrackMatchSorter::m_distance
double m_distance
Definition: EMTrackMatchBuilder.h:91
EMTrackMatchBuilder::TrackMatch::trackNumber
int trackNumber
Definition: EMTrackMatchBuilder.h:72
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
EMTrackMatchBuilder::m_extrapolationTool
ToolHandle< IEMExtrapolationTools > m_extrapolationTool
Definition: EMTrackMatchBuilder.h:242
TrackParticleContainerFwd.h
EMTrackMatchBuilder::m_broadDeltaEta
Gaudi::Property< double > m_broadDeltaEta
broad cut on deltaEta
Definition: EMTrackMatchBuilder.h:125