CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
edm::GenericConsumer Class Reference
Inheritance diagram for edm::GenericConsumer:
edm::global::EDAnalyzer<> edm::global::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (StreamID, Event const &, EventSetup const &) const override
 
 GenericConsumer (ParameterSet const &)
 
 ~GenericConsumer () override=default
 
- Public Member Functions inherited from edm::global::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

std::vector< ProductBranch > eventProducts_
 
std::string label_
 
std::vector< ProductBranch > lumiProducts_
 
std::vector< ProductBranch > processProducts_
 
std::vector< ProductBranch > runProducts_
 
bool verbose_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 119 of file GenericConsumer.cc.

Constructor & Destructor Documentation

◆ GenericConsumer()

edm::GenericConsumer::GenericConsumer ( ParameterSet const &  config)
explicit

Definition at line 137 of file GenericConsumer.cc.

References MicroEventContent_cff::branch, edm::global::EDAnalyzerBase::callWhenNewProductsRegistered(), edm::EDConsumerBase::consumes(), eventProducts_, Exception, edm::InEvent, edm::InLumi, edm::InProcess, edm::InRun, label, label_, edm::errors::LogicError, lumiProducts_, or, processProducts_, edm::PRODUCT_TYPE, runProducts_, AlCaHLTBitMon_QueryRunRegistry::string, and verbose_.

138  : eventProducts_(make_patterns(config.getUntrackedParameter<std::vector<std::string>>("eventProducts"))),
139  lumiProducts_(make_patterns(config.getUntrackedParameter<std::vector<std::string>>("lumiProducts"))),
140  runProducts_(make_patterns(config.getUntrackedParameter<std::vector<std::string>>("runProducts"))),
141  processProducts_(make_patterns(config.getUntrackedParameter<std::vector<std::string>>("processProducts"))),
142  label_(config.getParameter<std::string>("@module_label")),
143  verbose_(config.getUntrackedParameter<bool>("verbose")) {
145  static const std::string kPathStatus("edm::PathStatus");
146  static const std::string kEndPathStatus("edm::EndPathStatus");
147 
148  switch (branch.branchType()) {
149  case InEvent:
150  if (branch.className() == kPathStatus or branch.className() == kEndPathStatus)
151  return;
152  for (auto const& label : eventProducts_)
153  if (label.match(branch)) {
154  this->consumes(edm::TypeToGet{branch.unwrappedTypeID(), PRODUCT_TYPE},
155  edm::InputTag{branch.moduleLabel(), branch.productInstanceName(), branch.processName()});
156  if (verbose_) {
157  edm::LogVerbatim("GenericConsumer")
158  << label_ << " consumes Event product " << branch.friendlyClassName() << '_' << branch.moduleLabel()
159  << '_' << branch.productInstanceName() << '_' << branch.processName() << '\n';
160  }
161  break;
162  }
163  break;
164 
165  case InLumi:
166  for (auto const& label : lumiProducts_)
167  if (label.match(branch)) {
168  this->consumes<edm::InLumi>(
169  edm::TypeToGet{branch.unwrappedTypeID(), PRODUCT_TYPE},
170  edm::InputTag{branch.moduleLabel(), branch.productInstanceName(), branch.processName()});
171  if (verbose_) {
172  edm::LogVerbatim("GenericConsumer")
173  << label_ << " consumes LuminosityBlock product " << branch.friendlyClassName() << '_'
174  << branch.moduleLabel() << '_' << branch.productInstanceName() << '_' << branch.processName()
175  << '\n';
176  }
177  break;
178  }
179  break;
180 
181  case InRun:
182  for (auto const& label : runProducts_)
183  if (label.match(branch)) {
184  this->consumes<edm::InRun>(
185  edm::TypeToGet{branch.unwrappedTypeID(), PRODUCT_TYPE},
186  edm::InputTag{branch.moduleLabel(), branch.productInstanceName(), branch.processName()});
187  if (verbose_) {
188  edm::LogVerbatim("GenericConsumer")
189  << label_ << " consumes Run product " << branch.friendlyClassName() << '_' << branch.moduleLabel()
190  << '_' << branch.productInstanceName() << '_' << branch.processName() << '\n';
191  }
192  break;
193  }
194  break;
195 
196  case InProcess:
197  for (auto const& label : processProducts_)
198  if (label.match(branch)) {
199  this->consumes<edm::InProcess>(
200  edm::TypeToGet{branch.unwrappedTypeID(), PRODUCT_TYPE},
201  edm::InputTag{branch.moduleLabel(), branch.productInstanceName(), branch.processName()});
202  if (verbose_) {
203  edm::LogVerbatim("GenericConsumer")
204  << label_ << " consumes Process product " << branch.friendlyClassName() << '_'
205  << branch.moduleLabel() << '_' << branch.productInstanceName() << '_' << branch.processName()
206  << '\n';
207  }
208  break;
209  }
210  break;
211 
212  default:
214  << "Unexpected branch type " << branch.branchType() << "\nPlease contact a Framework developer\n";
215  }
216  });
217  }
Log< level::Info, true > LogVerbatim
void callWhenNewProductsRegistered(std::function< void(BranchDescription const &)> const &func)
Definition: config.py:1
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
char const * label
std::vector< ProductBranch > runProducts_
std::vector< ProductBranch > eventProducts_
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
std::vector< ProductBranch > processProducts_
std::vector< ProductBranch > lumiProducts_

◆ ~GenericConsumer()

edm::GenericConsumer::~GenericConsumer ( )
overridedefault

Member Function Documentation

◆ analyze()

void edm::GenericConsumer::analyze ( StreamID  ,
Event const &  ,
EventSetup const &   
) const
inlineoverridevirtual

Implements edm::global::EDAnalyzerBase.

Definition at line 124 of file GenericConsumer.cc.

124 {}

◆ fillDescriptions()

void edm::GenericConsumer::fillDescriptions ( ConfigurationDescriptions descriptions)
static

Definition at line 219 of file GenericConsumer.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, and edm::ConfigurationDescriptions::setComment().

219  {
220  descriptions.setComment(
221  R"(This EDAnalyzer will depend on all the event, lumi, run or process products declared by its configuration, both transient and persistent.
222 
223 The dependencies can be specified either as module labels (e.g. "<module label>") or as branch names (e.g. "<product type>_<module label>_<instance name>_<process name>").
224 If a module label is used, no underscore ("_") must be present; this module will depend all the products produced by that module, including those produced by the Transformer functionality (such as the implicitly copied-to-host products in case of Alpaka-based modules).
225 If a branch name is used, all four fields must be present, separated by underscores; this module will depend only on the matching product(s).
226 
227 Glob expressions ("?" and "*") are supported in module labels and within the individual fields of branch names, similar to an OutputModule's "keep" statements.
228 Use "*" to depend on all products of a given category.
229 
230 For example, in the case of Alpaka-based modules running on a device, using
231 
232  eventProducts = cms.untracked.vstring( "module" )
233 
234 will cause "module" to run, along with automatic copy of its device products to the host.
235 To avoid the copy, the DeviceProduct branch can be specified explicitly with
236 
237  eventProducts = cms.untracked.vstring( "*DeviceProduct_module_*_*" )
238 
239 .)");
240 
242  desc.addUntracked<std::vector<std::string>>("eventProducts", {})
243  ->setComment("List of modules or branches whose event products this module will depend on.");
244  desc.addUntracked<std::vector<std::string>>("lumiProducts", {})
245  ->setComment("List of modules or branches whose lumi products this module will depend on.");
246  desc.addUntracked<std::vector<std::string>>("runProducts", {})
247  ->setComment("List of modules or branches whose run products this module will depend on.");
248  desc.addUntracked<std::vector<std::string>>("processProducts", {})
249  ->setComment("List of modules or branches whose process products this module will depend on.");
250  desc.addUntracked<bool>("verbose", false)
251  ->setComment("Print the actual branch names for which the dependency are declared.");
252  descriptions.addWithDefaultLabel(desc);
253  }

Member Data Documentation

◆ eventProducts_

std::vector<ProductBranch> edm::GenericConsumer::eventProducts_
private

Definition at line 129 of file GenericConsumer.cc.

Referenced by GenericConsumer().

◆ label_

std::string edm::GenericConsumer::label_
private

◆ lumiProducts_

std::vector<ProductBranch> edm::GenericConsumer::lumiProducts_
private

Definition at line 130 of file GenericConsumer.cc.

Referenced by GenericConsumer().

◆ processProducts_

std::vector<ProductBranch> edm::GenericConsumer::processProducts_
private

Definition at line 132 of file GenericConsumer.cc.

Referenced by GenericConsumer().

◆ runProducts_

std::vector<ProductBranch> edm::GenericConsumer::runProducts_
private

Definition at line 131 of file GenericConsumer.cc.

Referenced by GenericConsumer().

◆ verbose_

bool edm::GenericConsumer::verbose_
private

Definition at line 134 of file GenericConsumer.cc.

Referenced by GenericConsumer().