Classes | Public Types | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
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 > > art::test::PMTestOutput arttest::EventProcessorTestOutput

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 () noexcept
 
 OutputModule (fhicl::ParameterSet const &pset)
 
 OutputModule (fhicl::TableFragment< Config > const &pset, fhicl::ParameterSet const &containing_pset)
 
 OutputModule (OutputModule const &)=delete
 
 OutputModule (OutputModule &&)=delete
 
OutputModuleoperator= (OutputModule const &)=delete
 
OutputModuleoperator= (OutputModule &&)=delete
 
int maxEvents () const
 
int remainingEvents () const
 
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 &, ModuleDescription const &)
 
BranchChildren const & branchChildren () const
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
fhicl::ParameterSetID selectorConfig () const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
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)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 
- Public Member Functions inherited from art::detail::SharedModule
 SharedModule ()
 
 SharedModule (std::string const &moduleLabel)
 
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 &)
 
- Protected Member Functions inherited from art::Observer
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &select_paths, std::vector< std::string > const &reject_paths, fhicl::ParameterSet const &config)
 
- Protected Member Functions inherited from art::ModuleBase
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 ()
 
- Protected Member Functions inherited from art::detail::SharedModule
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

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)
 
std::string workerType () const
 
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 ()
 
bool limitReached () const
 
virtual void startEndFile ()
 
virtual void writeFileFormatVersion ()
 
virtual void writeFileIdentifier ()
 
virtual void writeFileIndex ()
 
virtual void writeEventHistory ()
 
virtual void writeProcessConfigurationRegistry ()
 
virtual void writeProcessHistoryRegistry ()
 
virtual void writeParameterSetRegistry ()
 
virtual void writeBranchIDListRegistry ()
 
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_
 
int maxEvents_ {-1}
 
int remainingEvents_ {maxEvents_}
 
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::stringpluginNames_ {}
 
PluginCollection_t plugins_
 

Friends

class WorkerT< OutputModule >
 
class OutputWorker
 

Detailed Description

Definition at line 48 of file OutputModule.h.

Member Typedef Documentation

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

Definition at line 240 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 ( )
virtualdefaultnoexcept
art::OutputModule::OutputModule ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 73 of file OutputModule.cc.

74  : Observer{pset}
75  , groupSelectorRules_{pset.get<vector<string>>("outputCommands",
76  {"keep *"}),
77  "outputCommands",
78  "OutputModule"}
79  , configuredFileName_{pset.get<string>("fileName", "")}
80  , dataTier_{pset.get<string>("dataTier", "")}
81  , streamName_{pset.get<string>("streamName", "")}
82  , plugins_{makePlugins_(pset.get<vector<ParameterSet>>("FCMDPlugins", {}))}
83  {
85  }
std::string streamName_
Definition: OutputModule.h:245
SharedResource_t const LegacyResource
GroupSelectorRules groupSelectorRules_
Definition: OutputModule.h:237
PluginCollection_t plugins_
Definition: OutputModule.h:251
std::string configuredFileName_
Definition: OutputModule.h:243
std::string dataTier_
Definition: OutputModule.h:244
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,
fhicl::ParameterSet const &  containing_pset 
)
explicit

Definition at line 54 of file OutputModule.cc.

56  : Observer{config().eoFragment().selectEvents(),
57  config().eoFragment().rejectEvents(),
58  containing_pset}
60  "outputCommands",
61  "OutputModule"}
65  {
66  std::vector<ParameterSet> fcmdPluginPSets;
67  if (config().fcmdPlugins.get_if_present(fcmdPluginPSets)) {
68  plugins_ = makePlugins_(fcmdPluginPSets);
69  }
71  }
fhicl::Atom< std::string > fileName
Definition: OutputModule.h:78
fhicl::Sequence< std::string > outputCommands
Definition: OutputModule.h:75
std::string streamName_
Definition: OutputModule.h:245
fhicl::TableFragment< Observer::EOConfig > eoFragment
Definition: OutputModule.h:74
SharedResource_t const LegacyResource
GroupSelectorRules groupSelectorRules_
Definition: OutputModule.h:237
PluginCollection_t plugins_
Definition: OutputModule.h:251
static Config * config
Definition: config.cpp:1054
std::string configuredFileName_
Definition: OutputModule.h:243
std::string dataTier_
Definition: OutputModule.h:244
fhicl::Atom< std::string > streamName
Definition: OutputModule.h:80
PluginCollection_t makePlugins_(std::vector< fhicl::ParameterSet > const &psets)
fhicl::Atom< std::string > dataTier
Definition: OutputModule.h:79
Observer(Observer const &)=delete
void serialize(T const &...)
art::OutputModule::OutputModule ( OutputModule const &  )
delete
art::OutputModule::OutputModule ( OutputModule &&  )
delete

Member Function Documentation

void art::OutputModule::beginJob ( )
privatevirtual
void art::OutputModule::beginRun ( RunPrincipal const &  )
privatevirtual

Definition at line 453 of file OutputModule.cc.

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

Definition at line 461 of file OutputModule.cc.

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

Definition at line 694 of file OutputModule.cc.

695  {
696  return branchChildren_;
697  }
BranchChildren branchChildren_
Definition: OutputModule.h:242
void art::OutputModule::configure ( OutputModuleDescription const &  desc)
private

Definition at line 122 of file OutputModule.cc.

123  {
124  remainingEvents_ = maxEvents_ = desc.maxEvents_;
125  }
void art::OutputModule::doBeginJob ( detail::SharedResources const &  resources)
privatevirtual

Definition at line 191 of file OutputModule.cc.

192  {
193  createQueues(resources);
194  beginJob();
195  cet::for_all(plugins_, [](auto& p) { p->doBeginJob(); });
196  }
PluginCollection_t plugins_
Definition: OutputModule.h:251
p
Definition: test.py:223
void createQueues(SharedResources const &resources)
Definition: SharedModule.cc:34
auto for_all(FwdCont &, Func)
virtual void beginJob()
bool art::OutputModule::doBeginRun ( RunPrincipal const &  rp,
ModuleContext const &  mc 
)
private

Definition at line 199 of file OutputModule.cc.

200  {
201  FDEBUG(2) << "beginRun called\n";
202  beginRun(rp);
203  Run const r{rp, mc};
204  cet::for_all(plugins_, [&r](auto& p) { p->doBeginRun(r); });
205  return true;
206  }
virtual void beginRun(RunPrincipal const &)
PluginCollection_t plugins_
Definition: OutputModule.h:251
p
Definition: test.py:223
auto for_all(FwdCont &, Func)
#define FDEBUG(LEVEL)
Definition: DebugMacros.h:25
bool art::OutputModule::doBeginSubRun ( SubRunPrincipal const &  srp,
ModuleContext const &  mc 
)
private

Definition at line 209 of file OutputModule.cc.

211  {
212  FDEBUG(2) << "beginSubRun called\n";
213  beginSubRun(srp);
214  SubRun const sr{srp, mc};
215  cet::for_all(plugins_, [&sr](auto& p) { p->doBeginSubRun(sr); });
216  return true;
217  }
PluginCollection_t plugins_
Definition: OutputModule.h:251
p
Definition: test.py:223
auto for_all(FwdCont &, Func)
#define FDEBUG(LEVEL)
Definition: DebugMacros.h:25
static constexpr double sr
Definition: Units.h:166
virtual void beginSubRun(SubRunPrincipal const &)
bool art::OutputModule::doCloseFile ( )
private

Definition at line 358 of file OutputModule.cc.

359  {
360  if (isFileOpen()) {
361  reallyCloseFile();
362  return true;
363  }
364  return false;
365  }
virtual bool isFileOpen() const
void art::OutputModule::doEndJob ( )
private

Definition at line 307 of file OutputModule.cc.

308  {
309  endJob();
310  cet::for_all(plugins_, [](auto& p) { p->doEndJob(); });
311  }
PluginCollection_t plugins_
Definition: OutputModule.h:251
virtual void endJob()
p
Definition: test.py:223
auto for_all(FwdCont &, Func)
bool art::OutputModule::doEndRun ( RunPrincipal const &  rp,
ModuleContext const &  mc 
)
private

Definition at line 290 of file OutputModule.cc.

291  {
292  FDEBUG(2) << "endRun called\n";
293  endRun(rp);
294  Run const r{rp, mc};
295  cet::for_all(plugins_, [&r](auto& p) { p->doEndRun(r); });
296  return true;
297  }
virtual void endRun(RunPrincipal const &)
PluginCollection_t plugins_
Definition: OutputModule.h:251
p
Definition: test.py:223
auto for_all(FwdCont &, Func)
#define FDEBUG(LEVEL)
Definition: DebugMacros.h:25
bool art::OutputModule::doEndSubRun ( SubRunPrincipal const &  srp,
ModuleContext const &  mc 
)
private

Definition at line 266 of file OutputModule.cc.

267  {
268  FDEBUG(2) << "endSubRun called\n";
269  endSubRun(srp);
270  SubRun const sr{srp, mc};
271  cet::for_all(plugins_, [&sr](auto& p) { p->doEndSubRun(sr); });
272  return true;
273  }
PluginCollection_t plugins_
Definition: OutputModule.h:251
virtual void endSubRun(SubRunPrincipal const &)
p
Definition: test.py:223
auto for_all(FwdCont &, Func)
#define FDEBUG(LEVEL)
Definition: DebugMacros.h:25
static constexpr double sr
Definition: Units.h:166
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 220 of file OutputModule.cc.

225  {
226  FDEBUG(2) << "doEvent called\n";
227  Event const e{ep, mc};
228  if (wantEvent(mc.scheduleID(), e)) {
229  ++counts_run;
230  event(ep);
231  ++counts_passed;
232  }
233  return true;
234  }
virtual void event(EventPrincipal const &)
const double e
bool wantEvent(ScheduleID id, Event const &e) const
Definition: Observer.cc:74
#define FDEBUG(LEVEL)
Definition: DebugMacros.h:25
bool art::OutputModule::doOpenFile ( FileBlock const &  fb)
private

Definition at line 314 of file OutputModule.cc.

315  {
316  if (isFileOpen()) {
317  return false;
318  }
319  openFile(fb);
320  return true;
321  }
virtual bool isFileOpen() const
virtual void openFile(FileBlock const &)
void art::OutputModule::doRegisterProducts ( ProductDescriptions ,
ModuleDescription const &   
)
protectedvirtual

Definition at line 186 of file OutputModule.cc.

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

Definition at line 340 of file OutputModule.cc.

341  {
343  }
virtual void respondToCloseInputFile(FileBlock const &)
void art::OutputModule::doRespondToCloseOutputFiles ( FileBlock const &  fb)
private

Definition at line 352 of file OutputModule.cc.

353  {
355  }
virtual void respondToCloseOutputFiles(FileBlock const &)
void art::OutputModule::doRespondToOpenInputFile ( FileBlock const &  fb)
private

Definition at line 324 of file OutputModule.cc.

325  {
327  unique_ptr<ResultsPrincipal> respHolder;
328  ResultsPrincipal const* respPtr = fb.resultsPrincipal();
329  if (respPtr == nullptr) {
330  respHolder = make_unique<ResultsPrincipal>(
331  ResultsAuxiliary{},
333  nullptr);
334  respPtr = respHolder.get();
335  }
336  readResults(*respPtr);
337  }
virtual void readResults(ResultsPrincipal const &resp)
virtual void respondToOpenInputFile(FileBlock const &)
ProcessConfiguration const & processConfiguration() const
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:15
void art::OutputModule::doRespondToOpenOutputFiles ( FileBlock const &  fb)
private

Definition at line 346 of file OutputModule.cc.

347  {
349  }
virtual void respondToOpenOutputFiles(FileBlock const &)
void art::OutputModule::doSelectProducts ( ProductTables const &  tables)

Definition at line 128 of file OutputModule.cc.

129  {
130  // Note: The keptProducts_ data member records all of the
131  // BranchDescription objects that may be persisted to disk. Since
132  // we do not reset it, the list never shrinks. This behavior should
133  // be reconsidered for future use cases of art.
134  auto selectProductForBranchType = [this, &tables](BranchType const bt) {
135  auto const& productList = tables.descriptions(bt);
136  groupSelector_[bt] =
137  std::make_unique<GroupSelector const>(groupSelectorRules_, productList);
138  // TODO: See if we can collapse keptProducts_ and groupSelector into
139  // a single object. See the notes in the header for GroupSelector
140  // for more information.
141  for (auto const& val : productList) {
142  BranchDescription const& pd = val.second;
143  if (pd.transient() || pd.dropped()) {
144  continue;
145  }
146  if (selected(pd)) {
147  // Here, we take care to merge the BranchDescription objects
148  // if one was already present in the keptProducts list.
149  auto& keptProducts = keptProducts_[bt];
150  if (auto it = keptProducts.find(pd.productID());
151  it != end(keptProducts)) {
152  auto& found_pd = it->second;
153  assert(combinable(found_pd, pd));
154  found_pd.merge(pd);
155  } else {
156  // New product
157  keptProducts.emplace(pd.productID(), pd);
158  }
159  continue;
160  }
161  hasNewlyDroppedBranch_[bt] = true;
162  }
163  };
164  for_each_branch_type(selectProductForBranchType);
165  }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
GroupSelectorRules groupSelectorRules_
Definition: OutputModule.h:237
bt
Definition: tracks.py:83
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
Definition: OutputModule.h:236
std::array< std::unique_ptr< GroupSelector const >, NumBranchTypes > groupSelector_
Definition: OutputModule.h:235
SelectionsArray keptProducts_
Definition: OutputModule.h:233
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 283 of file OutputModule.cc.

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

Definition at line 260 of file OutputModule.cc.

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

Definition at line 237 of file OutputModule.cc.

238  {
239  FDEBUG(2) << "writeEvent called\n";
240  Event const e{ep, mc};
241  if (wantEvent(mc.scheduleID(), e)) {
242  write(ep);
243  // Declare that the event was selected for write to the catalog interface.
244  Handle<TriggerResults> trHandle{getTriggerResults(e)};
245  auto const& trRef(trHandle.isValid() ?
246  static_cast<HLTGlobalStatus>(*trHandle) :
247  HLTGlobalStatus{});
248  ci_->eventSelected(
249  moduleDescription().moduleLabel(), ep.eventID(), trRef);
250  // ... and invoke the plugins:
251  cet::for_all(plugins_, [&e](auto& p) { p->doCollectMetadata(e); });
253  if (remainingEvents_ > 0) {
255  }
256  }
257  }
void updateBranchParents(EventPrincipal &ep)
Handle< TriggerResults > getTriggerResults(Event const &e) const
Definition: Observer.cc:92
PluginCollection_t plugins_
Definition: OutputModule.h:251
const double e
bool wantEvent(ScheduleID id, Event const &e) const
Definition: Observer.cc:74
virtual void write(EventPrincipal &e)=0
p
Definition: test.py:223
ServiceHandle< CatalogInterface > ci_
Definition: OutputModule.h:246
auto for_all(FwdCont &, Func)
#define FDEBUG(LEVEL)
Definition: DebugMacros.h:25
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:15
void art::OutputModule::doWriteFileCatalogMetadata ( FileCatalogMetadata::collection_type const &  md,
FileCatalogMetadata::collection_type const &  ssmd 
)
privatevirtual

Definition at line 618 of file OutputModule.cc.

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

Definition at line 300 of file OutputModule.cc.

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

Definition at line 276 of file OutputModule.cc.

277  {
278  FDEBUG(2) << "writeSubRun called\n";
279  writeSubRun(srp);
280  }
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 457 of file OutputModule.cc.

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

Definition at line 465 of file OutputModule.cc.

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

Definition at line 449 of file OutputModule.cc.

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

Reimplemented in arttest::EventProcessorTestOutput.

Definition at line 110 of file OutputModule.cc.

bool art::OutputModule::fileIsOpen ( ) const

Definition at line 88 of file OutputModule.cc.

89  {
90  return isFileOpen();
91  }
virtual bool isFileOpen() const
OutputFileStatus art::OutputModule::fileStatus ( ) const
void art::OutputModule::fillDependencyGraph ( )
private

Definition at line 423 of file OutputModule.cc.

424  {
425  for (auto const& bp : branchParents_) {
426  ProductID const child = bp.first;
427  set<ParentageID> const& eIds = bp.second;
428  for (auto const& eId : eIds) {
429  Parentage par;
430  if (!ParentageRegistry::get(eId, par)) {
431  continue;
432  }
433  for (auto const& p : par.parents()) {
434  branchChildren_.insertChild(p, child);
435  }
436  }
437  }
438  }
BranchChildren branchChildren_
Definition: OutputModule.h:242
static collection_type const & get()
p
Definition: test.py:223
std::map< ProductID, std::set< ParentageID > > branchParents_
Definition: OutputModule.h:241
void insertChild(ProductID parent, ProductID child)
void art::OutputModule::finishEndFile ( )
privatevirtual

Definition at line 628 of file OutputModule.cc.

629  {}
std::array< bool, NumBranchTypes > const & art::OutputModule::hasNewlyDroppedBranch ( ) const

Definition at line 688 of file OutputModule.cc.

689  {
690  return hasNewlyDroppedBranch_;
691  }
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
Definition: OutputModule.h:236
void art::OutputModule::incrementInputFileNumber ( )
privatevirtual

Reimplemented in arttest::EventProcessorTestOutput.

Definition at line 100 of file OutputModule.cc.

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

Definition at line 501 of file OutputModule.cc.

502  {
503  return true;
504  }
SelectionsArray const & art::OutputModule::keptProducts ( ) const

Definition at line 674 of file OutputModule.cc.

675  {
676  return keptProducts_;
677  }
SelectionsArray keptProducts_
Definition: OutputModule.h:233
string const & art::OutputModule::lastClosedFileName ( ) const
virtual

Definition at line 116 of file OutputModule.cc.

117  {
118  return configuredFileName_;
119  }
std::string configuredFileName_
Definition: OutputModule.h:243
bool art::OutputModule::limitReached ( ) const
private

Definition at line 700 of file OutputModule.cc.

701  {
702  return remainingEvents_ == 0;
703  }
OutputModule::PluginCollection_t art::OutputModule::makePlugins_ ( std::vector< fhicl::ParameterSet > const &  psets)
private

Definition at line 632 of file OutputModule.cc.

633  {
635  result.reserve(psets.size());
636  size_t count{0};
637  try {
638  for (auto const& pset : psets) {
639  auto const& libspec =
640  pluginNames_.emplace_back(pset.get<string>("plugin_type"));
641  auto const pluginType = pluginFactory_.pluginType(libspec);
642  if (pluginType !=
644  throw Exception(errors::Configuration, "OutputModule: ")
645  << "unrecognized plugin type " << pluginType << ".\n";
646  }
647  result.emplace_back(
648  pluginFactory_.makePlugin<unique_ptr<FileCatalogMetadataPlugin>>(
649  libspec, pset));
650  ++count;
651  }
652  }
653  catch (cet::exception& e) {
654  throw Exception(errors::Configuration, "OutputModule: ", e)
655  << "Exception caught while processing FCMDPlugins[" << count
656  << "] in module " << moduleDescription().moduleLabel() << ".\n";
657  }
658  return result;
659  }
static QCString result
std::string const & moduleLabel() const
std::vector< std::string > pluginNames_
Definition: OutputModule.h:250
std::enable_if_t<!std::is_function_v< RESULT_TYPE >, RESULT_TYPE > makePlugin(std::string const &libspec, ARGS &&...args) const
std::vector< std::unique_ptr< FileCatalogMetadataPlugin >> PluginCollection_t
Definition: OutputModule.h:57
const double e
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
cet::BasicPluginFactory pluginFactory_
Definition: OutputModule.h:247
std::string pluginType(std::string const &libspec) const
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:15
int art::OutputModule::maxEvents ( ) const

Definition at line 662 of file OutputModule.cc.

663  {
664  return maxEvents_;
665  }
void art::OutputModule::openFile ( FileBlock const &  )
privatevirtual

Definition at line 477 of file OutputModule.cc.

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

Definition at line 175 of file OutputModule.cc.

176  {}
void art::OutputModule::readResults ( ResultsPrincipal const &  resp)
privatevirtual

Reimplemented in art::FileDumperOutput.

Definition at line 485 of file OutputModule.cc.

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

Definition at line 368 of file OutputModule.cc.

369  {
371  startEndFile();
374  writeFileIndex();
383  finishEndFile();
384  branchParents_.clear();
386  }
virtual void writeFileIdentifier()
virtual void writeProcessConfigurationRegistry()
virtual void finishEndFile()
void writeFileCatalogMetadata()
virtual void writeFileFormatVersion()
BranchChildren branchChildren_
Definition: OutputModule.h:242
virtual void writeFileIndex()
virtual void writeParameterSetRegistry()
virtual void writeParentageRegistry()
virtual void writeProductDescriptionRegistry()
std::map< ProductID, std::set< ParentageID > > branchParents_
Definition: OutputModule.h:241
void fillDependencyGraph()
virtual void writeEventHistory()
virtual void writeProcessHistoryRegistry()
virtual void writeProductDependencies()
virtual void startEndFile()
void art::OutputModule::registerProducts ( ProductDescriptions producedProducts,
ModuleDescription const &  md 
)

Definition at line 179 of file OutputModule.cc.

181  {
182  doRegisterProducts(producedProducts, md);
183  }
virtual void doRegisterProducts(ProductDescriptions &, ModuleDescription const &)
int art::OutputModule::remainingEvents ( ) const

Definition at line 668 of file OutputModule.cc.

669  {
670  return remainingEvents_;
671  }
bool art::OutputModule::requestsToCloseFile ( ) const
privatevirtual

Reimplemented in arttest::EventProcessorTestOutput.

Definition at line 104 of file OutputModule.cc.

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

Definition at line 489 of file OutputModule.cc.

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

Definition at line 497 of file OutputModule.cc.

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

Reimplemented in arttest::EventProcessorTestOutput.

Definition at line 481 of file OutputModule.cc.

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

Definition at line 493 of file OutputModule.cc.

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

Definition at line 680 of file OutputModule.cc.

681  {
682  auto const bt = pd.branchType();
683  assert(groupSelector_[bt]);
684  return groupSelector_[bt]->selected(pd);
685  }
bt
Definition: tracks.py:83
std::array< std::unique_ptr< GroupSelector const >, NumBranchTypes > groupSelector_
Definition: OutputModule.h:235
void art::OutputModule::selectProducts ( ProductTables const &  tables)

Definition at line 168 of file OutputModule.cc.

169  {
170  doSelectProducts(tables);
172  }
void doSelectProducts(ProductTables const &)
virtual void postSelectProducts()
void art::OutputModule::setFileStatus ( OutputFileStatus  )
privatevirtual

Definition at line 507 of file OutputModule.cc.

508  {}
void art::OutputModule::setRunAuxiliaryRangeSetID ( RangeSet const &  )
privatevirtual

Definition at line 469 of file OutputModule.cc.

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

Definition at line 473 of file OutputModule.cc.

474  {}
void art::OutputModule::startEndFile ( )
privatevirtual

Definition at line 511 of file OutputModule.cc.

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

Definition at line 391 of file OutputModule.cc.

392  {
393  // Note: threading: We are implicitly using the Principal
394  // iterators here which iterate over the groups held
395  // by the principal, which may be updated by a producer
396  // task in another stream while we are iterating! But
397  // only for Run, SubRun, and Results principals, in the
398  // case of Event principals we arrange that no producer
399  // or filter tasks are running when we run. So since we
400  // are only called for event principals we are safe.
401  //
402  // Note: threading: We update branchParents_ and
403  // branchChildren_ here which must be protected if we
404  // become a stream or global module.
405  //
406  for (auto const& pid_and_uptr_to_grp : ep) {
407  auto const& group = *pid_and_uptr_to_grp.second;
408  if (group.productProvenance()) {
409  ProductID const pid = pid_and_uptr_to_grp.first;
410  auto iter = branchParents_.find(pid);
411  if (iter == branchParents_.end()) {
412  iter = branchParents_.emplace(pid, set<ParentageID>{}).first;
413  }
414  iter->second.insert(group.productProvenance()->parentageID());
416  }
417  }
418  }
BranchChildren branchChildren_
Definition: OutputModule.h:242
void insertEmpty(ProductID parent)
std::map< ProductID, std::set< ParentageID > > branchParents_
Definition: OutputModule.h:241
string art::OutputModule::workerType ( ) const
private

Definition at line 94 of file OutputModule.cc.

95  {
96  return "OutputWorker";
97  }
virtual void art::OutputModule::write ( EventPrincipal e)
privatepure virtual
void art::OutputModule::writeBranchIDListRegistry ( )
privatevirtual

Definition at line 543 of file OutputModule.cc.

544  {}
void art::OutputModule::writeEventHistory ( )
privatevirtual

Definition at line 527 of file OutputModule.cc.

528  {}
void art::OutputModule::writeFileCatalogMetadata ( )
private

Definition at line 596 of file OutputModule.cc.

597  {
598  // Obtain metadata from service for output.
600  ServiceHandle<FileCatalogMetadata const> {}
601  ->getMetadata(md);
602  if (!dataTier_.empty()) {
603  md.emplace_back("data_tier", cet::canonical_string(dataTier_));
604  }
605  if (!streamName_.empty()) {
606  md.emplace_back("data_stream", cet::canonical_string(streamName_));
607  }
608  // Ask any plugins for their list of metadata, and put it in a
609  // separate list for the output module. The user stream-specific
610  // metadata should override stream-specific metadata generated by the
611  // output module iself.
613  collectStreamSpecificMetadata(plugins_, pluginNames_, ssmd);
614  doWriteFileCatalogMetadata(md, ssmd);
615  }
std::vector< std::pair< std::string, std::string >> collection_type
std::string streamName_
Definition: OutputModule.h:245
std::vector< std::string > pluginNames_
Definition: OutputModule.h:250
PluginCollection_t plugins_
Definition: OutputModule.h:251
std::string dataTier_
Definition: OutputModule.h:244
bool canonical_string(std::string const &str, std::string &result)
virtual void doWriteFileCatalogMetadata(FileCatalogMetadata::collection_type const &md, FileCatalogMetadata::collection_type const &ssmd)
void art::OutputModule::writeFileFormatVersion ( )
privatevirtual

Definition at line 515 of file OutputModule.cc.

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

Definition at line 519 of file OutputModule.cc.

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

Definition at line 523 of file OutputModule.cc.

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

Definition at line 539 of file OutputModule.cc.

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

Definition at line 547 of file OutputModule.cc.

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

Definition at line 531 of file OutputModule.cc.

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

Definition at line 535 of file OutputModule.cc.

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

Definition at line 624 of file OutputModule.cc.

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

Definition at line 551 of file OutputModule.cc.

552  {}
virtual void art::OutputModule::writeRun ( RunPrincipal r)
privatepure virtual
virtual void art::OutputModule::writeSubRun ( SubRunPrincipal sr)
privatepure virtual

Friends And Related Function Documentation

friend class OutputWorker
friend

Definition at line 50 of file OutputModule.h.

friend class WorkerT< OutputModule >
friend

Definition at line 49 of file OutputModule.h.

Member Data Documentation

BranchChildren art::OutputModule::branchChildren_ {}
private

Definition at line 242 of file OutputModule.h.

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

Definition at line 241 of file OutputModule.h.

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

Definition at line 246 of file OutputModule.h.

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

Definition at line 243 of file OutputModule.h.

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

Definition at line 244 of file OutputModule.h.

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

Definition at line 235 of file OutputModule.h.

GroupSelectorRules art::OutputModule::groupSelectorRules_
private

Definition at line 237 of file OutputModule.h.

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

Definition at line 236 of file OutputModule.h.

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

Definition at line 233 of file OutputModule.h.

int art::OutputModule::maxEvents_ {-1}
private

Definition at line 238 of file OutputModule.h.

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

Definition at line 247 of file OutputModule.h.

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

Definition at line 250 of file OutputModule.h.

PluginCollection_t art::OutputModule::plugins_
private

Definition at line 251 of file OutputModule.h.

int art::OutputModule::remainingEvents_ {maxEvents_}
private

Definition at line 239 of file OutputModule.h.

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

Definition at line 245 of file OutputModule.h.


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