CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
PFBadHcalPseudoClusterProducer Class Reference
Inheritance diagram for PFBadHcalPseudoClusterProducer:
edm::stream::EDProducer<>

Public Member Functions

 PFBadHcalPseudoClusterProducer (const edm::ParameterSet &)
 
 ~PFBadHcalPseudoClusterProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

virtual void init (const EventSetup &c)
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

std::vector< reco::PFClusterbadAreasC_
 
std::vector< reco::PFRecHitbadAreasRH_
 
unsigned long long cacheId_geom_
 
unsigned long long cacheId_quality_
 
bool debug_
 
bool enabled_
 
edm::ESHandle< CaloGeometryhGeom_
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordhGeomToken_
 
edm::ESHandle< HcalChannelQualityhQuality_
 
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcdhQualityToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 41 of file PFBadHcalPseudoClusterProducer.cc.

Constructor & Destructor Documentation

◆ PFBadHcalPseudoClusterProducer()

PFBadHcalPseudoClusterProducer::PFBadHcalPseudoClusterProducer ( const edm::ParameterSet ps)
explicit

Definition at line 65 of file PFBadHcalPseudoClusterProducer.cc.

66  : enabled_(ps.getParameter<bool>("enable")),
67  debug_(ps.getUntrackedParameter<bool>("debug", false)),
69  cacheId_geom_(0),
70  hQualityToken_(esConsumes(edm::ESInputTag("", "withTopo"))),
72  produces<std::vector<reco::PFCluster>>();
73  produces<std::vector<reco::PFRecHit>>("hits");
74 }

◆ ~PFBadHcalPseudoClusterProducer()

PFBadHcalPseudoClusterProducer::~PFBadHcalPseudoClusterProducer ( )
override

Definition at line 76 of file PFBadHcalPseudoClusterProducer.cc.

76 {}

Member Function Documentation

◆ fillDescriptions()

void PFBadHcalPseudoClusterProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 168 of file PFBadHcalPseudoClusterProducer.cc.

168  {
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);
174 }

References edm::ConfigurationDescriptions::add(), and submitPVResolutionJobs::desc.

◆ init()

void PFBadHcalPseudoClusterProducer::init ( const EventSetup c)
privatevirtual

Definition at line 78 of file PFBadHcalPseudoClusterProducer.cc.

78  {
79  badAreasC_.clear();
80  badAreasRH_.clear();
81 
82  hQuality_ = iSetup.getHandle(hQualityToken_);
83  const HcalChannelQuality& chanquality = *hQuality_;
84 
85  hGeom_ = iSetup.getHandle(hGeomToken_);
86  const CaloGeometry& caloGeom = *hGeom_;
89 
90  int statusMask = ((1 << HcalChannelStatus::HcalCellOff) | (1 << HcalChannelStatus::HcalCellMask) |
92  // histogram the number of bad depths at each ieta, iphi
93  std::map<std::pair<int, int>, int> good, bads;
94  std::map<std::pair<int, int>, std::pair<int, HcalSubdetector>> minDepths;
95  for (const DetId& i : chanquality.getAllChannels()) {
96  if (i.det() != DetId::Hcal)
97  continue; // not an hcal cell
98  HcalDetId id = HcalDetId(i);
99  if (id.subdet() != HcalBarrel && id.subdet() != HcalEndcap)
100  continue; // we don't deal with HO and HF here
101  int status = chanquality.getValues(id)->getValue();
102  auto tower = std::make_pair(id.ieta(), id.iphi());
103  if (status & statusMask) {
104  bads[tower]++;
105  if (debug_)
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;
109  } else {
110  good[tower]++;
111  }
112  auto& minD = minDepths[tower];
113  if (minD.second == HcalEmpty || minD.first > id.depth()) {
114  minD.first = id.depth();
115  minD.second = id.subdet();
116  }
117  }
118 
119  const float dummyEnergy = 1e-5; // non-zero, but small (even if it shouldn't ever be used)
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];
123  bool barrel = minDepth.second == HcalBarrel;
124  HcalDetId id(minDepth.second, ieta, iphi, minDepth.first);
125  bool isBad = (nbad > 0 && nbad >= ngood);
126  if (debug_)
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;
130  if (!isBad)
131  continue;
133  // make a PF RecHit
134  std::shared_ptr<const CaloCellGeometry> thisCell = (barrel ? hbGeom : heGeom)->getGeometry(id);
135  const GlobalPoint& pos = thisCell->getPosition();
136  badAreasRH_.emplace_back(thisCell, id(), layer, dummyEnergy);
137  // make a PF cluster (but can't add the rechit, as for that I need an edm::Ref)
138  badAreasC_.emplace_back(layer, dummyEnergy, pos.x(), pos.y(), pos.z());
140  }
141 
142  cacheId_quality_ = iSetup.get<HcalChannelQualityRcd>().cacheIdentifier();
143  cacheId_geom_ = iSetup.get<CaloGeometryRecord>().cacheIdentifier();
144 }

References badAreasC_, badAreasRH_, reco::CaloCluster::badHcalMarker, Reference_intrackfit_cff::barrel, cacheId_geom_, cacheId_quality_, gather_cfg::cout, debug_, MillePedeFileConverter_cfg::e, edm::EventSetup::get(), HcalCondObjectContainer< Item >::getAllChannels(), edm::EventSetup::getHandle(), CaloGeometry::getSubdetectorGeometry(), HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), good, DetId::Hcal, PFLayer::HCAL_BARREL1, PFLayer::HCAL_ENDCAP, HcalBarrel, HcalChannelStatus::HcalCellDead, HcalChannelStatus::HcalCellMask, HcalChannelStatus::HcalCellOff, HcalEmpty, HcalEndcap, hGeom_, hGeomToken_, hQuality_, hQualityToken_, mps_fire::i, triggerObjects_cff::id, LEDCalibrationChannels::ieta, LEDCalibrationChannels::iphi, phase1PixelTopology::layer, mps_update::status, and hgcalTowerProducer_cfi::tower.

Referenced by produce().

◆ produce()

void PFBadHcalPseudoClusterProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 147 of file PFBadHcalPseudoClusterProducer.cc.

147  {
148  if (enabled_) {
150  cacheId_geom_ != iSetup.get<CaloGeometryRecord>().cacheIdentifier()) {
151  init(iSetup);
152  }
153  }
154 
155  auto outRH = std::make_unique<std::vector<reco::PFRecHit>>(badAreasRH_);
156  auto rhHandle = iEvent.put(std::move(outRH), "hits");
157 
158  auto outC = std::make_unique<std::vector<reco::PFCluster>>(badAreasC_);
159 
160  // now we go set references
161  for (unsigned int i = 0, n = rhHandle->size(); i < n; ++i) {
162  (*outC)[i].addRecHitFraction(reco::PFRecHitFraction(reco::PFRecHitRef(rhHandle, i), 1.0));
163  }
164 
165  iEvent.put(std::move(outC));
166 }

References badAreasC_, badAreasRH_, cacheId_geom_, cacheId_quality_, edm::eventsetup::EventSetupRecord::cacheIdentifier(), enabled_, edm::EventSetup::get(), mps_fire::i, iEvent, init(), eostools::move(), and dqmiodumpmetadata::n.

Member Data Documentation

◆ badAreasC_

std::vector<reco::PFCluster> PFBadHcalPseudoClusterProducer::badAreasC_
private

Definition at line 58 of file PFBadHcalPseudoClusterProducer.cc.

Referenced by init(), and produce().

◆ badAreasRH_

std::vector<reco::PFRecHit> PFBadHcalPseudoClusterProducer::badAreasRH_
private

Definition at line 59 of file PFBadHcalPseudoClusterProducer.cc.

Referenced by init(), and produce().

◆ cacheId_geom_

unsigned long long PFBadHcalPseudoClusterProducer::cacheId_geom_
private

Definition at line 57 of file PFBadHcalPseudoClusterProducer.cc.

Referenced by init(), and produce().

◆ cacheId_quality_

unsigned long long PFBadHcalPseudoClusterProducer::cacheId_quality_
private

Definition at line 57 of file PFBadHcalPseudoClusterProducer.cc.

Referenced by init(), and produce().

◆ debug_

bool PFBadHcalPseudoClusterProducer::debug_
private

Definition at line 53 of file PFBadHcalPseudoClusterProducer.cc.

Referenced by init().

◆ enabled_

bool PFBadHcalPseudoClusterProducer::enabled_
private

Definition at line 52 of file PFBadHcalPseudoClusterProducer.cc.

Referenced by produce().

◆ hGeom_

edm::ESHandle<CaloGeometry> PFBadHcalPseudoClusterProducer::hGeom_
private

Definition at line 56 of file PFBadHcalPseudoClusterProducer.cc.

Referenced by init().

◆ hGeomToken_

edm::ESGetToken<CaloGeometry, CaloGeometryRecord> PFBadHcalPseudoClusterProducer::hGeomToken_
private

Definition at line 62 of file PFBadHcalPseudoClusterProducer.cc.

Referenced by init().

◆ hQuality_

edm::ESHandle<HcalChannelQuality> PFBadHcalPseudoClusterProducer::hQuality_
private

Definition at line 55 of file PFBadHcalPseudoClusterProducer.cc.

Referenced by init().

◆ hQualityToken_

edm::ESGetToken<HcalChannelQuality, HcalChannelQualityRcd> PFBadHcalPseudoClusterProducer::hQualityToken_
private

Definition at line 61 of file PFBadHcalPseudoClusterProducer.cc.

Referenced by init().

good
const auto good
min quality of good
Definition: CAHitNtupletGeneratorKernelsImpl.h:760
PFBadHcalPseudoClusterProducer::hQuality_
edm::ESHandle< HcalChannelQuality > hQuality_
Definition: PFBadHcalPseudoClusterProducer.cc:55
mps_fire.i
i
Definition: mps_fire.py:428
edm::ESInputTag
Definition: ESInputTag.h:87
Reference_intrackfit_cff.barrel
list barrel
Definition: Reference_intrackfit_cff.py:37
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
reco::PFRecHitFraction
Fraction of a PFRecHit (rechits can be shared between several PFCluster's)
Definition: PFRecHitFraction.h:18
HcalChannelQualityRcd
Definition: HcalChannelQualityRcd.h:8
mps_update.status
status
Definition: mps_update.py:68
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
gather_cfg.cout
cout
Definition: gather_cfg.py:144
pos
Definition: PixelAliasList.h:18
DetId::Hcal
Definition: DetId.h:28
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:4
PFLayer::HCAL_ENDCAP
Definition: PFLayer.h:37
CaloGeometry::getSubdetectorGeometry
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
HcalChannelQuality
Definition: HcalChannelQuality.h:17
PFBadHcalPseudoClusterProducer::badAreasRH_
std::vector< reco::PFRecHit > badAreasRH_
Definition: PFBadHcalPseudoClusterProducer.cc:59
HcalBarrel
Definition: HcalAssistant.h:33
HcalEmpty
Definition: HcalAssistant.h:32
HcalChannelStatus::HcalCellMask
Definition: HcalChannelStatus.h:18
HcalCondObjectContainer::getValues
const Item * getValues(DetId fId, bool throwOnFail=true) const
Definition: HcalCondObjectContainer.h:159
PFBadHcalPseudoClusterProducer::debug_
bool debug_
Definition: PFBadHcalPseudoClusterProducer.cc:53
edm::Ref< PFRecHitCollection >
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
PFBadHcalPseudoClusterProducer::hQualityToken_
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcd > hQualityToken_
Definition: PFBadHcalPseudoClusterProducer.cc:61
DetId
Definition: DetId.h:17
PFBadHcalPseudoClusterProducer::cacheId_quality_
unsigned long long cacheId_quality_
Definition: PFBadHcalPseudoClusterProducer.cc:57
CaloGeometry
Definition: CaloGeometry.h:21
HcalChannelStatus::HcalCellOff
Definition: HcalChannelStatus.h:17
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
PFBadHcalPseudoClusterProducer::init
virtual void init(const EventSetup &c)
Definition: PFBadHcalPseudoClusterProducer.cc:78
PFLayer::HCAL_BARREL1
Definition: PFLayer.h:35
reco::CaloCluster::badHcalMarker
Definition: CaloCluster.h:50
PFBadHcalPseudoClusterProducer::cacheId_geom_
unsigned long long cacheId_geom_
Definition: PFBadHcalPseudoClusterProducer.cc:57
PFBadHcalPseudoClusterProducer::enabled_
bool enabled_
Definition: PFBadHcalPseudoClusterProducer.cc:52
Point3DBase< float, GlobalTag >
PFBadHcalPseudoClusterProducer::hGeom_
edm::ESHandle< CaloGeometry > hGeom_
Definition: PFBadHcalPseudoClusterProducer.cc:56
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
PFLayer::Layer
Layer
layer definition
Definition: PFLayer.h:29
HcalChannelStatus::getValue
uint32_t getValue() const
Definition: HcalChannelStatus.h:60
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
HcalCondObjectContainer::getAllChannels
std::vector< DetId > getAllChannels() const
Definition: HcalCondObjectContainer.h:312
PFBadHcalPseudoClusterProducer::badAreasC_
std::vector< reco::PFCluster > badAreasC_
Definition: PFBadHcalPseudoClusterProducer.cc:58
HcalDetId
Definition: HcalDetId.h:12
iEvent
int iEvent
Definition: GenABIO.cc:224
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
HcalChannelStatus::HcalCellDead
Definition: HcalChannelStatus.h:20
HcalEndcap
Definition: HcalAssistant.h:34
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
PFBadHcalPseudoClusterProducer::hGeomToken_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > hGeomToken_
Definition: PFBadHcalPseudoClusterProducer.cc:62
edm::eventsetup::EventSetupRecord::cacheIdentifier
unsigned long long cacheIdentifier() const
Definition: EventSetupRecord.h:187
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37