LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
art::OutputModule Class Referenceabstract

#include "OutputModule.h"

Inheritance diagram for art::OutputModule:
art::Observer art::detail::SharedModule art::ModuleBase art::FileDumperOutput art::ProvenanceCheckerOutput art::ProvenanceDumper< DETAIL, Enable > art::ProvenanceDumper< DETAIL, std::void_t< typename DETAIL::Config > >

Classes

struct  Config
 

Public Types

using ModuleType = OutputModule
 
using WorkerType = OutputWorker
 
using PluginCollection_t = std::vector< std::unique_ptr< FileCatalogMetadataPlugin >>
 

Public Member Functions

virtual ~OutputModule ()
 
 OutputModule (fhicl::ParameterSet const &pset)
 
 OutputModule (fhicl::TableFragment< Config > const &pset)
 
 OutputModule (OutputModule const &)=delete
 
 OutputModule (OutputModule &&)=delete
 
OutputModuleoperator= (OutputModule const &)=delete
 
OutputModuleoperator= (OutputModule &&)=delete
 
bool fileIsOpen () const
 
OutputFileStatus fileStatus () const
 
virtual std::string const & lastClosedFileName () const
 
SelectionsArray const & keptProducts () const
 
bool selected (BranchDescription const &) const
 
std::array< bool, NumBranchTypes > const & hasNewlyDroppedBranch () const
 
void selectProducts (ProductTables const &)
 
void doSelectProducts (ProductTables const &)
 
void registerProducts (ProductDescriptions &)
 
BranchChildren const & branchChildren () const
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
std::unique_ptr< WorkermakeWorker (WorkerParams const &wp)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 
hep::concurrency::SerialTaskQueueChain * serialTaskQueueChain () const
 
std::set< std::string > const & sharedResources () const
 
void createQueues (SharedResources const &resources)
 
template<BranchType , typename... T>
void serialize (T const &...resources)
 
template<BranchType , typename... T>
void serializeExternal (T const &...resources)
 

Protected Member Functions

virtual void doRegisterProducts (ProductDescriptions &, ModuleDescription const &)
 
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<BranchType BT = InEvent, typename... T>
void serialize (T const &...)
 
template<BranchType BT = InEvent, typename... T>
void serializeExternal (T const &...)
 
template<BranchType BT = InEvent>
void async ()
 

Private Types

using BranchParents = std::map< ProductID, std::set< ParentageID >>
 

Private Member Functions

std::unique_ptr< WorkerdoMakeWorker (WorkerParams const &wp) final
 
void configure (OutputModuleDescription const &desc)
 
virtual void doBeginJob (detail::SharedResources const &resources)
 
virtual void postSelectProducts ()
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal const &rp, ModuleContext const &)
 
bool doEndRun (RunPrincipal const &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal const &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal const &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal const &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
void doWriteRun (RunPrincipal &rp)
 
void doWriteSubRun (SubRunPrincipal &srp)
 
void doWriteEvent (EventPrincipal &ep, ModuleContext const &mc)
 
void doSetRunAuxiliaryRangeSetID (RangeSet const &)
 
void doSetSubRunAuxiliaryRangeSetID (RangeSet const &)
 
bool doCloseFile ()
 
bool doOpenFile (FileBlock const &fb)
 
void reallyCloseFile ()
 
virtual void incrementInputFileNumber ()
 
virtual bool requestsToCloseFile () const
 
virtual Granularity fileGranularity () const
 
virtual void setFileStatus (OutputFileStatus)
 
virtual void beginJob ()
 
virtual void endJob ()
 
virtual void beginRun (RunPrincipal const &)
 
virtual void endRun (RunPrincipal const &)
 
virtual void writeRun (RunPrincipal &r)=0
 
virtual void setRunAuxiliaryRangeSetID (RangeSet const &)
 
virtual void beginSubRun (SubRunPrincipal const &)
 
virtual void endSubRun (SubRunPrincipal const &)
 
virtual void writeSubRun (SubRunPrincipal &sr)=0
 
virtual void setSubRunAuxiliaryRangeSetID (RangeSet const &)
 
virtual void event (EventPrincipal const &)
 
virtual void write (EventPrincipal &e)=0
 
virtual void openFile (FileBlock const &)
 
virtual void respondToOpenInputFile (FileBlock const &)
 
virtual void readResults (ResultsPrincipal const &resp)
 
virtual void respondToCloseInputFile (FileBlock const &)
 
virtual void respondToOpenOutputFiles (FileBlock const &)
 
virtual void respondToCloseOutputFiles (FileBlock const &)
 
virtual bool isFileOpen () const
 
void updateBranchParents (EventPrincipal &ep)
 
void fillDependencyGraph ()
 
virtual void startEndFile ()
 
virtual void writeFileFormatVersion ()
 
virtual void writeFileIdentifier ()
 
virtual void writeFileIndex ()
 
virtual void writeProcessConfigurationRegistry ()
 
virtual void writeProcessHistoryRegistry ()
 
virtual void writeParameterSetRegistry ()
 
virtual void writeParentageRegistry ()
 
virtual void writeProductDescriptionRegistry ()
 
void writeFileCatalogMetadata ()
 
virtual void doWriteFileCatalogMetadata (FileCatalogMetadata::collection_type const &md, FileCatalogMetadata::collection_type const &ssmd)
 
virtual void writeProductDependencies ()
 
virtual void finishEndFile ()
 
PluginCollection_t makePlugins_ (std::vector< fhicl::ParameterSet > const &psets)
 

Private Attributes

SelectionsArray keptProducts_ {{}}
 
std::array< std::unique_ptr< GroupSelector const >, NumBranchTypesgroupSelector_ {{nullptr}}
 
std::array< bool, NumBranchTypeshasNewlyDroppedBranch_ {{false}}
 
GroupSelectorRules groupSelectorRules_
 
std::map< ProductID, std::set< ParentageID > > branchParents_ {}
 
BranchChildren branchChildren_ {}
 
std::string configuredFileName_
 
std::string dataTier_
 
std::string streamName_
 
ServiceHandle< CatalogInterfaceci_ {}
 
cet::BasicPluginFactory pluginFactory_ {}
 
std::vector< std::string > pluginNames_ {}
 
PluginCollection_t plugins_
 

Friends

class OutputWorker
 

Detailed Description

Definition at line 49 of file OutputModule.h.

Member Typedef Documentation

using art::OutputModule::BranchParents = std::map<ProductID, std::set<ParentageID>>
private

Definition at line 231 of file OutputModule.h.

Definition at line 53 of file OutputModule.h.

Definition at line 57 of file OutputModule.h.

Definition at line 54 of file OutputModule.h.

Constructor & Destructor Documentation

art::OutputModule::~OutputModule ( )
virtualdefault
art::OutputModule::OutputModule ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 74 of file OutputModule.cc.

References configuredFileName_, dataTier_, groupSelectorRules_, art::detail::LegacyResource, makePlugins_(), plugins_, art::detail::SharedModule::serialize(), and streamName_.

75  : Observer{pset}
76  , groupSelectorRules_{pset.get<vector<string>>("outputCommands",
77  {"keep *"}),
78  "outputCommands",
79  "OutputModule"}
80  , configuredFileName_{pset.get<string>("fileName", "")}
81  , dataTier_{pset.get<string>("dataTier", "")}
82  , streamName_{pset.get<string>("streamName", "")}
83  , plugins_{makePlugins_(pset.get<vector<ParameterSet>>("FCMDPlugins", {}))}
84  {
86  }
std::string streamName_
Definition: OutputModule.h:236
SharedResource_t const LegacyResource
GroupSelectorRules groupSelectorRules_
Definition: OutputModule.h:230
PluginCollection_t plugins_
Definition: OutputModule.h:242
std::string configuredFileName_
Definition: OutputModule.h:234
std::string dataTier_
Definition: OutputModule.h:235
PluginCollection_t makePlugins_(std::vector< fhicl::ParameterSet > const &psets)
Observer(Observer const &)=delete
void serialize(T const &...)
art::OutputModule::OutputModule ( fhicl::TableFragment< Config > const &  pset)
explicit

Definition at line 57 of file OutputModule.cc.

References configuredFileName_, dataTier_, groupSelectorRules_, art::detail::LegacyResource, makePlugins_(), plugins_, art::detail::SharedModule::serialize(), and streamName_.

58  : Observer{config().eoFragment().selectEvents(),
59  config().eoFragment().rejectEvents()}
60  , groupSelectorRules_{config().outputCommands(),
61  "outputCommands",
62  "OutputModule"}
63  , configuredFileName_{config().fileName()}
64  , dataTier_{config().dataTier()}
65  , streamName_{config().streamName()}
66  {
67  std::vector<ParameterSet> fcmdPluginPSets;
68  if (config().fcmdPlugins.get_if_present(fcmdPluginPSets)) {
69  plugins_ = makePlugins_(fcmdPluginPSets);
70  }
72  }
std::string streamName_
Definition: OutputModule.h:236
SharedResource_t const LegacyResource
GroupSelectorRules groupSelectorRules_
Definition: OutputModule.h:230
PluginCollection_t plugins_
Definition: OutputModule.h:242
std::string configuredFileName_
Definition: OutputModule.h:234
std::string dataTier_
Definition: OutputModule.h:235
PluginCollection_t makePlugins_(std::vector< fhicl::ParameterSet > const &psets)
Observer(Observer const &)=delete
void serialize(T const &...)
art::OutputModule::OutputModule ( OutputModule const &  )
delete
art::OutputModule::OutputModule ( OutputModule &&  )
delete

Member Function Documentation

template<BranchType BT = InEvent>
void art::detail::SharedModule::async ( )
inlineprotectedinherited

Definition at line 38 of file SharedModule.h.

References art::detail::SharedModule::asyncDeclared_, art::detail::SharedModule::implicit_serialize(), art::InEvent, and art::detail::SharedModule::serialize_for().

39  {
40  static_assert(
41  BT == InEvent,
42  "async is currently supported only for the 'InEvent' level.");
43  asyncDeclared_ = true;
44  }
void art::OutputModule::beginJob ( )
privatevirtual
void art::OutputModule::beginRun ( RunPrincipal const &  )
privatevirtual

Definition at line 437 of file OutputModule.cc.

Referenced by doBeginRun().

438  {}
void art::OutputModule::beginSubRun ( SubRunPrincipal const &  )
privatevirtual

Definition at line 445 of file OutputModule.cc.

Referenced by doBeginSubRun().

446  {}
BranchChildren const & art::OutputModule::branchChildren ( ) const

Definition at line 660 of file OutputModule.cc.

References branchChildren_.

661  {
662  return branchChildren_;
663  }
BranchChildren branchChildren_
Definition: OutputModule.h:233
void art::OutputModule::configure ( OutputModuleDescription const &  desc)
private
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::consumes ( InputTag const &  tag)
protectedinherited

Definition at line 61 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumes().

62  {
63  return collector_.consumes<T, BT>(tag);
64  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ProductToken< T > consumes(InputTag const &)
ConsumesCollector & art::ModuleBase::consumesCollector ( )
protectedinherited

Definition at line 57 of file ModuleBase.cc.

References art::ModuleBase::collector_.

58  {
59  return collector_;
60  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::consumesMany ( )
protectedinherited

Definition at line 75 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesMany().

76  {
77  collector_.consumesMany<T, BT>();
78  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::consumesView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::consumesView ( InputTag const &  tag)
inherited

Definition at line 68 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesView().

69  {
70  return collector_.consumesView<T, BT>(tag);
71  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > consumesView(InputTag const &)
void art::detail::SharedModule::createQueues ( SharedResources const &  resources)
inherited

Definition at line 34 of file SharedModule.cc.

References art::detail::SharedModule::asyncDeclared_, util::cbegin(), util::cend(), art::detail::SharedModule::chain_, art::detail::SharedResources::createQueues(), e, util::empty(), art::errors::LogicError, and art::detail::SharedModule::resourceNames_.

Referenced by doBeginJob(), art::SharedFilter::setupQueues(), art::SharedProducer::setupQueues(), art::SharedAnalyzer::setupQueues(), art::EDFilter::setupQueues(), art::EDProducer::setupQueues(), and art::EDAnalyzer::setupQueues().

35  {
37  "An error occurred while processing scheduling options for a "
38  "module.\n"};
39  if (asyncDeclared_) {
40  if (empty(resourceNames_)) {
41  return;
42  }
43  throw e
44  << "async<art::InEvent>() cannot be called in combination with any "
45  "serialize<art::InEvent>(...) calls.\n";
46  }
47 
48  if (empty(resourceNames_)) {
49  throw e << "Either 'async<art::InEvent>()' or "
50  "'serialize<art::InEvent>(...)'\n"
51  "must be called in a shared module's constructor.\n";
52  }
53  std::vector<std::string> const names(cbegin(resourceNames_),
55  auto queues = resources.createQueues(names);
56  chain_ = std::make_unique<SerialTaskQueueChain>(queues);
57  }
decltype(auto) constexpr cend(T &&obj)
ADL-aware version of std::cend.
Definition: StdUtils.h:93
std::set< std::string > resourceNames_
Definition: SharedModule.h:76
std::unique_ptr< hep::concurrency::SerialTaskQueueChain > chain_
Definition: SharedModule.h:78
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
decltype(auto) constexpr cbegin(T &&obj)
ADL-aware version of std::cbegin.
Definition: StdUtils.h:85
Float_t e
Definition: plot.C:35
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Definition: StdUtils.h:109
void art::OutputModule::doBeginJob ( detail::SharedResources const &  resources)
privatevirtual

Definition at line 184 of file OutputModule.cc.

References beginJob(), art::detail::SharedModule::createQueues(), and plugins_.

185  {
186  createQueues(resources);
187  beginJob();
188  cet::for_all(plugins_, [](auto& p) { p->doBeginJob(); });
189  }
PluginCollection_t plugins_
Definition: OutputModule.h:242
void createQueues(SharedResources const &resources)
Definition: SharedModule.cc:34
virtual void beginJob()
bool art::OutputModule::doBeginRun ( RunPrincipal const &  rp,
ModuleContext const &  mc 
)
private

Definition at line 192 of file OutputModule.cc.

References beginRun(), FDEBUG, art::RunPrincipal::makeRun(), plugins_, and r.

193  {
194  FDEBUG(2) << "beginRun called\n";
195  beginRun(rp);
196  auto const r = rp.makeRun(mc);
197  cet::for_all(plugins_, [&r](auto& p) { p->doBeginRun(r); });
198  return true;
199  }
TRandom r
Definition: spectrum.C:23
virtual void beginRun(RunPrincipal const &)
PluginCollection_t plugins_
Definition: OutputModule.h:242
#define FDEBUG(LEVEL)
Definition: DebugMacros.h:25
bool art::OutputModule::doBeginSubRun ( SubRunPrincipal const &  srp,
ModuleContext const &  mc 
)
private

Definition at line 202 of file OutputModule.cc.

References beginSubRun(), FDEBUG, art::SubRunPrincipal::makeSubRun(), and plugins_.

204  {
205  FDEBUG(2) << "beginSubRun called\n";
206  beginSubRun(srp);
207  auto const sr = srp.makeSubRun(mc);
208  cet::for_all(plugins_, [&sr](auto& p) { p->doBeginSubRun(sr); });
209  return true;
210  }
PluginCollection_t plugins_
Definition: OutputModule.h:242
#define FDEBUG(LEVEL)
Definition: DebugMacros.h:25
virtual void beginSubRun(SubRunPrincipal const &)
bool art::OutputModule::doCloseFile ( )
private

Definition at line 347 of file OutputModule.cc.

References isFileOpen(), and reallyCloseFile().

348  {
349  if (isFileOpen()) {
350  reallyCloseFile();
351  return true;
352  }
353  return false;
354  }
virtual bool isFileOpen() const
void art::OutputModule::doEndJob ( )
private

Definition at line 296 of file OutputModule.cc.

References endJob(), and plugins_.

297  {
298  endJob();
299  cet::for_all(plugins_, [](auto& p) { p->doEndJob(); });
300  }
PluginCollection_t plugins_
Definition: OutputModule.h:242
virtual void endJob()
bool art::OutputModule::doEndRun ( RunPrincipal const &  rp,
ModuleContext const &  mc 
)
private

Definition at line 279 of file OutputModule.cc.

References endRun(), FDEBUG, art::RunPrincipal::makeRun(), plugins_, and r.

280  {
281  FDEBUG(2) << "endRun called\n";
282  endRun(rp);
283  auto const r = rp.makeRun(mc);
284  cet::for_all(plugins_, [&r](auto& p) { p->doEndRun(r); });
285  return true;
286  }
TRandom r
Definition: spectrum.C:23
virtual void endRun(RunPrincipal const &)
PluginCollection_t plugins_
Definition: OutputModule.h:242
#define FDEBUG(LEVEL)
Definition: DebugMacros.h:25
bool art::OutputModule::doEndSubRun ( SubRunPrincipal const &  srp,
ModuleContext const &  mc 
)
private

Definition at line 255 of file OutputModule.cc.

References endSubRun(), FDEBUG, art::SubRunPrincipal::makeSubRun(), and plugins_.

256  {
257  FDEBUG(2) << "endSubRun called\n";
258  endSubRun(srp);
259  auto const sr = srp.makeSubRun(mc);
260  cet::for_all(plugins_, [&sr](auto& p) { p->doEndSubRun(sr); });
261  return true;
262  }
PluginCollection_t plugins_
Definition: OutputModule.h:242
virtual void endSubRun(SubRunPrincipal const &)
#define FDEBUG(LEVEL)
Definition: DebugMacros.h:25
bool art::OutputModule::doEvent ( EventPrincipal const &  ep,
ModuleContext const &  mc,
std::atomic< std::size_t > &  counts_run,
std::atomic< std::size_t > &  counts_passed,
std::atomic< std::size_t > &  counts_failed 
)
private

Definition at line 213 of file OutputModule.cc.

References event(), FDEBUG, art::EventPrincipal::makeEvent(), art::ModuleContext::scheduleID(), and art::Observer::wantEvent().

218  {
219  FDEBUG(2) << "doEvent called\n";
220  if (wantEvent(mc.scheduleID(), ep.makeEvent(mc))) {
221  ++counts_run;
222  event(ep);
223  ++counts_passed;
224  }
225  return true;
226  }
virtual void event(EventPrincipal const &)
bool wantEvent(ScheduleID id, Event const &e) const
Definition: Observer.cc:63
#define FDEBUG(LEVEL)
Definition: DebugMacros.h:25
std::unique_ptr< Worker > art::OutputModule::doMakeWorker ( WorkerParams const &  wp)
finalprivatevirtual

Implements art::ModuleBase.

Definition at line 89 of file OutputModule.cc.

90  {
91  return std::make_unique<OutputWorker>(this, wp);
92  }
bool art::OutputModule::doOpenFile ( FileBlock const &  fb)
private

Definition at line 303 of file OutputModule.cc.

References isFileOpen(), and openFile().

304  {
305  if (isFileOpen()) {
306  return false;
307  }
308  openFile(fb);
309  return true;
310  }
virtual bool isFileOpen() const
TFile fb("Li6.root")
virtual void openFile(FileBlock const &)
void art::OutputModule::doRegisterProducts ( ProductDescriptions ,
ModuleDescription const &   
)
protectedvirtual

Definition at line 179 of file OutputModule.cc.

Referenced by registerProducts().

181  {}
void art::OutputModule::doRespondToCloseInputFile ( FileBlock const &  fb)
private

Definition at line 329 of file OutputModule.cc.

References respondToCloseInputFile().

330  {
332  }
TFile fb("Li6.root")
virtual void respondToCloseInputFile(FileBlock const &)
void art::OutputModule::doRespondToCloseOutputFiles ( FileBlock const &  fb)
private

Definition at line 341 of file OutputModule.cc.

References respondToCloseOutputFiles().

342  {
344  }
virtual void respondToCloseOutputFiles(FileBlock const &)
TFile fb("Li6.root")
void art::OutputModule::doRespondToOpenInputFile ( FileBlock const &  fb)
private

Definition at line 313 of file OutputModule.cc.

References art::ModuleBase::moduleDescription(), art::ModuleDescription::processConfiguration(), readResults(), respondToOpenInputFile(), and art::FileBlock::resultsPrincipal().

314  {
316  unique_ptr<ResultsPrincipal> respHolder;
317  ResultsPrincipal const* respPtr = fb.resultsPrincipal();
318  if (respPtr == nullptr) {
319  respHolder = make_unique<ResultsPrincipal>(
320  ResultsAuxiliary{},
322  nullptr);
323  respPtr = respHolder.get();
324  }
325  readResults(*respPtr);
326  }
virtual void readResults(ResultsPrincipal const &resp)
virtual void respondToOpenInputFile(FileBlock const &)
ProcessConfiguration const & processConfiguration() const
TFile fb("Li6.root")
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:13
void art::OutputModule::doRespondToOpenOutputFiles ( FileBlock const &  fb)
private

Definition at line 335 of file OutputModule.cc.

References respondToOpenOutputFiles().

336  {
338  }
virtual void respondToOpenOutputFiles(FileBlock const &)
TFile fb("Li6.root")
void art::OutputModule::doSelectProducts ( ProductTables const &  tables)

Definition at line 123 of file OutputModule.cc.

References art::combinable(), art::ProductTables::descriptions(), util::end(), art::for_each_branch_type(), groupSelector_, groupSelectorRules_, hasNewlyDroppedBranch_, keptProducts(), keptProducts_, selected(), and util::values().

Referenced by selectProducts().

124  {
125  // Note: The keptProducts_ data member records all of the
126  // BranchDescription objects that may be persisted to disk. Since
127  // we do not reset it, the list never shrinks. This behavior should
128  // be reconsidered for future use cases of art.
129  auto selectProductForBranchType = [this, &tables](BranchType const bt) {
130  auto const& productList = tables.descriptions(bt);
131  groupSelector_[bt] =
132  std::make_unique<GroupSelector const>(groupSelectorRules_, productList);
133  // TODO: See if we can collapse keptProducts_ and groupSelector into
134  // a single object. See the notes in the header for GroupSelector
135  // for more information.
136  for (auto const& pd : productList | ::ranges::views::values) {
137  if (pd.transient() || pd.dropped()) {
138  continue;
139  }
140  if (selected(pd)) {
141  // Here, we take care to merge the BranchDescription objects
142  // if one was already present in the keptProducts list.
143  auto& keptProducts = keptProducts_[bt];
144  if (auto it = keptProducts.find(pd.productID());
145  it != end(keptProducts)) {
146  auto& found_pd = it->second;
147  assert(combinable(found_pd, pd));
148  found_pd.merge(pd);
149  } else {
150  // New product
151  keptProducts.emplace(pd.productID(), pd);
152  }
153  continue;
154  }
155  hasNewlyDroppedBranch_[bt] = true;
156  }
157  };
158  for_each_branch_type(selectProductForBranchType);
159  }
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
GroupSelectorRules groupSelectorRules_
Definition: OutputModule.h:230
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
Definition: OutputModule.h:229
std::array< std::unique_ptr< GroupSelector const >, NumBranchTypes > groupSelector_
Definition: OutputModule.h:228
decltype(auto) values(Coll &&coll)
Range-for loop helper iterating across the values of the specified collection.
SelectionsArray keptProducts_
Definition: OutputModule.h:226
bool selected(BranchDescription const &) const
bool combinable(BranchDescription const &a, BranchDescription const &b)
SelectionsArray const & keptProducts() const
BranchType
Definition: BranchType.h:20
void for_each_branch_type(F f)
Definition: BranchType.h:38
void art::OutputModule::doSetRunAuxiliaryRangeSetID ( RangeSet const &  ranges)
private

Definition at line 272 of file OutputModule.cc.

References FDEBUG, and setRunAuxiliaryRangeSetID().

273  {
274  FDEBUG(2) << "writeAuxiliaryRangeSets(rp) called\n";
276  }
virtual void setRunAuxiliaryRangeSetID(RangeSet const &)
#define FDEBUG(LEVEL)
Definition: DebugMacros.h:25
void art::OutputModule::doSetSubRunAuxiliaryRangeSetID ( RangeSet const &  ranges)
private

Definition at line 249 of file OutputModule.cc.

References setSubRunAuxiliaryRangeSetID().

250  {
252  }
virtual void setSubRunAuxiliaryRangeSetID(RangeSet const &)
void art::OutputModule::doWriteEvent ( EventPrincipal ep,
ModuleContext const &  mc 
)
private

Definition at line 229 of file OutputModule.cc.

References ci_, e, art::EventPrincipal::eventID(), FDEBUG, art::Observer::getTriggerResults(), art::ModuleBase::moduleDescription(), plugins_, art::ModuleContext::scheduleID(), updateBranchParents(), art::Observer::wantEvent(), and write().

230  {
231  FDEBUG(2) << "writeEvent called\n";
232  auto const e = std::as_const(ep).makeEvent(mc);
233  if (wantEvent(mc.scheduleID(), e)) {
234  write(ep);
235  // Declare that the event was selected for write to the catalog interface.
236  Handle<TriggerResults> trHandle{getTriggerResults(e)};
237  auto const& trRef(trHandle.isValid() ?
238  static_cast<HLTGlobalStatus>(*trHandle) :
239  HLTGlobalStatus{});
240  ci_->eventSelected(
241  moduleDescription().moduleLabel(), ep.eventID(), trRef);
242  // ... and invoke the plugins:
243  cet::for_all(plugins_, [&e](auto& p) { p->doCollectMetadata(e); });
245  }
246  }
void updateBranchParents(EventPrincipal &ep)
Handle< TriggerResults > getTriggerResults(Event const &e) const
Definition: Observer.cc:75
PluginCollection_t plugins_
Definition: OutputModule.h:242
bool wantEvent(ScheduleID id, Event const &e) const
Definition: Observer.cc:63
virtual void write(EventPrincipal &e)=0
ServiceHandle< CatalogInterface > ci_
Definition: OutputModule.h:237
#define FDEBUG(LEVEL)
Definition: DebugMacros.h:25
Float_t e
Definition: plot.C:35
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:13
void art::OutputModule::doWriteFileCatalogMetadata ( FileCatalogMetadata::collection_type const &  md,
FileCatalogMetadata::collection_type const &  ssmd 
)
privatevirtual

Definition at line 596 of file OutputModule.cc.

Referenced by writeFileCatalogMetadata().

599  {}
void art::OutputModule::doWriteRun ( RunPrincipal rp)
private

Definition at line 289 of file OutputModule.cc.

References FDEBUG, and writeRun().

290  {
291  FDEBUG(2) << "writeRun called\n";
292  writeRun(rp);
293  }
virtual void writeRun(RunPrincipal &r)=0
#define FDEBUG(LEVEL)
Definition: DebugMacros.h:25
void art::OutputModule::doWriteSubRun ( SubRunPrincipal srp)
private

Definition at line 265 of file OutputModule.cc.

References FDEBUG, and writeSubRun().

266  {
267  FDEBUG(2) << "writeSubRun called\n";
268  writeSubRun(srp);
269  }
virtual void writeSubRun(SubRunPrincipal &sr)=0
#define FDEBUG(LEVEL)
Definition: DebugMacros.h:25
void art::OutputModule::endJob ( )
privatevirtual
void art::OutputModule::endRun ( RunPrincipal const &  )
privatevirtual

Definition at line 441 of file OutputModule.cc.

Referenced by doEndRun().

442  {}
void art::OutputModule::endSubRun ( SubRunPrincipal const &  )
privatevirtual

Definition at line 449 of file OutputModule.cc.

Referenced by doEndSubRun().

450  {}
void art::OutputModule::event ( EventPrincipal const &  )
privatevirtual

Definition at line 433 of file OutputModule.cc.

Referenced by doEvent().

434  {}
Granularity art::OutputModule::fileGranularity ( ) const
privatevirtual

Definition at line 111 of file OutputModule.cc.

References art::Granularity::Unset.

bool art::OutputModule::fileIsOpen ( ) const

Definition at line 95 of file OutputModule.cc.

References isFileOpen().

96  {
97  return isFileOpen();
98  }
virtual bool isFileOpen() const
OutputFileStatus art::OutputModule::fileStatus ( ) const
void art::OutputModule::fillDependencyGraph ( )
private

Definition at line 409 of file OutputModule.cc.

References branchChildren_, branchParents_, art::thread_safe_registry_via_id< K, M >::get(), art::BranchChildren::insertChild(), and art::Parentage::parents().

Referenced by reallyCloseFile().

410  {
411  for (auto const& [child, eIds] : branchParents_) {
412  for (auto const& eId : eIds) {
413  Parentage par;
414  if (!ParentageRegistry::get(eId, par)) {
415  continue;
416  }
417  for (auto const& p : par.parents()) {
418  branchChildren_.insertChild(p, child);
419  }
420  }
421  }
422  }
BranchChildren branchChildren_
Definition: OutputModule.h:233
static collection_type const & get()
std::map< ProductID, std::set< ParentageID > > branchParents_
Definition: OutputModule.h:232
void insertChild(ProductID parent, ProductID child)
void art::OutputModule::finishEndFile ( )
privatevirtual

Definition at line 606 of file OutputModule.cc.

Referenced by reallyCloseFile().

607  {}
std::array< std::vector< ProductInfo >, NumBranchTypes > const & art::ModuleBase::getConsumables ( ) const
inherited

Definition at line 43 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::getConsumables().

44  {
45  return collector_.getConsumables();
46  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables() const
Handle< TriggerResults > art::Observer::getTriggerResults ( Event const &  e) const
protectedinherited

Definition at line 75 of file Observer.cc.

References art::ProductRetriever::get(), and art::Observer::selectors_.

Referenced by doWriteEvent(), and art::Observer::wantAllEvents().

76  {
77  if (selectors_) {
78  return selectors_->getOneTriggerResults(e);
79  }
80 
81  // The following applies for cases where no SelectEvents entries
82  // exist.
83  Handle<TriggerResults> h;
84  if (e.get(empty_process_name, h)) {
85  return h;
86  }
87  return Handle<TriggerResults>{};
88  }
Float_t e
Definition: plot.C:35
std::optional< detail::ProcessAndEventSelectors > selectors_
Definition: Observer.h:79
std::array< bool, NumBranchTypes > const & art::OutputModule::hasNewlyDroppedBranch ( ) const

Definition at line 654 of file OutputModule.cc.

References hasNewlyDroppedBranch_.

655  {
656  return hasNewlyDroppedBranch_;
657  }
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
Definition: OutputModule.h:229
void art::OutputModule::incrementInputFileNumber ( )
privatevirtual

Definition at line 101 of file OutputModule.cc.

102  {}
bool art::OutputModule::isFileOpen ( ) const
privatevirtual

Definition at line 485 of file OutputModule.cc.

Referenced by doCloseFile(), doOpenFile(), and fileIsOpen().

486  {
487  return true;
488  }
SelectionsArray const & art::OutputModule::keptProducts ( ) const

Definition at line 640 of file OutputModule.cc.

References keptProducts_.

Referenced by doSelectProducts().

641  {
642  return keptProducts_;
643  }
SelectionsArray keptProducts_
Definition: OutputModule.h:226
string const & art::OutputModule::lastClosedFileName ( ) const
virtual

Definition at line 117 of file OutputModule.cc.

References configuredFileName_.

118  {
119  return configuredFileName_;
120  }
std::string configuredFileName_
Definition: OutputModule.h:234
OutputModule::PluginCollection_t art::OutputModule::makePlugins_ ( std::vector< fhicl::ParameterSet > const &  psets)
private

Definition at line 610 of file OutputModule.cc.

References art::errors::Configuration, e, art::ModuleBase::moduleDescription(), art::ModuleDescription::moduleLabel(), pluginFactory_, pluginNames_, and value.

Referenced by OutputModule().

611  {
612  PluginCollection_t result;
613  result.reserve(psets.size());
614  size_t count{0};
615  try {
616  for (auto const& pset : psets) {
617  auto const& libspec =
618  pluginNames_.emplace_back(pset.get<string>("plugin_type"));
619  auto const pluginType = pluginFactory_.pluginType(libspec);
620  if (pluginType !=
622  throw Exception(errors::Configuration, "OutputModule: ")
623  << "unrecognized plugin type " << pluginType << ".\n";
624  }
625  result.emplace_back(
626  pluginFactory_.makePlugin<unique_ptr<FileCatalogMetadataPlugin>>(
627  libspec, pset));
628  ++count;
629  }
630  }
631  catch (cet::exception& e) {
632  throw Exception(errors::Configuration, "OutputModule: ", e)
633  << "Exception caught while processing FCMDPlugins[" << count
634  << "] in module " << moduleDescription().moduleLabel() << ".\n";
635  }
636  return result;
637  }
std::string const & moduleLabel() const
std::vector< std::string > pluginNames_
Definition: OutputModule.h:241
std::vector< std::unique_ptr< FileCatalogMetadataPlugin >> PluginCollection_t
Definition: OutputModule.h:57
double value
Definition: spectrum.C:18
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
cet::BasicPluginFactory pluginFactory_
Definition: OutputModule.h:238
Float_t e
Definition: plot.C:35
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:13
std::unique_ptr< Worker > art::ModuleBase::makeWorker ( WorkerParams const &  wp)
inherited

Definition at line 37 of file ModuleBase.cc.

References art::ModuleBase::doMakeWorker(), and art::NumBranchTypes.

38  {
39  return doMakeWorker(wp);
40  }
virtual std::unique_ptr< Worker > doMakeWorker(WorkerParams const &wp)=0
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::mayConsume ( InputTag const &  tag)
protectedinherited

Definition at line 82 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsume().

83  {
84  return collector_.mayConsume<T, BT>(tag);
85  }
ProductToken< T > mayConsume(InputTag const &)
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::mayConsumeMany ( )
protectedinherited

Definition at line 96 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeMany().

97  {
98  collector_.mayConsumeMany<T, BT>();
99  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::mayConsumeView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::mayConsumeView ( InputTag const &  tag)
inherited

Definition at line 89 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeView().

90  {
91  return collector_.mayConsumeView<T, BT>(tag);
92  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > mayConsumeView(InputTag const &)
ModuleDescription const & art::ModuleBase::moduleDescription ( ) const
inherited

Definition at line 13 of file ModuleBase.cc.

References art::errors::LogicError.

Referenced by doRespondToOpenInputFile(), doWriteEvent(), art::Modifier::fillProductDescriptions(), makePlugins_(), art::OutputWorker::OutputWorker(), reco::shower::LArPandoraModularShowerCreation::produce(), art::Modifier::registerProducts(), and registerProducts().

14  {
15  if (md_.has_value()) {
16  return *md_;
17  }
18 
20  "There was an error while calling moduleDescription().\n"}
21  << "The moduleDescription() base-class member function cannot be called\n"
22  "during module construction. To determine which module is "
23  "responsible\n"
24  "for calling it, find the '<module type>:<module "
25  "label>@Construction'\n"
26  "tag in the message prefix above. Please contact artists@fnal.gov\n"
27  "for guidance.\n";
28  }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
void art::OutputModule::openFile ( FileBlock const &  )
privatevirtual

Definition at line 461 of file OutputModule.cc.

Referenced by doOpenFile().

462  {}
OutputModule& art::OutputModule::operator= ( OutputModule const &  )
delete
OutputModule& art::OutputModule::operator= ( OutputModule &&  )
delete
void art::OutputModule::postSelectProducts ( )
privatevirtual

Definition at line 169 of file OutputModule.cc.

Referenced by selectProducts().

170  {}
string const & art::Observer::processName ( ) const
protectedinherited

Definition at line 57 of file Observer.cc.

References art::Observer::process_name_.

Referenced by art::FileDumperOutput::printPrincipal().

58  {
59  return process_name_;
60  }
std::string process_name_
Definition: Observer.h:76
void art::OutputModule::readResults ( ResultsPrincipal const &  resp)
privatevirtual

Reimplemented in art::FileDumperOutput.

Definition at line 469 of file OutputModule.cc.

Referenced by doRespondToOpenInputFile().

470  {}
void art::OutputModule::reallyCloseFile ( )
private

Definition at line 357 of file OutputModule.cc.

References branchChildren_, branchParents_, art::BranchChildren::clear(), fillDependencyGraph(), finishEndFile(), startEndFile(), writeFileCatalogMetadata(), writeFileFormatVersion(), writeFileIdentifier(), writeFileIndex(), writeParameterSetRegistry(), writeParentageRegistry(), writeProcessConfigurationRegistry(), writeProcessHistoryRegistry(), writeProductDependencies(), and writeProductDescriptionRegistry().

Referenced by doCloseFile().

358  {
360  startEndFile();
363  writeFileIndex();
371  finishEndFile();
372  branchParents_.clear();
374  }
virtual void writeFileIdentifier()
virtual void writeProcessConfigurationRegistry()
virtual void finishEndFile()
void writeFileCatalogMetadata()
virtual void writeFileFormatVersion()
BranchChildren branchChildren_
Definition: OutputModule.h:233
virtual void writeFileIndex()
virtual void writeParameterSetRegistry()
virtual void writeParentageRegistry()
virtual void writeProductDescriptionRegistry()
std::map< ProductID, std::set< ParentageID > > branchParents_
Definition: OutputModule.h:232
void fillDependencyGraph()
virtual void writeProcessHistoryRegistry()
virtual void writeProductDependencies()
virtual void startEndFile()
void art::OutputModule::registerProducts ( ProductDescriptions producedProducts)

Definition at line 173 of file OutputModule.cc.

References doRegisterProducts(), and art::ModuleBase::moduleDescription().

174  {
175  doRegisterProducts(producedProducts, moduleDescription());
176  }
virtual void doRegisterProducts(ProductDescriptions &, ModuleDescription const &)
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:13
bool art::OutputModule::requestsToCloseFile ( ) const
privatevirtual

Definition at line 105 of file OutputModule.cc.

106  {
107  return false;
108  }
void art::OutputModule::respondToCloseInputFile ( FileBlock const &  )
privatevirtual

Definition at line 473 of file OutputModule.cc.

Referenced by doRespondToCloseInputFile().

474  {}
void art::OutputModule::respondToCloseOutputFiles ( FileBlock const &  )
privatevirtual

Definition at line 481 of file OutputModule.cc.

Referenced by doRespondToCloseOutputFiles().

482  {}
void art::OutputModule::respondToOpenInputFile ( FileBlock const &  )
privatevirtual

Definition at line 465 of file OutputModule.cc.

Referenced by doRespondToOpenInputFile().

466  {}
void art::OutputModule::respondToOpenOutputFiles ( FileBlock const &  )
privatevirtual

Definition at line 477 of file OutputModule.cc.

Referenced by doRespondToOpenOutputFiles().

478  {}
bool art::OutputModule::selected ( BranchDescription const &  pd) const

Definition at line 646 of file OutputModule.cc.

References art::BranchDescription::branchType(), and groupSelector_.

Referenced by doSelectProducts().

647  {
648  auto const bt = pd.branchType();
649  assert(groupSelector_[bt]);
650  return groupSelector_[bt]->selected(pd);
651  }
std::array< std::unique_ptr< GroupSelector const >, NumBranchTypes > groupSelector_
Definition: OutputModule.h:228
void art::OutputModule::selectProducts ( ProductTables const &  tables)

Definition at line 162 of file OutputModule.cc.

References doSelectProducts(), and postSelectProducts().

163  {
164  doSelectProducts(tables);
166  }
void doSelectProducts(ProductTables const &)
virtual void postSelectProducts()
template<BranchType BT = InEvent, typename... T>
void art::detail::SharedModule::serialize ( T const &  ...)
protectedinherited
template<BranchType , typename... T>
void art::detail::SharedModule::serialize ( T const &...  resources)
inherited

Definition at line 83 of file SharedModule.h.

References art::detail::SharedModule::serialize_for_resource().

84  {
85  serialize_for_resource(resources...);
86  }
void serialize_for_resource(T const &...t)
Definition: SharedModule.h:52
template<BranchType BT = InEvent, typename... T>
void art::detail::SharedModule::serializeExternal ( T const &  ...)
protectedinherited
template<BranchType , typename... T>
void art::detail::SharedModule::serializeExternal ( T const &...  resources)
inherited

Definition at line 90 of file SharedModule.h.

References art::detail::SharedModule::serialize_for_external_resource().

91  {
92  serialize_for_external_resource(resources...);
93  }
void serialize_for_external_resource(T const &...t)
Definition: SharedModule.h:65
SerialTaskQueueChain * art::detail::SharedModule::serialTaskQueueChain ( ) const
inherited

Definition at line 22 of file SharedModule.cc.

References art::detail::SharedModule::chain_.

23  {
24  return chain_.get();
25  }
std::unique_ptr< hep::concurrency::SerialTaskQueueChain > chain_
Definition: SharedModule.h:78
void art::OutputModule::setFileStatus ( OutputFileStatus  )
privatevirtual

Definition at line 491 of file OutputModule.cc.

492  {}
void art::ModuleBase::setModuleDescription ( ModuleDescription const &  md)
inherited

Definition at line 31 of file ModuleBase.cc.

References art::ModuleBase::md_.

32  {
33  md_ = md;
34  }
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
void art::OutputModule::setRunAuxiliaryRangeSetID ( RangeSet const &  )
privatevirtual

Definition at line 453 of file OutputModule.cc.

Referenced by doSetRunAuxiliaryRangeSetID().

454  {}
void art::OutputModule::setSubRunAuxiliaryRangeSetID ( RangeSet const &  )
privatevirtual

Definition at line 457 of file OutputModule.cc.

Referenced by doSetSubRunAuxiliaryRangeSetID().

458  {}
std::set< std::string > const & art::detail::SharedModule::sharedResources ( ) const
inherited

Definition at line 28 of file SharedModule.cc.

References art::detail::SharedModule::resourceNames_.

29  {
30  return resourceNames_;
31  }
std::set< std::string > resourceNames_
Definition: SharedModule.h:76
void art::ModuleBase::sortConsumables ( std::string const &  current_process_name)
inherited

Definition at line 49 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::sortConsumables().

50  {
51  // Now that we know we have seen all the consumes declarations,
52  // sort the results for fast lookup later.
53  collector_.sortConsumables(current_process_name);
54  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
void sortConsumables(std::string const &current_process_name)
void art::OutputModule::startEndFile ( )
privatevirtual

Definition at line 495 of file OutputModule.cc.

Referenced by reallyCloseFile().

496  {}
void art::OutputModule::updateBranchParents ( EventPrincipal ep)
private

Definition at line 379 of file OutputModule.cc.

References branchChildren_, branchParents_, and art::BranchChildren::insertEmpty().

Referenced by doWriteEvent().

380  {
381  // Note: threading: We are implicitly using the Principal
382  // iterators here which iterate over the groups held by the
383  // principal, which may be updated by a producer task in
384  // another stream while we are iterating! But only for Run,
385  // SubRun, and Results principals, in the case of Event
386  // principals we arrange that no producer or filter tasks
387  // are running when we run. So since we are only called for
388  // event principals we are safe.
389  //
390  // Note: threading: We update branchParents_ and branchChildren_
391  // here which must be protected if we become a stream or
392  // global module.
393  //
394  for (auto const& [pid, group] : ep) {
395  if (auto provenance = group->productProvenance()) {
396  auto iter = branchParents_.find(pid);
397  if (iter == branchParents_.end()) {
398  iter = branchParents_.emplace(pid, set<ParentageID>{}).first;
399  }
400  iter->second.insert(provenance->parentageID());
402  }
403  }
404  }
BranchChildren branchChildren_
Definition: OutputModule.h:233
void insertEmpty(ProductID parent)
std::map< ProductID, std::set< ParentageID > > branchParents_
Definition: OutputModule.h:232
bool art::Observer::wantAllEvents ( ) const
inlineprotectednoexceptinherited

Definition at line 31 of file Observer.h.

References e, art::Observer::getTriggerResults(), art::Observer::wantAllEvents_, and art::Observer::wantEvent().

32  {
33  return wantAllEvents_;
34  }
bool wantAllEvents_
Definition: Observer.h:75
bool art::Observer::wantEvent ( ScheduleID  id,
Event const &  e 
) const
protectedinherited

Definition at line 63 of file Observer.cc.

References art::Observer::rejectors_, art::Observer::selectors_, and art::Observer::wantAllEvents_.

Referenced by doEvent(), doWriteEvent(), and art::Observer::wantAllEvents().

64  {
65  if (wantAllEvents_) {
66  return true;
67  }
68  bool const select_event = selectors_ ? selectors_->matchEvent(id, e) : true;
69  bool const reject_event =
70  rejectors_ ? rejectors_->matchEvent(id, e) : false;
71  return select_event and not reject_event;
72  }
bool wantAllEvents_
Definition: Observer.h:75
std::optional< detail::ProcessAndEventSelectors > rejectors_
Definition: Observer.h:80
Float_t e
Definition: plot.C:35
std::optional< detail::ProcessAndEventSelectors > selectors_
Definition: Observer.h:79
void art::OutputModule::writeFileCatalogMetadata ( )
private

Definition at line 573 of file OutputModule.cc.

References dataTier_, doWriteFileCatalogMetadata(), pluginNames_, plugins_, and streamName_.

Referenced by reallyCloseFile().

574  {
575  // Obtain metadata from service for output.
577  ServiceHandle<FileCatalogMetadata const>
578  {
579  } -> getMetadata(md);
580  if (!dataTier_.empty()) {
581  md.emplace_back("data_tier", cet::canonical_string(dataTier_));
582  }
583  if (!streamName_.empty()) {
584  md.emplace_back("data_stream", cet::canonical_string(streamName_));
585  }
586  // Ask any plugins for their list of metadata, and put it in a
587  // separate list for the output module. The user stream-specific
588  // metadata should override stream-specific metadata generated by the
589  // output module iself.
591  collectStreamSpecificMetadata(plugins_, pluginNames_, ssmd);
592  doWriteFileCatalogMetadata(md, ssmd);
593  }
std::vector< std::pair< std::string, std::string >> collection_type
std::string streamName_
Definition: OutputModule.h:236
std::vector< std::string > pluginNames_
Definition: OutputModule.h:241
PluginCollection_t plugins_
Definition: OutputModule.h:242
std::string dataTier_
Definition: OutputModule.h:235
virtual void doWriteFileCatalogMetadata(FileCatalogMetadata::collection_type const &md, FileCatalogMetadata::collection_type const &ssmd)
void art::OutputModule::writeFileFormatVersion ( )
privatevirtual

Definition at line 499 of file OutputModule.cc.

Referenced by reallyCloseFile().

500  {}
void art::OutputModule::writeFileIdentifier ( )
privatevirtual

Definition at line 503 of file OutputModule.cc.

Referenced by reallyCloseFile().

504  {}
void art::OutputModule::writeFileIndex ( )
privatevirtual

Definition at line 507 of file OutputModule.cc.

Referenced by reallyCloseFile().

508  {}
void art::OutputModule::writeParameterSetRegistry ( )
privatevirtual

Definition at line 519 of file OutputModule.cc.

Referenced by reallyCloseFile().

520  {}
void art::OutputModule::writeParentageRegistry ( )
privatevirtual

Definition at line 523 of file OutputModule.cc.

Referenced by reallyCloseFile().

524  {}
void art::OutputModule::writeProcessConfigurationRegistry ( )
privatevirtual

Definition at line 511 of file OutputModule.cc.

Referenced by reallyCloseFile().

512  {}
void art::OutputModule::writeProcessHistoryRegistry ( )
privatevirtual

Definition at line 515 of file OutputModule.cc.

Referenced by reallyCloseFile().

516  {}
void art::OutputModule::writeProductDependencies ( )
privatevirtual

Definition at line 602 of file OutputModule.cc.

Referenced by reallyCloseFile().

603  {}
void art::OutputModule::writeProductDescriptionRegistry ( )
privatevirtual

Definition at line 527 of file OutputModule.cc.

References art::errors::DataCorruption, parser(), art::plugin, tmp, and lar::dump::vector().

Referenced by reallyCloseFile().

528  {}

Friends And Related Function Documentation

friend class OutputWorker
friend

Definition at line 50 of file OutputModule.h.

Member Data Documentation

BranchChildren art::OutputModule::branchChildren_ {}
private
std::map<ProductID, std::set<ParentageID> > art::OutputModule::branchParents_ {}
private

Definition at line 232 of file OutputModule.h.

Referenced by fillDependencyGraph(), reallyCloseFile(), and updateBranchParents().

ServiceHandle<CatalogInterface> art::OutputModule::ci_ {}
private

Definition at line 237 of file OutputModule.h.

Referenced by doWriteEvent().

std::string art::OutputModule::configuredFileName_
private

Definition at line 234 of file OutputModule.h.

Referenced by lastClosedFileName(), and OutputModule().

std::string art::OutputModule::dataTier_
private

Definition at line 235 of file OutputModule.h.

Referenced by OutputModule(), and writeFileCatalogMetadata().

std::array<std::unique_ptr<GroupSelector const>, NumBranchTypes> art::OutputModule::groupSelector_ {{nullptr}}
private

Definition at line 228 of file OutputModule.h.

Referenced by doSelectProducts(), and selected().

GroupSelectorRules art::OutputModule::groupSelectorRules_
private

Definition at line 230 of file OutputModule.h.

Referenced by doSelectProducts(), and OutputModule().

std::array<bool, NumBranchTypes> art::OutputModule::hasNewlyDroppedBranch_ {{false}}
private

Definition at line 229 of file OutputModule.h.

Referenced by doSelectProducts(), and hasNewlyDroppedBranch().

SelectionsArray art::OutputModule::keptProducts_ {{}}
private

Definition at line 226 of file OutputModule.h.

Referenced by doSelectProducts(), and keptProducts().

cet::BasicPluginFactory art::OutputModule::pluginFactory_ {}
private

Definition at line 238 of file OutputModule.h.

Referenced by makePlugins_().

std::vector<std::string> art::OutputModule::pluginNames_ {}
private

Definition at line 241 of file OutputModule.h.

Referenced by makePlugins_(), and writeFileCatalogMetadata().

std::string art::OutputModule::streamName_
private

Definition at line 236 of file OutputModule.h.

Referenced by OutputModule(), and writeFileCatalogMetadata().


The documentation for this class was generated from the following files: