Skip to content

Commit

Permalink
Merge pull request #44843 from wddgit/fixBugTICLLayerTileProducer
Browse files Browse the repository at this point in the history
Fix bug in TICLLayerTileProducer.
  • Loading branch information
cmsbuild authored Apr 29, 2024
2 parents 93c1c50 + b55dad4 commit b39a398
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions RecoHGCal/TICL/plugins/TICLLayerTileProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,18 @@ class TICLLayerTileProducer : public edm::stream::EDProducer<> {

TICLLayerTileProducer::TICLLayerTileProducer(const edm::ParameterSet &ps)
: detector_(ps.getParameter<std::string>("detector")) {
clusters_HFNose_token_ =
consumes<std::vector<reco::CaloCluster>>(ps.getParameter<edm::InputTag>("layer_HFNose_clusters"));
clusters_token_ = consumes<std::vector<reco::CaloCluster>>(ps.getParameter<edm::InputTag>("layer_clusters"));
geometry_token_ = esConsumes<CaloGeometry, CaloGeometryRecord, edm::Transition::BeginRun>();

doNose_ = (detector_ == "HFNose");

if (doNose_)
if (doNose_) {
clusters_HFNose_token_ =
consumes<std::vector<reco::CaloCluster>>(ps.getParameter<edm::InputTag>("layer_HFNose_clusters"));
produces<TICLLayerTilesHFNose>();
else
} else {
clusters_token_ = consumes<std::vector<reco::CaloCluster>>(ps.getParameter<edm::InputTag>("layer_clusters"));
produces<TICLLayerTiles>();
}
}

void TICLLayerTileProducer::beginRun(edm::Run const &, edm::EventSetup const &es) {
Expand All @@ -52,8 +53,13 @@ void TICLLayerTileProducer::beginRun(edm::Run const &, edm::EventSetup const &es
}

void TICLLayerTileProducer::produce(edm::Event &evt, const edm::EventSetup &) {
auto result = std::make_unique<TICLLayerTiles>();
auto resultHFNose = std::make_unique<TICLLayerTilesHFNose>();
std::unique_ptr<TICLLayerTilesHFNose> resultHFNose;
std::unique_ptr<TICLLayerTiles> result;
if (doNose_) {
resultHFNose = std::make_unique<TICLLayerTilesHFNose>();
} else {
result = std::make_unique<TICLLayerTiles>();
}

edm::Handle<std::vector<reco::CaloCluster>> cluster_h;
if (doNose_)
Expand All @@ -70,13 +76,14 @@ void TICLLayerTileProducer::produce(edm::Event &evt, const edm::EventSetup &) {

assert(layer >= 0);

if (doNose_)
if (doNose_) {
resultHFNose->fill(layer, lc.eta(), lc.phi(), lcId);
else
} else {
result->fill(layer, lc.eta(), lc.phi(), lcId);
LogDebug("TICLLayerTileProducer") << "Adding layerClusterId: " << lcId << " into bin [eta,phi]: [ "
<< (*result)[layer].etaBin(lc.eta()) << ", " << (*result)[layer].phiBin(lc.phi())
<< "] for layer: " << layer << std::endl;
LogDebug("TICLLayerTileProducer") << "Adding layerClusterId: " << lcId << " into bin [eta,phi]: [ "
<< (*result)[layer].etaBin(lc.eta()) << ", "
<< (*result)[layer].phiBin(lc.phi()) << "] for layer: " << layer << std::endl;
}
lcId++;
}
if (doNose_)
Expand Down

0 comments on commit b39a398

Please sign in to comment.