RecoTracker
TkSeedingLayers
plugins
CombinedSeedComparitor.cc
Go to the documentation of this file.
1
#include "
RecoTracker/TkSeedingLayers/interface/SeedComparitor.h
"
2
#include "
RecoTracker/TkSeedingLayers/interface/SeedComparitorFactory.h
"
3
#include "
FWCore/Utilities/interface/Exception.h
"
4
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
5
6
#include <vector>
7
#include <memory>
8
9
class
CombinedSeedComparitor
:
public
SeedComparitor
{
10
public
:
11
CombinedSeedComparitor
(
const
edm::ParameterSet
&
cfg
,
edm::ConsumesCollector
&iC);
12
~CombinedSeedComparitor
()
override
;
13
void
init
(
const
edm::Event
&
ev
,
const
edm::EventSetup
&es)
override
;
14
bool
compatible
(
const
SeedingHitSet
&
hits
)
const override
;
15
bool
compatible
(
const
TrajectoryStateOnSurface
&,
SeedingHitSet::ConstRecHitPointer
hit
)
const override
;
16
bool
compatible
(
const
SeedingHitSet
&
hits
,
17
const
GlobalTrajectoryParameters
&helixStateAtVertex,
18
const
FastHelix
&helix)
const override
;
19
20
private
:
21
std::vector<std::unique_ptr<SeedComparitor>>
comparitors_
;
22
bool
isAnd_
;
23
};
24
25
CombinedSeedComparitor::CombinedSeedComparitor
(
const
edm::ParameterSet
&
cfg
,
edm::ConsumesCollector
&iC) {
26
std::string
mode
=
cfg
.getParameter<
std::string
>(
"mode"
);
27
if
(
mode
==
"and"
)
28
isAnd_
=
true
;
29
else
if
(
mode
==
"or"
)
30
isAnd_
=
false
;
31
else
32
throw
cms::Exception
(
"Configuration"
,
"Parameter 'mode' of CombinedSeedComparitor must be either 'and' or 'or'\n"
);
33
34
typedef
std::vector<edm::ParameterSet>
VPSet
;
35
VPSet
psets =
cfg
.getParameter<
VPSet
>(
"comparitors"
);
36
for
(VPSet::const_iterator it = psets.begin(), ed = psets.end(); it != ed; ++it) {
37
std::string
name
= it->getParameter<
std::string
>(
"ComponentName"
);
38
comparitors_
.emplace_back(
SeedComparitorFactory::get
()->
create
(
name
, *it, iC));
39
}
40
}
41
42
CombinedSeedComparitor::~CombinedSeedComparitor
() {}
43
44
void
CombinedSeedComparitor::init
(
const
edm::Event
&
ev
,
const
edm::EventSetup
&es) {
45
for
(
const
auto
&it :
comparitors_
) {
46
it->init(
ev
, es);
47
}
48
}
49
50
bool
CombinedSeedComparitor::compatible
(
const
SeedingHitSet
&
hits
)
const
{
51
for
(
const
auto
&it :
comparitors_
) {
52
bool
pass = it->compatible(
hits
);
53
if
(
isAnd_
!= pass)
54
return
pass;
// break on failures if doing an AND, and on successes if doing an OR
55
}
56
return
isAnd_
;
// if we arrive here, we have no successes for OR, and no failures for AND
57
}
58
59
bool
CombinedSeedComparitor::compatible
(
const
TrajectoryStateOnSurface
&tsos,
60
SeedingHitSet::ConstRecHitPointer
hit
)
const
{
61
for
(
const
auto
&it :
comparitors_
) {
62
bool
pass = it->compatible(tsos,
hit
);
63
if
(
isAnd_
!= pass)
64
return
pass;
// break on failures if doing an AND, and on successes if doing an OR
65
}
66
return
isAnd_
;
// if we arrive here, we have no successes for OR, and no failures for AND
67
}
68
69
bool
CombinedSeedComparitor::compatible
(
const
SeedingHitSet
&
hits
,
70
const
GlobalTrajectoryParameters
&helixStateAtVertex,
71
const
FastHelix
&helix)
const
{
72
for
(
const
auto
&it :
comparitors_
) {
73
bool
pass = it->compatible(
hits
, helixStateAtVertex, helix);
74
if
(
isAnd_
!= pass)
75
return
pass;
// break on failures if doing an AND, and on successes if doing an OR
76
}
77
return
isAnd_
;
// if we arrive here, we have no successes for OR, and no failures for AND
78
}
79
80
DEFINE_EDM_PLUGIN
(
SeedComparitorFactory
,
CombinedSeedComparitor
,
"CombinedSeedComparitor"
);
hfClusterShapes_cfi.hits
hits
Definition:
hfClusterShapes_cfi.py:5
SeedingHitSet
Definition:
SeedingHitSet.h:6
FastHelix
Definition:
FastHelix.h:26
SeedingHitSet::ConstRecHitPointer
BaseTrackerRecHit const * ConstRecHitPointer
Definition:
SeedingHitSet.h:10
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition:
ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
beamerCreator.create
def create(alignables, pedeDump, additionalData, outputFile, config)
Definition:
beamerCreator.py:44
CombinedSeedComparitor::~CombinedSeedComparitor
~CombinedSeedComparitor() override
Definition:
CombinedSeedComparitor.cc:42
CombinedSeedComparitor::init
void init(const edm::Event &ev, const edm::EventSetup &es) override
Definition:
CombinedSeedComparitor.cc:44
TrajectoryStateOnSurface
Definition:
TrajectoryStateOnSurface.h:16
CombinedSeedComparitor::CombinedSeedComparitor
CombinedSeedComparitor(const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
Definition:
CombinedSeedComparitor.cc:25
SeedComparitor
Definition:
SeedComparitor.h:25
GlobalTrajectoryParameters
Definition:
GlobalTrajectoryParameters.h:15
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition:
PluginFactory.h:124
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition:
ParameterSet.h:47
SeedComparitorFactory.h
CombinedSeedComparitor::comparitors_
std::vector< std::unique_ptr< SeedComparitor > > comparitors_
Definition:
CombinedSeedComparitor.cc:21
edmplugin::PluginFactory
Definition:
PluginFactory.h:34
CombinedSeedComparitor::compatible
bool compatible(const SeedingHitSet &hits) const override
Definition:
CombinedSeedComparitor.cc:50
CombinedSeedComparitor
Definition:
CombinedSeedComparitor.cc:9
edm::EventSetup
Definition:
EventSetup.h:57
get
#define get
looper.cfg
cfg
Definition:
looper.py:297
CombinedSeedComparitor::isAnd_
bool isAnd_
Definition:
CombinedSeedComparitor.cc:22
SeedComparitor.h
HistogramManager_cfi.VPSet
def VPSet(*args)
Definition:
HistogramManager_cfi.py:401
ev
bool ev
Definition:
Hydjet2Hadronizer.cc:95
Exception
Definition:
hltDiff.cc:246
Skims_PA_cff.name
name
Definition:
Skims_PA_cff.py:17
Exception.h
ParameterSet.h
edm::Event
Definition:
Event.h:73
edm::ConsumesCollector
Definition:
ConsumesCollector.h:45
hit
Definition:
SiStripHitEffFromCalibTree.cc:88
Generated for CMSSW Reference Manual by
1.8.16