Skip to content

Commit

Permalink
Merge pull request #30656 from fwyzard/convert_CSCTriggerPrimitivesPr…
Browse files Browse the repository at this point in the history
…oducer_to_one_11_2_x

Convert the CSCTriggerPrimitivesProducer to a "one" module
  • Loading branch information
cmsbuild authored Jul 13, 2020
2 parents c3539d7 + 50d3f78 commit 692a8d5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,22 @@ CSCTriggerPrimitivesProducer::CSCTriggerPrimitivesProducer(const edm::ParameterS
produces<CSCCorrelatedLCTDigiCollection>("MPCSORTED");
if (runME11ILT_ or runME21ILT_)
produces<GEMCoPadDigiCollection>();

// temporarily switch to a "one" module with a CSCTriggerPrimitivesBuilder data member
builder_ = std::make_unique<CSCTriggerPrimitivesBuilder>(config_);
}

CSCTriggerPrimitivesProducer::~CSCTriggerPrimitivesProducer() {}

void CSCTriggerPrimitivesProducer::produce(edm::StreamID iID, edm::Event& ev, const edm::EventSetup& setup) const {
// Remark: access builder using "streamCache(iID)"

void CSCTriggerPrimitivesProducer::produce(edm::Event& ev, const edm::EventSetup& setup) {
// get the csc geometry
edm::ESHandle<CSCGeometry> h = setup.getHandle(cscToken_);
streamCache(iID)->setCSCGeometry(&*h);
builder_->setCSCGeometry(&*h);

// get the gem geometry if it's there
edm::ESHandle<GEMGeometry> h_gem = setup.getHandle(gemToken_);
if (h_gem.isValid()) {
streamCache(iID)->setGEMGeometry(&*h_gem);
builder_->setGEMGeometry(&*h_gem);
} else {
edm::LogInfo("CSCTriggerPrimitivesProducer|NoGEMGeometry")
<< "+++ Info: GEM geometry is unavailable. Running CSC-only trigger algorithm. +++\n";
Expand All @@ -114,7 +115,7 @@ void CSCTriggerPrimitivesProducer::produce(edm::StreamID iID, edm::Event& ev, co
<< "+++ Cannot continue emulation without these parameters +++\n";
return;
}
streamCache(iID)->setConfigParameters(conf.product());
builder_->setConfigParameters(conf.product());
}

// Get the collections of comparator & wire digis from event.
Expand Down Expand Up @@ -167,21 +168,21 @@ void CSCTriggerPrimitivesProducer::produce(edm::StreamID iID, edm::Event& ev, co
// Fill output collections if valid input collections are available.
if (wireDigis.isValid() && compDigis.isValid()) {
const CSCBadChambers* temp = checkBadChambers_ ? pBadChambers.product() : new CSCBadChambers;
streamCache(iID)->build(temp,
wireDigis.product(),
compDigis.product(),
gemPads,
gemPadClusters,
*oc_alct,
*oc_alct_all,
*oc_clct,
*oc_clct_all,
*oc_alctpretrigger,
*oc_clctpretrigger,
*oc_pretrig,
*oc_lct,
*oc_sorted_lct,
*oc_gemcopad);
builder_->build(temp,
wireDigis.product(),
compDigis.product(),
gemPads,
gemPadClusters,
*oc_alct,
*oc_alct_all,
*oc_clct,
*oc_clct_all,
*oc_alctpretrigger,
*oc_clctpretrigger,
*oc_pretrig,
*oc_lct,
*oc_sorted_lct,
*oc_gemcopad);
if (!checkBadChambers_)
delete temp;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#include "FWCore/Framework/interface/ConsumesCollector.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/global/EDProducer.h"
#include "FWCore/Framework/interface/one/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"
Expand All @@ -45,20 +45,20 @@
#include "Geometry/GEMGeometry/interface/GEMGeometry.h"
#include "CondFormats/DataRecord/interface/CSCDBL1TPParametersRcd.h"

class CSCTriggerPrimitivesProducer : public edm::global::EDProducer<edm::StreamCache<CSCTriggerPrimitivesBuilder>> {
// temporarily switch to a "one" module with a CSCTriggerPrimitivesBuilder data member
class CSCTriggerPrimitivesProducer : public edm::one::EDProducer<> {
public:
explicit CSCTriggerPrimitivesProducer(const edm::ParameterSet&);
~CSCTriggerPrimitivesProducer() override;

void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
void produce(edm::Event&, const edm::EventSetup&) override;

private:
// master configuration
edm::ParameterSet config_;

std::unique_ptr<CSCTriggerPrimitivesBuilder> beginStream(edm::StreamID) const override {
return std::unique_ptr<CSCTriggerPrimitivesBuilder>(new CSCTriggerPrimitivesBuilder(config_));
}
// temporarily switch to a "one" module with a CSCTriggerPrimitivesBuilder data member
std::unique_ptr<CSCTriggerPrimitivesBuilder> builder_;

// input tags for input collections
edm::InputTag compDigiProducer_;
Expand Down

0 comments on commit 692a8d5

Please sign in to comment.