From 3a39f8f9011f79d97556024a234011410bbde764 Mon Sep 17 00:00:00 2001 From: swagata87 Date: Mon, 16 Oct 2023 14:19:35 +0200 Subject: [PATCH] code-check --- .../interface/SeedFinderBase.h | 3 +- .../plugins/LocalMaximumSeedFinder.cc | 30 ++++++++++--------- .../plugins/PFClusterProducer.cc | 13 ++++---- .../plugins/PassThruSeedFinder.cc | 6 ++-- 4 files changed, 28 insertions(+), 24 deletions(-) diff --git a/RecoParticleFlow/PFClusterProducer/interface/SeedFinderBase.h b/RecoParticleFlow/PFClusterProducer/interface/SeedFinderBase.h index 29fd03d62d247..6349df1f03f50 100644 --- a/RecoParticleFlow/PFClusterProducer/interface/SeedFinderBase.h +++ b/RecoParticleFlow/PFClusterProducer/interface/SeedFinderBase.h @@ -17,7 +17,8 @@ class SeedFinderBase { virtual void findSeeds(const edm::Handle& input, const std::vector& mask, - std::vector& seedable, HcalPFCuts*) = 0; + std::vector& seedable, + HcalPFCuts*) = 0; const std::string& name() const { return _algoName; } diff --git a/RecoParticleFlow/PFClusterProducer/plugins/LocalMaximumSeedFinder.cc b/RecoParticleFlow/PFClusterProducer/plugins/LocalMaximumSeedFinder.cc index e3e2528997003..48b802863d9a5 100644 --- a/RecoParticleFlow/PFClusterProducer/plugins/LocalMaximumSeedFinder.cc +++ b/RecoParticleFlow/PFClusterProducer/plugins/LocalMaximumSeedFinder.cc @@ -19,7 +19,8 @@ class LocalMaximumSeedFinder final : public SeedFinderBase { void findSeeds(const edm::Handle& input, const std::vector& mask, - std::vector& seedable, HcalPFCuts*) override; + std::vector& seedable, + HcalPFCuts*) override; private: const int _nNeighbours; @@ -71,7 +72,7 @@ LocalMaximumSeedFinder::LocalMaximumSeedFinder(const edm::ParameterSet& conf) thresh_E = pset.getParameter >("seedingThreshold"); thresh_pT = pset.getParameter >("seedingThresholdPt"); if (thresh_E.size() != depths.size() || thresh_pT.size() != depths.size()) { - throw cms::Exception("InvalidGatheringThreshold") << "gatheringThresholds mismatch with the numbers of depths"; + throw cms::Exception("InvalidGatheringThreshold") << "gatheringThresholds mismatch with the numbers of depths"; } } else { depths.push_back(0); @@ -96,7 +97,8 @@ LocalMaximumSeedFinder::LocalMaximumSeedFinder(const edm::ParameterSet& conf) // the starting state of seedable is all false! void LocalMaximumSeedFinder::findSeeds(const edm::Handle& input, const std::vector& mask, - std::vector& seedable, HcalPFCuts* hcalCuts) { + std::vector& seedable, + HcalPFCuts* hcalCuts) { auto nhits = input->size(); initDynArray(bool, nhits, usable, true); //need to run over energy sorted rechits @@ -126,9 +128,9 @@ void LocalMaximumSeedFinder::findSeeds(const edm::Handle(thresholds)[j]; - //if ((seedlayer == PFLayer::HCAL_BARREL1) || (seedlayer == PFLayer::HCAL_ENDCAP)) { - //std::cout << "thresholdE OLD " << thresholdE << std::endl; - //} + //if ((seedlayer == PFLayer::HCAL_BARREL1) || (seedlayer == PFLayer::HCAL_ENDCAP)) { + //std::cout << "thresholdE OLD " << thresholdE << std::endl; + //} thresholdPT2 = std::get<2>(thresholds)[j]; } } @@ -136,15 +138,15 @@ void LocalMaximumSeedFinder::findSeeds(const edm::HandlegetValues(thisId.rawId()); - thresholdE = item->seedThreshold(); - // float noiseth = item->noiseThreshold(); - // std::cout << "thresholds NEW: seedTh " << thresholdE << std::endl; + if ((seedlayer == PFLayer::HCAL_BARREL1) || (seedlayer == PFLayer::HCAL_ENDCAP)) { + HcalDetId thisId = maybeseed.detId(); + const HcalPFCut* item = hcalCuts->getValues(thisId.rawId()); + thresholdE = item->seedThreshold(); + // float noiseth = item->noiseThreshold(); + // std::cout << "thresholds NEW: seedTh " << thresholdE << std::endl; } - } - + } + if (maybeseed.energy() < thresholdE || maybeseed.pt2() < thresholdPT2) usable[i] = false; if (!usable[i]) diff --git a/RecoParticleFlow/PFClusterProducer/plugins/PFClusterProducer.cc b/RecoParticleFlow/PFClusterProducer/plugins/PFClusterProducer.cc index b811d7365835a..e5c5e84b78677 100644 --- a/RecoParticleFlow/PFClusterProducer/plugins/PFClusterProducer.cc +++ b/RecoParticleFlow/PFClusterProducer/plugins/PFClusterProducer.cc @@ -60,7 +60,7 @@ PFClusterProducer::PFClusterProducer(const edm::ParameterSet& conf) : _prodInitClusters(conf.getUntrackedParameter("prodInitialClusters", false)) { _rechitsLabel = consumes(conf.getParameter("recHitsSource")); edm::ConsumesCollector cc = consumesCollector(); - + htopoToken_ = esConsumes(); hcalCutsToken_ = esConsumes(); @@ -126,14 +126,13 @@ void PFClusterProducer::beginRun(const edm::Run& run, const edm::EventSetup& es) } void PFClusterProducer::produce(edm::Event& e, const edm::EventSetup& es) { - const HcalTopology& htopo = es.getData(htopoToken_); - const HcalPFCuts& hcalCuts = es.getData(hcalCutsToken_); - - std::unique_ptr paramPF_; + const HcalPFCuts& hcalCuts = es.getData(hcalCutsToken_); + + std::unique_ptr paramPF_; paramPF_ = std::make_unique(hcalCuts); paramPF_->setTopo(&htopo); - + _initialClustering->reset(); if (_pfClusterBuilder) _pfClusterBuilder->reset(); @@ -155,7 +154,7 @@ void PFClusterProducer::produce(edm::Event& e, const edm::EventSetup& es) { } std::vector seedable(rechits->size(), false); - HcalPFCuts* paramPF = paramPF_.release(); + HcalPFCuts* paramPF = paramPF_.release(); _seedFinder->findSeeds(rechits, seedmask, seedable, paramPF); auto initialClusters = std::make_unique(); diff --git a/RecoParticleFlow/PFClusterProducer/plugins/PassThruSeedFinder.cc b/RecoParticleFlow/PFClusterProducer/plugins/PassThruSeedFinder.cc index 7b617b458f6c2..6297e9171ffbd 100644 --- a/RecoParticleFlow/PFClusterProducer/plugins/PassThruSeedFinder.cc +++ b/RecoParticleFlow/PFClusterProducer/plugins/PassThruSeedFinder.cc @@ -10,7 +10,8 @@ class PassThruSeedFinder : public SeedFinderBase { void findSeeds(const edm::Handle& input, const std::vector& mask, - std::vector& seedable, HcalPFCuts*) override; + std::vector& seedable, + HcalPFCuts*) override; private: }; @@ -22,6 +23,7 @@ PassThruSeedFinder::PassThruSeedFinder(const edm::ParameterSet& conf) : SeedFind // the starting state of seedable is all false! void PassThruSeedFinder::findSeeds(const edm::Handle& input, const std::vector& mask, - std::vector& seedable, HcalPFCuts*) { + std::vector& seedable, + HcalPFCuts*) { seedable = std::vector(input->size(), true); }