ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigAnalysis
TrigInDetAnalysisUtils
TrigInDetAnalysisUtils
Associator_DeltaR.h
Go to the documentation of this file.
1
/* emacs: this is -*- c++ -*- */
10
11
13
14
15
#if 0
16
17
#ifndef TrigInDetAnalysisUtils_Associator_DeltaR_H
18
#define TrigInDetAnalysisUtils_Associator_DeltaR_H
19
20
21
#include <iostream>
22
#include <string>
23
#include <cmath>
24
#include <map>
25
26
#include "
TrigInDetAnalysis/TrackAssociator.h
"
27
#include "
TrigInDetAnalysis/Track.h
"
28
29
30
31
32
33
class
Associator_DeltaR :
public
TrackAssociator
{
34
35
public
:
36
37
Associator_DeltaR(
const
std::string& name,
double
deltaR
) :
TrackAssociator
(
name
), m_deltaR2(
deltaR
*
deltaR
) {}
38
39
~Associator_DeltaR() { }
40
41
42
virtual
void
match
(
const
std::vector<TIDA::Track*>& referenceTracks,
43
const
std::vector<TIDA::Track*>& testTracks) {
44
45
// Clear previously filled association map
46
clear
();
47
48
// Loop over reference tracks
49
std::vector<TIDA::Track*>::const_iterator
reference
, referenceEnd=referenceTracks.end();
50
for
(reference=referenceTracks.begin(); reference!=referenceEnd; reference++) {
51
52
// Loop over test tracks and find the closest
53
TIDA::Track* bestMatch = NULL;
54
double
bestDeltaR=1000;
55
56
std::vector<TIDA::Track*>::const_iterator
test
, testEnd=testTracks.end();
57
for
(test=testTracks.begin(); test!=testEnd; test++) {
58
59
// Evaluate distance between reference and test tracks
60
double
deta = (*reference)->eta() - (*test)->eta();
61
double
dphi = (*reference)->phi() - (*test)->phi();
62
if
(dphi>
M_PI
) dphi-=2*
M_PI
;
63
if
(dphi<-
M_PI
) dphi+=2*
M_PI
;
64
double
deltaR
= deta*deta+dphi*dphi;
65
66
// Check if this is the best match so far
67
if
(bestMatch==NULL ||
deltaR
<bestDeltaR) {
68
bestDeltaR =
deltaR
;
69
bestMatch = (*test);
70
}
71
}
72
73
// Check if the best match is within delta R specifications
74
if
(bestMatch && bestDeltaR<m_deltaR2) {
75
// Create reference->test and test->reference associations
76
mmatched.insert(map_type::value_type(*reference, bestMatch));
77
mrevmatched.insert(map_type::value_type(bestMatch, *reference));
78
}
79
}
80
}
81
82
private
:
83
84
double
m_deltaR2;
85
86
};
87
88
#endif
// TrigInDetAnalysisUtils_Associator_DeltaR_H
89
90
#endif
M_PI
#define M_PI
Definition
ActiveFraction.h:14
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
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