ATLAS Offline Software
PFMatchDistance.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /*
6  * PFMatchDistance.h
7  *
8  * Created on: 28.03.2014
9  * Author: tlodd
10  */
11 
12 #ifndef PFMATCHDISTANCE_H_
13 #define PFMATCHDISTANCE_H_
14 
16 
17 namespace PFMatch {
18 
19 class EtaPhi;
20 class EtaPhiWithVariance;
21 
22 /* Distance calculator classes */
23 
27 class EtaPhiSqDistanceCalculator: public DistanceCalculator<EtaPhi, EtaPhi> {
28 public:
31 
32  virtual double distanceBetween(const EtaPhi& position1, const EtaPhi& position2) const;
33 };
34 
38 class EtaPhiSqSignificanceCalculator: public DistanceCalculator<EtaPhi, EtaPhiWithVariance> {
39 public:
42 
43  virtual double distanceBetween(const EtaPhi& position1, const EtaPhiWithVariance& position2) const;
44 };
45 
46 
47 /* Distance calculator factory */
48 
53 public:
54  static std::unique_ptr<IDistanceProvider> Get(const std::string& distanceType, std::unique_ptr<IPositionProvider> trackPosition,
55  std::unique_ptr<IPositionProvider> clusterPosition) {
56  if (distanceType == "EtaPhiSquareDistance") {
57  return std::make_unique<DistanceProvider<EtaPhi, EtaPhi> >(std::move(trackPosition), std::move(clusterPosition), std::make_unique<EtaPhiSqDistanceCalculator>());
58  } else if (distanceType == "EtaPhiSquareSignificance") {
59  return std::make_unique<DistanceProvider<EtaPhi, EtaPhiWithVariance> >(std::move(trackPosition), std::move(clusterPosition), std::make_unique<EtaPhiSqSignificanceCalculator>());
60  } else {
61  std::cerr << "DistanceFactory\tERROR\tInvalid distance type: \"" << distanceType << "\"" << std::endl;
62  assert(false);
63  return 0;
64  }
65  }
66 };
67 
68 }
69 
70 #endif /* PFMATCHDISTANCE_H_ */
PFMatchInterfaces.h
PFMatch::DistanceFactory
Factory to create IDistanceProvider of the type requested.
Definition: PFMatchDistance.h:52
PFMatch::EtaPhiSqSignificanceCalculator::EtaPhiSqSignificanceCalculator
EtaPhiSqSignificanceCalculator()
Definition: PFMatchDistance.h:40
PFMatch::EtaPhi
Definition: PFMatchPositions.h:23
PFMatch::EtaPhiSqSignificanceCalculator::~EtaPhiSqSignificanceCalculator
virtual ~EtaPhiSqSignificanceCalculator()
Definition: PFMatchDistance.h:41
PFMatch::DistanceCalculator
Definition: PFMatchInterfaces.h:104
PFMatch::EtaPhiSqDistanceCalculator::distanceBetween
virtual double distanceBetween(const EtaPhi &position1, const EtaPhi &position2) const
Definition: PFMatchDistance.cxx:25
PFMatch::EtaPhiSqDistanceCalculator::EtaPhiSqDistanceCalculator
EtaPhiSqDistanceCalculator()
Definition: PFMatchDistance.h:29
PFMatch::EtaPhiWithVariance
Definition: PFMatchPositions.h:41
PFMatch::EtaPhiSqDistanceCalculator
Calculates distance between two EtaPhi objects.
Definition: PFMatchDistance.h:27
PFMatch::DistanceFactory::Get
static std::unique_ptr< IDistanceProvider > Get(const std::string &distanceType, std::unique_ptr< IPositionProvider > trackPosition, std::unique_ptr< IPositionProvider > clusterPosition)
Definition: PFMatchDistance.h:54
PFMatch
Definition: PFMatchDistance.h:17
PFMatch::EtaPhiSqSignificanceCalculator
Calculates distance between EtaPhi and EtaPhiWithVariance object.
Definition: PFMatchDistance.h:38
PFMatch::EtaPhiSqDistanceCalculator::~EtaPhiSqDistanceCalculator
virtual ~EtaPhiSqDistanceCalculator()
Definition: PFMatchDistance.h:30
PFMatch::EtaPhiSqSignificanceCalculator::distanceBetween
virtual double distanceBetween(const EtaPhi &position1, const EtaPhiWithVariance &position2) const
Definition: PFMatchDistance.cxx:29