ATLAS Offline Software
Associator_BestMatch.h
Go to the documentation of this file.
1 /* emacs: this is -*- c++ -*- */
14 #ifndef TIDAUTILS_ASSOCIATOR_BESTMATCH_H
15 #define TIDAUTILS_ASSOCIATOR_BESTMATCH_H
16 
17 #include <set>
18 #include <map>
19 
20 
23 
25 
26 
27 
29 
30 
31 
32 
34 
35 public:
36 
37  Associator_DeltaRMatcher(const std::string& name, double d) :
39  { }
40 
42 
43  virtual TrackAssociator* clone() override { return new Associator_DeltaRMatcher(*this); }
44 
45  virtual double distance( const TIDA::Track* t0, const TIDA::Track* t1 ) const override {
46  double deta = t0->eta()-t1->eta();
47  double dphi = t0->phi()-t1->phi();
48  if ( dphi> M_PI ) dphi-=2*M_PI;
49  if ( dphi<-M_PI ) dphi+=2*M_PI;
50  return std::sqrt( deta*deta + dphi*dphi );
51  }
52 
53 };
54 
55 
56 
57 
59 
60 public:
61 
62  Associator_SecondBestpTMatcher(const std::string& name, double d) :
64  { }
65 
67 
68  virtual TrackAssociator* clone() override { return new Associator_SecondBestpTMatcher(*this); }
69 
70  virtual double distance( const TIDA::Track* t0, const TIDA::Track* t1 ) const override {
71  double dpT = fabs( t0->pT()/1000 - t1->pT()/1000 );
72  //std::cout << "pT dist = " << dpT << " dpT / pT = " << dpT/fabs(t0->pT()/1000) << std::endl;
73  return dpT/(fabs(t0->pT()/1000));
74  }
75 
76 };
77 
78 
79 
81 
82 public:
83 
84  Associator_BestDeltaRMatcher(const std::string& name, double d) :
86  { }
87 
89 
90  virtual TrackAssociator* clone() override { return new Associator_BestDeltaRMatcher(*this); }
91 
92  virtual double distance( const TIDA::Track* t0, const TIDA::Track* t1 ) const override {
93  double deta = t0->eta()-t1->eta();
94  double dphi = t0->phi()-t1->phi();
95  if ( dphi> M_PI ) dphi-=2*M_PI;
96  if ( dphi<-M_PI ) dphi+=2*M_PI;
97  return std::sqrt( deta*deta + dphi*dphi );
98  }
99 
100 };
101 
102 
103 
104 
105 
106 
107 
108 
110 
111 public:
112 
113  Associator_BestDeltaRZMatcher(const std::string& name, double deta=0.05, double dphi=0.05, double dzed=5) :
115  m_deta2(deta*deta),
116  m_dphi2(dphi*dphi),
117  m_dzed2(dzed*dzed)
118  {
119  std::cout << "Associator: Best RZ Matcher" << std::endl;
120  }
121 
123 
124  virtual TrackAssociator* clone() override { return new Associator_BestDeltaRZMatcher(*this); }
125 
126  virtual double distance( const TIDA::Track* t0, const TIDA::Track* t1 ) const override {
127  double deta = t0->eta()-t1->eta();
128  double dphi = t0->phi()-t1->phi(); if ( dphi> M_PI ) dphi-=2*M_PI; if ( dphi<-M_PI ) dphi+=2*M_PI;
129  double dzed = t0->z0()-t1->z0();
130 
131  double dr = std::sqrt( deta*deta/m_deta2 + dphi*dphi/m_dphi2 + dzed*dzed/m_dzed2 );
132 
133  // std::cout << "RZ matcher dr: " << dr
134  // << "\t : \t" << deta*deta/m_deta2 << "\t" << dphi*dphi/m_dphi2 << "\t" << dzed*dzed/m_dzed2 << "\t" << *t1
135  // << std::endl;
136 
137  return dr;
138  }
139 
140 protected:
141 
142  double m_deta2;
143  double m_dphi2;
144  double m_dzed2;
145 
146 };
147 
148 
149 
150 
151 
153 
154 public:
155 
156  Associator_BestDeltaRZSinThetaMatcher(const std::string& name, double deta=0.05, double dphi=0.05, double dzed=5) :
158  m_deta2(deta*deta),
159  m_dphi2(dphi*dphi),
160  m_dzed2(dzed*dzed)
161  {
162  std::cout << "Associator: Best RZ Matcher" << std::endl;
163  }
164 
166 
167  virtual TrackAssociator* clone() override { return new Associator_BestDeltaRZSinThetaMatcher(*this); }
168 
169  virtual double distance( const TIDA::Track* t0, const TIDA::Track* t1 ) const override {
170  double theta = 2*std::atan(std::exp(-t1->eta()));
171 
172  double deta = t0->eta()-t1->eta();
173  double dphi = t0->phi()-t1->phi(); if ( dphi> M_PI ) dphi-=2*M_PI; if ( dphi<-M_PI ) dphi+=2*M_PI;
174 
175  double dzed = (t0->z0()-t1->z0())*std::sin(theta);
176 
177  double dr = std::sqrt( deta*deta/m_deta2 + dphi*dphi/m_dphi2 + dzed*dzed/m_dzed2 );
178 
179  // std::cout << "RZ matcher dr: " << dr
180  // << "\t : \t" << deta*deta/m_deta2 << "\t" << dphi*dphi/m_dphi2 << "\t" << dzed*dzed/m_dzed2 << "\t" << *t1
181  // << std::endl;
182 
183  return dr;
184  }
185 
186 protected:
187 
188  double m_deta2;
189  double m_dphi2;
190  double m_dzed2;
191 
192 };
193 
194 
195 
196 
198 
199 public:
200 
201  Associator_BestSigmaMatcher(const std::string& name, double dsigma=1) :
202  Associator_BestMatcher(name, dsigma)
203  {
204  std::cout << "Associator: Best Sigma Matcher" << std::endl;
205  }
206 
208 
209  virtual TrackAssociator* clone() override { return new Associator_BestSigmaMatcher(*this); }
210 
211  virtual double distance( const TIDA::Track* t0, const TIDA::Track* t1 ) const override {
212  double deta = t1->eta()-t0->eta();
213  double dphi = t1->phi()-t0->phi();
214  if ( dphi> M_PI ) dphi-=2*M_PI;
215  if ( dphi<-M_PI ) dphi+=2*M_PI;
216  double dzed = t1->z0()-t0->z0();
217 
218  // std::cout << *t0 << "\n" << *t1 << "\ndphi : " << dphi << std::endl;
219 
220  deta /= t1->deta();
221  dphi /= t1->dphi();
222  dzed /= t1->dz0();
223 
224  double dr = std::sqrt( deta*deta + dphi*dphi + dzed*dzed );
225 
226  // std::cout << "Sigma matcher dr: " << dr
227  // << "\t : \t" << deta*deta << "\t" << dphi*dphi << "\t" << dzed*dzed << "\t" << *t1
228  // << std::endl;
229 
230  return dr;
231  }
232 
233 };
234 
235 
236 
237 
239 
240 public:
241 
242  Associator_BestDeltaPhiMatcher(const std::string& name, double p) :
244  { }
245 
247 
248  virtual TrackAssociator* clone() override { return new Associator_BestDeltaPhiMatcher(*this); }
249 
250  virtual double distance( const TIDA::Track* t0, const TIDA::Track* t1 ) const override {
251  double dphi = t0->phi()-t1->phi();
252  if ( dphi> M_PI ) dphi-=2*M_PI;
253  if ( dphi<-M_PI ) dphi+=2*M_PI;
254  return std::fabs( dphi );
255  }
256 
257 };
258 
259 
260 
261 
262 #endif // TIDAUTILS_ASSOCIATOR_BESTMATCH_H
Associator_BestDeltaRZSinThetaMatcher::m_deta2
double m_deta2
Definition: Associator_BestMatch.h:188
TIDA::Associator
Definition: TIDAAssociator.h:24
Associator_BestDeltaRZMatcher::m_dzed2
double m_dzed2
Definition: Associator_BestMatch.h:144
Track.h
Associator_BestDeltaRZSinThetaMatcher
Definition: Associator_BestMatch.h:152
Associator_DeltaRMatcher::distance
virtual double distance(const TIDA::Track *t0, const TIDA::Track *t1) const override
Definition: Associator_BestMatch.h:45
Associator_BestDeltaPhiMatcher::Associator_BestDeltaPhiMatcher
Associator_BestDeltaPhiMatcher(const std::string &name, double p)
Definition: Associator_BestMatch.h:242
Associator_BestDeltaPhiMatcher::clone
virtual TrackAssociator * clone() override
Definition: Associator_BestMatch.h:248
Associator_BestDeltaRZSinThetaMatcher::Associator_BestDeltaRZSinThetaMatcher
Associator_BestDeltaRZSinThetaMatcher(const std::string &name, double deta=0.05, double dphi=0.05, double dzed=5)
Definition: Associator_BestMatch.h:156
Associator_BestDeltaRZMatcher::clone
virtual TrackAssociator * clone() override
Definition: Associator_BestMatch.h:124
Associator_BestMatcher
BestMatcher< TIDA::Track > Associator_BestMatcher
Definition: Associator_BestMatch.h:28
Associator_DeltaRMatcher::clone
virtual TrackAssociator * clone() override
Definition: Associator_BestMatch.h:43
Associator_DeltaRMatcher::Associator_DeltaRMatcher
Associator_DeltaRMatcher(const std::string &name, double d)
Definition: Associator_BestMatch.h:37
hist_file_dump.d
d
Definition: hist_file_dump.py:137
Associator_BestSigmaMatcher::clone
virtual TrackAssociator * clone() override
Definition: Associator_BestMatch.h:209
theta
Scalar theta() const
theta method
Definition: AmgMatrixBasePlugin.h:75
ALFA_EventTPCnv_Dict::t0
std::vector< ALFA_RawData_p1 > t0
Definition: ALFA_EventTPCnvDict.h:42
ALFA_EventTPCnv_Dict::t1
std::vector< ALFA_RawDataCollection_p1 > t1
Definition: ALFA_EventTPCnvDict.h:43
M_PI
#define M_PI
Definition: ActiveFraction.h:11
Associator_BestDeltaRMatcher::~Associator_BestDeltaRMatcher
virtual ~Associator_BestDeltaRMatcher()
Definition: Associator_BestMatch.h:88
python.TurnDataReader.dr
dr
Definition: TurnDataReader.py:112
Associator_BestDeltaRZMatcher::Associator_BestDeltaRZMatcher
Associator_BestDeltaRZMatcher(const std::string &name, double deta=0.05, double dphi=0.05, double dzed=5)
Definition: Associator_BestMatch.h:113
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
Associator_BestDeltaPhiMatcher
Definition: Associator_BestMatch.h:238
Associator_SecondBestpTMatcher::~Associator_SecondBestpTMatcher
virtual ~Associator_SecondBestpTMatcher()
Definition: Associator_BestMatch.h:66
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
Associator_BestSigmaMatcher::Associator_BestSigmaMatcher
Associator_BestSigmaMatcher(const std::string &name, double dsigma=1)
Definition: Associator_BestMatch.h:201
Associator_DeltaRMatcher::~Associator_DeltaRMatcher
virtual ~Associator_DeltaRMatcher()
Definition: Associator_BestMatch.h:41
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
Associator_DeltaRMatcher
Definition: Associator_BestMatch.h:33
Associator_BestDeltaPhiMatcher::~Associator_BestDeltaPhiMatcher
virtual ~Associator_BestDeltaPhiMatcher()
Definition: Associator_BestMatch.h:246
Associator_SecondBestpTMatcher
Definition: Associator_BestMatch.h:58
Associator_BestSigmaMatcher
Definition: Associator_BestMatch.h:197
Associator_BestDeltaRZSinThetaMatcher::distance
virtual double distance(const TIDA::Track *t0, const TIDA::Track *t1) const override
Definition: Associator_BestMatch.h:169
Associator_BestDeltaRZSinThetaMatcher::m_dphi2
double m_dphi2
Definition: Associator_BestMatch.h:189
Associator_BestDeltaRZMatcher::distance
virtual double distance(const TIDA::Track *t0, const TIDA::Track *t1) const override
Definition: Associator_BestMatch.h:126
Associator_SecondBestpTMatcher::distance
virtual double distance(const TIDA::Track *t0, const TIDA::Track *t1) const override
Definition: Associator_BestMatch.h:70
Associator_BestDeltaRMatcher
Definition: Associator_BestMatch.h:80
BestMatcher.h
TrackAssociator.h
Associator_BestSigmaMatcher::~Associator_BestSigmaMatcher
virtual ~Associator_BestSigmaMatcher()
Definition: Associator_BestMatch.h:207
Associator_BestDeltaRZMatcher::m_deta2
double m_deta2
Definition: Associator_BestMatch.h:142
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Associator_BestDeltaRZMatcher
Definition: Associator_BestMatch.h:109
Associator_BestDeltaRMatcher::clone
virtual TrackAssociator * clone() override
Definition: Associator_BestMatch.h:90
Associator_BestDeltaRMatcher::distance
virtual double distance(const TIDA::Track *t0, const TIDA::Track *t1) const override
Definition: Associator_BestMatch.h:92
Associator_SecondBestpTMatcher::clone
virtual TrackAssociator * clone() override
Definition: Associator_BestMatch.h:68
BestMatcher
Definition: BestMatcher.h:29
Associator_BestDeltaRZMatcher::~Associator_BestDeltaRZMatcher
virtual ~Associator_BestDeltaRZMatcher()
Definition: Associator_BestMatch.h:122
Associator_BestDeltaRZMatcher::m_dphi2
double m_dphi2
Definition: Associator_BestMatch.h:143
Associator_BestDeltaRZSinThetaMatcher::clone
virtual TrackAssociator * clone() override
Definition: Associator_BestMatch.h:167
Associator_BestDeltaRZSinThetaMatcher::m_dzed2
double m_dzed2
Definition: Associator_BestMatch.h:190
Associator_BestDeltaRZSinThetaMatcher::~Associator_BestDeltaRZSinThetaMatcher
virtual ~Associator_BestDeltaRZSinThetaMatcher()
Definition: Associator_BestMatch.h:165
Associator_BestSigmaMatcher::distance
virtual double distance(const TIDA::Track *t0, const TIDA::Track *t1) const override
Definition: Associator_BestMatch.h:211
Associator_BestDeltaRMatcher::Associator_BestDeltaRMatcher
Associator_BestDeltaRMatcher(const std::string &name, double d)
Definition: Associator_BestMatch.h:84
TIDA::Track
Definition: Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Track.h:26
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
Associator_BestDeltaPhiMatcher::distance
virtual double distance(const TIDA::Track *t0, const TIDA::Track *t1) const override
Definition: Associator_BestMatch.h:250
Associator_SecondBestpTMatcher::Associator_SecondBestpTMatcher
Associator_SecondBestpTMatcher(const std::string &name, double d)
Definition: Associator_BestMatch.h:62