ATLAS Offline Software
Public Types | Public Member Functions | Protected Attributes | Private Attributes | List of all members
Associator_DeltaEtaPhi Class Referenceabstract

Fixme: needs to be replaced by something inheriting from BestMatcher. More...

#include <Associator_DeltaEtaPhi.h>

Inheritance diagram for Associator_DeltaEtaPhi:
Collaboration diagram for Associator_DeltaEtaPhi:

Public Types

typedef std::map< T *, S * > map_type
 
typedef std::map< S *, T * > rmap_type
 

Public Member Functions

 Associator_DeltaEtaPhi (const std::string &name, double deltaEta, double deltaPhi)
 
 ~Associator_DeltaEtaPhi ()
 
virtual TrackAssociatorclone () override
 
virtual void match (const std::vector< TIDA::Track * > &referenceTracks, const std::vector< TIDA::Track * > &testTracks)
 
virtual void match (const std::vector< T * > &s1, const std::vector< S * > &s2)=0
 
virtual const S * matched (T *t)
 
const map_typematched () const
 
virtual const T * revmatched (S *t)
 
const rmap_typerevmatched () const
 
void clear ()
 
unsigned size () const
 

Protected Attributes

std::string mname
 
map_type mmatched
 
rmap_type mrevmatched
 

Private Attributes

double m_deltaEta
 
double m_deltaPhi
 

Detailed Description

Fixme: needs to be replaced by something inheriting from BestMatcher.

Definition at line 28 of file Associator_DeltaEtaPhi.h.

Member Typedef Documentation

◆ map_type

template<typename T , typename S = T>
typedef std::map<T*, S*> TIDA::Associator< T, S >::map_type
inherited

Definition at line 28 of file TIDAAssociator.h.

◆ rmap_type

template<typename T , typename S = T>
typedef std::map<S*, T*> TIDA::Associator< T, S >::rmap_type
inherited

Definition at line 29 of file TIDAAssociator.h.

Constructor & Destructor Documentation

◆ Associator_DeltaEtaPhi()

Associator_DeltaEtaPhi::Associator_DeltaEtaPhi ( const std::string &  name,
double  deltaEta,
double  deltaPhi 
)
inline

◆ ~Associator_DeltaEtaPhi()

Associator_DeltaEtaPhi::~Associator_DeltaEtaPhi ( )
inline

Definition at line 34 of file Associator_DeltaEtaPhi.h.

34 { }

Member Function Documentation

◆ clear()

template<typename T , typename S = T>
void TIDA::Associator< T, S >::clear ( )
inlineinherited

Definition at line 63 of file TIDAAssociator.h.

63 { mmatched.clear(); mrevmatched.clear(); }

◆ clone()

virtual TrackAssociator* Associator_DeltaEtaPhi::clone ( )
inlineoverridevirtual

Implements TIDA::Associator< T, S >.

Definition at line 36 of file Associator_DeltaEtaPhi.h.

36 { return new Associator_DeltaEtaPhi(*this); }

◆ match() [1/2]

template<typename T , typename S = T>
virtual void TIDA::Associator< T, S >::match ( const std::vector< T * > &  s1,
const std::vector< S * > &  s2 
)
pure virtualinherited

Implemented in BestMatcher< TIDA::Vertex >.

◆ match() [2/2]

virtual void Associator_DeltaEtaPhi::match ( const std::vector< TIDA::Track * > &  referenceTracks,
const std::vector< TIDA::Track * > &  testTracks 
)
inlinevirtual

Definition at line 38 of file Associator_DeltaEtaPhi.h.

39  {
40 
41  // Clear previously filled association map
42  clear();
43 
44 
45  // Loop over reference tracks
46  std::vector<TIDA::Track*>::const_iterator reference, referenceEnd=referenceTracks.end();
47  for(reference=referenceTracks.begin(); reference!=referenceEnd; reference++) {
48 
49  // std::cout << "Offline = " << (*reference)->eta() << " " << (*reference)->phi() << " " << (*reference)->pT() << std::endl;
50 
51  // Loop over test tracks and find the closest
52  TIDA::Track* bestMatch = NULL;
53  double bestDeltaR=1000;
54 
55  std::vector<TIDA::Track*>::const_iterator test, testEnd=testTracks.end();
56  for(test=testTracks.begin(); test!=testEnd; test++) {
57 
58  // Evaluate distance between reference and test tracks
59  double deta = (*reference)->eta() - (*test)->eta();
60  double dphi = (*reference)->phi() - (*test)->phi();
61  if(dphi>M_PI) dphi-=2*M_PI;
62  if(dphi<-M_PI) dphi+=2*M_PI;
63 
64  if (fabs(deta)>m_deltaEta || fabs(dphi)>m_deltaPhi) continue;
65 
66  double deltaR = (deta*deta)/(m_deltaEta*m_deltaEta)+(dphi*dphi)/(m_deltaPhi*m_deltaPhi);
67 
68  // Check if this is the best match so far
69  if(bestMatch==NULL || deltaR<bestDeltaR) {
70  bestDeltaR = deltaR;
71  bestMatch = (*test);
72  }
73  }
74 
75  // Check if the best match is within delta R specifications
76  if(bestMatch) {
77  // Create reference->test and test->reference associations
78  mmatched.insert(map_type::value_type(*reference, bestMatch));
79  mrevmatched.insert(map_type::value_type(bestMatch, *reference));
80  //std::cout << "Matched = " << bestMatch->eta() << " "<< bestMatch->phi() << " " << bestMatch->pT() << std::endl;
81  }
82  }
83  }

◆ matched() [1/2]

template<typename T , typename S = T>
const map_type& TIDA::Associator< T, S >::matched ( ) const
inlineinherited

Definition at line 59 of file TIDAAssociator.h.

59 { return mmatched; }

◆ matched() [2/2]

template<typename T , typename S = T>
virtual const S* TIDA::Associator< T, S >::matched ( T *  t)
inlinevirtualinherited

Definition at line 45 of file TIDAAssociator.h.

45  {
46  typename map_type::const_iterator titr = mmatched.find(t);
47  if ( titr != mmatched.end() ) return titr->second;
48  else return 0;
49  }

◆ revmatched() [1/2]

template<typename T , typename S = T>
const rmap_type& TIDA::Associator< T, S >::revmatched ( ) const
inlineinherited

Definition at line 60 of file TIDAAssociator.h.

60 { return mrevmatched; }

◆ revmatched() [2/2]

template<typename T , typename S = T>
virtual const T* TIDA::Associator< T, S >::revmatched ( S *  t)
inlinevirtualinherited

Definition at line 52 of file TIDAAssociator.h.

52  {
53  typename rmap_type::const_iterator titr = mrevmatched.find(t);
54  if ( titr != mrevmatched.end() ) return titr->second;
55  else return 0;
56  }

◆ size()

template<typename T , typename S = T>
unsigned TIDA::Associator< T, S >::size ( ) const
inlineinherited

Definition at line 66 of file TIDAAssociator.h.

66 { return mmatched.size(); }

Member Data Documentation

◆ m_deltaEta

double Associator_DeltaEtaPhi::m_deltaEta
private

Definition at line 87 of file Associator_DeltaEtaPhi.h.

◆ m_deltaPhi

double Associator_DeltaEtaPhi::m_deltaPhi
private

Definition at line 88 of file Associator_DeltaEtaPhi.h.

◆ mmatched

template<typename T , typename S = T>
map_type TIDA::Associator< T, S >::mmatched
protectedinherited

Definition at line 73 of file TIDAAssociator.h.

◆ mname

template<typename T , typename S = T>
std::string TIDA::Associator< T, S >::mname
protectedinherited

Definition at line 71 of file TIDAAssociator.h.

◆ mrevmatched

template<typename T , typename S = T>
rmap_type TIDA::Associator< T, S >::mrevmatched
protectedinherited

Definition at line 74 of file TIDAAssociator.h.


The documentation for this class was generated from the following file:
xAOD::deltaPhi
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap setEtaBin setIsTgcFailure setDeltaPt deltaPhi
Definition: L2StandAloneMuon_v1.cxx:160
M_PI
#define M_PI
Definition: ActiveFraction.h:11
TIDA::Associator::mmatched
map_type mmatched
Definition: TIDAAssociator.h:73
reference
Definition: hcg.cxx:437
TrigInDetValidation_Base.test
test
Definition: TrigInDetValidation_Base.py:144
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Associator_DeltaEtaPhi::Associator_DeltaEtaPhi
Associator_DeltaEtaPhi(const std::string &name, double deltaEta, double deltaPhi)
Definition: Associator_DeltaEtaPhi.h:32
TIDA::Associator::clear
void clear()
Definition: TIDAAssociator.h:63
P4Helpers::deltaEta
double deltaEta(const I4Momentum &p1, const I4Momentum &p2)
Computes efficiently .
Definition: P4Helpers.h:53
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
Associator_DeltaEtaPhi::m_deltaEta
double m_deltaEta
Definition: Associator_DeltaEtaPhi.h:87
dq_make_web_display.reference
reference
Definition: dq_make_web_display.py:44
TIDA::Track
Definition: Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Track.h:26
TIDA::Associator::mrevmatched
rmap_type mrevmatched
Definition: TIDAAssociator.h:74
TrackAssociator
TIDA::Associator< TIDA::Track > TrackAssociator
Definition: TrackAssociator.h:26
makeComparison.deltaR
float deltaR
Definition: makeComparison.py:36
Associator_DeltaEtaPhi::m_deltaPhi
double m_deltaPhi
Definition: Associator_DeltaEtaPhi.h:88