ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigAnalysis
TrigInDetAnalysisUtils
TrigInDetAnalysisUtils
Associator_DeltaEtaPhi.h
Go to the documentation of this file.
1
/* emacs: this is -*- c++ -*- */
10
11
#if 0
12
15
16
18
19
20
21
22
#ifndef TrigInDetAnalysisUtils_Associator_DeltaEtaPhi_H
23
#define TrigInDetAnalysisUtils_Associator_DeltaEtaPhi_H
24
25
26
#include <iostream>
27
#include <string>
28
#include <cmath>
29
#include <map>
30
31
#include "
TrigInDetAnalysis/TrackAssociator.h
"
32
#include "
TrigInDetAnalysis/Track.h
"
33
34
35
class
Associator_DeltaEtaPhi :
public
TrackAssociator
{
36
37
public
:
38
39
Associator_DeltaEtaPhi(
const
std::string& name,
double
deltaEta,
double
deltaPhi
) :
TrackAssociator
(
name
), m_deltaEta(
deltaEta
), m_deltaPhi(
deltaPhi
) {}
40
41
~Associator_DeltaEtaPhi() { }
42
43
44
virtual
void
match
(
const
std::vector<TIDA::Track*>& referenceTracks,
45
const
std::vector<TIDA::Track*>& testTracks) {
46
47
// Clear previously filled association map
48
clear
();
49
50
51
// Loop over reference tracks
52
std::vector<TIDA::Track*>::const_iterator
reference
, referenceEnd=referenceTracks.end();
53
for
(reference=referenceTracks.begin(); reference!=referenceEnd; reference++) {
54
55
// std::cout << "Offline = " << (*reference)->eta() << " " << (*reference)->phi() << " " << (*reference)->pT() << std::endl;
56
57
// Loop over test tracks and find the closest
58
TIDA::Track* bestMatch = NULL;
59
double
bestDeltaR=1000;
60
61
std::vector<TIDA::Track*>::const_iterator
test
, testEnd=testTracks.end();
62
for
(test=testTracks.begin(); test!=testEnd; test++) {
63
64
// Evaluate distance between reference and test tracks
65
double
deta = (*reference)->eta() - (*test)->eta();
66
double
dphi = (*reference)->phi() - (*test)->phi();
67
if
(dphi>
M_PI
) dphi-=2*
M_PI
;
68
if
(dphi<-
M_PI
) dphi+=2*
M_PI
;
69
70
if
(fabs(deta)>m_deltaEta || fabs(dphi)>m_deltaPhi)
continue
;
71
72
double
deltaR
= (deta*deta)/(m_deltaEta*m_deltaEta)+(dphi*dphi)/(m_deltaPhi*m_deltaPhi);
73
74
// Check if this is the best match so far
75
if
(bestMatch==NULL ||
deltaR
<bestDeltaR) {
76
bestDeltaR =
deltaR
;
77
bestMatch = (*test);
78
}
79
}
80
81
// Check if the best match is within delta R specifications
82
if
(bestMatch) {
83
// Create reference->test and test->reference associations
84
mmatched.insert(map_type::value_type(*reference, bestMatch));
85
mrevmatched.insert(map_type::value_type(bestMatch, *reference));
86
//std::cout << "Matched = " << bestMatch->eta() << " "<< bestMatch->phi() << " " << bestMatch->pT() << std::endl;
87
}
88
}
89
}
90
91
private
:
92
93
double
m_deltaEta;
94
double
m_deltaPhi;
95
96
};
97
98
99
#endif
// TrigInDetAnalysisUtils_Associator_DeltaEtaPhi_H
100
101
#endif
M_PI
#define M_PI
Definition
ActiveFraction.h:14
deltaPhi
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
Definition
AmgMatrixBasePlugin.h:112
deltaR
Scalar deltaR(const MatrixBase< Derived > &vec) const
Definition
AmgMatrixBasePlugin.h:105
TrackAssociator.h
TrackAssociator
TIDA::Associator< TIDA::Track > TrackAssociator
Definition
TrackAssociator.h:26
Track.h
TIDA::Associator< TIDA::Track >::clear
void clear()
Definition
TIDAAssociator.h:65
TIDA::Associator< TIDA::Track >::match
virtual void match(const std::vector< TIDA::Track * > &s1, const std::vector< TIDA::Track * > &s2)=0
P4Helpers::deltaEta
double deltaEta(const I4Momentum &p1, const I4Momentum &p2)
Computes efficiently .
Definition
P4Helpers.h:66
TrigInDetValidation_Base.test
test
Definition
TrigInDetValidation_Base.py:142
dq_make_web_display.reference
reference
Definition
dq_make_web_display.py:43
extractSporadic.name
name
Definition
extractSporadic.py:101
Generated on
for ATLAS Offline Software by
1.17.0