Skip to content

Commit

Permalink
Merge pull request #35459 from jbsauvan/hgc-tpg-migrate-esconsumes
Browse files Browse the repository at this point in the history
[HGCAL trigger] Migrate to esConsumes
  • Loading branch information
cmsbuild committed Oct 8, 2021
2 parents ac1544c + 97ceaf1 commit ad0988e
Show file tree
Hide file tree
Showing 51 changed files with 267 additions and 238 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class HGCalCoarseTriggerCellMapping {
GlobalPoint getCoarseTriggerCellPosition(uint32_t ctcId) const;
uint32_t getCoarseTriggerCellId(uint32_t detid) const;
void checkSizeValidity(int ctcSize) const;
void eventSetup(const edm::EventSetup& es) { triggerTools_.eventSetup(es); }
void setGeometry(const HGCalTriggerGeometryBase* const geom) { triggerTools_.setGeometry(geom); }

static constexpr int kCTCsizeCoarse_ = 16;
static constexpr int kCTCsizeMid_ = 8;
Expand Down
13 changes: 8 additions & 5 deletions L1Trigger/L1THGCal/interface/HGCalProcessorBaseT.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,19 @@ class HGCalProcessorBaseT {

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

void setGeometry(const HGCalTriggerGeometryBase* const geom) { geometry_ = geom; }
virtual void setGeometry(const HGCalTriggerGeometryBase* const geom) { geometry_ = geom; }

virtual void eventSetup(const edm::EventSetup& es){};

virtual void run(const InputCollection& inputColl, OutputCollection& outColl, const edm::EventSetup& es) = 0;
virtual void run(const InputCollection& inputColl, OutputCollection& outColl) = 0;

protected:
const HGCalTriggerGeometryBase* geometry_;
const HGCalTriggerGeometryBase* geometry() const {
if (!geometry_)
throw cms::Exception("HGCTriggerSetupError") << "The geometry has not been set in processor " << name_;
return geometry_;
}

private:
const HGCalTriggerGeometryBase* geometry_;
const std::string name_;
};

Expand Down
2 changes: 1 addition & 1 deletion L1Trigger/L1THGCal/interface/HGCalTriggerCellCalibration.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class HGCalTriggerCellCalibration {
public:
HGCalTriggerCellCalibration(const edm::ParameterSet& conf);
void eventSetup(const edm::EventSetup& es) { triggerTools_.eventSetup(es); }
void setGeometry(const HGCalTriggerGeometryBase* const geom) { triggerTools_.setGeometry(geom); }
void calibrateInMipT(l1t::HGCalTriggerCell&) const;
void calibrateMipTinGeV(l1t::HGCalTriggerCell&) const;
void calibrateInGeV(l1t::HGCalTriggerCell&) const;
Expand Down
6 changes: 3 additions & 3 deletions L1Trigger/L1THGCal/interface/HGCalTriggerTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
#include "L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h"

namespace edm {
class Event;
class EventSetup;
} // namespace edm
}

class HGCalTriggerTools {
public:
HGCalTriggerTools() : geom_(nullptr), eeLayers_(0), fhLayers_(0), bhLayers_(0), noseLayers_(0), totalLayers_(0) {}
~HGCalTriggerTools() {}

void eventSetup(const edm::EventSetup&);
void setGeometry(const HGCalTriggerGeometryBase* const);
void eventSetup(const edm::EventSetup&); // Kept for backward compatibility: used in L1Trigger/L1CaloTrigger/test
GlobalPoint getTCPosition(const DetId& id) const;
unsigned layers(ForwardSubdetector type) const;
unsigned layers(DetId::Detector type) const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class HGCalTriggerTowerGeometryHelper {

~HGCalTriggerTowerGeometryHelper() {}

void eventSetup(const edm::EventSetup& es) { triggerTools_.eventSetup(es); }
void setGeometry(const HGCalTriggerGeometryBase* const geom) { triggerTools_.setGeometry(geom); }

const std::vector<l1t::HGCalTowerCoord>& getTowerCoordinates() const;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class HGCalClusteringDummyImpl {
public:
HGCalClusteringDummyImpl(const edm::ParameterSet& conf);

void eventSetup(const edm::EventSetup& es) { triggerTools_.eventSetup(es); }
void setGeometry(const HGCalTriggerGeometryBase* const geom) { triggerTools_.setGeometry(geom); }

void clusterizeDummy(const std::vector<edm::Ptr<l1t::HGCalTriggerCell>>& triggerCellsPtrs,
l1t::HGCalClusterBxCollection& clusters);
Expand Down
2 changes: 1 addition & 1 deletion L1Trigger/L1THGCal/interface/backend/HGCalClusteringImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class HGCalClusteringImpl {
public:
HGCalClusteringImpl(const edm::ParameterSet& conf);

void eventSetup(const edm::EventSetup& es) { triggerTools_.eventSetup(es); }
void setGeometry(const HGCalTriggerGeometryBase* const geom) { triggerTools_.setGeometry(geom); }

/* dR-algorithms */
bool isPertinent(const l1t::HGCalTriggerCell& tc, const l1t::HGCalCluster& clu, double distXY) const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ class HGCalHistoClusteringImpl {
public:
HGCalHistoClusteringImpl(const edm::ParameterSet& conf);

void eventSetup(const edm::EventSetup& es) {
triggerTools_.eventSetup(es);
shape_.eventSetup(es);
void setGeometry(const HGCalTriggerGeometryBase* const geom) {
triggerTools_.setGeometry(geom);
shape_.setGeometry(geom);
if ((!dr_byLayer_coefficientA_.empty() && (dr_byLayer_coefficientA_.size() - 1) < triggerTools_.lastLayerBH()) ||
(!dr_byLayer_coefficientB_.empty() && (dr_byLayer_coefficientB_.size() - 1) < triggerTools_.lastLayerBH())) {
throw cms::Exception("Configuration")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class HGCalHistoSeedingImpl {
public:
HGCalHistoSeedingImpl(const edm::ParameterSet& conf);

void eventSetup(const edm::EventSetup& es) { triggerTools_.eventSetup(es); }
void setGeometry(const HGCalTriggerGeometryBase* const geom) { triggerTools_.setGeometry(geom); }

float dR(const l1t::HGCalCluster& clu, const GlobalPoint& seed) const;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ class HGCalMulticlusteringImpl {
public:
HGCalMulticlusteringImpl(const edm::ParameterSet& conf);

void eventSetup(const edm::EventSetup& es) {
triggerTools_.eventSetup(es);
shape_.eventSetup(es);
void setGeometry(const HGCalTriggerGeometryBase* const geom) {
triggerTools_.setGeometry(geom);
shape_.setGeometry(geom);
}

bool isPertinent(const l1t::HGCalCluster& clu, const l1t::HGCalMulticluster& mclu, double dR) const;
Expand Down
2 changes: 1 addition & 1 deletion L1Trigger/L1THGCal/interface/backend/HGCalShowerShape.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class HGCalShowerShape {

~HGCalShowerShape() {}

void eventSetup(const edm::EventSetup& es) { triggerTools_.eventSetup(es); }
void setGeometry(const HGCalTriggerGeometryBase* const geom) { triggerTools_.setGeometry(geom); }

int firstLayer(const l1t::HGCalMulticluster& c3d) const;
int lastLayer(const l1t::HGCalMulticluster& c3d) const;
Expand Down
7 changes: 3 additions & 4 deletions L1Trigger/L1THGCal/interface/backend/HGCalTowerMap2DImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Framework/interface/EventSetup.h"

#include "DataFormats/L1THGCal/interface/HGCalTriggerSums.h"
#include "DataFormats/L1THGCal/interface/HGCalTriggerCell.h"
Expand Down Expand Up @@ -49,9 +48,9 @@ class HGCalTowerMap2DImpl {
}
}

void eventSetup(const edm::EventSetup& es) {
triggerTools_.eventSetup(es);
towerGeometryHelper_.eventSetup(es);
void setGeometry(const HGCalTriggerGeometryBase* const geom) {
triggerTools_.setGeometry(geom);
towerGeometryHelper_.setGeometry(geom);
}

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@

#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "DataFormats/L1THGCal/interface/HGCalMulticluster.h"
#include "L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h"

class HGCalTriggerClusterInterpreterBase {
public:
HGCalTriggerClusterInterpreterBase(){};
virtual ~HGCalTriggerClusterInterpreterBase(){};
virtual void initialize(const edm::ParameterSet& conf) = 0;
virtual void eventSetup(const edm::EventSetup& es) = 0;
virtual void setGeometry(const HGCalTriggerGeometryBase* const) = 0;
virtual void interpret(l1t::HGCalMulticlusterBxCollection& multiclusters) const = 0;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class HGCalConcentratorAutoEncoderImpl {
std::vector<l1t::HGCalTriggerCell>& trigCellVecOutput,
std::vector<l1t::HGCalConcentratorData>& ae_EncodedOutput);

void eventSetup(const edm::EventSetup& es) { triggerTools_.eventSetup(es); }
void setGeometry(const HGCalTriggerGeometryBase* const geom) { triggerTools_.setGeometry(geom); }

private:
static constexpr int nTriggerCells_ = 48;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class HGCalConcentratorBestChoiceImpl {
std::vector<l1t::HGCalTriggerCell>& trigCellVecOutput,
std::vector<l1t::HGCalTriggerCell>& trigCellVecNotSelected);

void eventSetup(const edm::EventSetup& es) { triggerTools_.eventSetup(es); }
void setGeometry(const HGCalTriggerGeometryBase* const geom) { triggerTools_.setGeometry(geom); }

private:
std::vector<unsigned> nData_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ class HGCalConcentratorCoarsenerImpl {

void coarsen(const std::vector<l1t::HGCalTriggerCell>& trigCellVecInput,
std::vector<l1t::HGCalTriggerCell>& trigCellVecOutput);
void eventSetup(const edm::EventSetup& es) {
triggerTools_.eventSetup(es);
coarseTCmapping_.eventSetup(es);
calibration_.eventSetup(es);
void setGeometry(const HGCalTriggerGeometryBase* const geom) {
triggerTools_.setGeometry(geom);
coarseTCmapping_.setGeometry(geom);
calibration_.setGeometry(geom);
}

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ class HGCalConcentratorProcessorSelection : public HGCalConcentratorProcessorBas
void run(const edm::Handle<l1t::HGCalTriggerCellBxCollection>& triggerCellCollInput,
std::tuple<l1t::HGCalTriggerCellBxCollection,
l1t::HGCalTriggerSumsBxCollection,
l1t::HGCalConcentratorDataBxCollection>& triggerCollOutput,
const edm::EventSetup& es) override;
l1t::HGCalConcentratorDataBxCollection>& triggerCollOutput) override;

private:
bool fixedDataSizePerHGCROC_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ class HGCalConcentratorSuperTriggerCellImpl {

void select(const std::vector<l1t::HGCalTriggerCell>& trigCellVecInput,
std::vector<l1t::HGCalTriggerCell>& trigCellVecOutput);
void eventSetup(const edm::EventSetup& es) {
triggerTools_.eventSetup(es);
coarseTCmapping_.eventSetup(es);
superTCmapping_.eventSetup(es);
calibrationEE_.eventSetup(es);
calibrationHEsi_.eventSetup(es);
calibrationHEsc_.eventSetup(es);
calibrationNose_.eventSetup(es);
void setGeometry(const HGCalTriggerGeometryBase* const geom) {
triggerTools_.setGeometry(geom);
coarseTCmapping_.setGeometry(geom);
superTCmapping_.setGeometry(geom);
calibrationEE_.setGeometry(geom);
calibrationHEsi_.setGeometry(geom);
calibrationHEsc_.setGeometry(geom);
calibrationNose_.setGeometry(geom);
}

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class HGCalConcentratorThresholdImpl {
std::vector<l1t::HGCalTriggerCell>& trigCellVecOutput,
std::vector<l1t::HGCalTriggerCell>& trigCellVecNotSelected);

void eventSetup(const edm::EventSetup& es) { triggerTools_.eventSetup(es); }
void setGeometry(const HGCalTriggerGeometryBase* const geom) { triggerTools_.setGeometry(geom); }

private:
double threshold_silicon_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class HGCalConcentratorTrigSumImpl {
const std::vector<l1t::HGCalTriggerCell>& trigCellVecInput,
std::vector<l1t::HGCalTriggerSums>& trigSumsVecOutput) const;

void eventSetup(const edm::EventSetup& es) { triggerTools_.eventSetup(es); }
void setGeometry(const HGCalTriggerGeometryBase* const geom) { triggerTools_.setGeometry(geom); }

private:
HGCalTriggerTools triggerTools_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ class HGCalVFEProcessorSums : public HGCalVFEProcessorBase {
public:
HGCalVFEProcessorSums(const edm::ParameterSet& conf);

void run(const HGCalDigiCollection& digiColl,
l1t::HGCalTriggerCellBxCollection& triggerCellColl,
const edm::EventSetup& es) override;
void run(const HGCalDigiCollection& digiColl, l1t::HGCalTriggerCellBxCollection& triggerCellColl) override;

private:
std::unique_ptr<HGCalVFELinearizationImpl> vfeLinearizationSiImpl_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class HGCalVFESummationImpl {
public:
HGCalVFESummationImpl(const edm::ParameterSet& conf);

void eventSetup(const edm::EventSetup& es) { triggerTools_.eventSetup(es); }
void setGeometry(const HGCalTriggerGeometryBase* const geom) { triggerTools_.setGeometry(geom); }
void triggerCellSums(const std::vector<std::pair<DetId, uint32_t> >&, std::unordered_map<uint32_t, uint32_t>&);

private:
Expand Down
8 changes: 5 additions & 3 deletions L1Trigger/L1THGCal/plugins/HFNoseVFEProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ class HFNoseVFEProducer : public edm::stream::EDProducer<> {
// inputs
edm::EDGetToken inputnose_;
edm::ESHandle<HGCalTriggerGeometryBase> triggerGeometry_;
edm::ESGetToken<HGCalTriggerGeometryBase, CaloGeometryRecord> triggerGeomToken_;

std::unique_ptr<HGCalVFEProcessorBase> vfeProcess_;
};

DEFINE_FWK_MODULE(HFNoseVFEProducer);

HFNoseVFEProducer::HFNoseVFEProducer(const edm::ParameterSet& conf)
: inputnose_(consumes<HGCalDigiCollection>(conf.getParameter<edm::InputTag>("noseDigis"))) {
: inputnose_(consumes<HGCalDigiCollection>(conf.getParameter<edm::InputTag>("noseDigis"))),
triggerGeomToken_(esConsumes<HGCalTriggerGeometryBase, CaloGeometryRecord, edm::Transition::BeginRun>()) {
// setup VFE parameters
const edm::ParameterSet& vfeParamConfig = conf.getParameterSet("ProcessorParameters");
const std::string& vfeProcessorName = vfeParamConfig.getParameter<std::string>("ProcessorName");
Expand All @@ -45,7 +47,7 @@ HFNoseVFEProducer::HFNoseVFEProducer(const edm::ParameterSet& conf)
}

void HFNoseVFEProducer::beginRun(const edm::Run& /*run*/, const edm::EventSetup& es) {
es.get<CaloGeometryRecord>().get(triggerGeometry_);
triggerGeometry_ = es.getHandle(triggerGeomToken_);
vfeProcess_->setGeometry(triggerGeometry_.product());
}

Expand All @@ -58,7 +60,7 @@ void HFNoseVFEProducer::produce(edm::Event& e, const edm::EventSetup& es) {

if (nose_digis_h.isValid()) {
const HGCalDigiCollection& nose_digis = *nose_digis_h;
vfeProcess_->run(nose_digis, *vfe_trigcell_output, es);
vfeProcess_->run(nose_digis, *vfe_trigcell_output);
}

// Put in the event
Expand Down
2 changes: 1 addition & 1 deletion L1Trigger/L1THGCal/plugins/HGCalBackendLayer1Producer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ void HGCalBackendLayer1Producer::produce(edm::Event& e, const edm::EventSetup& e
edm::Handle<l1t::HGCalTriggerCellBxCollection> trigCellBxColl;

e.getByToken(input_cell_, trigCellBxColl);
backendProcess_->run(trigCellBxColl, *be_cluster_output, es);
backendProcess_->run(trigCellBxColl, *be_cluster_output);
e.put(std::move(be_cluster_output), backendProcess_->name());
}
2 changes: 1 addition & 1 deletion L1Trigger/L1THGCal/plugins/HGCalBackendLayer2Producer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void HGCalBackendLayer2Producer::produce(edm::Event& e, const edm::EventSetup& e

e.getByToken(input_clusters_, trigCluster2DBxColl);

backendProcess_->run(trigCluster2DBxColl, be_output, es);
backendProcess_->run(trigCluster2DBxColl, be_output);

e.put(std::make_unique<l1t::HGCalMulticlusterBxCollection>(std::move(be_output.first)), backendProcess_->name());
e.put(std::make_unique<l1t::HGCalClusterBxCollection>(std::move(be_output.second)),
Expand Down
3 changes: 1 addition & 2 deletions L1Trigger/L1THGCal/plugins/HGCalConcentratorProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ HGCalConcentratorProducer::HGCalConcentratorProducer(const edm::ParameterSet& co

void HGCalConcentratorProducer::beginRun(const edm::Run& /*run*/, const edm::EventSetup& es) {
triggerGeometry_ = es.getHandle(triggerGeomToken_);

concentratorProcess_->setGeometry(triggerGeometry_.product());
}

Expand All @@ -66,7 +65,7 @@ void HGCalConcentratorProducer::produce(edm::Event& e, const edm::EventSetup& es
edm::Handle<l1t::HGCalTriggerCellBxCollection> trigCellBxColl;

e.getByToken(input_cell_, trigCellBxColl);
concentratorProcess_->run(trigCellBxColl, cc_output, es);
concentratorProcess_->run(trigCellBxColl, cc_output);
// Put in the event
e.put(std::make_unique<l1t::HGCalTriggerCellBxCollection>(std::move(std::get<0>(cc_output))),
concentratorProcess_->name());
Expand Down
2 changes: 1 addition & 1 deletion L1Trigger/L1THGCal/plugins/HGCalTowerMapProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void HGCalTowerMapProducer::produce(edm::Event& e, const edm::EventSetup& es) {

e.getByToken(input_sums_, trigSumBxColl);

towersMapProcess_->run(trigSumBxColl, *towersMap_output, es);
towersMapProcess_->run(trigSumBxColl, *towersMap_output);

e.put(std::move(towersMap_output), towersMapProcess_->name());
}
3 changes: 1 addition & 2 deletions L1Trigger/L1THGCal/plugins/HGCalTowerProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ HGCalTowerProducer::HGCalTowerProducer(const edm::ParameterSet& conf)
}

void HGCalTowerProducer::beginRun(const edm::Run& /*run*/, const edm::EventSetup& es) {
towersProcess_->eventSetup(es);
triggerGeometry_ = es.getHandle(triggerGeomToken_);
towersProcess_->setGeometry(triggerGeometry_.product());
}
Expand All @@ -65,7 +64,7 @@ void HGCalTowerProducer::produce(edm::Event& e, const edm::EventSetup& es) {
e.getByToken(input_towers_map_, towersMapBxColl);
e.getByToken(input_trigger_cells_, clustersBxColl);

towersProcess_->run(inputsColl, *towers_output, es);
towersProcess_->run(inputsColl, *towers_output);

e.put(std::move(towers_output), towersProcess_->name());
}
6 changes: 3 additions & 3 deletions L1Trigger/L1THGCal/plugins/HGCalVFEProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,17 @@ void HGCalVFEProducer::produce(edm::Event& e, const edm::EventSetup& es) {
// Processing DigiCollections and putting the results into the HGCalTriggerCellBxCollectio
if (ee_digis_h.isValid()) {
const HGCalDigiCollection& ee_digis = *ee_digis_h;
vfeProcess_->run(ee_digis, *vfe_trigcell_output, es);
vfeProcess_->run(ee_digis, *vfe_trigcell_output);
}

if (fh_digis_h.isValid()) {
const HGCalDigiCollection& fh_digis = *fh_digis_h;
vfeProcess_->run(fh_digis, *vfe_trigcell_output, es);
vfeProcess_->run(fh_digis, *vfe_trigcell_output);
}

if (bh_digis_h.isValid()) {
const HGCalDigiCollection& bh_digis = *bh_digis_h;
vfeProcess_->run(bh_digis, *vfe_trigcell_output, es);
vfeProcess_->run(bh_digis, *vfe_trigcell_output);
}

// Put in the event
Expand Down
Loading

0 comments on commit ad0988e

Please sign in to comment.