Skip to content

Commit

Permalink
Merge pull request #28154 from wddgit/producesCollector2
Browse files Browse the repository at this point in the history
Initial Implementation of ProducesCollector
  • Loading branch information
cmsbuild authored Oct 30, 2019
2 parents 88f1911 + ef9f5cd commit f42c909
Show file tree
Hide file tree
Showing 109 changed files with 738 additions and 352 deletions.
6 changes: 2 additions & 4 deletions EventFilter/L1TRawToDigi/interface/PackingSetup.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <map>

#include "FWCore/Framework/interface/ProducesCollector.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"

#include "EventFilter/L1TRawToDigi/interface/Packer.h"
Expand All @@ -15,9 +16,6 @@ namespace edm {
class ConsumesCollector;
class Event;
class ParameterSet;
namespace stream {
class EDProducerBase;
}
} // namespace edm

namespace l1t {
Expand All @@ -31,7 +29,7 @@ namespace l1t {
PackingSetup(){};
virtual ~PackingSetup(){};
virtual std::unique_ptr<PackerTokens> registerConsumes(const edm::ParameterSet&, edm::ConsumesCollector&) = 0;
virtual void registerProducts(edm::stream::EDProducerBase&) = 0;
virtual void registerProducts(edm::ProducesCollector) = 0;

// Get a map of (amc #, board id) ↔ list of packing functions for a specific FED, FW combination
virtual PackerMap getPackers(int fed, unsigned int fw) = 0;
Expand Down
2 changes: 1 addition & 1 deletion EventFilter/L1TRawToDigi/plugins/L1TRawToDigi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ namespace l1t {
}

prov_ = PackingSetupFactory::get()->make(config.getParameter<std::string>("Setup"));
prov_->registerProducts(*this);
prov_->registerProducts(producesCollector());

slinkHeaderSize_ = config.getUntrackedParameter<int>("lenSlinkHeader");
slinkTrailerSize_ = config.getUntrackedParameter<int>("lenSlinkTrailer");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "FWCore/Framework/interface/stream/EDProducerBase.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include "EventFilter/L1TRawToDigi/plugins/PackerFactory.h"
Expand Down Expand Up @@ -43,7 +42,7 @@ PackerMap CaloSetup::getPackers(int fed, unsigned int fw) {
return res;
}

void CaloSetup::registerProducts(edm::stream::EDProducerBase& prod) {
void CaloSetup::registerProducts(edm::ProducesCollector prod) {
prod.produces<L1CaloEmCollection>();
prod.produces<CaloSpareBxCollection>("HFBitCounts");
prod.produces<CaloSpareBxCollection>("HFRingSums");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "EventFilter/L1TRawToDigi/interface/Unpacker.h"

#include "EventFilter/L1TRawToDigi/interface/PackingSetup.h"
#include "FWCore/Framework/interface/ProducesCollector.h"

#include "CaloCollections.h"
#include "CaloTokens.h"
Expand All @@ -17,7 +18,7 @@ namespace l1t {
std::unique_ptr<PackerTokens> registerConsumes(const edm::ParameterSet& cfg, edm::ConsumesCollector& cc) override;
void fillDescription(edm::ParameterSetDescription& desc) override;
PackerMap getPackers(int fed, unsigned int fw) override;
void registerProducts(edm::stream::EDProducerBase& prod) override;
void registerProducts(edm::ProducesCollector) override;
std::unique_ptr<UnpackerCollections> getCollections(edm::Event& e) override;
UnpackerMap getUnpackers(int fed, int board, int amc, unsigned int fw) override;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include "FWCore/Framework/interface/stream/EDProducerBase.h"

#include "EventFilter/L1TRawToDigi/plugins/PackerFactory.h"
#include "EventFilter/L1TRawToDigi/plugins/PackingSetupFactory.h"
#include "EventFilter/L1TRawToDigi/plugins/UnpackerFactory.h"
Expand Down Expand Up @@ -61,7 +59,7 @@ namespace l1t {
return res;
} //getPackers

void BMTFSetup::registerProducts(edm::stream::EDProducerBase& prod) {
void BMTFSetup::registerProducts(edm::ProducesCollector prod) {
prod.produces<RegionalMuonCandBxCollection>("BMTF");
prod.produces<RegionalMuonCandBxCollection>("BMTF2");
prod.produces<L1MuDTChambPhContainer>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "EventFilter/L1TRawToDigi/interface/Packer.h"
#include "EventFilter/L1TRawToDigi/interface/PackingSetup.h"
#include "EventFilter/L1TRawToDigi/interface/Unpacker.h"
#include "FWCore/Framework/interface/ProducesCollector.h"

#include "BMTFCollections.h"
#include "BMTFTokens.h"
Expand All @@ -16,7 +17,7 @@ namespace l1t {
std::unique_ptr<PackerTokens> registerConsumes(const edm::ParameterSet& cfg, edm::ConsumesCollector& cc) override;
void fillDescription(edm::ParameterSetDescription& desc) override;
PackerMap getPackers(int fed, unsigned int fw) override;
void registerProducts(edm::stream::EDProducerBase& prod) override;
void registerProducts(edm::ProducesCollector) override;
std::unique_ptr<UnpackerCollections> getCollections(edm::Event& e) override;
UnpackerMap getUnpackers(int fed, int board, int amc, unsigned int fw) override;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "FWCore/Framework/interface/stream/EDProducerBase.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include "EventFilter/L1TRawToDigi/plugins/PackerFactory.h"
Expand Down Expand Up @@ -52,7 +51,7 @@ namespace l1t {
return res;
}

void CaloLayer1Setup::registerProducts(edm::stream::EDProducerBase& prod) {
void CaloLayer1Setup::registerProducts(edm::ProducesCollector prod) {
prod.produces<EcalTrigPrimDigiCollection>();
prod.produces<HcalTrigPrimDigiCollection>();
prod.produces<L1CaloRegionCollection>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "EventFilter/L1TRawToDigi/interface/Unpacker.h"

#include "EventFilter/L1TRawToDigi/interface/PackingSetup.h"
#include "FWCore/Framework/interface/ProducesCollector.h"

#include "CaloLayer1Collections.h"
#include "CaloLayer1Tokens.h"
Expand All @@ -16,7 +17,7 @@ namespace l1t {
std::unique_ptr<PackerTokens> registerConsumes(const edm::ParameterSet& cfg, edm::ConsumesCollector& cc) override;
void fillDescription(edm::ParameterSetDescription& desc) override;
PackerMap getPackers(int fed, unsigned int fw) override;
void registerProducts(edm::stream::EDProducerBase& prod) override;
void registerProducts(edm::ProducesCollector) override;
std::unique_ptr<UnpackerCollections> getCollections(edm::Event& e) override;
UnpackerMap getUnpackers(int fed, int board, int amc, unsigned int fw) override;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include "FWCore/Framework/interface/stream/EDProducerBase.h"

#include "EventFilter/L1TRawToDigi/plugins/PackerFactory.h"
#include "EventFilter/L1TRawToDigi/plugins/PackingSetupFactory.h"
#include "EventFilter/L1TRawToDigi/plugins/UnpackerFactory.h"
Expand Down Expand Up @@ -32,7 +30,7 @@ namespace l1t {
return res;
}

void CaloSetup::registerProducts(edm::stream::EDProducerBase& prod) {
void CaloSetup::registerProducts(edm::ProducesCollector prod) {
prod.produces<CaloTowerBxCollection>("CaloTower");
prod.produces<EGammaBxCollection>("EGamma");
prod.produces<EtSumBxCollection>("EtSum");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "EventFilter/L1TRawToDigi/interface/Unpacker.h"

#include "EventFilter/L1TRawToDigi/interface/PackingSetup.h"
#include "FWCore/Framework/interface/ProducesCollector.h"

#include "CaloCollections.h"
#include "CaloTokens.h"
Expand All @@ -16,7 +17,7 @@ namespace l1t {
std::unique_ptr<PackerTokens> registerConsumes(const edm::ParameterSet& cfg, edm::ConsumesCollector& cc) override;
void fillDescription(edm::ParameterSetDescription& desc) override;
PackerMap getPackers(int fed, unsigned int fw) override;
void registerProducts(edm::stream::EDProducerBase& prod) override;
void registerProducts(edm::ProducesCollector) override;
std::unique_ptr<UnpackerCollections> getCollections(edm::Event& e) override;
UnpackerMap getUnpackers(int fed, int board, int amc, unsigned int fw) override;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "FWCore/Framework/interface/stream/EDProducerBase.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include "EventFilter/L1TRawToDigi/plugins/PackerFactory.h"
Expand Down Expand Up @@ -35,7 +34,7 @@ namespace l1t {
return res;
}

void EMTFSetup::registerProducts(edm::stream::EDProducerBase& prod) {
void EMTFSetup::registerProducts(edm::ProducesCollector prod) {
prod.produces<RegionalMuonCandBxCollection>();
prod.produces<EMTFDaqOutCollection>();
prod.produces<EMTFHitCollection>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "EventFilter/L1TRawToDigi/interface/Unpacker.h"

#include "EventFilter/L1TRawToDigi/interface/PackingSetup.h"
#include "FWCore/Framework/interface/ProducesCollector.h"

#include "EMTFCollections.h"
#include "EMTFTokens.h"
Expand All @@ -16,7 +17,7 @@ namespace l1t {
std::unique_ptr<PackerTokens> registerConsumes(const edm::ParameterSet& cfg, edm::ConsumesCollector& cc) override;
void fillDescription(edm::ParameterSetDescription& desc) override;
PackerMap getPackers(int fed, unsigned int fw) override;
void registerProducts(edm::stream::EDProducerBase& prod) override;
void registerProducts(edm::ProducesCollector) override;
std::unique_ptr<UnpackerCollections> getCollections(edm::Event& e) override;
UnpackerMap getUnpackers(int fed, int board, int amc, unsigned int fw) override;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "FWCore/Framework/interface/stream/EDProducerBase.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include "EventFilter/L1TRawToDigi/plugins/PackerFactory.h"
Expand Down Expand Up @@ -48,7 +47,7 @@ namespace l1t {
return res;
}

void GMTSetup::registerProducts(edm::stream::EDProducerBase& prod) {
void GMTSetup::registerProducts(edm::ProducesCollector prod) {
prod.produces<RegionalMuonCandBxCollection>("BMTF");
prod.produces<RegionalMuonCandBxCollection>("OMTF");
prod.produces<RegionalMuonCandBxCollection>("EMTF");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "EventFilter/L1TRawToDigi/interface/Unpacker.h"

#include "EventFilter/L1TRawToDigi/interface/PackingSetup.h"
#include "FWCore/Framework/interface/ProducesCollector.h"

#include "GMTCollections.h"
#include "GMTTokens.h"
Expand All @@ -16,7 +17,7 @@ namespace l1t {
std::unique_ptr<PackerTokens> registerConsumes(const edm::ParameterSet& cfg, edm::ConsumesCollector& cc) override;
void fillDescription(edm::ParameterSetDescription& desc) override;
PackerMap getPackers(int fed, unsigned int fw) override;
void registerProducts(edm::stream::EDProducerBase& prod) override;
void registerProducts(edm::ProducesCollector) override;
std::unique_ptr<UnpackerCollections> getCollections(edm::Event& e) override;
UnpackerMap getUnpackers(int fed, int board, int amc, unsigned int fw) override;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include "FWCore/Framework/interface/stream/EDProducerBase.h"

#include "EventFilter/L1TRawToDigi/plugins/PackerFactory.h"
#include "EventFilter/L1TRawToDigi/plugins/PackingSetupFactory.h"
#include "EventFilter/L1TRawToDigi/plugins/UnpackerFactory.h"
Expand Down Expand Up @@ -47,7 +45,7 @@ namespace l1t {
return res;
}

void GTSetup::registerProducts(edm::stream::EDProducerBase& prod) {
void GTSetup::registerProducts(edm::ProducesCollector prod) {
prod.produces<MuonBxCollection>("Muon");
prod.produces<EGammaBxCollection>("EGamma");
prod.produces<EtSumBxCollection>("EtSum");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "EventFilter/L1TRawToDigi/interface/Unpacker.h"

#include "EventFilter/L1TRawToDigi/interface/PackingSetup.h"
#include "FWCore/Framework/interface/ProducesCollector.h"

#include "GTCollections.h"
#include "GTTokens.h"
Expand All @@ -17,7 +18,7 @@ namespace l1t {
std::unique_ptr<PackerTokens> registerConsumes(const edm::ParameterSet& cfg, edm::ConsumesCollector& cc) override;
void fillDescription(edm::ParameterSetDescription& desc) override;
PackerMap getPackers(int fed, unsigned int fw) override;
void registerProducts(edm::stream::EDProducerBase& prod) override;
void registerProducts(edm::ProducesCollector) override;
std::unique_ptr<UnpackerCollections> getCollections(edm::Event& e) override;
UnpackerMap getUnpackers(int fed, int board, int amc, unsigned int fw) override;
};
Expand Down
4 changes: 2 additions & 2 deletions EventFilter/RPCRawToDigi/plugins/RPCAMCRawToDigi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ RPCAMCRawToDigi::RPCAMCRawToDigi(edm::ParameterSet const &config)
fill_counters_(config.getParameter<bool>("fillCounters")),
rpc_unpacker_(
RPCAMCUnpackerFactory::get()->create(config.getParameter<std::string>("RPCAMCUnpacker"),
*this,
config.getParameter<edm::ParameterSet>("RPCAMCUnpackerSettings"))) {
config.getParameter<edm::ParameterSet>("RPCAMCUnpackerSettings"),
producesCollector())) {
if (fill_counters_) {
produces<RPCAMCLinkCounters>();
}
Expand Down
3 changes: 1 addition & 2 deletions EventFilter/RPCRawToDigi/plugins/RPCAMCUnpacker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"

RPCAMCUnpacker::RPCAMCUnpacker(edm::stream::EDProducerBase& producer, edm::ParameterSet const& config) {}

RPCAMCUnpacker::RPCAMCUnpacker(edm::ParameterSet const&, edm::ProducesCollector) {}
RPCAMCUnpacker::~RPCAMCUnpacker() {}

void RPCAMCUnpacker::fillDescription(edm::ParameterSetDescription& desc) {
Expand Down
6 changes: 2 additions & 4 deletions EventFilter/RPCRawToDigi/plugins/RPCAMCUnpacker.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,19 @@

#include "CondFormats/RPCObjects/interface/RPCAMCLink.h"
#include "EventFilter/RPCRawToDigi/interface/RPCAMC13Record.h"
#include "FWCore/Framework/interface/ProducesCollector.h"

namespace edm {
class Event;
class EventSetup;
class ParameterSet;
class ParameterSetDescription;
class Run;
namespace stream {
class EDProducerBase;
} // namespace stream
} // namespace edm

class RPCAMCUnpacker {
public:
RPCAMCUnpacker(edm::stream::EDProducerBase& producer, edm::ParameterSet const& config);
RPCAMCUnpacker(edm::ParameterSet const&, edm::ProducesCollector);
virtual ~RPCAMCUnpacker();

static void fillDescription(edm::ParameterSetDescription& desc);
Expand Down
6 changes: 2 additions & 4 deletions EventFilter/RPCRawToDigi/plugins/RPCAMCUnpackerFactory.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
#ifndef EventFilter_RPCRawToDigi_RPCAMCUnpackerFactory_h
#define EventFilter_RPCRawToDigi_RPCAMCUnpackerFactory_h

#include "FWCore/Framework/interface/ProducesCollector.h"
#include "FWCore/PluginManager/interface/PluginFactory.h"

namespace edm {
class ParameterSet;
namespace stream {
class EDProducerBase;
} // namespace stream
} // namespace edm

class RPCAMCUnpacker;

typedef edmplugin::PluginFactory<RPCAMCUnpacker *(edm::stream::EDProducerBase &producer, edm::ParameterSet const &)>
typedef edmplugin::PluginFactory<RPCAMCUnpacker *(edm::ParameterSet const &, edm::ProducesCollector)>
RPCAMCUnpackerFactory;

#endif // EventFilter_RPCRawToDigi_RPCAMCUnpackerFactory_h
11 changes: 5 additions & 6 deletions EventFilter/RPCRawToDigi/plugins/RPCCPPFUnpacker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "DataFormats/Common/interface/Handle.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/stream/EDProducerBase.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
Expand All @@ -16,15 +15,15 @@
#include "EventFilter/RPCRawToDigi/interface/RPCAMCLinkEvents.h"
#include "EventFilter/RPCRawToDigi/interface/RPCMP7Record.h"

RPCCPPFUnpacker::RPCCPPFUnpacker(edm::stream::EDProducerBase& producer, edm::ParameterSet const& config)
: RPCAMCUnpacker(producer, config),
RPCCPPFUnpacker::RPCCPPFUnpacker(edm::ParameterSet const& config, edm::ProducesCollector producesCollector)
: RPCAMCUnpacker(config, producesCollector),
fill_counters_(config.getParameter<bool>("fillAMCCounters")),
bx_min_(config.getParameter<int>("bxMin")),
bx_max_(config.getParameter<int>("bxMax")) {
producer.produces<RPCDigiCollection>();
producer.produces<l1t::CPPFDigiCollection>();
producesCollector.produces<RPCDigiCollection>();
producesCollector.produces<l1t::CPPFDigiCollection>();
if (fill_counters_) {
producer.produces<RPCAMCLinkCounters>("RPCAMCUnpacker");
producesCollector.produces<RPCAMCLinkCounters>("RPCAMCUnpacker");
}
}

Expand Down
3 changes: 2 additions & 1 deletion EventFilter/RPCRawToDigi/plugins/RPCCPPFUnpacker.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/ESWatcher.h"
#include "FWCore/Framework/interface/ProducesCollector.h"

#include "CondFormats/DataRecord/interface/RPCCPPFLinkMapRcd.h"
#include "CondFormats/RPCObjects/interface/RPCAMCLinkMap.h"
Expand All @@ -21,7 +22,7 @@ class RPCAMCLinkCounters;

class RPCCPPFUnpacker : public RPCAMCUnpacker {
public:
RPCCPPFUnpacker(edm::stream::EDProducerBase& producer, edm::ParameterSet const& config);
RPCCPPFUnpacker(edm::ParameterSet const&, edm::ProducesCollector);

void beginRun(edm::Run const& run, edm::EventSetup const& setup) override;
void produce(edm::Event& event,
Expand Down
6 changes: 5 additions & 1 deletion FWCore/Framework/interface/ProducerBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ EDProducts into an Event.
namespace edm {
class BranchDescription;
class ModuleDescription;
class ProducesCollector;
class ProductRegistry;
class Event;
class LuminosityBlock;
Expand Down Expand Up @@ -72,7 +73,6 @@ namespace edm {

void registerProducts(ProducerBase*, ProductRegistry*, ModuleDescription const&);

using ProductRegistryHelper::produces;
using ProductRegistryHelper::recordProvenanceList;
using ProductRegistryHelper::typeLabelList;

Expand All @@ -94,6 +94,10 @@ namespace edm {
return putTokenToResolverIndex_;
}

protected:
ProducesCollector producesCollector();
using ProductRegistryHelper::produces;

private:
friend class EDProducer;
friend class EDFilter;
Expand Down
Loading

0 comments on commit f42c909

Please sign in to comment.