20 #include "cetlib/canonical_string.h" 21 #include "cetlib/exempt_ptr.h" 22 #include "cetlib_except/demangle.h" 23 IGNORE_FALLTHROUGH_START
24 #include "rapidjson/document.h" 25 #include "rapidjson/error/en.h" 52 ,
dataTier_{pset.get<
string>(
"dataTier",
"")}
82 for (
auto const& val : productList) {
89 keptProducts_[bt].push_back(&pd);
126 cet::for_all(
plugins_, [](
auto& p) { p->doBeginJob(); });
134 FDEBUG(2) <<
"beginRun called\n";
137 cet::for_all(
plugins_, [&r](
auto& p) { p->doBeginRun(r); });
146 FDEBUG(2) <<
"beginSubRun called\n";
149 cet::for_all(
plugins_, [&sr](
auto& p) { p->doBeginSubRun(sr); });
159 FDEBUG(2) <<
"doEvent called\n";
175 FDEBUG(2) <<
"writeEvent called\n";
182 auto const& trRef(trHandle.isValid() ?
191 cet::for_all(
plugins_, [&we](
auto& p) { p->doCollectMetadata(we); });
211 FDEBUG(2) <<
"endSubRun called\n";
214 cet::for_all(
plugins_, [&sr](
auto& p) { p->doEndSubRun(sr); });
221 FDEBUG(2) <<
"writeSubRun called\n";
228 FDEBUG(2) <<
"writeAuxiliaryRangeSets(rp) called\n";
237 FDEBUG(2) <<
"endRun called\n";
240 cet::for_all(
plugins_, [&r](
auto& p) { p->doEndRun(r); });
247 FDEBUG(2) <<
"writeRun called\n";
255 cet::for_all(
plugins_, [](
auto& p) { p->doEndJob(); });
268 std::unique_ptr<ResultsPrincipal> respHolder;
270 if (respPtr ==
nullptr) {
271 respHolder = std::make_unique<ResultsPrincipal>(
273 respPtr = respHolder.get();
329 for (
auto const& groupPr : ep) {
330 auto const& group = *groupPr.second;
331 if (group.productProvenancePtr()) {
337 it->second.insert(group.productProvenancePtr()->parentageID());
348 std::set<ParentageID>
const& eIds = bp.second;
349 for (
auto const& eId : eIds) {
354 for (
auto const& p : par.
parents())
472 collectStreamSpecificMetadata(
473 vector<std::unique_ptr<art::FileCatalogMetadataPlugin>>
const& plugins,
474 vector<string>
const& pluginNames,
477 std::size_t pluginCounter{0};
478 std::ostringstream errors;
479 for (
auto&
plugin : plugins) {
481 plugin->doProduceMetadata();
482 ssmd.reserve(tmp.size() + ssmd.size());
483 for (
auto&& entry : tmp) {
485 ->wantCheckSyntax()) {
486 rapidjson::Document
d;
487 string checkString(
"{ ");
489 cet::canonical_string(entry.first) +
" : " + entry.second +
" }";
490 if (d.Parse(checkString.c_str()).HasParseError()) {
491 auto const nSpaces = d.GetErrorOffset();
492 std::cerr <<
"nSpaces = " << nSpaces <<
".\n";
493 errors <<
"art::OutputModule::writeCatalogMetadata():" 494 <<
"syntax error in metadata produced by plugin " 495 << pluginNames[pluginCounter] <<
":\n" 496 << rapidjson::GetParseError_En(d.GetParseError())
497 <<
" Faulty key/value clause:\n" 498 << checkString <<
"\n" 499 << (nSpaces ?
string(nSpaces,
'-') :
"") <<
"^\n";
502 ssmd.emplace_back(std::move(entry));
506 auto const errMsg = errors.str();
507 if (!errMsg.empty()) {
521 md.emplace_back(
"data_tier", cet::canonical_string(
dataTier_));
524 md.emplace_back(
"data_stream", cet::canonical_string(
streamName_));
556 auto const psets = top_pset.get<vector<ParameterSet>>(
"FCMDPlugins", {});
558 result.reserve(psets.size());
561 for (
auto const& pset : psets) {
562 pluginNames_.emplace_back(pset.get<
string>(
"plugin_type"));
568 pluginFactory_.makePlugin<std::unique_ptr<FileCatalogMetadataPlugin>>(
572 <<
"unrecognized plugin type " << pluginType <<
".\n";
579 <<
"Exception caught while processing FCMDPlugins[" << count
virtual void doRegisterProducts(MasterProductRegistry &, ProductDescriptions &, ModuleDescription const &)
virtual void writeFileIdentifier()
bool doBeginSubRun(SubRunPrincipal const &srp, CurrentProcessingContext const *cpc)
std::unique_ptr< GroupSelector const > groupSelector_
virtual void writeProcessConfigurationRegistry()
virtual void readResults(ResultsPrincipal const &resp)
virtual void finishEndFile()
virtual void event(EventPrincipal const &)
virtual void respondToCloseOutputFiles(FileBlock const &)
virtual void writeRun(RunPrincipal &r)=0
virtual void writeSubRun(SubRunPrincipal &sr)=0
std::vector< std::string > pluginNames_
bool wantEvent(Event const &e)
static cet::exempt_ptr< Consumer > non_module_context()
virtual void respondToOpenInputFile(FileBlock const &)
void writeFileCatalogMetadata()
std::map< BranchKey, BranchDescription > ProductList
void doWriteSubRun(SubRunPrincipal &srp)
std::vector< BranchDescription > ProductDescriptions
virtual void writeFileFormatVersion()
virtual void beginRun(RunPrincipal const &)
BranchChildren branchChildren_
virtual void endRun(RunPrincipal const &)
virtual bool isFileOpen() const
virtual std::string const & lastClosedFileName() const
std::vector< std::unique_ptr< FileCatalogMetadataPlugin >> PluginCollection_t
void insertEmpty(ProductID parent)
void doRespondToCloseInputFile(FileBlock const &fb)
virtual void writeFileIndex()
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
virtual void respondToOpenOutputFiles(FileBlock const &)
std::vector< ProductID > const & parents() const
GroupSelectorRules groupSelectorRules_
PluginCollection_t plugins_
virtual void setSubRunAuxiliaryRangeSetID(RangeSet const &)
static collection_type const & get()
ModuleDescription moduleDescription_
ResultsPrincipal const * resultsPrincipal() const
virtual void writeBranchMapper()
virtual void writeParameterSetRegistry()
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
virtual void endSubRun(SubRunPrincipal const &)
art::Handle< art::TriggerResults > getTriggerResults(Event const &e) const
virtual void setRunAuxiliaryRangeSetID(RangeSet const &)
BranchType branchType() const
virtual void writeParentageRegistry()
cet::exempt_ptr< CurrentProcessingContext const > current_context_
PluginCollection_t makePlugins_(fhicl::ParameterSet const &top_pset)
virtual void write(EventPrincipal &e)=0
void doSetSubRunAuxiliaryRangeSetID(RangeSet const &)
SelectionsArray keptProducts_
ServiceHandle< CatalogInterface > ci_
void doWriteEvent(EventPrincipal &ep)
virtual void writeProductDescriptionRegistry()
void registerProducts(MasterProductRegistry &, ProductDescriptions &, ModuleDescription const &)
bool doEndRun(RunPrincipal const &rp, CurrentProcessingContext const *cpc)
bool doBeginRun(RunPrincipal const &rp, CurrentProcessingContext const *cpc)
bool selected(BranchDescription const &) const
ModuleDescription const & description() const
std::string configuredFileName_
std::string const & moduleLabel() const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
void fillDependencyGraph()
void insertChild(ProductID parent, ProductID child)
detail::CachedProducts & cachedProducts()
cet::BasicPluginFactory pluginFactory_
std::string value(boost::any const &)
void doRespondToOpenOutputFiles(FileBlock const &fb)
virtual void postSelectProducts()
virtual void openFile(FileBlock const &)
void selectProducts(ProductList const &)
void doWriteRun(RunPrincipal &rp)
virtual void writeEventHistory()
void doSelectProducts(ProductList const &)
virtual void writeProcessHistoryRegistry()
EventID const & id() const
void doOpenFile(FileBlock const &fb)
virtual void writeProductDependencies()
virtual void setFileStatus(OutputFileStatus)
virtual void doWriteFileCatalogMetadata(FileCatalogMetadata::collection_type const &md, FileCatalogMetadata::collection_type const &ssmd)
virtual void respondToCloseInputFile(FileBlock const &)
void doRespondToCloseOutputFiles(FileBlock const &fb)
bool doEndSubRun(SubRunPrincipal const &srp, CurrentProcessingContext const *cpc)
void updateBranchParents(EventPrincipal const &ep)
bool doEvent(EventPrincipal const &ep, CurrentProcessingContext const *cpc, CountingStatistics &)
virtual void beginSubRun(SubRunPrincipal const &)
void doRespondToOpenInputFile(FileBlock const &fb)
virtual void startEndFile()
cet::coded_exception< error, detail::translate > exception
OutputModule(OutputModule const &)=delete
BranchParents branchParents_
ProcessConfiguration const & processConfiguration() const
void doSetRunAuxiliaryRangeSetID(RangeSet const &)
void configure(OutputModuleDescription const &desc)
bool wantAllEvents() const