diff --git a/FWCore/Modules/src/GetProductCheckerOutputModule.cc b/FWCore/Modules/src/GetProductCheckerOutputModule.cc index 6338fd0808015..d010b2bfcc83d 100644 --- a/FWCore/Modules/src/GetProductCheckerOutputModule.cc +++ b/FWCore/Modules/src/GetProductCheckerOutputModule.cc @@ -24,6 +24,7 @@ #include "FWCore/Utilities/interface/ProductKindOfType.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" namespace edm { class ModuleCallingContext; @@ -40,6 +41,7 @@ namespace edm { void write(EventForOutput const& e) override; void writeLuminosityBlock(LuminosityBlockForOutput const&) override; void writeRun(RunForOutput const&) override; + const bool verbose_; }; // @@ -54,7 +56,9 @@ namespace edm { // constructors and destructor // GetProductCheckerOutputModule::GetProductCheckerOutputModule(ParameterSet const& iPSet) - : one::OutputModuleBase(iPSet), one::OutputModule<>(iPSet) {} + : one::OutputModuleBase(iPSet), + one::OutputModule<>(iPSet), + verbose_(iPSet.getUntrackedParameter("verbose")) {} // GetProductCheckerOutputModule::GetProductCheckerOutputModule(GetProductCheckerOutputModule const& rhs) { // // do actual copying here; @@ -77,12 +81,23 @@ namespace edm { // member functions // template - static void check(T const& p, std::string const& id, SelectedProducts const& iProducts) { + static void check(T const& p, std::string const& id, SelectedProducts const& iProducts, bool iVerbose) { for (auto const& product : iProducts) { BranchDescription const* branchDescription = product.first; TypeID const& tid = branchDescription->unwrappedTypeID(); EDGetToken const& token = product.second; BasicHandle bh = p.getByToken(token, tid); + if (iVerbose) { + if (bh.isValid()) { + edm::LogInfo("FoundProduct") << "found " << branchDescription->moduleLabel() << " '" + << branchDescription->productInstanceName() << "' " + << branchDescription->processName(); + } else { + edm::LogInfo("DidNotFindProduct") + << "did not find " << branchDescription->moduleLabel() << " '" << branchDescription->productInstanceName() + << "' " << branchDescription->processName(); + } + } if (nullptr != bh.provenance() && bh.provenance()->branchDescription().branchID() != branchDescription->branchID()) { throw cms::Exception("BranchIDMissMatch") @@ -96,17 +111,17 @@ namespace edm { void GetProductCheckerOutputModule::write(EventForOutput const& e) { std::ostringstream str; str << e.id(); - check(e, str.str(), keptProducts()[InEvent]); + check(e, str.str(), keptProducts()[InEvent], verbose_); } void GetProductCheckerOutputModule::writeLuminosityBlock(LuminosityBlockForOutput const& l) { std::ostringstream str; str << l.id(); - check(l, str.str(), keptProducts()[InLumi]); + check(l, str.str(), keptProducts()[InLumi], verbose_); } void GetProductCheckerOutputModule::writeRun(RunForOutput const& r) { std::ostringstream str; str << r.id(); - check(r, str.str(), keptProducts()[InRun]); + check(r, str.str(), keptProducts()[InRun], verbose_); } // @@ -120,6 +135,7 @@ namespace edm { void GetProductCheckerOutputModule::fillDescriptions(ConfigurationDescriptions& descriptions) { ParameterSetDescription desc; one::OutputModule<>::fillDescription(desc); + desc.addUntracked("verbose", false); descriptions.add("productChecker", desc); } } // namespace edm