Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20358 from Dr15Jones/limitedModule
limited:: module types
- Loading branch information
Showing
41 changed files
with
5,814 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#ifndef FWCore_Framework_limited_EDAnalyzer_h | ||
#define FWCore_Framework_limited_EDAnalyzer_h | ||
// -*- C++ -*- | ||
// | ||
// Package: FWCore/Framework | ||
// Class : edm::limited::EDAnalyzer | ||
// | ||
/**\class edm::limited::EDAnalyzer EDAnalyzer.h "FWCore/Framework/interface/limited/EDAnalyzer.h" | ||
Description: [one line class summary] | ||
Usage: | ||
<usage> | ||
*/ | ||
// | ||
// Original Author: Chris Jones | ||
// Created: Thu, 18 Jul 2013 11:51:07 GMT | ||
// | ||
|
||
// system include files | ||
|
||
// user include files | ||
#include "FWCore/Framework/interface/limited/analyzerAbilityToImplementor.h" | ||
#include "FWCore/Framework/interface/moduleAbilities.h" | ||
|
||
// forward declarations | ||
|
||
namespace edm { | ||
namespace limited { | ||
template< typename... T> | ||
class EDAnalyzer : public analyzer::AbilityToImplementor<T>::Type..., | ||
public virtual EDAnalyzerBase | ||
{ | ||
|
||
public: | ||
EDAnalyzer(edm::ParameterSet const& iPSet) : EDAnalyzerBase(iPSet),analyzer::AbilityToImplementor<T>::Type(iPSet)... {} | ||
// We do this only in the case of the intel compiler as this might | ||
// end up creating a lot of code bloat due to inline symbols being generated | ||
// in each DSO which uses this header. | ||
#ifdef __INTEL_COMPILER | ||
virtual ~EDAnalyzer() {} | ||
#endif | ||
// ---------- const member functions --------------------- | ||
|
||
// ---------- static member functions -------------------- | ||
|
||
// ---------- member functions --------------------------- | ||
|
||
private: | ||
EDAnalyzer(const EDAnalyzer&) = delete; | ||
|
||
const EDAnalyzer& operator=(const EDAnalyzer&) = delete; | ||
|
||
// ---------- member data -------------------------------- | ||
|
||
}; | ||
|
||
} | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
#ifndef FWCore_Framework_limited_EDAnalyzerBase_h | ||
#define FWCore_Framework_limited_EDAnalyzerBase_h | ||
// -*- C++ -*- | ||
// | ||
// Package: FWCore/Framework | ||
// Class : EDAnalyzerBase | ||
// | ||
/**\class limited::EDAnalyzerBase EDAnalyzerBase.h "EDAnalyzerBase.h" | ||
Description: [one line class summary] | ||
Usage: | ||
<usage> | ||
*/ | ||
// | ||
// Original Author: Chris Jones | ||
// Created: Thu, 18 Jul 2013 11:51:14 GMT | ||
// | ||
|
||
// system include files | ||
|
||
// user include files | ||
#include "FWCore/Framework/interface/EDConsumerBase.h" | ||
#include "FWCore/Framework/interface/Frameworkfwd.h" | ||
#include "DataFormats/Provenance/interface/ModuleDescription.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSetfwd.h" | ||
#include "FWCore/Concurrency/interface/LimitedTaskQueue.h" | ||
|
||
// forward declarations | ||
|
||
namespace edm { | ||
class ModuleCallingContext; | ||
class PreallocationConfiguration; | ||
class StreamID; | ||
class ActivityRegistry; | ||
class ProductRegistry; | ||
class ThinnedAssociationsHelper; | ||
class WaitingTask; | ||
|
||
namespace maker { | ||
template<typename T> class ModuleHolderT; | ||
} | ||
|
||
namespace limited { | ||
|
||
class EDAnalyzerBase : public EDConsumerBase | ||
{ | ||
|
||
public: | ||
template <typename T> friend class edm::WorkerT; | ||
template <typename T> friend class edm::maker::ModuleHolderT; | ||
typedef EDAnalyzerBase ModuleType; | ||
|
||
EDAnalyzerBase(ParameterSet const& pset); | ||
~EDAnalyzerBase() override; | ||
|
||
static void fillDescriptions(ConfigurationDescriptions& descriptions); | ||
static void prevalidate(ConfigurationDescriptions& descriptions); | ||
static const std::string& baseType(); | ||
|
||
// Warning: the returned moduleDescription will be invalid during construction | ||
ModuleDescription const& moduleDescription() const { return moduleDescription_; } | ||
|
||
unsigned int concurrencyLimit() const { return queue_.concurrencyLimit(); } | ||
|
||
LimitedTaskQueue& queue() { | ||
return queue_; | ||
} | ||
private: | ||
bool doEvent(EventPrincipal const& ep, EventSetup const& c, | ||
ActivityRegistry*, | ||
ModuleCallingContext const*); | ||
//For now this is a placeholder | ||
/*virtual*/ void preActionBeforeRunEventAsync(WaitingTask* iTask, ModuleCallingContext const& iModuleCallingContext, Principal const& iPrincipal) const {} | ||
|
||
void doPreallocate(PreallocationConfiguration const&); | ||
void doBeginJob(); | ||
void doEndJob(); | ||
|
||
void doBeginStream(StreamID id); | ||
void doEndStream(StreamID id); | ||
void doStreamBeginRun(StreamID id, | ||
RunPrincipal const& ep, | ||
EventSetup const& c, | ||
ModuleCallingContext const*); | ||
void doStreamEndRun(StreamID id, | ||
RunPrincipal const& ep, | ||
EventSetup const& c, | ||
ModuleCallingContext const*); | ||
void doStreamBeginLuminosityBlock(StreamID id, | ||
LuminosityBlockPrincipal const& ep, | ||
EventSetup const& c, | ||
ModuleCallingContext const*); | ||
void doStreamEndLuminosityBlock(StreamID id, | ||
LuminosityBlockPrincipal const& ep, | ||
EventSetup const& c, | ||
ModuleCallingContext const*); | ||
|
||
|
||
void doBeginRun(RunPrincipal const& rp, EventSetup const& c, | ||
ModuleCallingContext const*); | ||
void doEndRun(RunPrincipal const& rp, EventSetup const& c, | ||
ModuleCallingContext const*); | ||
void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c, | ||
ModuleCallingContext const*); | ||
void doEndLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c, | ||
ModuleCallingContext const*); | ||
|
||
//For now, the following are just dummy implemenations with no ability for users to override | ||
void doRespondToOpenInputFile(FileBlock const& fb); | ||
void doRespondToCloseInputFile(FileBlock const& fb); | ||
void doRegisterThinnedAssociations(ProductRegistry const&, | ||
ThinnedAssociationsHelper&) { } | ||
|
||
void registerProductsAndCallbacks(EDAnalyzerBase* module, ProductRegistry* reg); | ||
std::string workerType() const {return "WorkerT<EDAnalyzer>";} | ||
|
||
virtual void analyze(StreamID, Event const& , EventSetup const&) const= 0; | ||
virtual void beginJob() {} | ||
virtual void endJob(){} | ||
|
||
|
||
virtual void preallocStreams(unsigned int); | ||
virtual void doBeginStream_(StreamID id); | ||
virtual void doEndStream_(StreamID id); | ||
virtual void doStreamBeginRun_(StreamID id, Run const& rp, EventSetup const& c); | ||
virtual void doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c); | ||
virtual void doStreamEndRunSummary_(StreamID id, Run const& rp, EventSetup const& c); | ||
virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c); | ||
virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c); | ||
virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c); | ||
|
||
virtual void doBeginRun_(Run const& rp, EventSetup const& c); | ||
virtual void doBeginRunSummary_(Run const& rp, EventSetup const& c); | ||
virtual void doEndRunSummary_(Run const& rp, EventSetup const& c); | ||
virtual void doEndRun_(Run const& rp, EventSetup const& c); | ||
virtual void doBeginLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c); | ||
virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const& rp, EventSetup const& c); | ||
virtual void doEndLuminosityBlockSummary_(LuminosityBlock const& lb, EventSetup const& c); | ||
virtual void doEndLuminosityBlock_(LuminosityBlock const& lb, EventSetup const& c); | ||
|
||
void setModuleDescription(ModuleDescription const& md) { | ||
moduleDescription_ = md; | ||
} | ||
ModuleDescription moduleDescription_; | ||
|
||
std::function<void(BranchDescription const&)> callWhenNewProductsRegistered_; | ||
|
||
LimitedTaskQueue queue_; | ||
}; | ||
|
||
} | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#ifndef FWCore_Framework_limited_EDFilter_h | ||
#define FWCore_Framework_limited_EDFilter_h | ||
// -*- C++ -*- | ||
// | ||
// Package: FWCore/Framework | ||
// Class : edm::limited::EDFilter | ||
// | ||
/**\class edm::limited::EDFilter EDFilter.h "FWCore/Framework/interface/limited/EDFilter.h" | ||
Description: [one line class summary] | ||
Usage: | ||
<usage> | ||
*/ | ||
// | ||
// Original Author: Chris Jones | ||
// Created: Tue, 23 Jul 2013 11:51:07 GMT | ||
// | ||
|
||
// system include files | ||
|
||
// user include files | ||
#include "FWCore/Framework/interface/limited/filterAbilityToImplementor.h" | ||
#include "FWCore/Framework/interface/moduleAbilities.h" | ||
|
||
// forward declarations | ||
|
||
namespace edm { | ||
namespace limited { | ||
template< typename... T> | ||
class EDFilter : | ||
public virtual EDFilterBase, | ||
public filter::SpecializeAbilityToImplementor< | ||
CheckAbility<edm::module::Abilities::kRunSummaryCache,T...>::kHasIt & CheckAbility<edm::module::Abilities::kEndRunProducer,T...>::kHasIt, | ||
CheckAbility<edm::module::Abilities::kLuminosityBlockSummaryCache,T...>::kHasIt & CheckAbility<edm::module::Abilities::kEndLuminosityBlockProducer,T...>::kHasIt, | ||
T>::Type... | ||
{ | ||
|
||
public: | ||
EDFilter(edm::ParameterSet const& iPSet) : EDFilterBase(iPSet), | ||
filter::SpecializeAbilityToImplementor< | ||
CheckAbility<edm::module::Abilities::kRunSummaryCache,T...>::kHasIt & CheckAbility<edm::module::Abilities::kEndRunProducer,T...>::kHasIt, | ||
CheckAbility<edm::module::Abilities::kLuminosityBlockSummaryCache,T...>::kHasIt & CheckAbility<edm::module::Abilities::kEndLuminosityBlockProducer,T...>::kHasIt, | ||
T>::Type(iPSet)... | ||
{} | ||
// We do this only in the case of the intel compiler as this might | ||
// end up creating a lot of code bloat due to inline symbols being generated | ||
// in each DSO which uses this header. | ||
#ifdef __INTEL_COMPILER | ||
virtual ~EDFilter() = default; | ||
#endif | ||
// ---------- const member functions --------------------- | ||
|
||
// ---------- static member functions -------------------- | ||
|
||
// ---------- member functions --------------------------- | ||
|
||
private: | ||
EDFilter(const EDFilter&) = delete; | ||
|
||
const EDFilter& operator=(const EDFilter&) = delete; | ||
|
||
// ---------- member data -------------------------------- | ||
|
||
}; | ||
|
||
} | ||
} | ||
|
||
#endif |
Oops, something went wrong.