LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
art::OutputModule Class Referenceabstract

#include "OutputModule.h"

Inheritance diagram for art::OutputModule:
art::EventObserverBase art::Consumer art::FileDumperOutput art::ProvenanceCheckerOutput art::ProvenanceDumper< DETAIL, Enable > art::ProvenanceDumper< DETAIL,                                                                                                                                                                                   cet::enable_if_type_exists_t< typename DETAIL::Config > > art::RootOutput

Classes

struct  Config
 

Public Types

using ModuleType = OutputModule
 
using WorkerType = OutputWorker
 

Public Member Functions

 OutputModule (OutputModule const &)=delete
 
OutputModuleoperator= (OutputModule const &)=delete
 
 OutputModule (fhicl::TableFragment< Config > const &pset, fhicl::ParameterSet const &containing_pset)
 
 OutputModule (fhicl::ParameterSet const &pset)
 
virtual ~OutputModule () noexcept=default
 
int maxEvents () const
 
int remainingEvents () const
 
bool fileIsOpen () const
 
OutputFileStatus fileStatus () const
 
virtual std::string const & lastClosedFileName () const
 
bool selected (BranchDescription const &) const
 
SelectionsArray const & keptProducts () const
 
std::array< bool, NumBranchTypes > const & hasNewlyDroppedBranch () const
 
BranchChildren const & branchChildren () const
 
void selectProducts (ProductList const &)
 
void registerProducts (MasterProductRegistry &, ProductDescriptions &, ModuleDescription const &)
 
bool modifiesEvent () const
 
std::string const & processName () const
 
bool wantAllEvents () const
 
bool wantEvent (Event const &e)
 
fhicl::ParameterSetID selectorConfig () const
 
art::Handle< art::TriggerResultsgetTriggerResults (Event const &e) const
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< T > consumes (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< T > consumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< T > mayConsume (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< T > mayConsumeView (InputTag const &it)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Protected Member Functions

CurrentProcessingContext const * currentContext () const
 
ModuleDescription const & description () const
 
virtual void postSelectProducts ()
 
virtual void doRegisterProducts (MasterProductRegistry &, ProductDescriptions &, ModuleDescription const &)
 
detail::CachedProductscachedProducts ()
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Types

using BranchParents = std::map< ProductID, std::set< ParentageID >>
 
using PluginCollection_t = std::vector< std::unique_ptr< FileCatalogMetadataPlugin >>
 

Private Member Functions

void configure (OutputModuleDescription const &desc)
 
void doBeginJob ()
 
void doEndJob ()
 
bool doEvent (EventPrincipal const &ep, CurrentProcessingContext const *cpc, CountingStatistics &)
 
bool doBeginRun (RunPrincipal const &rp, CurrentProcessingContext const *cpc)
 
bool doEndRun (RunPrincipal const &rp, CurrentProcessingContext const *cpc)
 
bool doBeginSubRun (SubRunPrincipal const &srp, CurrentProcessingContext const *cpc)
 
bool doEndSubRun (SubRunPrincipal const &srp, CurrentProcessingContext const *cpc)
 
void doWriteRun (RunPrincipal &rp)
 
void doWriteSubRun (SubRunPrincipal &srp)
 
void doWriteEvent (EventPrincipal &ep)
 
void doSetRunAuxiliaryRangeSetID (RangeSet const &)
 
void doSetSubRunAuxiliaryRangeSetID (RangeSet const &)
 
void doOpenFile (FileBlock const &fb)
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
void doSelectProducts (ProductList const &)
 
std::string workerType () const
 
void doCloseFile ()
 
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 setModuleDescription (ModuleDescription const &md)
 
void updateBranchParents (EventPrincipal const &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 writeParentageRegistry ()
 
virtual void writeProductDescriptionRegistry ()
 
void writeFileCatalogMetadata ()
 
virtual void doWriteFileCatalogMetadata (FileCatalogMetadata::collection_type const &md, FileCatalogMetadata::collection_type const &ssmd)
 
virtual void writeProductDependencies ()
 
virtual void writeBranchMapper ()
 
virtual void finishEndFile ()
 
PluginCollection_t makePlugins_ (fhicl::ParameterSet const &top_pset)
 

Private Attributes

SelectionsArray keptProducts_ {{}}
 
std::array< bool, NumBranchTypeshasNewlyDroppedBranch_
 
GroupSelectorRules groupSelectorRules_
 
std::unique_ptr< GroupSelector const > groupSelector_ {nullptr}
 
int maxEvents_ {-1}
 
int remainingEvents_ {maxEvents_}
 
ModuleDescription moduleDescription_ {}
 
cet::exempt_ptr< CurrentProcessingContext const > current_context_ {nullptr}
 
BranchParents 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

template<typename T >
class WorkerT
 
class OutputWorker
 

Detailed Description

Definition at line 53 of file OutputModule.h.

Member Typedef Documentation

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

Definition at line 168 of file OutputModule.h.

Definition at line 61 of file OutputModule.h.

using art::OutputModule::PluginCollection_t = std::vector<std::unique_ptr<FileCatalogMetadataPlugin>>
private

Definition at line 182 of file OutputModule.h.

Definition at line 62 of file OutputModule.h.

Constructor & Destructor Documentation

art::OutputModule::OutputModule ( OutputModule const &  )
delete
art::OutputModule::OutputModule ( fhicl::TableFragment< Config > const &  pset,
fhicl::ParameterSet const &  containing_pset 
)
explicit

Definition at line 34 of file OutputModule.cc.

References configuredFileName_, dataTier_, groupSelectorRules_, makePlugins_(), plugins_, and streamName_.

36  : EventObserverBase{config().eoFragment().selectEvents(), containing_pset}
37  , groupSelectorRules_{config().outputCommands(),
38  "outputCommands",
39  "OutputModule"}
40  , configuredFileName_{config().fileName()}
41  , dataTier_{config().dataTier()}
42  , streamName_{config().streamName()}
43  , plugins_{makePlugins_(containing_pset)}
44 {}
std::string streamName_
Definition: OutputModule.h:175
GroupSelectorRules groupSelectorRules_
Definition: OutputModule.h:160
PluginCollection_t plugins_
Definition: OutputModule.h:183
PluginCollection_t makePlugins_(fhicl::ParameterSet const &top_pset)
std::string configuredFileName_
Definition: OutputModule.h:173
std::string dataTier_
Definition: OutputModule.h:174
EventObserverBase(std::vector< std::string > const &paths, fhicl::ParameterSet const &config)
art::OutputModule::OutputModule ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 46 of file OutputModule.cc.

References configuredFileName_, dataTier_, groupSelectorRules_, makePlugins_(), plugins_, and streamName_.

47  : EventObserverBase{pset}
48  , groupSelectorRules_{pset.get<vector<string>>("outputCommands", {"keep *"}),
49  "outputCommands",
50  "OutputModule"}
51  , configuredFileName_{pset.get<string>("fileName", "")}
52  , dataTier_{pset.get<string>("dataTier", "")}
53  , streamName_{pset.get<string>("streamName", "")}
54  , plugins_{makePlugins_(pset)}
55 {}
std::string streamName_
Definition: OutputModule.h:175
GroupSelectorRules groupSelectorRules_
Definition: OutputModule.h:160
PluginCollection_t plugins_
Definition: OutputModule.h:183
PluginCollection_t makePlugins_(fhicl::ParameterSet const &top_pset)
std::string configuredFileName_
Definition: OutputModule.h:173
std::string dataTier_
Definition: OutputModule.h:174
EventObserverBase(std::vector< std::string > const &paths, fhicl::ParameterSet const &config)
virtual art::OutputModule::~OutputModule ( )
virtualdefaultnoexcept

Member Function Documentation

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

Reimplemented in art::RootOutput.

Definition at line 373 of file OutputModule.cc.

Referenced by doBeginRun(), and fileGranularity().

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

Reimplemented in art::RootOutput.

Definition at line 381 of file OutputModule.cc.

Referenced by doBeginSubRun(), and fileGranularity().

382 {}
art::BranchChildren const & art::OutputModule::branchChildren ( ) const
inline

Definition at line 349 of file OutputModule.h.

References branchChildren_.

Referenced by fileIsOpen(), and art::RootOutputFile::writeProductDependencies().

350 {
351  return branchChildren_;
352 }
BranchChildren branchChildren_
Definition: OutputModule.h:171
detail::CachedProducts& art::EventObserverBase::cachedProducts ( )
inlineprotectedinherited

Definition at line 79 of file EventObserverBase.h.

References art::EventObserverBase::selectors_.

Referenced by art::EDAnalyzer::doEvent(), and doWriteEvent().

80  {
81  return selectors_;
82  }
detail::CachedProducts selectors_
void art::OutputModule::configure ( OutputModuleDescription const &  desc)
private

Definition at line 64 of file OutputModule.cc.

References art::OutputModuleDescription::maxEvents_, maxEvents_, and remainingEvents_.

Referenced by art::OutputWorker::configure().

65 {
66  remainingEvents_ = maxEvents_ = desc.maxEvents_;
67 }
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::consumes ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::consumes ( InputTag const &  it)
inherited

Definition at line 147 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

148 {
149  if (!moduleContext_)
150  return ProductToken<T>::invalid();
151 
152  consumables_[BT].emplace_back(ConsumableType::Product,
153  TypeID{typeid(T)},
154  it.label(),
155  it.instance(),
156  it.process());
157  return ProductToken<T>{it};
158 }
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename T , art::BranchType BT>
void art::Consumer::consumesMany ( )
inherited

Definition at line 162 of file Consumer.h.

163 {
164  if (!moduleContext_)
165  return;
166 
167  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
168 }
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::consumesView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::consumesView ( InputTag const &  it)
inherited

Definition at line 172 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

173 {
174  if (!moduleContext_)
175  return ViewToken<T>::invalid();
176 
177  consumables_[BT].emplace_back(ConsumableType::ViewElement,
178  TypeID{typeid(T)},
179  it.label(),
180  it.instance(),
181  it.process());
182  return ViewToken<T>{it};
183 }
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
art::CurrentProcessingContext const * art::OutputModule::currentContext ( ) const
inlineprotected

Definition at line 305 of file OutputModule.h.

References current_context_.

Referenced by fileIsOpen().

306 {
307  return current_context_.get();
308 }
cet::exempt_ptr< CurrentProcessingContext const > current_context_
Definition: OutputModule.h:166
art::ModuleDescription const & art::OutputModule::description ( ) const
inlineprotected

Definition at line 311 of file OutputModule.h.

References moduleDescription_.

Referenced by doRespondToOpenInputFile(), fileIsOpen(), makePlugins_(), and art::RootOutput::startEndFile().

312 {
313  return moduleDescription_;
314 }
ModuleDescription moduleDescription_
Definition: OutputModule.h:165
void art::OutputModule::doBeginJob ( )
private

Definition at line 123 of file OutputModule.cc.

References beginJob(), and plugins_.

124 {
125  beginJob();
126  cet::for_all(plugins_, [](auto& p) { p->doBeginJob(); });
127 }
PluginCollection_t plugins_
Definition: OutputModule.h:183
virtual void beginJob()
bool art::OutputModule::doBeginRun ( RunPrincipal const &  rp,
CurrentProcessingContext const *  cpc 
)
private

Definition at line 130 of file OutputModule.cc.

References beginRun(), current_context_, FDEBUG, moduleDescription_, art::Consumer::non_module_context(), and plugins_.

132 {
133  detail::CPCSentry sentry{current_context_, cpc};
134  FDEBUG(2) << "beginRun called\n";
135  beginRun(rp);
137  cet::for_all(plugins_, [&r](auto& p) { p->doBeginRun(r); });
138  return true;
139 }
static cet::exempt_ptr< Consumer > non_module_context()
Definition: Consumer.cc:76
virtual void beginRun(RunPrincipal const &)
PluginCollection_t plugins_
Definition: OutputModule.h:183
ModuleDescription moduleDescription_
Definition: OutputModule.h:165
cet::exempt_ptr< CurrentProcessingContext const > current_context_
Definition: OutputModule.h:166
#define FDEBUG(lev)
Definition: DebugMacros.h:26
bool art::OutputModule::doBeginSubRun ( SubRunPrincipal const &  srp,
CurrentProcessingContext const *  cpc 
)
private

Definition at line 142 of file OutputModule.cc.

References beginSubRun(), current_context_, FDEBUG, moduleDescription_, art::Consumer::non_module_context(), and plugins_.

144 {
145  detail::CPCSentry sentry{current_context_, cpc};
146  FDEBUG(2) << "beginSubRun called\n";
147  beginSubRun(srp);
149  cet::for_all(plugins_, [&sr](auto& p) { p->doBeginSubRun(sr); });
150  return true;
151 }
static cet::exempt_ptr< Consumer > non_module_context()
Definition: Consumer.cc:76
PluginCollection_t plugins_
Definition: OutputModule.h:183
ModuleDescription moduleDescription_
Definition: OutputModule.h:165
cet::exempt_ptr< CurrentProcessingContext const > current_context_
Definition: OutputModule.h:166
#define FDEBUG(lev)
Definition: DebugMacros.h:26
virtual void beginSubRun(SubRunPrincipal const &)
void art::OutputModule::doCloseFile ( )
private

Definition at line 297 of file OutputModule.cc.

References isFileOpen(), and reallyCloseFile().

Referenced by art::OutputWorker::closeFile(), and workerType().

298 {
299  if (isFileOpen()) {
300  reallyCloseFile();
301  }
302 }
virtual bool isFileOpen() const
void art::OutputModule::doEndJob ( )
private

Definition at line 252 of file OutputModule.cc.

References endJob(), and plugins_.

253 {
254  endJob();
255  cet::for_all(plugins_, [](auto& p) { p->doEndJob(); });
256 }
PluginCollection_t plugins_
Definition: OutputModule.h:183
virtual void endJob()
bool art::OutputModule::doEndRun ( RunPrincipal const &  rp,
CurrentProcessingContext const *  cpc 
)
private

Definition at line 233 of file OutputModule.cc.

References current_context_, endRun(), FDEBUG, moduleDescription_, art::Consumer::non_module_context(), and plugins_.

235 {
236  detail::CPCSentry sentry{current_context_, cpc};
237  FDEBUG(2) << "endRun called\n";
238  endRun(rp);
240  cet::for_all(plugins_, [&r](auto& p) { p->doEndRun(r); });
241  return true;
242 }
static cet::exempt_ptr< Consumer > non_module_context()
Definition: Consumer.cc:76
virtual void endRun(RunPrincipal const &)
PluginCollection_t plugins_
Definition: OutputModule.h:183
ModuleDescription moduleDescription_
Definition: OutputModule.h:165
cet::exempt_ptr< CurrentProcessingContext const > current_context_
Definition: OutputModule.h:166
#define FDEBUG(lev)
Definition: DebugMacros.h:26
bool art::OutputModule::doEndSubRun ( SubRunPrincipal const &  srp,
CurrentProcessingContext const *  cpc 
)
private

Definition at line 207 of file OutputModule.cc.

References current_context_, endSubRun(), FDEBUG, moduleDescription_, art::Consumer::non_module_context(), and plugins_.

209 {
210  detail::CPCSentry sentry{current_context_, cpc};
211  FDEBUG(2) << "endSubRun called\n";
212  endSubRun(srp);
214  cet::for_all(plugins_, [&sr](auto& p) { p->doEndSubRun(sr); });
215  return true;
216 }
static cet::exempt_ptr< Consumer > non_module_context()
Definition: Consumer.cc:76
PluginCollection_t plugins_
Definition: OutputModule.h:183
ModuleDescription moduleDescription_
Definition: OutputModule.h:165
virtual void endSubRun(SubRunPrincipal const &)
cet::exempt_ptr< CurrentProcessingContext const > current_context_
Definition: OutputModule.h:166
#define FDEBUG(lev)
Definition: DebugMacros.h:26
bool art::OutputModule::doEvent ( EventPrincipal const &  ep,
CurrentProcessingContext const *  cpc,
CountingStatistics counts 
)
private

Definition at line 154 of file OutputModule.cc.

References current_context_, e, event(), FDEBUG, art::ExecutionCounts< ARGS >::increment(), moduleDescription_, art::EventObserverBase::wantAllEvents(), and art::EventObserverBase::wantEvent().

157 {
158  detail::CPCSentry sentry{current_context_, cpc};
159  FDEBUG(2) << "doEvent called\n";
160  Event const e{ep, moduleDescription_, this};
161  if (wantAllEvents() || wantEvent(e)) {
162  // Run is incremented before event(ep); to properly count whenever
163  // an exception is thrown in the user's module.
164  counts.increment<stats::Run>();
165  event(ep);
166  counts.increment<stats::Passed>();
167  }
168  return true;
169 }
virtual void event(EventPrincipal const &)
bool wantEvent(Event const &e)
ModuleDescription moduleDescription_
Definition: OutputModule.h:165
cet::exempt_ptr< CurrentProcessingContext const > current_context_
Definition: OutputModule.h:166
#define FDEBUG(lev)
Definition: DebugMacros.h:26
Float_t e
Definition: plot.C:34
void art::OutputModule::doOpenFile ( FileBlock const &  fb)
private

Definition at line 259 of file OutputModule.cc.

References openFile().

Referenced by art::OutputWorker::openFile().

260 {
261  openFile(fb);
262 }
TFile fb("Li6.root")
virtual void openFile(FileBlock const &)
void art::OutputModule::doRegisterProducts ( MasterProductRegistry ,
ProductDescriptions ,
ModuleDescription const &   
)
protectedvirtual

Reimplemented in art::RootOutput.

Definition at line 117 of file OutputModule.cc.

Referenced by fileIsOpen(), and registerProducts().

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

Definition at line 279 of file OutputModule.cc.

References respondToCloseInputFile().

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

Definition at line 291 of file OutputModule.cc.

References respondToCloseOutputFiles().

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

Definition at line 265 of file OutputModule.cc.

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

266 {
268  std::unique_ptr<ResultsPrincipal> respHolder;
269  art::ResultsPrincipal const* respPtr = fb.resultsPrincipal();
270  if (respPtr == nullptr) {
271  respHolder = std::make_unique<ResultsPrincipal>(
272  ResultsAuxiliary{}, description().processConfiguration(), nullptr);
273  respPtr = respHolder.get();
274  }
275  readResults(*respPtr);
276 }
virtual void readResults(ResultsPrincipal const &resp)
virtual void respondToOpenInputFile(FileBlock const &)
TFile fb("Li6.root")
ModuleDescription const & description() const
Definition: OutputModule.h:311
ProcessConfiguration const & processConfiguration() const
void art::OutputModule::doRespondToOpenOutputFiles ( FileBlock const &  fb)
private

Definition at line 285 of file OutputModule.cc.

References respondToOpenOutputFiles().

286 {
288 }
virtual void respondToOpenOutputFiles(FileBlock const &)
TFile fb("Li6.root")
void art::OutputModule::doSelectProducts ( ProductList const &  productList)
private

Definition at line 70 of file OutputModule.cc.

References art::BranchDescription::branchType(), art::BranchDescription::dropped(), groupSelector_, groupSelectorRules_, hasNewlyDroppedBranch_, keptProducts_, selected(), and art::BranchDescription::transient().

Referenced by selectProducts().

71 {
72  // These variables cause problems for MT. This function must be
73  // called in a single-threaded context.
75  std::make_unique<GroupSelector const>(groupSelectorRules_, productList);
76  keptProducts_ = {{}};
77 
78  // TODO: See if we can collapse keptProducts_ and groupSelector into
79  // a single object. See the notes in the header for GroupSelector
80  // for more information.
81 
82  for (auto const& val : productList) {
83  BranchDescription const& pd = val.second;
84  auto const bt = pd.branchType();
85  if (pd.transient() || pd.dropped()) {
86  continue;
87  }
88  if (selected(pd)) {
89  keptProducts_[bt].push_back(&pd);
90  continue;
91  }
92  // Newly dropped, skip it.
93  hasNewlyDroppedBranch_[bt] = true;
94  }
95 }
std::unique_ptr< GroupSelector const > groupSelector_
Definition: OutputModule.h:161
GroupSelectorRules groupSelectorRules_
Definition: OutputModule.h:160
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
Definition: OutputModule.h:158
SelectionsArray keptProducts_
Definition: OutputModule.h:157
bool selected(BranchDescription const &) const
Definition: OutputModule.h:329
void art::OutputModule::doSetRunAuxiliaryRangeSetID ( RangeSet const &  ranges)
private

Definition at line 226 of file OutputModule.cc.

References FDEBUG, and setRunAuxiliaryRangeSetID().

Referenced by art::OutputWorker::setRunAuxiliaryRangeSetID().

227 {
228  FDEBUG(2) << "writeAuxiliaryRangeSets(rp) called\n";
230 }
virtual void setRunAuxiliaryRangeSetID(RangeSet const &)
#define FDEBUG(lev)
Definition: DebugMacros.h:26
void art::OutputModule::doSetSubRunAuxiliaryRangeSetID ( RangeSet const &  ranges)
private

Definition at line 201 of file OutputModule.cc.

References setSubRunAuxiliaryRangeSetID().

Referenced by art::OutputWorker::setSubRunAuxiliaryRangeSetID().

202 {
204 }
virtual void setSubRunAuxiliaryRangeSetID(RangeSet const &)
void art::OutputModule::doWriteEvent ( EventPrincipal ep)
private

Definition at line 172 of file OutputModule.cc.

References art::EventObserverBase::cachedProducts(), ci_, e, FDEBUG, art::EventObserverBase::getTriggerResults(), art::EventPrincipal::id(), moduleDescription_, art::ModuleDescription::moduleLabel(), art::Consumer::non_module_context(), plugins_, remainingEvents_, updateBranchParents(), art::EventObserverBase::wantAllEvents(), art::EventObserverBase::wantEvent(), and write().

Referenced by art::OutputWorker::writeEvent().

173 {
174  detail::PVSentry clearTriggerResults{cachedProducts()};
175  FDEBUG(2) << "writeEvent called\n";
176  Event const e{ep, moduleDescription_, this};
177  if (wantAllEvents() || wantEvent(e)) {
178  write(ep); // Write the event.
179  // Declare that the event was selected for write to the catalog
180  // interface
182  auto const& trRef(trHandle.isValid() ?
183  static_cast<HLTGlobalStatus>(*trHandle) :
184  HLTGlobalStatus{});
185  ci_->eventSelected(moduleDescription_.moduleLabel(), ep.id(), trRef);
186  // ... and invoke the plugins:
187  // ... The transactional object presented to the plugins is
188  // different since the relevant context information is not the
189  // same for the consumes functionality.
191  cet::for_all(plugins_, [&we](auto& p) { p->doCollectMetadata(we); });
192  // Finish.
194  if (remainingEvents_ > 0) {
196  }
197  }
198 }
bool wantEvent(Event const &e)
static cet::exempt_ptr< Consumer > non_module_context()
Definition: Consumer.cc:76
PluginCollection_t plugins_
Definition: OutputModule.h:183
ModuleDescription moduleDescription_
Definition: OutputModule.h:165
art::Handle< art::TriggerResults > getTriggerResults(Event const &e) const
virtual void write(EventPrincipal &e)=0
ServiceHandle< CatalogInterface > ci_
Definition: OutputModule.h:176
std::string const & moduleLabel() const
detail::CachedProducts & cachedProducts()
#define FDEBUG(lev)
Definition: DebugMacros.h:26
Float_t e
Definition: plot.C:34
void updateBranchParents(EventPrincipal const &ep)
void art::OutputModule::doWriteFileCatalogMetadata ( FileCatalogMetadata::collection_type const &  md,
FileCatalogMetadata::collection_type const &  ssmd 
)
privatevirtual

Reimplemented in art::RootOutput.

Definition at line 535 of file OutputModule.cc.

Referenced by fileGranularity(), and writeFileCatalogMetadata().

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

Definition at line 245 of file OutputModule.cc.

References FDEBUG, and writeRun().

Referenced by art::OutputWorker::writeRun().

246 {
247  FDEBUG(2) << "writeRun called\n";
248  writeRun(rp);
249 }
virtual void writeRun(RunPrincipal &r)=0
#define FDEBUG(lev)
Definition: DebugMacros.h:26
void art::OutputModule::doWriteSubRun ( SubRunPrincipal srp)
private

Definition at line 219 of file OutputModule.cc.

References FDEBUG, and writeSubRun().

Referenced by art::OutputWorker::writeSubRun().

220 {
221  FDEBUG(2) << "writeSubRun called\n";
222  writeSubRun(srp);
223 }
virtual void writeSubRun(SubRunPrincipal &sr)=0
#define FDEBUG(lev)
Definition: DebugMacros.h:26
void art::OutputModule::endJob ( )
privatevirtual
void art::OutputModule::endRun ( RunPrincipal const &  )
privatevirtual

Reimplemented in art::RootOutput.

Definition at line 377 of file OutputModule.cc.

Referenced by doEndRun(), and fileGranularity().

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

Reimplemented in art::RootOutput.

Definition at line 385 of file OutputModule.cc.

Referenced by doEndSubRun(), and fileGranularity().

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

Reimplemented in art::RootOutput.

Definition at line 369 of file OutputModule.cc.

Referenced by doEvent(), and fileGranularity().

370 {}
bool art::OutputModule::fileIsOpen ( ) const
inline
OutputFileStatus art::OutputModule::fileStatus ( ) const

Referenced by fileIsOpen().

void art::OutputModule::fillDependencyGraph ( )
private

Definition at line 344 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 fileGranularity(), and reallyCloseFile().

345 {
346  for (auto const& bp : branchParents_) {
347  ProductID const child = bp.first;
348  std::set<ParentageID> const& eIds = bp.second;
349  for (auto const& eId : eIds) {
350  Parentage par;
351  if (!ParentageRegistry::get(eId, par)) {
352  continue;
353  }
354  for (auto const& p : par.parents())
355  branchChildren_.insertChild(p, child);
356  }
357  }
358 }
BranchChildren branchChildren_
Definition: OutputModule.h:171
static collection_type const & get()
void insertChild(ProductID parent, ProductID child)
BranchParents branchParents_
Definition: OutputModule.h:169
void art::OutputModule::finishEndFile ( )
privatevirtual

Reimplemented in art::RootOutput.

Definition at line 549 of file OutputModule.cc.

Referenced by fileGranularity(), and reallyCloseFile().

550 {}
art::Handle<art::TriggerResults> art::EventObserverBase::getTriggerResults ( Event const &  e) const
inlineinherited

Definition at line 61 of file EventObserverBase.h.

References art::detail::CachedProducts::getOneTriggerResults(), and art::EventObserverBase::selectors_.

Referenced by doWriteEvent().

62  {
64  }
detail::CachedProducts selectors_
art::Handle< art::TriggerResults > getOneTriggerResults(Event const &) const
Float_t e
Definition: plot.C:34
auto art::OutputModule::hasNewlyDroppedBranch ( ) const
inline

Definition at line 342 of file OutputModule.h.

References hasNewlyDroppedBranch_.

Referenced by fileIsOpen(), art::RootOutput::startEndFile(), art::RootOutput::write(), art::RootOutput::writeRun(), and art::RootOutput::writeSubRun().

344 {
345  return hasNewlyDroppedBranch_;
346 }
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
Definition: OutputModule.h:158
virtual void art::OutputModule::incrementInputFileNumber ( )
inlineprivatevirtual

Reimplemented in art::RootOutput.

Definition at line 227 of file OutputModule.h.

Referenced by art::OutputWorker::incrementInputFileNumber().

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

Reimplemented in art::RootOutput.

Definition at line 421 of file OutputModule.cc.

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

422 {
423  return true;
424 }
auto art::OutputModule::keptProducts ( ) const
inline

Definition at line 336 of file OutputModule.h.

References keptProducts_.

Referenced by fileIsOpen(), and art::RootOutputFile::selectProducts().

337 {
338  return keptProducts_;
339 }
SelectionsArray keptProducts_
Definition: OutputModule.h:157
string const & art::OutputModule::lastClosedFileName ( ) const
virtual

Reimplemented in art::RootOutput.

Definition at line 58 of file OutputModule.cc.

References configuredFileName_.

Referenced by fileIsOpen(), and art::OutputWorker::lastClosedFileName().

59 {
60  return configuredFileName_;
61 }
std::string configuredFileName_
Definition: OutputModule.h:173
bool art::OutputModule::limitReached ( ) const
inlineprivate

Definition at line 361 of file OutputModule.h.

References remainingEvents_.

Referenced by fileGranularity(), and art::OutputWorker::limitReached().

362 {
363  return remainingEvents_ == 0;
364 }
auto art::OutputModule::makePlugins_ ( fhicl::ParameterSet const &  top_pset)
private

Definition at line 553 of file OutputModule.cc.

References art::errors::Configuration, description(), e, art::ModuleDescription::moduleLabel(), pluginFactory_, pluginNames_, and fhicl::detail::atom::value().

Referenced by fileGranularity(), and OutputModule().

555 {
556  auto const psets = top_pset.get<vector<ParameterSet>>("FCMDPlugins", {});
557  PluginCollection_t result;
558  result.reserve(psets.size());
559  size_t count{0};
560  try {
561  for (auto const& pset : psets) {
562  pluginNames_.emplace_back(pset.get<string>("plugin_type"));
563  auto const& libspec = pluginNames_.back();
564  auto const pluginType = pluginFactory_.pluginType(libspec);
565  if (pluginType ==
567  result.emplace_back(
568  pluginFactory_.makePlugin<std::unique_ptr<FileCatalogMetadataPlugin>>(
569  libspec, pset));
570  } else {
571  throw Exception(errors::Configuration, "OutputModule: ")
572  << "unrecognized plugin type " << pluginType << ".\n";
573  }
574  ++count;
575  }
576  }
577  catch (cet::exception& e) {
578  throw Exception(errors::Configuration, "OutputModule: ", e)
579  << "Exception caught while processing FCMDPlugins[" << count
580  << "] in module " << description().moduleLabel() << ".\n";
581  }
582  return result;
583 }
std::vector< std::string > pluginNames_
Definition: OutputModule.h:179
std::vector< std::unique_ptr< FileCatalogMetadataPlugin >> PluginCollection_t
Definition: OutputModule.h:182
ModuleDescription const & description() const
Definition: OutputModule.h:311
std::string const & moduleLabel() const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
cet::BasicPluginFactory pluginFactory_
Definition: OutputModule.h:178
std::string value(boost::any const &)
Float_t e
Definition: plot.C:34
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
int art::OutputModule::maxEvents ( ) const
inline

Definition at line 317 of file OutputModule.h.

References maxEvents_.

318 {
319  return maxEvents_;
320 }
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::mayConsume ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::mayConsume ( InputTag const &  it)
inherited

Definition at line 190 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

191 {
192  if (!moduleContext_)
193  return ProductToken<T>::invalid();
194 
195  consumables_[BT].emplace_back(ConsumableType::Product,
196  TypeID{typeid(T)},
197  it.label(),
198  it.instance(),
199  it.process());
200  return ProductToken<T>{it};
201 }
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )
inherited

Definition at line 205 of file Consumer.h.

206 {
207  if (!moduleContext_)
208  return;
209 
210  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
211 }
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::mayConsumeView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::mayConsumeView ( InputTag const &  it)
inherited

Definition at line 215 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

216 {
217  if (!moduleContext_)
218  return ViewToken<T>::invalid();
219 
220  consumables_[BT].emplace_back(ConsumableType::ViewElement,
221  TypeID{typeid(T)},
222  it.label(),
223  it.instance(),
224  it.process());
225  return ViewToken<T>{it};
226 }
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
bool art::EventObserverBase::modifiesEvent ( ) const
inlineinherited

Definition at line 25 of file EventObserverBase.h.

26  {
27  return false;
28  }
void art::OutputModule::openFile ( FileBlock const &  )
privatevirtual

Reimplemented in art::RootOutput.

Definition at line 397 of file OutputModule.cc.

Referenced by doOpenFile(), and fileGranularity().

398 {}
OutputModule& art::OutputModule::operator= ( OutputModule const &  )
delete
void art::OutputModule::postSelectProducts ( )
protectedvirtual

Reimplemented in art::RootOutput.

Definition at line 113 of file OutputModule.cc.

Referenced by fileIsOpen(), and selectProducts().

114 {}
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited

Definition at line 89 of file Consumer.cc.

References fhicl::ParameterSet::get_if_present().

Referenced by art::EDProducer::doBeginJob(), art::EDFilter::doBeginJob(), and art::EDAnalyzer::doBeginJob().

90 {
91  if (!moduleContext_)
92  return;
93 
94  pset.get_if_present("errorOnMissingConsumes", requireConsumes_);
95  for (auto& consumablesPerBranch : consumables_) {
96  cet::sort_all(consumablesPerBranch);
97  }
98 }
bool requireConsumes_
Definition: Consumer.h:137
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
std::string const& art::EventObserverBase::processName ( ) const
inlineinherited
void art::OutputModule::readResults ( ResultsPrincipal const &  resp)
privatevirtual

Reimplemented in art::RootOutput, and art::FileDumperOutput.

Definition at line 405 of file OutputModule.cc.

Referenced by doRespondToOpenInputFile(), and fileGranularity().

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

Definition at line 305 of file OutputModule.cc.

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

Referenced by doCloseFile(), and workerType().

306 {
308  startEndFile();
311  writeFileIndex();
321  finishEndFile();
322  branchParents_.clear();
324 }
virtual void writeFileIdentifier()
virtual void writeProcessConfigurationRegistry()
virtual void finishEndFile()
void writeFileCatalogMetadata()
virtual void writeFileFormatVersion()
BranchChildren branchChildren_
Definition: OutputModule.h:171
virtual void writeFileIndex()
virtual void writeBranchMapper()
virtual void writeParameterSetRegistry()
virtual void writeParentageRegistry()
virtual void writeProductDescriptionRegistry()
void fillDependencyGraph()
virtual void writeEventHistory()
virtual void writeProcessHistoryRegistry()
virtual void writeProductDependencies()
virtual void startEndFile()
BranchParents branchParents_
Definition: OutputModule.h:169
void art::OutputModule::registerProducts ( MasterProductRegistry mpr,
ProductDescriptions producedProducts,
ModuleDescription const &  md 
)

Definition at line 105 of file OutputModule.cc.

References doRegisterProducts().

Referenced by fileIsOpen().

108 {
109  doRegisterProducts(mpr, producedProducts, md);
110 }
virtual void doRegisterProducts(MasterProductRegistry &, ProductDescriptions &, ModuleDescription const &)
int art::OutputModule::remainingEvents ( ) const
inline

Definition at line 323 of file OutputModule.h.

References remainingEvents_.

Referenced by art::RootOutput::respondToOpenInputFile().

324 {
325  return remainingEvents_;
326 }
virtual bool art::OutputModule::requestsToCloseFile ( ) const
inlineprivatevirtual

Reimplemented in art::RootOutput.

Definition at line 240 of file OutputModule.h.

Referenced by art::OutputWorker::requestsToCloseFile().

241  {
242  return false;
243  }
void art::OutputModule::respondToCloseInputFile ( FileBlock const &  )
privatevirtual

Reimplemented in art::RootOutput.

Definition at line 409 of file OutputModule.cc.

Referenced by doRespondToCloseInputFile(), and fileGranularity().

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

Definition at line 417 of file OutputModule.cc.

Referenced by doRespondToCloseOutputFiles(), and fileGranularity().

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

Reimplemented in art::RootOutput.

Definition at line 401 of file OutputModule.cc.

Referenced by doRespondToOpenInputFile(), and fileGranularity().

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

Definition at line 413 of file OutputModule.cc.

Referenced by doRespondToOpenOutputFiles(), and fileGranularity().

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

Definition at line 329 of file OutputModule.h.

References groupSelector_.

Referenced by doSelectProducts(), and fileIsOpen().

330 {
331  assert(groupSelector_);
332  return groupSelector_->selected(pd);
333 }
std::unique_ptr< GroupSelector const > groupSelector_
Definition: OutputModule.h:161
fhicl::ParameterSetID art::EventObserverBase::selectorConfig ( ) const
inlineinherited

Definition at line 56 of file EventObserverBase.h.

References art::EventObserverBase::selector_config_id_.

Referenced by art::RootOutputFile::writeOne().

57  {
58  return selector_config_id_;
59  }
fhicl::ParameterSetID selector_config_id_
void art::OutputModule::selectProducts ( ProductList const &  productList)

Definition at line 98 of file OutputModule.cc.

References doSelectProducts(), and postSelectProducts().

Referenced by fileIsOpen(), and art::OutputWorker::selectProducts().

99 {
100  doSelectProducts(productList);
102 }
virtual void postSelectProducts()
void doSelectProducts(ProductList const &)
Definition: OutputModule.cc:70
void art::OutputModule::setFileStatus ( OutputFileStatus  )
privatevirtual

Reimplemented in art::RootOutput.

Definition at line 427 of file OutputModule.cc.

Referenced by fileGranularity(), and art::OutputWorker::setFileStatus().

428 {}
void art::OutputModule::setModuleDescription ( ModuleDescription const &  md)
inlineprivate

Definition at line 355 of file OutputModule.h.

References moduleDescription_.

Referenced by fileGranularity().

356 {
357  moduleDescription_ = md;
358 }
ModuleDescription moduleDescription_
Definition: OutputModule.h:165
void art::OutputModule::setRunAuxiliaryRangeSetID ( RangeSet const &  )
privatevirtual

Reimplemented in art::RootOutput.

Definition at line 389 of file OutputModule.cc.

Referenced by doSetRunAuxiliaryRangeSetID(), and fileGranularity().

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

Reimplemented in art::RootOutput.

Definition at line 393 of file OutputModule.cc.

Referenced by doSetSubRunAuxiliaryRangeSetID(), and fileGranularity().

394 {}
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

Definition at line 125 of file Consumer.cc.

Referenced by art::EDProducer::doEndJob(), art::EDFilter::doEndJob(), art::EDAnalyzer::doEndJob(), and art::RootOutput::endJob().

126 {
127  if (!moduleContext_)
128  return;
129 
130  // If none of the branches have missing consumes statements, exit early.
131  if (std::all_of(cbegin(missingConsumes_),
132  cend(missingConsumes_),
133  [](auto const& perBranch) { return perBranch.empty(); }))
134  return;
135 
136  constexpr cet::HorizontalRule rule{60};
137  mf::LogPrint log{"MTdiagnostics"};
138  log << '\n'
139  << rule('=') << '\n'
140  << "The following consumes (or mayConsume) statements are missing from\n"
141  << module_context(moduleDescription_) << '\n'
142  << rule('-') << '\n';
143 
144  cet::for_all_with_index(
145  missingConsumes_, [&log](std::size_t const i, auto const& perBranch) {
146  for (auto const& pi : perBranch) {
147  log << " "
148  << assemble_consumes_statement(static_cast<BranchType>(i), pi)
149  << '\n';
150  }
151  });
152  log << rule('=');
153 }
cet::exempt_ptr< ModuleDescription const > moduleDescription_
Definition: Consumer.h:140
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
bool moduleContext_
Definition: Consumer.h:136
ConsumableProductSets missingConsumes_
Definition: Consumer.h:139
void art::OutputModule::startEndFile ( )
privatevirtual

Reimplemented in art::RootOutput.

Definition at line 431 of file OutputModule.cc.

Referenced by fileGranularity(), and reallyCloseFile().

432 {}
void art::OutputModule::updateBranchParents ( EventPrincipal const &  ep)
private

Definition at line 327 of file OutputModule.cc.

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

Referenced by doWriteEvent(), and fileGranularity().

328 {
329  for (auto const& groupPr : ep) {
330  auto const& group = *groupPr.second;
331  if (group.productProvenancePtr()) {
332  ProductID const pid = groupPr.first;
333  auto it = branchParents_.find(pid);
334  if (it == branchParents_.end()) {
335  it = branchParents_.emplace(pid, std::set<ParentageID>{}).first;
336  }
337  it->second.insert(group.productProvenancePtr()->parentageID());
339  }
340  }
341 }
BranchChildren branchChildren_
Definition: OutputModule.h:171
void insertEmpty(ProductID parent)
BranchParents branchParents_
Definition: OutputModule.h:169
void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited

Definition at line 101 of file Consumer.cc.

References art::errors::ProductRegistrationFailure.

103 {
104  // Early exits if consumes tracking has been disabled or if the
105  // consumed product is an allowed consumable.
106  if (!moduleContext_)
107  return;
108 
109  if (cet::binary_search_all(consumables_[bt], pi))
110  return;
111 
112  if (requireConsumes_) {
114  "Consumer: an error occurred during validation of a "
115  "retrieved product\n\n")
116  << "The following consumes (or mayConsume) statement is missing from\n"
117  << module_context(moduleDescription_) << ":\n\n"
118  << " " << assemble_consumes_statement(bt, pi) << "\n\n";
119  }
120 
121  missingConsumes_[bt].insert(pi);
122 }
cet::exempt_ptr< ModuleDescription const > moduleDescription_
Definition: Consumer.h:140
bool requireConsumes_
Definition: Consumer.h:137
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
ConsumableProductSets missingConsumes_
Definition: Consumer.h:139
bool art::EventObserverBase::wantAllEvents ( ) const
inlineinherited
bool art::EventObserverBase::wantEvent ( Event const &  e)
inlineinherited

Definition at line 51 of file EventObserverBase.h.

References art::EventObserverBase::selectors_, and art::detail::CachedProducts::wantEvent().

Referenced by art::EDAnalyzer::doEvent(), doEvent(), and doWriteEvent().

52  {
53  return selectors_.wantEvent(e);
54  }
detail::CachedProducts selectors_
Float_t e
Definition: plot.C:34
bool wantEvent(Event const &)
std::string art::OutputModule::workerType ( ) const
inlineprivate

Definition at line 214 of file OutputModule.h.

References doCloseFile(), and reallyCloseFile().

215  {
216  return "OutputWorker";
217  }
void art::OutputModule::writeBranchMapper ( )
privatevirtual

Definition at line 545 of file OutputModule.cc.

Referenced by fileGranularity(), and reallyCloseFile().

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

Reimplemented in art::RootOutput.

Definition at line 447 of file OutputModule.cc.

Referenced by fileGranularity(), and reallyCloseFile().

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

Definition at line 514 of file OutputModule.cc.

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

Referenced by fileGranularity(), and reallyCloseFile().

515 {
516  // Obtain metadata from service for output.
518  ServiceHandle<FileCatalogMetadata const> {}
519  ->getMetadata(md);
520  if (!dataTier_.empty()) {
521  md.emplace_back("data_tier", cet::canonical_string(dataTier_));
522  }
523  if (!streamName_.empty()) {
524  md.emplace_back("data_stream", cet::canonical_string(streamName_));
525  }
526  // Ask any plugins for their list of metadata, and put it in a
527  // separate list for the output module. The user stream-specific
528  // metadata should override stream-specific metadata generated by the
529  // output module iself.
530  collectStreamSpecificMetadata(plugins_, pluginNames_, ssmd);
531  doWriteFileCatalogMetadata(md, ssmd);
532 }
std::vector< std::pair< std::string, std::string >> collection_type
std::string streamName_
Definition: OutputModule.h:175
std::vector< std::string > pluginNames_
Definition: OutputModule.h:179
PluginCollection_t plugins_
Definition: OutputModule.h:183
std::string dataTier_
Definition: OutputModule.h:174
virtual void doWriteFileCatalogMetadata(FileCatalogMetadata::collection_type const &md, FileCatalogMetadata::collection_type const &ssmd)
void art::OutputModule::writeFileFormatVersion ( )
privatevirtual

Reimplemented in art::RootOutput.

Definition at line 435 of file OutputModule.cc.

Referenced by fileGranularity(), and reallyCloseFile().

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

Definition at line 439 of file OutputModule.cc.

Referenced by fileGranularity(), and reallyCloseFile().

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

Reimplemented in art::RootOutput.

Definition at line 443 of file OutputModule.cc.

Referenced by fileGranularity(), and reallyCloseFile().

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

Reimplemented in art::RootOutput.

Definition at line 459 of file OutputModule.cc.

Referenced by fileGranularity(), and reallyCloseFile().

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

Reimplemented in art::RootOutput.

Definition at line 463 of file OutputModule.cc.

Referenced by fileGranularity(), and reallyCloseFile().

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

Reimplemented in art::RootOutput.

Definition at line 451 of file OutputModule.cc.

Referenced by fileGranularity(), and reallyCloseFile().

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

Reimplemented in art::RootOutput.

Definition at line 455 of file OutputModule.cc.

Referenced by fileGranularity(), and reallyCloseFile().

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

Reimplemented in art::RootOutput.

Definition at line 541 of file OutputModule.cc.

Referenced by fileGranularity(), and reallyCloseFile().

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

Reimplemented in art::RootOutput.

Definition at line 467 of file OutputModule.cc.

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

Referenced by fileGranularity(), and reallyCloseFile().

468 {}

Friends And Related Function Documentation

friend class OutputWorker
friend

Definition at line 60 of file OutputModule.h.

template<typename T >
friend class WorkerT
friend

Definition at line 59 of file OutputModule.h.

Member Data Documentation

BranchChildren art::OutputModule::branchChildren_ {}
private
BranchParents art::OutputModule::branchParents_ {}
private

Definition at line 169 of file OutputModule.h.

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

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

Definition at line 176 of file OutputModule.h.

Referenced by doWriteEvent().

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

Definition at line 173 of file OutputModule.h.

Referenced by lastClosedFileName(), and OutputModule().

cet::exempt_ptr<CurrentProcessingContext const> art::OutputModule::current_context_ {nullptr}
private
std::string art::OutputModule::dataTier_
private

Definition at line 174 of file OutputModule.h.

Referenced by OutputModule(), and writeFileCatalogMetadata().

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

Definition at line 161 of file OutputModule.h.

Referenced by doSelectProducts(), and selected().

GroupSelectorRules art::OutputModule::groupSelectorRules_
private

Definition at line 160 of file OutputModule.h.

Referenced by doSelectProducts(), and OutputModule().

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

Definition at line 158 of file OutputModule.h.

Referenced by doSelectProducts(), and hasNewlyDroppedBranch().

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

Definition at line 157 of file OutputModule.h.

Referenced by doSelectProducts(), and keptProducts().

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

Definition at line 162 of file OutputModule.h.

Referenced by configure(), and maxEvents().

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

Definition at line 178 of file OutputModule.h.

Referenced by makePlugins_().

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

Definition at line 179 of file OutputModule.h.

Referenced by makePlugins_(), and writeFileCatalogMetadata().

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

Definition at line 163 of file OutputModule.h.

Referenced by configure(), doWriteEvent(), limitReached(), and remainingEvents().

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

Definition at line 175 of file OutputModule.h.

Referenced by OutputModule(), and writeFileCatalogMetadata().


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