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

#include <Associator_DeltaRCosmics.h>

Inheritance diagram for Associator_DeltaRCosmics:
Collaboration diagram for Associator_DeltaRCosmics:

Public Types

typedef std::map< T *, S * > map_type
 
typedef std::map< S *, T * > 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 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_deltaR2
 

Detailed Description

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

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

Definition at line 29 of file Associator_DeltaRCosmics.h.

◆ ~Associator_DeltaRCosmics()

Associator_DeltaRCosmics::~Associator_DeltaRCosmics ( )
inline

Definition at line 31 of file Associator_DeltaRCosmics.h.

31 { }

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

Implements TIDA::Associator< T, S >.

Definition at line 33 of file Associator_DeltaRCosmics.h.

33 { return new Associator_DeltaRCosmics(*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_DeltaRCosmics::match ( const std::vector< TIDA::Track * > &  referenceTracks,
const std::vector< TIDA::Track * > &  testTracks 
)
inlinevirtual

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  }

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

double Associator_DeltaRCosmics::m_deltaR2
private

Definition at line 77 of file Associator_DeltaRCosmics.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:
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:147
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Associator_DeltaRCosmics::m_deltaR2
double m_deltaR2
Definition: Associator_DeltaRCosmics.h:77
TIDA::Associator::clear
void clear()
Definition: TIDAAssociator.h:63
Associator_DeltaRCosmics::Associator_DeltaRCosmics
Associator_DeltaRCosmics(const std::string &name, double deltaR)
Definition: Associator_DeltaRCosmics.h:29
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
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