RecoParticleFlow
PFProducer
plugins
linkers
TrackAndTrackLinker.cc
Go to the documentation of this file.
1
#include "
RecoParticleFlow/PFProducer/interface/BlockElementLinkerBase.h
"
2
#include "
DataFormats/ParticleFlowReco/interface/PFCluster.h
"
3
#include "
DataFormats/ParticleFlowReco/interface/PFBlockElementCluster.h
"
4
#include "
DataFormats/ParticleFlowReco/interface/PFBlockElementTrack.h
"
5
#include "
RecoParticleFlow/PFClusterTools/interface/LinkByRecHit.h
"
6
7
class
TrackAndTrackLinker
:
public
BlockElementLinkerBase
{
8
public
:
9
TrackAndTrackLinker
(
const
edm::ParameterSet
& conf)
10
:
BlockElementLinkerBase
(conf),
11
useKDTree_
(conf.getParameter<
bool
>(
"useKDTree"
)),
12
debug_
(conf.getUntrackedParameter<
bool
>(
"debug"
,
false
)) {}
13
14
bool
linkPrefilter
(
const
reco::PFBlockElement
*,
const
reco::PFBlockElement
*)
const override
;
15
16
double
testLink
(
const
reco::PFBlockElement
*,
const
reco::PFBlockElement
*)
const override
;
17
18
private
:
19
bool
useKDTree_
,
debug_
;
20
};
21
22
DEFINE_EDM_PLUGIN
(
BlockElementLinkerFactory
,
TrackAndTrackLinker
,
"TrackAndTrackLinker"
);
23
24
bool
TrackAndTrackLinker::linkPrefilter
(
const
reco::PFBlockElement
*
e1
,
const
reco::PFBlockElement
* e2)
const
{
25
return
(
e1
->isLinkedToDisplacedVertex() || e2->
isLinkedToDisplacedVertex
());
26
}
27
28
double
TrackAndTrackLinker::testLink
(
const
reco::PFBlockElement
* elem1,
const
reco::PFBlockElement
* elem2)
const
{
29
constexpr
reco::PFBlockElement::TrackType
T_TO_DISP =
reco::PFBlockElement::T_TO_DISP
;
30
constexpr
reco::PFBlockElement::TrackType
T_FROM_DISP =
reco::PFBlockElement::T_FROM_DISP
;
31
double
dist = -1.0;
32
33
const
reco::PFDisplacedTrackerVertexRef
& ni1_TO_DISP = elem1->
displacedVertexRef
(T_TO_DISP);
34
const
reco::PFDisplacedTrackerVertexRef
& ni2_TO_DISP = elem2->
displacedVertexRef
(T_TO_DISP);
35
const
reco::PFDisplacedTrackerVertexRef
& ni1_FROM_DISP = elem1->
displacedVertexRef
(T_FROM_DISP);
36
const
reco::PFDisplacedTrackerVertexRef
& ni2_FROM_DISP = elem2->
displacedVertexRef
(T_FROM_DISP);
37
38
if
(ni1_TO_DISP.
isNonnull
() && ni2_FROM_DISP.
isNonnull
())
39
if
(ni1_TO_DISP == ni2_FROM_DISP) {
40
dist = 1.0;
41
}
42
43
if
(ni1_FROM_DISP.
isNonnull
() && ni2_TO_DISP.
isNonnull
())
44
if
(ni1_FROM_DISP == ni2_TO_DISP) {
45
dist = 1.0;
46
}
47
48
if
(ni1_FROM_DISP.
isNonnull
() && ni2_FROM_DISP.
isNonnull
())
49
if
(ni1_FROM_DISP == ni2_FROM_DISP) {
50
dist = 1.0;
51
}
52
53
if
(elem1->
trackType
(
reco::PFBlockElement::T_FROM_GAMMACONV
) &&
54
elem2->
trackType
(
reco::PFBlockElement::T_FROM_GAMMACONV
)) {
55
for
(
const
auto
& conv1 : elem1->
convRefs
()) {
56
for
(
const
auto
& conv2 : elem2->
convRefs
()) {
57
if
(conv1.isNonnull() && conv2.isNonnull() && conv1 == conv2) {
58
dist = 1.0;
59
break
;
60
}
61
}
62
}
63
}
64
65
if
(elem1->
trackType
(
reco::PFBlockElement::T_FROM_V0
) && elem2->
trackType
(
reco::PFBlockElement::T_FROM_V0
)) {
66
if
(elem1->
V0Ref
().
isNonnull
() && elem2->
V0Ref
().
isNonnull
()) {
67
if
(elem1->
V0Ref
() == elem2->
V0Ref
()) {
68
dist = 1.0;
69
}
70
}
71
}
72
73
return
dist;
74
}
reco::PFBlockElement::trackType
virtual bool trackType(TrackType trType) const
Definition:
PFBlockElement.h:72
electrons_cff.bool
bool
Definition:
electrons_cff.py:366
TrackAndTrackLinker
Definition:
TrackAndTrackLinker.cc:7
TrackAndTrackLinker::testLink
double testLink(const reco::PFBlockElement *, const reco::PFBlockElement *) const override
Definition:
TrackAndTrackLinker.cc:28
funct::false
false
Definition:
Factorize.h:29
reco::PFBlockElement::V0Ref
virtual const VertexCompositeCandidateRef & V0Ref() const
Definition:
PFBlockElement.h:94
PFBlockElementCluster.h
TrackAndTrackLinker::debug_
bool debug_
Definition:
TrackAndTrackLinker.cc:19
reco::PFBlockElement::T_TO_DISP
Definition:
PFBlockElement.h:47
reco::PFBlockElement::isLinkedToDisplacedVertex
virtual bool isLinkedToDisplacedVertex() const
Definition:
PFBlockElement.h:111
BlockElementLinkerBase
Definition:
BlockElementLinkerBase.h:10
edm::Ref< PFDisplacedTrackerVertexCollection >
PFCluster.h
TrackAndTrackLinker::linkPrefilter
bool linkPrefilter(const reco::PFBlockElement *, const reco::PFBlockElement *) const override
Definition:
TrackAndTrackLinker.cc:24
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition:
PluginFactory.h:124
reco::PFBlockElement::T_FROM_V0
Definition:
PFBlockElement.h:47
reco::PFBlockElement::TrackType
TrackType
Definition:
PFBlockElement.h:47
reco::PFBlockElement::T_FROM_DISP
Definition:
PFBlockElement.h:47
edm::ParameterSet
Definition:
ParameterSet.h:47
reco::PFBlockElement::convRefs
virtual const ConversionRefVector & convRefs() const
Definition:
PFBlockElement.h:92
edmplugin::PluginFactory
Definition:
PluginFactory.h:34
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition:
Ref.h:238
LinkByRecHit.h
StorageManager_cfg.e1
e1
Definition:
StorageManager_cfg.py:16
reco::PFBlockElement::T_FROM_GAMMACONV
Definition:
PFBlockElement.h:47
TrackAndTrackLinker::useKDTree_
bool useKDTree_
Definition:
TrackAndTrackLinker.cc:19
reco::PFBlockElement
Abstract base class for a PFBlock element (track, cluster...)
Definition:
PFBlockElement.h:26
reco::PFBlockElement::displacedVertexRef
virtual const PFDisplacedTrackerVertexRef & displacedVertexRef(TrackType trType) const
Definition:
PFBlockElement.h:91
BlockElementLinkerBase.h
PFBlockElementTrack.h
TrackAndTrackLinker::TrackAndTrackLinker
TrackAndTrackLinker(const edm::ParameterSet &conf)
Definition:
TrackAndTrackLinker.cc:9
Generated for CMSSW Reference Manual by
1.8.16