ATLAS Offline Software
Loading...
Searching...
No Matches
Associator_DeltaEtaPhi Class Reference

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< TIDA::Track *, TIDA::Track * > map_type
typedef std::map< TIDA::Track *, TIDA::Track * > 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 const TIDA::Trackmatched (TIDA::Track *t)
const map_typematched () const
virtual const TIDA::Trackrevmatched (TIDA::Track *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

typedef std::map<TIDA::Track*, TIDA::Track*> TIDA::Associator< TIDA::Track, TIDA::Track >::map_type
inherited

Definition at line 28 of file TIDAAssociator.h.

◆ rmap_type

typedef std::map<TIDA::Track*, TIDA::Track*> TIDA::Associator< TIDA::Track, TIDA::Track >::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

Definition at line 32 of file Associator_DeltaEtaPhi.h.

32: TrackAssociator(name), m_deltaEta(deltaEta), m_deltaPhi(deltaPhi) {}
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
TIDA::Associator< TIDA::Track > TrackAssociator

◆ ~Associator_DeltaEtaPhi()

Associator_DeltaEtaPhi::~Associator_DeltaEtaPhi ( )
inline

Definition at line 34 of file Associator_DeltaEtaPhi.h.

34{ }

Member Function Documentation

◆ clear()

void TIDA::Associator< TIDA::Track, TIDA::Track >::clear ( )
inlineinherited

Definition at line 63 of file TIDAAssociator.h.

◆ clone()

virtual TrackAssociator * Associator_DeltaEtaPhi::clone ( )
inlineoverridevirtual

Implements TIDA::Associator< TIDA::Track >.

Definition at line 36 of file Associator_DeltaEtaPhi.h.

36{ return new Associator_DeltaEtaPhi(*this); }
Associator_DeltaEtaPhi(const std::string &name, double deltaEta, double deltaPhi)

◆ match()

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

Implements TIDA::Associator< TIDA::Track >.

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 }
#define M_PI
Scalar deltaR(const MatrixBase< Derived > &vec) const

◆ matched() [1/2]

const map_type & TIDA::Associator< TIDA::Track, TIDA::Track >::matched ( ) const
inlineinherited

Definition at line 59 of file TIDAAssociator.h.

59{ return mmatched; }

◆ matched() [2/2]

virtual const TIDA::Track * TIDA::Associator< TIDA::Track, TIDA::Track >::matched ( TIDA::Track * 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]

const rmap_type & TIDA::Associator< TIDA::Track, TIDA::Track >::revmatched ( ) const
inlineinherited

Definition at line 60 of file TIDAAssociator.h.

60{ return mrevmatched; }

◆ revmatched() [2/2]

virtual const TIDA::Track * TIDA::Associator< TIDA::Track, TIDA::Track >::revmatched ( TIDA::Track * t)
inlinevirtualinherited

Definition at line 52 of file TIDAAssociator.h.

52 {
54 if ( titr != mrevmatched.end() ) return titr->second;
55 else return 0;
56 }

◆ size()

unsigned TIDA::Associator< TIDA::Track, TIDA::Track >::size ( ) const
inlineinherited

Definition at line 66 of file TIDAAssociator.h.

66{ return mmatched.size(); }
unsigned size() const

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

map_type TIDA::Associator< TIDA::Track, TIDA::Track >::mmatched
protectedinherited

Definition at line 73 of file TIDAAssociator.h.

◆ mname

std::string TIDA::Associator< TIDA::Track, TIDA::Track >::mname
protectedinherited

Definition at line 71 of file TIDAAssociator.h.

◆ mrevmatched

rmap_type TIDA::Associator< TIDA::Track, TIDA::Track >::mrevmatched
protectedinherited

Definition at line 74 of file TIDAAssociator.h.


The documentation for this class was generated from the following file: