RecoParticleFlow
PFClusterProducer
plugins
FlagsCleanerECAL.cc
Go to the documentation of this file.
1
#include "
CommonTools/Utils/interface/StringToEnumValue.h
"
2
#include "
DataFormats/EcalRecHit/interface/EcalRecHit.h
"
3
#include "
FWCore/Framework/interface/ConsumesCollector.h
"
4
#include "
RecoParticleFlow/PFClusterProducer/interface/RecHitTopologicalCleanerBase.h
"
5
6
class
FlagsCleanerECAL
:
public
RecHitTopologicalCleanerBase
{
7
public
:
8
FlagsCleanerECAL
(
const
edm::ParameterSet
& conf,
edm::ConsumesCollector
&
cc
);
9
FlagsCleanerECAL
(
const
FlagsCleanerECAL
&) =
delete
;
10
FlagsCleanerECAL
&
operator=
(
const
FlagsCleanerECAL
&) =
delete
;
11
12
// mark rechits which are flagged as one of the values provided in the vector
13
void
clean
(
const
edm::Handle<reco::PFRecHitCollection>
&
input
, std::vector<bool>& mask)
override
;
14
15
private
:
16
std::vector<int>
v_chstatus_excl_
;
// list of rechit status flags to be excluded from seeding
17
bool
checkFlags
(
const
reco::PFRecHit
&
hit
);
18
};
19
20
DEFINE_EDM_PLUGIN
(
RecHitTopologicalCleanerFactory
,
FlagsCleanerECAL
,
"FlagsCleanerECAL"
);
21
22
FlagsCleanerECAL::FlagsCleanerECAL
(
const
edm::ParameterSet
& conf,
edm::ConsumesCollector
&
cc
)
23
:
RecHitTopologicalCleanerBase
(conf,
cc
) {
24
const
std::vector<std::string> flagnames = conf.
getParameter
<std::vector<std::string> >(
"RecHitFlagsToBeExcluded"
);
25
v_chstatus_excl_
= StringToEnumValue<EcalRecHit::Flags>(flagnames);
26
}
27
28
void
FlagsCleanerECAL::clean
(
const
edm::Handle<reco::PFRecHitCollection>
&
input
, std::vector<bool>& mask) {
29
auto
const
&
hits
= *
input
;
30
31
for
(uint16_t
idx
= 0;
idx
<
hits
.size(); ++
idx
) {
32
if
(!mask[
idx
])
33
continue
;
// don't need to re-mask things :-)
34
const
reco::PFRecHit
& rechit =
hits
[
idx
];
35
if
(
checkFlags
(rechit))
36
mask[
idx
] =
false
;
37
}
38
}
39
40
// returns true if one of the flags in the exclusion list is up
41
bool
FlagsCleanerECAL::checkFlags
(
const
reco::PFRecHit
&
hit
) {
42
for
(
auto
flag
:
v_chstatus_excl_
) {
// check if one of the flags is up
43
if
(
hit
.flags() & (0x1 <<
flag
))
44
return
true
;
45
}
46
return
false
;
47
}
input
static const std::string input
Definition:
EdmProvDump.cc:48
hfClusterShapes_cfi.hits
hits
Definition:
hfClusterShapes_cfi.py:5
edm::Handle< reco::PFRecHitCollection >
heavyIonCSV_trainingSettings.idx
idx
Definition:
heavyIonCSV_trainingSettings.py:5
EcalRecHit.h
StringToEnumValue.h
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition:
PluginFactory.h:124
FlagsCleanerECAL::operator=
FlagsCleanerECAL & operator=(const FlagsCleanerECAL &)=delete
RecHitTopologicalCleanerBase.h
FlagsCleanerECAL
Definition:
FlagsCleanerECAL.cc:6
edm::ParameterSet
Definition:
ParameterSet.h:47
edmplugin::PluginFactory
Definition:
PluginFactory.h:34
cc
FlagsCleanerECAL::v_chstatus_excl_
std::vector< int > v_chstatus_excl_
Definition:
FlagsCleanerECAL.cc:16
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
FlagsCleanerECAL::clean
void clean(const edm::Handle< reco::PFRecHitCollection > &input, std::vector< bool > &mask) override
Definition:
FlagsCleanerECAL.cc:28
reco::PFRecHit
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition:
PFRecHit.h:31
RecHitTopologicalCleanerBase
Definition:
RecHitTopologicalCleanerBase.h:13
ConsumesCollector.h
FlagsCleanerECAL::FlagsCleanerECAL
FlagsCleanerECAL(const edm::ParameterSet &conf, edm::ConsumesCollector &cc)
Definition:
FlagsCleanerECAL.cc:22
edm::ConsumesCollector
Definition:
ConsumesCollector.h:45
hit
Definition:
SiStripHitEffFromCalibTree.cc:88
FlagsCleanerECAL::checkFlags
bool checkFlags(const reco::PFRecHit &hit)
Definition:
FlagsCleanerECAL.cc:41
RemoveAddSevLevel.flag
flag
Definition:
RemoveAddSevLevel.py:117
Generated for CMSSW Reference Manual by
1.8.16