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;
102 auto tower = std::make_pair(
id.ieta(),
id.iphi());
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];
124 HcalDetId id(minDepth.second, ieta, iphi, minDepth.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);
136 badAreasRH_.emplace_back(thisCell,
id(), layer, dummyEnergy);
138 badAreasC_.emplace_back(layer, dummyEnergy, pos.
x(), pos.
y(), pos.
z());
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)");
173 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.
const edm::EventSetup & c
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > hGeomToken_
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
uint16_t *__restrict__ id
#define DEFINE_FWK_MODULE(type)
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcd > hQualityToken_
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
edm::ESHandle< CaloGeometry > hGeom_
constexpr std::array< uint8_t, layerIndexSize > layer
std::vector< DetId > getAllChannels() const
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_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
auto const good
min quality of good
void add(std::string const &label, ParameterSetDescription const &psetDescription)
unsigned long long cacheId_quality_
virtual void init(const EventSetup &c)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
uint32_t getValue() const
~PFBadHcalPseudoClusterProducer() override