Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report # events per Lumi for output files in framework job report #17912

Merged
merged 1 commit into from Mar 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions FWCore/MessageLogger/interface/JobReport.h
Expand Up @@ -108,7 +108,7 @@ namespace edm {

struct RunReport {
RunNumber runNumber;
std::set<unsigned int> lumiSections;
std::map<unsigned int,unsigned long> lumiSectionsToNEvents;
};

/**\struct InputFile
Expand Down Expand Up @@ -197,7 +197,7 @@ namespace edm {
* Associate a Lumi Section to all open output files
*
*/
void associateLumiSection(JobReport::Token token, unsigned int runNumber, unsigned int lumiSection);
void associateLumiSection(JobReport::Token token, unsigned int runNumber, unsigned int lumiSection, unsigned long nEvents);

/*
* Associate a Lumi Section to all open input files
Expand Down Expand Up @@ -341,7 +341,7 @@ namespace edm {
/// for output files, call only if lumi section is written to
/// the output file
///
void reportLumiSection(JobReport::Token token, unsigned int run, unsigned int lumiSectId);
void reportLumiSection(JobReport::Token token, unsigned int run, unsigned int lumiSectId, unsigned long nEvents=0);

///
/// API for reporting a Lumi Section to the job report.
Expand Down
23 changes: 14 additions & 9 deletions FWCore/MessageLogger/src/JobReport.cc
Expand Up @@ -98,8 +98,13 @@ namespace edm {
<< rep.runNumber
<< "\">\n";

for(auto il : rep.lumiSections) {
os << " <LumiSection ID=\"" << il << "\"/>\n";
for(auto const& il : rep.lumiSectionsToNEvents) {
if(std::numeric_limits<unsigned long>::max() == il.second) {
os << " <LumiSection ID=\"" << il.first << "\"/>\n";

} else {
os << " <LumiSection ID=\"" << il.first << "\" NEvents=\""<<il.second<< "\"/>\n";
}
}
os << "</Run>\n";
return os;
Expand Down Expand Up @@ -291,13 +296,13 @@ namespace edm {
}
}

void JobReport::JobReportImpl::associateLumiSection(JobReport::Token token, unsigned int runNumber, unsigned int lumiSect) {
void JobReport::JobReportImpl::associateLumiSection(JobReport::Token token, unsigned int runNumber, unsigned int lumiSect, unsigned long nEvents) {
std::map<RunNumber, RunReport>& theMap = outputFiles_.at(token).runReports;
std::map<RunNumber, RunReport>::iterator iter(theMap.lower_bound(runNumber));
if(iter == theMap.end() || runNumber < iter->first) { // not found
theMap.emplace_hint(iter, runNumber, JobReport::RunReport{ runNumber, {lumiSect}}); // insert it
theMap.emplace_hint(iter, runNumber, JobReport::RunReport{ runNumber, {{{lumiSect,nEvents}}}}); // insert it
} else {
iter->second.lumiSections.insert(lumiSect);
iter->second.lumiSectionsToNEvents[lumiSect]+=nEvents;
}
}

Expand All @@ -307,9 +312,9 @@ namespace edm {
std::map<RunNumber, RunReport>& theMap = inputFile.runReports;
std::map<RunNumber, RunReport>::iterator iter(theMap.lower_bound(runNumber));
if(iter == theMap.end() || runNumber < iter->first) { // not found
theMap.emplace_hint(iter, runNumber, JobReport::RunReport{ runNumber, {lumiSect}}); // insert it
theMap.emplace_hint(iter, runNumber, JobReport::RunReport{ runNumber, {{lumiSect,std::numeric_limits<unsigned long>::max()}}}); // insert it
} else {
iter->second.lumiSections.insert(lumiSect);
iter->second.lumiSectionsToNEvents[lumiSect]=std::numeric_limits<unsigned long>::max();
}
}
}
Expand Down Expand Up @@ -535,8 +540,8 @@ namespace edm {
}

void
JobReport::reportLumiSection(JobReport::Token token, unsigned int run, unsigned int lumiSectId) {
impl_->associateLumiSection(token, run, lumiSectId);
JobReport::reportLumiSection(JobReport::Token token, unsigned int run, unsigned int lumiSectId, unsigned long nEvents) {
impl_->associateLumiSection(token, run, lumiSectId,nEvents);
}

void
Expand Down
5 changes: 4 additions & 1 deletion IOPool/Output/src/RootOutputFile.cc
Expand Up @@ -88,6 +88,7 @@ namespace edm {
lumiEntryNumber_(0LL),
runEntryNumber_(0LL),
indexIntoFile_(),
nEventsInLumi_(0),
metaDataTree_(nullptr),
parameterSetsTree_(nullptr),
parentageTree_(nullptr),
Expand Down Expand Up @@ -432,6 +433,7 @@ namespace edm {
// Report event written
Service<JobReport> reportSvc;
reportSvc->eventWrittenToFile(reportToken_, e.id().run(), e.id().event());
++nEventsInLumi_;
}

void RootOutputFile::writeLuminosityBlock(LuminosityBlockForOutput const& lb) {
Expand All @@ -451,7 +453,8 @@ namespace edm {
lumiTree_.optimizeBaskets(10ULL*1024*1024);

Service<JobReport> reportSvc;
reportSvc->reportLumiSection(reportToken_, lb.id().run(), lb.id().luminosityBlock());
reportSvc->reportLumiSection(reportToken_, lb.id().run(), lb.id().luminosityBlock(),nEventsInLumi_);
nEventsInLumi_ = 0;
}

void RootOutputFile::writeRun(RunForOutput const& r) {
Expand Down
1 change: 1 addition & 0 deletions IOPool/Output/src/RootOutputFile.h
Expand Up @@ -116,6 +116,7 @@ namespace edm {
IndexIntoFile::EntryNumber_t lumiEntryNumber_;
IndexIntoFile::EntryNumber_t runEntryNumber_;
IndexIntoFile indexIntoFile_;
unsigned long nEventsInLumi_;
edm::propagate_const<TTree*> metaDataTree_;
edm::propagate_const<TTree*> parameterSetsTree_;
edm::propagate_const<TTree*> parentageTree_;
Expand Down