Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DataFormats/ParticleFlowReco/interface/PFRecHitSoA.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace reco {
using PFRecHitsNeighbours = Eigen::Matrix<int32_t, 8, 1>;
GENERATE_SOA_LAYOUT(PFRecHitSoALayout,
SOA_COLUMN(uint32_t, detId),
SOA_COLUMN(uint32_t, denseId),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see where this is stored (PFRecHitProducerKernel.dev.cc lines 100 and 118), but where is it used ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used to set the threshold for the PFRecHit later in PFClusterSoAProducerKernel.dev.cc.

SOA_COLUMN(float, energy),
SOA_COLUMN(float, time),
SOA_COLUMN(int, depth),
Expand Down
20 changes: 10 additions & 10 deletions RecoParticleFlow/PFClusterProducer/interface/PFClusterParamsSoA.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef RecoParticleFlow_PFClusterProducer_interface_PFRecHitHBHEParamsSoA_h
#define RecoParticleFlow_PFClusterProducer_interface_PFRecHitHBHEParamsSoA_h
#ifndef RecoParticleFlow_PFClusterProducer_interface_PFClusterParamsSoA_h
#define RecoParticleFlow_PFClusterProducer_interface_PFClusterParamsSoA_h

#include "DataFormats/SoATemplate/interface/SoACommon.h"
#include "DataFormats/SoATemplate/interface/SoALayout.h"
Expand All @@ -9,12 +9,12 @@ namespace reco {

GENERATE_SOA_LAYOUT(PFClusterParamsSoALayout,
SOA_SCALAR(int32_t, nNeigh),
SOA_SCALAR(float, seedPt2ThresholdEB),
SOA_SCALAR(float, seedPt2ThresholdEE),
SOA_COLUMN(float, seedEThresholdEB_vec),
SOA_COLUMN(float, seedEThresholdEE_vec),
SOA_COLUMN(float, topoEThresholdEB_vec),
SOA_COLUMN(float, topoEThresholdEE_vec),
SOA_SCALAR(float, seedPt2ThresholdHB),
SOA_SCALAR(float, seedPt2ThresholdHE),
SOA_COLUMN(float, seedEThresholdHB_vec),
SOA_COLUMN(float, seedEThresholdHE_vec),
SOA_COLUMN(float, topoEThresholdHB_vec),
SOA_COLUMN(float, topoEThresholdHE_vec),
Comment on lines -12 to +17
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these variable specific to HCAL ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

SOA_SCALAR(float, showerSigma2),
SOA_SCALAR(float, minFracToKeep),
SOA_SCALAR(float, minFracTot),
Expand All @@ -23,8 +23,8 @@ namespace reco {
SOA_SCALAR(float, stoppingTolerance),
SOA_SCALAR(float, minFracInCalc),
SOA_SCALAR(float, minAllowedNormalization),
SOA_COLUMN(float, recHitEnergyNormInvEB_vec),
SOA_COLUMN(float, recHitEnergyNormInvEE_vec),
SOA_COLUMN(float, recHitEnergyNormInvHB_vec),
SOA_COLUMN(float, recHitEnergyNormInvHE_vec),
SOA_SCALAR(float, barrelTimeResConsts_corrTermLowE),
SOA_SCALAR(float, barrelTimeResConsts_threshLowE),
SOA_SCALAR(float, barrelTimeResConsts_noiseTerm),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Utilities/interface/EDPutToken.h"

#include "CondFormats/DataRecord/interface/HcalPFCutsRcd.h"
#include "CondTools/Hcal/interface/HcalPFCutsHandler.h"

#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/DetId/interface/DetId.h"
#include "DataFormats/ParticleFlowReco/interface/PFRecHitHostCollection.h"
Expand All @@ -39,7 +42,9 @@ class LegacyPFClusterProducer : public edm::stream::EDProducer<> {
InputPFRecHitSoA_Token_{consumes(config.getParameter<edm::InputTag>("PFRecHitsLabelIn"))},
pfClusParamsToken_(esConsumes(config.getParameter<edm::ESInputTag>("pfClusterParams"))),
legacyPfClustersToken_(produces()),
recHitsLabel_(consumes(config.getParameter<edm::InputTag>("recHitsSource"))) {
recHitsLabel_(consumes(config.getParameter<edm::InputTag>("recHitsSource"))),
hcalCutsToken_(esConsumes<HcalPFCuts, HcalPFCutsRcd>(edm::ESInputTag("", "withTopo"))),
cutsFromDB_(config.getParameter<bool>("usePFThresholdsFromDB")) {
edm::ConsumesCollector cc = consumesCollector();

//setup pf cluster builder if requested
Expand All @@ -65,6 +70,7 @@ class LegacyPFClusterProducer : public edm::stream::EDProducer<> {
desc.add<edm::InputTag>("PFRecHitsLabelIn");
desc.add<edm::ESInputTag>("pfClusterParams");
desc.add<edm::InputTag>("recHitsSource");
desc.add<bool>("usePFThresholdsFromDB", true);
{
edm::ParameterSetDescription pfClusterBuilder;
pfClusterBuilder.add<unsigned int>("maxIterations", 5);
Expand Down Expand Up @@ -180,6 +186,8 @@ class LegacyPFClusterProducer : public edm::stream::EDProducer<> {
const edm::ESGetToken<reco::PFClusterParamsHostCollection, JobConfigurationGPURecord> pfClusParamsToken_;
const edm::EDPutTokenT<reco::PFClusterCollection> legacyPfClustersToken_;
const edm::EDGetTokenT<reco::PFRecHitCollection> recHitsLabel_;
const edm::ESGetToken<HcalPFCuts, HcalPFCutsRcd> hcalCutsToken_;
const bool cutsFromDB_;
// the actual algorithm
std::unique_ptr<PFCPositionCalculatorBase> positionCalc_;
std::unique_ptr<PFCPositionCalculatorBase> allCellsPositionCalc_;
Expand All @@ -188,6 +196,8 @@ class LegacyPFClusterProducer : public edm::stream::EDProducer<> {
void LegacyPFClusterProducer::produce(edm::Event& event, const edm::EventSetup& setup) {
const reco::PFRecHitHostCollection& pfRecHits = event.get(InputPFRecHitSoA_Token_);

HcalPFCuts const* paramPF = cutsFromDB_ ? &setup.getData(hcalCutsToken_) : nullptr;

auto const& pfClusterSoA = event.get(pfClusterSoAToken_).const_view();
auto const& pfRecHitFractionSoA = event.get(pfRecHitFractionSoAToken_).const_view();

Expand Down Expand Up @@ -221,11 +231,9 @@ void LegacyPFClusterProducer::produce(edm::Event& event, const edm::EventSetup&

// Now PFRecHitFraction of this PFCluster is set. Now compute calculateAndSetPosition (energy, position etc)
if (nTopoSeeds[pfClusterSoA[i].topoId()] == 1 && allCellsPositionCalc_) {
allCellsPositionCalc_->calculateAndSetPosition(
temp, nullptr); // temporarily use nullptr until we can properly set GT thresholds
allCellsPositionCalc_->calculateAndSetPosition(temp, paramPF);
} else {
positionCalc_->calculateAndSetPosition(
temp, nullptr); // temporarily use nullptr until we can properly set GT thresholds
positionCalc_->calculateAndSetPosition(temp, paramPF);
}
out.emplace_back(std::move(temp));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
if (thresholds.size() != kMaxDepth_barrel)
throw cms::Exception("Configuration") << "Invalid size (" << thresholds.size() << " != " << kMaxDepth_barrel
<< ") for \"\" vector of det = \"" << det << "\"";
view.seedPt2ThresholdEB() = seedPt2Threshold;
view.seedPt2ThresholdHB() = seedPt2Threshold;
for (size_t idx = 0; idx < thresholds.size(); ++idx) {
view.seedEThresholdEB_vec()[idx] = thresholds[idx];
view.seedEThresholdHB_vec()[idx] = thresholds[idx];
}
} else if (det == "HCAL_ENDCAP") {
if (thresholds.size() != kMaxDepth_endcap)
throw cms::Exception("Configuration") << "Invalid size (" << thresholds.size() << " != " << kMaxDepth_endcap
<< ") for \"\" vector of det = \"" << det << "\"";
view.seedPt2ThresholdEE() = seedPt2Threshold;
view.seedPt2ThresholdHE() = seedPt2Threshold;
for (size_t idx = 0; idx < thresholds.size(); ++idx) {
view.seedEThresholdEE_vec()[idx] = thresholds[idx];
view.seedEThresholdHE_vec()[idx] = thresholds[idx];
}
} else {
throw cms::Exception("Configuration") << "Unknown detector when parsing seedFinder: " << det;
Expand All @@ -63,14 +63,14 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
throw cms::Exception("Configuration") << "Invalid size (" << thresholds.size() << " != " << kMaxDepth_barrel
<< ") for \"\" vector of det = \"" << det << "\"";
for (size_t idx = 0; idx < thresholds.size(); ++idx) {
view.topoEThresholdEB_vec()[idx] = thresholds[idx];
view.topoEThresholdHB_vec()[idx] = thresholds[idx];
}
} else if (det == "HCAL_ENDCAP") {
if (thresholds.size() != kMaxDepth_endcap)
throw cms::Exception("Configuration") << "Invalid size (" << thresholds.size() << " != " << kMaxDepth_endcap
<< ") for \"\" vector of det = \"" << det << "\"";
for (size_t idx = 0; idx < thresholds.size(); ++idx) {
view.topoEThresholdEE_vec()[idx] = thresholds[idx];
view.topoEThresholdHE_vec()[idx] = thresholds[idx];
}
} else {
throw cms::Exception("Configuration") << "Unknown detector when parsing initClusteringStep: " << det;
Expand Down Expand Up @@ -99,15 +99,15 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
<< "Invalid size (" << recHitNorms.size() << " != " << kMaxDepth_barrel
<< ") for \"\" vector of det = \"" << det << "\"";
for (size_t idx = 0; idx < recHitNorms.size(); ++idx) {
view.recHitEnergyNormInvEB_vec()[idx] = 1. / recHitNorms[idx];
view.recHitEnergyNormInvHB_vec()[idx] = 1. / recHitNorms[idx];
}
} else if (det == "HCAL_ENDCAP") {
if (recHitNorms.size() != kMaxDepth_endcap)
throw cms::Exception("Configuration")
<< "Invalid size (" << recHitNorms.size() << " != " << kMaxDepth_endcap
<< ") for \"\" vector of det = \"" << det << "\"";
for (size_t idx = 0; idx < recHitNorms.size(); ++idx) {
view.recHitEnergyNormInvEE_vec()[idx] = 1. / recHitNorms[idx];
view.recHitEnergyNormInvHE_vec()[idx] = 1. / recHitNorms[idx];
}
} else {
throw cms::Exception("Configuration") << "Unknown detector when parsing recHitEnergyNorms: " << det;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
public:
PFClusterSoAProducer(edm::ParameterSet const& config)
: pfClusParamsToken(esConsumes(config.getParameter<edm::ESInputTag>("pfClusterParams"))),
topologyToken_(esConsumes(config.getParameter<edm::ESInputTag>("topology"))),
inputPFRecHitSoA_Token_{consumes(config.getParameter<edm::InputTag>("pfRecHits"))},
outputPFClusterSoA_Token_{produces()},
outputPFRHFractionSoA_Token_{produces()},
Expand All @@ -26,6 +27,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {

void produce(device::Event& event, device::EventSetup const& setup) override {
const reco::PFClusterParamsDeviceCollection& params = setup.getData(pfClusParamsToken);
const reco::PFRecHitHCALTopologyDeviceCollection& topology = setup.getData(topologyToken_);
const reco::PFRecHitHostCollection& pfRecHits = event.get(inputPFRecHitSoA_Token_);
const int nRH = pfRecHits->size();

Expand All @@ -36,7 +38,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {

PFClusterProducerKernel kernel(event.queue(), pfRecHits);
kernel.execute(
event.queue(), params, pfClusteringVars, pfClusteringEdgeVars, pfRecHits, pfClusters, pfrhFractions);
event.queue(), params, topology, pfClusteringVars, pfClusteringEdgeVars, pfRecHits, pfClusters, pfrhFractions);

if (synchronise_)
alpaka::wait(event.queue());
Expand All @@ -49,13 +51,15 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
edm::ParameterSetDescription desc;
desc.add<edm::InputTag>("pfRecHits");
desc.add<edm::ESInputTag>("pfClusterParams");
desc.add<edm::ESInputTag>("topology");
desc.add<bool>("synchronise");
desc.add<int>("pfRecHitFractionAllocation", 120);
descriptions.addWithDefaultLabel(desc);
}

private:
const device::ESGetToken<reco::PFClusterParamsDeviceCollection, JobConfigurationGPURecord> pfClusParamsToken;
const device::ESGetToken<reco::PFRecHitHCALTopologyDeviceCollection, PFRecHitHCALTopologyRecord> topologyToken_;
const edm::EDGetTokenT<reco::PFRecHitHostCollection> inputPFRecHitSoA_Token_;
const device::EDPutToken<reco::PFClusterDeviceCollection> outputPFClusterSoA_Token_;
const device::EDPutToken<reco::PFRecHitFractionDeviceCollection> outputPFRHFractionSoA_Token_;
Expand Down
Loading