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
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ LCToCPAssociatorByEnergyScoreProducerT<HIT, CLUSTER>::LCToCPAssociatorByEnergySc
caloGeometry_(esConsumes<CaloGeometry, CaloGeometryRecord>()),
hardScatterOnly_(ps.getParameter<bool>("hardScatterOnly")),
hits_token_(consumes<multiCollectionT>(ps.getParameter<edm::InputTag>("hits"))) {
rhtools_ = std::make_shared<hgcal::RecHitTools>();

// Register the product
produces<ticl::LayerClusterToCaloParticleAssociatorT<CLUSTER>>();
}
Expand All @@ -23,7 +21,8 @@ void LCToCPAssociatorByEnergyScoreProducerT<HIT, CLUSTER>::produce(edm::StreamID
edm::Event &iEvent,
const edm::EventSetup &es) const {
edm::ESHandle<CaloGeometry> geom = es.getHandle(caloGeometry_);
rhtools_->setGeometry(*geom);
auto rhtools = std::make_shared<hgcal::RecHitTools>();
rhtools->setGeometry(*geom);

if (!iEvent.getHandle(hitMap_) || !iEvent.getHandle(hits_token_)) {
if (!iEvent.getHandle(hitMap_)) {
Expand All @@ -37,7 +36,7 @@ void LCToCPAssociatorByEnergyScoreProducerT<HIT, CLUSTER>::produce(edm::StreamID
const std::unordered_map<DetId, const unsigned int> hitMap; // empty map
const multiCollectionT hits;
auto impl = std::make_unique<LCToCPAssociatorByEnergyScoreImplT<HIT, CLUSTER>>(
iEvent.productGetter(), hardScatterOnly_, rhtools_, &hitMap, hits);
iEvent.productGetter(), hardScatterOnly_, rhtools, &hitMap, hits);
auto emptyAssociator = std::make_unique<ticl::LayerClusterToCaloParticleAssociatorT<CLUSTER>>(std::move(impl));
iEvent.put(std::move(emptyAssociator));
return;
Expand All @@ -61,7 +60,7 @@ void LCToCPAssociatorByEnergyScoreProducerT<HIT, CLUSTER>::produce(edm::StreamID

const auto hitMap = &iEvent.get(hitMap_);
auto impl = std::make_unique<LCToCPAssociatorByEnergyScoreImplT<HIT, CLUSTER>>(
iEvent.productGetter(), hardScatterOnly_, rhtools_, hitMap, hits);
iEvent.productGetter(), hardScatterOnly_, rhtools, hitMap, hits);
auto toPut = std::make_unique<ticl::LayerClusterToCaloParticleAssociatorT<CLUSTER>>(std::move(impl));
iEvent.put(std::move(toPut));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class LCToCPAssociatorByEnergyScoreProducerT : public edm::global::EDProducer<>
edm::EDGetTokenT<std::unordered_map<DetId, const unsigned int>> hitMap_;
edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeometry_;
const bool hardScatterOnly_;
std::shared_ptr<hgcal::RecHitTools> rhtools_;
edm::EDGetTokenT<multiCollectionT> hits_token_;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ LCToSCAssociatorByEnergyScoreProducerT<HIT, CLUSTER>::LCToSCAssociatorByEnergySc
caloGeometry_(esConsumes<CaloGeometry, CaloGeometryRecord>()),
hardScatterOnly_(ps.getParameter<bool>("hardScatterOnly")),
hits_token_(consumes<multiCollectionT>(ps.getParameter<edm::InputTag>("hits"))) {
rhtools_ = std::make_shared<hgcal::RecHitTools>();

// Register the product
produces<ticl::LayerClusterToSimClusterAssociatorT<CLUSTER>>();
}
Expand All @@ -22,7 +20,8 @@ void LCToSCAssociatorByEnergyScoreProducerT<HIT, CLUSTER>::produce(edm::StreamID
edm::Event &iEvent,
const edm::EventSetup &es) const {
edm::ESHandle<CaloGeometry> geom = es.getHandle(caloGeometry_);
rhtools_->setGeometry(*geom);
auto rhtools = std::make_shared<hgcal::RecHitTools>();
rhtools->setGeometry(*geom);

if (!iEvent.getHandle(hitMap_) || !iEvent.getHandle(hits_token_)) {
if (!iEvent.getHandle(hitMap_)) {
Expand All @@ -36,7 +35,7 @@ void LCToSCAssociatorByEnergyScoreProducerT<HIT, CLUSTER>::produce(edm::StreamID
const std::unordered_map<DetId, const unsigned int> hitMap; // empty map
const multiCollectionT hits;
auto impl = std::make_unique<LCToSCAssociatorByEnergyScoreImplT<HIT, CLUSTER>>(
iEvent.productGetter(), hardScatterOnly_, rhtools_, &hitMap, hits);
iEvent.productGetter(), hardScatterOnly_, rhtools, &hitMap, hits);
auto emptyAssociator = std::make_unique<ticl::LayerClusterToSimClusterAssociatorT<CLUSTER>>(std::move(impl));
iEvent.put(std::move(emptyAssociator));
return;
Expand All @@ -60,7 +59,7 @@ void LCToSCAssociatorByEnergyScoreProducerT<HIT, CLUSTER>::produce(edm::StreamID

const auto hitMap = &iEvent.get(hitMap_);
auto impl = std::make_unique<LCToSCAssociatorByEnergyScoreImplT<HIT, CLUSTER>>(
iEvent.productGetter(), hardScatterOnly_, rhtools_, hitMap, hits);
iEvent.productGetter(), hardScatterOnly_, rhtools, hitMap, hits);
auto toPut = std::make_unique<ticl::LayerClusterToSimClusterAssociatorT<CLUSTER>>(std::move(impl));
iEvent.put(std::move(toPut));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class LCToSCAssociatorByEnergyScoreProducerT : public edm::global::EDProducer<>
edm::EDGetTokenT<std::unordered_map<DetId, const unsigned int>> hitMap_;
edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeometry_;
const bool hardScatterOnly_;
std::shared_ptr<hgcal::RecHitTools> rhtools_;
edm::EDGetTokenT<multiCollectionT> hits_token_;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,9 @@ class LCToSimTSAssociatorByEnergyScoreProducer : public edm::global::EDProducer<

private:
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override;
edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeometry_;
std::shared_ptr<hgcal::RecHitTools> rhtools_;
};

LCToSimTSAssociatorByEnergyScoreProducer::LCToSimTSAssociatorByEnergyScoreProducer(const edm::ParameterSet &ps)
: caloGeometry_(esConsumes<CaloGeometry, CaloGeometryRecord>()) {
rhtools_ = std::make_shared<hgcal::RecHitTools>();

LCToSimTSAssociatorByEnergyScoreProducer::LCToSimTSAssociatorByEnergyScoreProducer(const edm::ParameterSet &) {
// Register the product
produces<ticl::LayerClusterToSimTracksterAssociator>();
}
Expand All @@ -41,10 +36,7 @@ LCToSimTSAssociatorByEnergyScoreProducer::~LCToSimTSAssociatorByEnergyScoreProdu

void LCToSimTSAssociatorByEnergyScoreProducer::produce(edm::StreamID,
edm::Event &iEvent,
const edm::EventSetup &es) const {
edm::ESHandle<CaloGeometry> geom = es.getHandle(caloGeometry_);
rhtools_->setGeometry(*geom);

const edm::EventSetup &) const {
auto impl = std::make_unique<LCToSimTSAssociatorByEnergyScoreImpl>(iEvent.productGetter());
auto toPut = std::make_unique<ticl::LayerClusterToSimTracksterAssociator>(std::move(impl));
iEvent.put(std::move(toPut));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class TSToSimTSAssociatorByEnergyScoreProducer : public edm::global::EDProducer<
edm::EDGetTokenT<std::unordered_map<DetId, const unsigned int>> hitMap_;
edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeometry_;
const bool hardScatterOnly_;
std::shared_ptr<hgcal::RecHitTools> rhtools_;
std::vector<edm::InputTag> hits_label_;
std::vector<edm::EDGetTokenT<HGCRecHitCollection>> hits_token_;
};
Expand All @@ -40,8 +39,6 @@ TSToSimTSAssociatorByEnergyScoreProducer::TSToSimTSAssociatorByEnergyScoreProduc
caloGeometry_(esConsumes<CaloGeometry, CaloGeometryRecord>()),
hardScatterOnly_(ps.getParameter<bool>("hardScatterOnly")),
hits_label_(ps.getParameter<std::vector<edm::InputTag>>("hits")) {
rhtools_ = std::make_shared<hgcal::RecHitTools>();

for (auto &label : hits_label_) {
hits_token_.push_back(consumes<HGCRecHitCollection>(label));
}
Expand All @@ -56,7 +53,8 @@ void TSToSimTSAssociatorByEnergyScoreProducer::produce(edm::StreamID,
edm::Event &iEvent,
const edm::EventSetup &es) const {
edm::ESHandle<CaloGeometry> geom = es.getHandle(caloGeometry_);
rhtools_->setGeometry(*geom);
auto rhtools = std::make_shared<hgcal::RecHitTools>();
rhtools->setGeometry(*geom);

std::vector<const HGCRecHit *> hits;
for (auto &token : hits_token_) {
Expand All @@ -76,15 +74,15 @@ void TSToSimTSAssociatorByEnergyScoreProducer::produce(edm::StreamID,

const std::unordered_map<DetId, const unsigned int> hitMap; // empty map
auto impl = std::make_unique<TSToSimTSAssociatorByEnergyScoreImpl>(
iEvent.productGetter(), hardScatterOnly_, rhtools_, &hitMap, hits);
iEvent.productGetter(), hardScatterOnly_, rhtools, &hitMap, hits);
auto emptyAssociator = std::make_unique<ticl::TracksterToSimTracksterAssociator>(std::move(impl));
iEvent.put(std::move(emptyAssociator));
return;
}

const auto hitMap = &iEvent.get(hitMap_);
auto impl = std::make_unique<TSToSimTSAssociatorByEnergyScoreImpl>(
iEvent.productGetter(), hardScatterOnly_, rhtools_, hitMap, hits);
iEvent.productGetter(), hardScatterOnly_, rhtools, hitMap, hits);
auto toPut = std::make_unique<ticl::TracksterToSimTracksterAssociator>(std::move(impl));
iEvent.put(std::move(toPut));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class TSToSimTSHitLCAssociatorByEnergyScoreProducer : public edm::global::EDProd
edm::EDGetTokenT<std::unordered_map<DetId, const unsigned int>> hitMap_;
edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeometry_;
const bool hardScatterOnly_;
std::shared_ptr<hgcal::RecHitTools> rhtools_;
std::vector<edm::InputTag> hits_label_;
std::vector<edm::EDGetTokenT<std::vector<HIT>>> hits_token_;
};
Expand All @@ -44,8 +43,6 @@ TSToSimTSHitLCAssociatorByEnergyScoreProducer<HIT>::TSToSimTSHitLCAssociatorByEn
caloGeometry_(esConsumes<CaloGeometry, CaloGeometryRecord>()),
hardScatterOnly_(ps.getParameter<bool>("hardScatterOnly")),
hits_label_(ps.getParameter<std::vector<edm::InputTag>>("hits")) {
rhtools_ = std::make_shared<hgcal::RecHitTools>();

for (auto &label : hits_label_) {
hits_token_.push_back(consumes<std::vector<HIT>>(label));
}
Expand All @@ -62,7 +59,8 @@ void TSToSimTSHitLCAssociatorByEnergyScoreProducer<HIT>::produce(edm::StreamID,
edm::Event &iEvent,
const edm::EventSetup &es) const {
edm::ESHandle<CaloGeometry> geom = es.getHandle(caloGeometry_);
rhtools_->setGeometry(*geom);
auto rhtools = std::make_shared<hgcal::RecHitTools>();
rhtools->setGeometry(*geom);

std::vector<const HIT *> hits;
for (auto &token : hits_token_) {
Expand All @@ -84,15 +82,15 @@ void TSToSimTSHitLCAssociatorByEnergyScoreProducer<HIT>::produce(edm::StreamID,

const std::unordered_map<DetId, const unsigned int> hitMap; // empty map
auto impl = std::make_unique<TSToSimTSHitLCAssociatorByEnergyScoreImpl<HIT>>(
iEvent.productGetter(), hardScatterOnly_, rhtools_, &hitMap, hits);
iEvent.productGetter(), hardScatterOnly_, rhtools, &hitMap, hits);
auto emptyAssociator = std::make_unique<ticl::TracksterToSimTracksterHitLCAssociator>(std::move(impl));
iEvent.put(std::move(emptyAssociator));
return;
}

const auto hitMap = &iEvent.get(hitMap_);
auto impl = std::make_unique<TSToSimTSHitLCAssociatorByEnergyScoreImpl<HIT>>(
iEvent.productGetter(), hardScatterOnly_, rhtools_, hitMap, hits);
iEvent.productGetter(), hardScatterOnly_, rhtools, hitMap, hits);
auto toPut = std::make_unique<ticl::TracksterToSimTracksterHitLCAssociator>(std::move(impl));
iEvent.put(std::move(toPut));
}
Expand Down