20 #include "range/v3/view.hpp" 80 Comment(
"data product (subrun level) with the summary information"),
84 Name(
"SummaryCategory"),
85 Comment(
"name of the output category the summary is sent to"),
90 Name(
"RunSummaryCategory"),
91 Comment(
"name of the output category the summary is sent to"),
116 virtual void endJob()
override;
136 std::map<art::RunID, art::SummedValue<sumdata::POTSummary>>
fRunPOT;
169 auto const& ID = subRun.
id();
178 <<
"Fragment of subrun " << ID <<
" has no '" <<
fPOTtag.
encode() <<
"' POT summary.";
189 fRunPOT[ID.runID()].update(summaryHandle);
241 unsigned int nFragments = nMissing;
243 if (iFound != fend) nFragments += iFound->second;
245 log <<
"\n" <<
id <<
": " << nMissing <<
" / " << nFragments <<
" \"fragments\"";
256 std::map<art::RunID, unsigned int> subrunCount;
258 ++subrunCount[ID.runID()];
262 for (
auto const& [
id, POT] :
fRunPOT) {
263 log <<
"\n " <<
id <<
" (" << subrunCount[id]
fhicl::Atom< art::InputTag > SummaryTag
POTaccumulator(Parameters const &config)
Configuration-checking constructor.
std::string fSummaryOutputCategory
Name of the main stream for output.
std::map< art::RunID, art::SummedValue< sumdata::POTSummary > > fRunPOT
Partial count of POT in the run, per run.
EDAnalyzer(fhicl::ParameterSet const &pset)
fhicl::Atom< std::string > SummaryCategory
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
POTaccumulator & operator=(POTaccumulator const &)=delete
static std::string to_string(sumdata::POTSummary const &POT)
Converts the information from POT in a compact string.
virtual void endJob() override
Prints the general summary.
#define DEFINE_ART_MODULE(klass)
fhicl::Atom< std::string > RunSummaryCategory
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
Collection of configuration parameters for the module.
decltype(auto) values(Coll &&coll)
Range-for loop helper iterating across the values of the specified collection.
void printRunSummary() const
Prints the list of POT per run.
std::string fRunOutputCategory
Name of the run stream for output.
void printMissingSubrunList() const
Prints the list of subruns with partial or missing POT information.
Prints on console the total Protons On Target from the input subruns.
void aggregate(POTSummary const &other)
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
virtual void analyze(art::Event const &event) override
virtual void endSubRun(art::SubRun const &subRun) override
Collects information from each subrun.
std::map< art::SubRunID, unsigned int > fPresentSubrunFragments
Count of subrun fragments with POT information.
art::InputTag fPOTtag
Name of sumdata::POTSummary data product.
void printSummary(sumdata::POTSummary const &totalPOT) const
Prints the total POT summary totalPOT.
std::map< art::SubRunID, unsigned int > fMissingSubrunFragments
Count of subrun fragments without POT information.
Event finding and building.