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

#include <Associator_DeltaRCosmics.h>

Inheritance diagram for Associator_DeltaRCosmics:
Collaboration diagram for Associator_DeltaRCosmics:

Public Types

typedef std::map< TIDA::Track *, TIDA::Track * > map_type
typedef std::map< TIDA::Track *, TIDA::Track * > rmap_type

Public Member Functions

 Associator_DeltaRCosmics (const std::string &name, double deltaR)
 ~Associator_DeltaRCosmics ()
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_deltaR2

Detailed Description

Definition at line 25 of file Associator_DeltaRCosmics.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_DeltaRCosmics()

Associator_DeltaRCosmics::Associator_DeltaRCosmics ( const std::string & name,
double deltaR )
inline

Definition at line 29 of file Associator_DeltaRCosmics.h.

Scalar deltaR(const MatrixBase< Derived > &vec) const
TIDA::Associator< TIDA::Track > TrackAssociator

◆ ~Associator_DeltaRCosmics()

Associator_DeltaRCosmics::~Associator_DeltaRCosmics ( )
inline

Definition at line 31 of file Associator_DeltaRCosmics.h.

31{ }

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_DeltaRCosmics::clone ( )
inlineoverridevirtual

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

Definition at line 33 of file Associator_DeltaRCosmics.h.

33{ return new Associator_DeltaRCosmics(*this); }
Associator_DeltaRCosmics(const std::string &name, double deltaR)

◆ match()

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

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

Definition at line 35 of file Associator_DeltaRCosmics.h.

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

◆ 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_deltaR2

double Associator_DeltaRCosmics::m_deltaR2
private

Definition at line 77 of file Associator_DeltaRCosmics.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: