Skip to content

Commit

Permalink
code-check
Browse files Browse the repository at this point in the history
  • Loading branch information
swagata87 committed Oct 16, 2023
1 parent 7d179f3 commit 3a39f8f
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class SeedFinderBase {

virtual void findSeeds(const edm::Handle<reco::PFRecHitCollection>& input,
const std::vector<bool>& mask,
std::vector<bool>& seedable, HcalPFCuts*) = 0;
std::vector<bool>& seedable,
HcalPFCuts*) = 0;

const std::string& name() const { return _algoName; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class LocalMaximumSeedFinder final : public SeedFinderBase {

void findSeeds(const edm::Handle<reco::PFRecHitCollection>& input,
const std::vector<bool>& mask,
std::vector<bool>& seedable, HcalPFCuts*) override;
std::vector<bool>& seedable,
HcalPFCuts*) override;

private:
const int _nNeighbours;
Expand Down Expand Up @@ -71,7 +72,7 @@ LocalMaximumSeedFinder::LocalMaximumSeedFinder(const edm::ParameterSet& conf)
thresh_E = pset.getParameter<std::vector<double> >("seedingThreshold");
thresh_pT = pset.getParameter<std::vector<double> >("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);
Expand All @@ -96,7 +97,8 @@ LocalMaximumSeedFinder::LocalMaximumSeedFinder(const edm::ParameterSet& conf)
// the starting state of seedable is all false!
void LocalMaximumSeedFinder::findSeeds(const edm::Handle<reco::PFRecHitCollection>& input,
const std::vector<bool>& mask,
std::vector<bool>& seedable, HcalPFCuts* hcalCuts) {
std::vector<bool>& seedable,
HcalPFCuts* hcalCuts) {
auto nhits = input->size();
initDynArray(bool, nhits, usable, true);
//need to run over energy sorted rechits
Expand Down Expand Up @@ -126,25 +128,25 @@ void LocalMaximumSeedFinder::findSeeds(const edm::Handle<reco::PFRecHitCollectio
(seedlayer == PFLayer::HCAL_ENDCAP && maybeseed.depth() == depth) ||
(seedlayer != PFLayer::HCAL_BARREL1 && seedlayer != PFLayer::HCAL_ENDCAP)) {
thresholdE = std::get<1>(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];
}
}

if (cutsFromDB) {
//std::cout << "cutsFromDB " << cutsFromDB << " READ cuts from DB \n";
// new way, for HBHE
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 ((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])
Expand Down
13 changes: 6 additions & 7 deletions RecoParticleFlow/PFClusterProducer/plugins/PFClusterProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ PFClusterProducer::PFClusterProducer(const edm::ParameterSet& conf)
: _prodInitClusters(conf.getUntrackedParameter<bool>("prodInitialClusters", false)) {
_rechitsLabel = consumes<reco::PFRecHitCollection>(conf.getParameter<edm::InputTag>("recHitsSource"));
edm::ConsumesCollector cc = consumesCollector();

htopoToken_ = esConsumes<HcalTopology, HcalRecNumberingRecord>();
hcalCutsToken_ = esConsumes<HcalPFCuts, HcalPFCutsRcd>();

Expand Down Expand Up @@ -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<HcalPFCuts> paramPF_;
const HcalPFCuts& hcalCuts = es.getData(hcalCutsToken_);

std::unique_ptr<HcalPFCuts> paramPF_;
paramPF_ = std::make_unique<HcalPFCuts>(hcalCuts);
paramPF_->setTopo(&htopo);

_initialClustering->reset();
if (_pfClusterBuilder)
_pfClusterBuilder->reset();
Expand All @@ -155,7 +154,7 @@ void PFClusterProducer::produce(edm::Event& e, const edm::EventSetup& es) {
}

std::vector<bool> seedable(rechits->size(), false);
HcalPFCuts* paramPF = paramPF_.release();
HcalPFCuts* paramPF = paramPF_.release();
_seedFinder->findSeeds(rechits, seedmask, seedable, paramPF);

auto initialClusters = std::make_unique<reco::PFClusterCollection>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class PassThruSeedFinder : public SeedFinderBase {

void findSeeds(const edm::Handle<reco::PFRecHitCollection>& input,
const std::vector<bool>& mask,
std::vector<bool>& seedable, HcalPFCuts*) override;
std::vector<bool>& seedable,
HcalPFCuts*) override;

private:
};
Expand All @@ -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<reco::PFRecHitCollection>& input,
const std::vector<bool>& mask,
std::vector<bool>& seedable, HcalPFCuts*) {
std::vector<bool>& seedable,
HcalPFCuts*) {
seedable = std::vector<bool>(input->size(), true);
}

0 comments on commit 3a39f8f

Please sign in to comment.