66 : enabled_(ps.getParameter<
bool>(
"enable")),
67 debug_(ps.getUntrackedParameter<
bool>(
"debug",
false)),
72 produces<std::vector<reco::PFCluster>>();
73 produces<std::vector<reco::PFRecHit>>(
"hits");
93 std::map<std::pair<int, int>,
int>
good, bads;
94 std::map<std::pair<int, int>, std::pair<int, HcalSubdetector>> minDepths;
103 if (
status & statusMask) {
106 std::cout <<
"Channel " <<
i() <<
" (subdet " <<
id.subdet() <<
", zside " <<
id.zside() <<
", ieta " 107 <<
id.ieta() <<
", iphi " <<
id.iphi() <<
" depth " <<
id.depth() <<
" has status " <<
status 108 <<
" masked " << (
status & statusMask) << std::endl;
112 auto& minD = minDepths[
tower];
113 if (minD.second ==
HcalEmpty || minD.first >
id.depth()) {
114 minD.first =
id.depth();
115 minD.second =
id.subdet();
119 const float dummyEnergy = 1
e-5;
120 for (
const auto& rec : bads) {
121 int ieta = rec.first.first,
iphi = rec.first.second, nbad = rec.second, ngood =
good[rec.first];
122 auto minDepth = minDepths[rec.first];
125 bool isBad = (nbad > 0 && nbad >= ngood);
127 std::cout <<
"At ieta " <<
id.ieta() <<
", iphi " <<
id.iphi() <<
" I have " << nbad <<
" bad depths, " << ngood
128 <<
" good depths. First depth is in " << (
barrel ?
"HB" :
"HE") <<
" depth " << minDepth.first <<
"; " 129 << (isBad ?
" MARK BAD" :
" ignore") << std::endl;
134 std::shared_ptr<const CaloCellGeometry> thisCell = (
barrel ? hbGeom : heGeom)->getGeometry(
id);
155 auto outRH = std::make_unique<std::vector<reco::PFRecHit>>(
badAreasRH_);
158 auto outC = std::make_unique<std::vector<reco::PFCluster>>(
badAreasC_);
161 for (
unsigned int i = 0,
n = rhHandle->size();
i <
n; ++
i) {
170 desc.add<
bool>(
"enable",
true)
171 ->setComment(
"activate the module (if false, it doesn't check the DB and produces an empty collection)");
172 desc.addUntracked<
bool>(
"debug",
false);
173 descriptions.
add(
"particleFlowBadHcalPseudoCluster",
desc);
std::vector< reco::PFCluster > badAreasC_
auto const good
min quality of good
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > hGeomToken_
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcd > hQualityToken_
Fraction of a PFRecHit (rechits can be shared between several PFCluster's)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
unsigned long long cacheIdentifier() const
edm::ESHandle< CaloGeometry > hGeom_
const Item * getValues(DetId fId, bool throwOnFail=true) const
std::vector< DetId > getAllChannels() const
#define DEFINE_FWK_MODULE(type)
edm::ESHandle< HcalChannelQuality > hQuality_
void produce(edm::Event &, const edm::EventSetup &) override
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
PFBadHcalPseudoClusterProducer(const edm::ParameterSet &)
uint32_t getValue() const
unsigned long long cacheId_geom_
std::vector< reco::PFRecHit > badAreasRH_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
unsigned long long cacheId_quality_
virtual void init(const EventSetup &c)
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
~PFBadHcalPseudoClusterProducer() override