65 enabled_(ps.getParameter<
bool>(
"enable")),
66 debug_(ps.getUntrackedParameter<
bool>(
"debug",
false)),
67 cacheId_quality_(0), cacheId_geom_(0)
69 produces<std::vector<reco::PFCluster>>();
70 produces<std::vector<reco::PFRecHit>>(
"hits");
95 std::map<std::pair<int,int>,
int> good, bads;
96 std::map<std::pair<int,int>, std::pair<int,HcalSubdetector>> minDepths;
102 auto tower = std::make_pair(
id.ieta(),
id.iphi());
103 if (status & statusMask) {
105 if (
debug_)
std::cout <<
"Channel " <<
i() <<
" (subdet " <<
id.subdet() <<
", zside " <<
id.zside() <<
", ieta " <<
id.ieta() <<
", iphi " <<
id.iphi() <<
" depth " <<
id.depth() <<
" has status " << status <<
" masked " << (status & statusMask) << std::endl;
109 auto & minD = minDepths[tower];
110 if (minD.second ==
HcalEmpty || minD.first >
id.depth()) {
111 minD.first =
id.depth();
112 minD.second =
id.subdet();
116 const float dummyEnergy = 1
e-5;
117 for (
const auto & rec : bads) {
118 int ieta = rec.first.first, iphi = rec.first.second, nbad = rec.second, ngood = good[rec.first];
119 auto minDepth = minDepths[rec.first];
121 HcalDetId id(minDepth.second, ieta, iphi, minDepth.first);
122 bool isBad = (nbad > 0 && nbad >= ngood);
123 if (
debug_)
std::cout <<
"At ieta " <<
id.ieta() <<
", iphi " <<
id.iphi() <<
" I have " << nbad <<
" bad depths, " << ngood <<
" good depths. First depth is in " << (barrel ?
"HB" :
"HE") <<
" depth " << minDepth.first <<
"; " << (isBad ?
" MARK BAD":
" ignore") << std::endl;
124 if (!isBad)
continue;
127 std::shared_ptr<const CaloCellGeometry> thisCell = (barrel ? hbGeom : heGeom)->
getGeometry(
id);
129 badAreasRH_.emplace_back( thisCell,
id(), layer, dummyEnergy );
131 badAreasC_.emplace_back( layer, dummyEnergy, pos.
x(), pos.
y(), pos.
z() );
151 auto outRH = std::make_unique<std::vector<reco::PFRecHit>>(
badAreasRH_);
154 auto outC = std::make_unique<std::vector<reco::PFCluster>>(
badAreasC_);
157 for (
unsigned int i = 0,
n = rhHandle->size();
i <
n; ++
i) {
166 desc.
add<
bool>(
"enable",
false)->setComment(
"activate the module (if false, it doesn't check the DB and produces an empty collection)");
168 descriptions.
add(
"particleFlowBadHcalPseudoCluster", desc);
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
unsigned long long cacheIdentifier() const
std::vector< reco::PFCluster > badAreasC_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
#define DEFINE_FWK_MODULE(type)
Fraction of a PFRecHit (rechits can be shared between several PFCluster's)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const Item * getValues(DetId fId, bool throwOnFail=true) const
CaloGeometry const * getGeometry()
edm::ESHandle< CaloGeometry > hGeom_
std::vector< DetId > getAllChannels() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::ESHandle< HcalChannelQuality > hQuality_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void produce(edm::Event &, const edm::EventSetup &) override
PFBadHcalPseudoClusterProducer(const edm::ParameterSet &)
unsigned long long cacheId_geom_
std::vector< reco::PFRecHit > badAreasRH_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
unsigned long long cacheId_quality_
virtual void init(const EventSetup &c)
uint32_t getValue() const
~PFBadHcalPseudoClusterProducer() override