ATLAS Offline Software
Tracking
TrkUtilityPackages
TrkDriftCircleMath
TrkDriftCircleMath
SortSegBySizeAndChi2.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef DCMATH_SORTSEGBYSIZEANDCHI2_H
6
#define DCMATH_SORTSEGBYSIZEANDCHI2_H
7
8
#include "
TrkDriftCircleMath/Segment.h
"
9
10
namespace
TrkDriftCircleMath
{
11
12
struct
SortSegByNumberOfMDTHitsAndChi2
{
13
bool
operator()
(
const
Segment
& seg1,
const
Segment
& seg2) {
14
// prefer segment with T0 fit
15
if
(seg1.
hasT0Shift
() && !seg2.
hasT0Shift
())
16
return
true
;
17
else
if
(!seg1.
hasT0Shift
() && seg2.
hasT0Shift
())
18
return
false
;
19
20
// sort by numbers of hits on track
21
if
(seg1.
hitsOnTrack
() > seg2.
hitsOnTrack
())
22
return
true
;
23
else
if
(seg1.
hitsOnTrack
() < seg2.
hitsOnTrack
())
24
return
false
;
25
26
// take the one with less empty crossed tubes
27
if
(seg1.
emptyTubes
().size() < seg2.
emptyTubes
().size())
28
return
true
;
29
else
if
(seg1.
emptyTubes
().size() > seg2.
emptyTubes
().size())
30
return
false
;
31
32
// take one with associated clusters
33
if
(seg1.
clusterLayers
() > 0 && seg2.
clusterLayers
() == 0)
return
true
;
34
if
(seg1.
clusterLayers
() == 0 && seg2.
clusterLayers
() > 0)
return
false
;
35
36
// if equal sort by number of deltas
37
if
(seg1.
deltas
() < seg2.
deltas
())
38
return
true
;
39
else
if
(seg1.
deltas
() > seg2.
deltas
())
40
return
false
;
41
42
// finally take the one with best chi2
43
return
seg1.
chi2
() < seg2.
chi2
();
44
}
45
};
46
47
struct
SortSegByNumberOfHitsAndChi2
{
48
bool
operator()
(
const
Segment
& seg1,
const
Segment
& seg2) {
49
// prefer segment with T0 fit
50
if
(seg1.
hasT0Shift
() && !seg2.
hasT0Shift
())
51
return
true
;
52
else
if
(!seg1.
hasT0Shift
() && seg2.
hasT0Shift
())
53
return
false
;
54
55
unsigned
int
nhits1 = seg1.
hitsOnTrack
() + seg1.
clusterLayers
();
56
unsigned
int
nhits2 = seg2.
hitsOnTrack
() + seg2.
clusterLayers
();
57
58
// sort by numbers of hits on track
59
if
(nhits1 > nhits2)
60
return
true
;
61
else
if
(nhits1 < nhits2)
62
return
false
;
63
64
// take the one with less empty crossed tubes
65
if
(seg1.
emptyTubes
().size() < seg2.
emptyTubes
().size())
66
return
true
;
67
else
if
(seg1.
emptyTubes
().size() > seg2.
emptyTubes
().size())
68
return
false
;
69
70
// finally take the one with best chi2
71
return
seg1.
chi2
() < seg2.
chi2
();
72
}
73
};
74
75
}
// namespace TrkDriftCircleMath
76
77
#endif
TrkDriftCircleMath::SortSegByNumberOfHitsAndChi2
Definition:
SortSegBySizeAndChi2.h:47
TrkDriftCircleMath::SortSegByNumberOfMDTHitsAndChi2::operator()
bool operator()(const Segment &seg1, const Segment &seg2)
Definition:
SortSegBySizeAndChi2.h:13
TrkDriftCircleMath::SortSegByNumberOfHitsAndChi2::operator()
bool operator()(const Segment &seg1, const Segment &seg2)
Definition:
SortSegBySizeAndChi2.h:48
TrkDriftCircleMath::Segment::hasT0Shift
bool hasT0Shift() const
Definition:
TrkUtilityPackages/TrkDriftCircleMath/TrkDriftCircleMath/Segment.h:70
TrkDriftCircleMath
Function object to check whether two Segments are sub/super sets or different.
Definition:
IMdtSegmentFinder.h:13
TrkDriftCircleMath::Segment
Definition:
TrkUtilityPackages/TrkDriftCircleMath/TrkDriftCircleMath/Segment.h:18
TrkDriftCircleMath::Segment::chi2
double chi2() const
Definition:
TrkUtilityPackages/TrkDriftCircleMath/TrkDriftCircleMath/Segment.h:42
TrkDriftCircleMath::Segment::emptyTubes
const DCVec & emptyTubes() const
Definition:
TrkUtilityPackages/TrkDriftCircleMath/TrkDriftCircleMath/Segment.h:30
TrkDriftCircleMath::Segment::hitsOnTrack
void hitsOnTrack(unsigned int hitsOnTrack)
Definition:
TrkUtilityPackages/TrkDriftCircleMath/TrkDriftCircleMath/Segment.h:52
TrkDriftCircleMath::Segment::clusterLayers
void clusterLayers(unsigned int ncl)
Definition:
TrkUtilityPackages/TrkDriftCircleMath/TrkDriftCircleMath/Segment.h:64
Segment.h
TrkDriftCircleMath::SortSegByNumberOfMDTHitsAndChi2
Definition:
SortSegBySizeAndChi2.h:12
TrkDriftCircleMath::Segment::deltas
void deltas(unsigned int dts)
Definition:
TrkUtilityPackages/TrkDriftCircleMath/TrkDriftCircleMath/Segment.h:50
Generated on Tue Jul 2 2024 21:27:09 for ATLAS Offline Software by
1.8.18