39 template <
typename S,
typename T>
42 if(f.fileHasBeenClosed) {
43 os <<
"\n<State Value=\"closed\"/>";
45 os <<
"\n<State Value=\"open\"/>";
48 os <<
"\n<LFN>" <<
TiXmlText(f.logicalFileName) <<
"</LFN>";
49 os <<
"\n<PFN>" <<
TiXmlText(f.physicalFileName) <<
"</PFN>";
50 os <<
"\n<Catalog>" <<
TiXmlText(f.catalog) <<
"</Catalog>";
51 os <<
"\n<ModuleLabel>" <<
TiXmlText(f.moduleLabel) <<
"</ModuleLabel>";
52 os <<
"\n<GUID>" << f.guid <<
"</GUID>";
54 for(
auto const& branch : f.branchNames) {
55 os <<
"\n <Branch>" <<
TiXmlText(branch) <<
"</Branch>";
57 os <<
"\n</Branches>";
68 os <<
"\n<InputFile>";
70 os <<
"\n<InputType>" << f.
inputType <<
"</InputType>";
72 <<
"</InputSourceClass>";
80 os <<
"\n<OutputModuleClass>"
82 <<
"</OutputModuleClass>";
83 os <<
"\n<TotalEvents>"
85 <<
"</TotalEvents>\n";
89 os <<
"\n<BranchHash>"
104 os <<
" <LumiSection ID=\"" << il.first <<
"\"/>\n";
107 os <<
" <LumiSection ID=\"" << il.first <<
"\" NEvents=\""<<il.second<<
"\"/>\n";
130 <<
"Access reported for secondary source input file with token "
132 <<
" but no matching input file is found\n";
138 <<
"Access reported for input file with token "
140 <<
" but no matching input file is found\n";
146 <<
"Access reported for input file with token "
148 <<
" after this file has been closed.\n"
149 <<
"File record follows:\n"
157 if(t >= outputFiles_.size()) {
159 <<
"Access reported for output file with token "
161 <<
" but no matching output file is found\n";
163 if(outputFiles_[t].fileHasBeenClosed) {
165 <<
"Access reported for output file with token "
167 <<
" after this file has been closed.\n"
168 <<
"File record follows:\n"
172 return outputFiles_[
t];
185 outputFile.contributingInputsSecSource.push_back(t);
202 for(
auto const& runReport : f.runReports) {
203 *ost_ << runReport.second;
205 *ost_ <<
"\n</Runs>\n";
206 *ost_ <<
"</InputFile>\n";
231 for(
auto const& runReport : f.runReports) {
232 *ost_ << runReport.second;
234 *ost_ <<
"\n</Runs>\n";
236 *ost_ <<
"\n<Inputs>";
237 for(
auto token : f.contributingInputs) {
239 *ost_ <<
"\n<Input>";
243 *ost_ <<
"\n</Input>";
245 for(
auto token : f.contributingInputsSecSource) {
247 *ost_ <<
"\n<Input>";
251 *ost_ <<
"\n</Input>";
253 *ost_ <<
"\n</Inputs>";
254 *ost_ <<
"\n</File>\n";
263 for(
auto const&
inputFile : inputFiles_) {
268 for(
auto const&
inputFile : inputFilesSecSource_) {
281 std::map<RunNumber, RunReport>& theMap = outputFiles_.at(token).runReports;
282 std::map<RunNumber, RunReport>::iterator
iter(theMap.lower_bound(runNumber));
283 if(
iter == theMap.end() || runNumber <
iter->first) {
291 std::map<RunNumber, RunReport>& theMap =
inputFile.runReports;
292 std::map<RunNumber, RunReport>::iterator
iter(theMap.lower_bound(runNumber));
293 if(
iter == theMap.end() || runNumber <
iter->first) {
301 std::map<RunNumber, RunReport>& theMap = outputFiles_.at(token).runReports;
302 std::map<RunNumber, RunReport>::iterator
iter(theMap.lower_bound(runNumber));
303 if(
iter == theMap.end() || runNumber <
iter->first) {
306 iter->second.lumiSectionsToNEvents[lumiSect]+=
nEvents;
313 std::map<RunNumber, RunReport>& theMap =
inputFile.runReports;
314 std::map<RunNumber, RunReport>::iterator
iter(theMap.lower_bound(runNumber));
315 if(
iter == theMap.end() || runNumber <
iter->first) {
327 *(
impl_->ost_) <<
"</FrameworkJobReport>\n" << std::flush;
337 *(
impl_->ost_) <<
"<FrameworkJobReport>\n";
343 toFileName(
std::string const& jobReportFile,
unsigned int childIndex,
unsigned int numberOfChildren, std::ostringstream& ofilename) {
344 char filler = ofilename.fill();
345 unsigned int numberOfDigitsInIndex = 0U;
346 while (numberOfChildren != 0) {
347 ++numberOfDigitsInIndex;
348 numberOfChildren /= 10;
350 if(numberOfDigitsInIndex == 0) {
351 numberOfDigitsInIndex = 3;
354 if(offset == std::string::npos) {
355 ofilename << jobReportFile;
356 ofilename <<
'_' << std::setw(numberOfDigitsInIndex) << std::setfill(
'0') << childIndex << std::setfill(filler);
358 ofilename << jobReportFile.substr(0, offset);
359 ofilename <<
'_' << std::setw(numberOfDigitsInIndex) << std::setfill(
'0') << childIndex << std::setfill(filler);
360 ofilename << jobReportFile.substr(offset);
368 *(
impl_->ost_) <<
"<ChildProcessFiles>\n";
369 for(
unsigned int i = 0;
i < numberOfChildren; ++
i) {
370 std::ostringstream ofilename;
371 toFileName(jobReportFile,
i, numberOfChildren, ofilename);
372 *(
impl_->ost_) <<
" <ChildProcessFile>" << ofilename.str() <<
"</ChildProcessFile>\n";
374 *(
impl_->ost_) <<
"</ChildProcessFiles>\n";
375 *(
impl_->ost_) <<
"</FrameworkJobReport>\n";
376 std::ofstream*
p =
dynamic_cast<std::ofstream *
>(
impl_->ost_);
389 std::ofstream*
p =
dynamic_cast<std::ofstream*
>(
impl_->ost_);
391 std::ostringstream ofilename;
392 toFileName(jobReportFile, childIndex, numberOfChildren, ofilename);
393 p->open(ofilename.str().c_str());
394 *p <<
"<FrameworkJobReport>\n";
405 std::vector<std::string>
const& branchNames) {
411 if (inputType ==
"mixingFiles") {
414 newFile = &
impl_->inputFilesSecSource_.back();
415 newToken =
impl_->inputFilesSecSource_.size() - 1;
417 if (inputType ==
"secondaryFiles") {
420 impl_->inputFiles_.emplace_back();
421 newFile = &
impl_->inputFiles_.back();
422 newToken =
impl_->inputFiles_.size() - 1;
426 impl_->lastOpenedPrimaryInputFile_ =
impl_->inputFiles_.size() - 1;
434 newFile->
guid = guid;
441 impl_->insertInputForOutputs(theInputType, newToken);
462 impl_->writeInputFile(f);
466 impl_->writeInputFile(f);
480 std::vector<std::string>
const& branchNames) {
481 impl_->outputFiles_.emplace_back();
499 if(!
impl_->inputFiles_[
i].fileHasBeenClosed) {
504 if(!
impl_->inputFilesSecSource_[
i].fileHasBeenClosed) {
508 return impl_->outputFiles_.size()-1;
521 impl_->writeOutputFile(f);
530 msg <<
"<SkippedEvent Run=\"" << run <<
"\"";
531 msg <<
" Event=\"" <<
event <<
"\" />\n";
545 impl_->associateLumiSection(token, run, lumiSectId,nEvents);
550 impl_->associateInputLumiSection(run, lumiSectId);
555 impl_->associateRun(token, run);
560 impl_->associateInputRun(run);
569 msg <<
"<AnalysisFile>\n"
570 <<
" <FileName>" <<
TiXmlText(fileName) <<
"</FileName>\n";
572 typedef std::map<std::string, std::string>::const_iterator const_iterator;
573 for(const_iterator pos = fileData.begin(), posEnd = fileData.end(); pos != posEnd; ++pos) {
574 msg <<
" <" << pos->first
575 <<
" Value=\"" << pos->second <<
"\" />"
578 msg <<
"</AnalysisFile>\n";
587 int const& exitCode) {
592 msg <<
"<FrameworkError ExitStatus=\""<< exitCode
593 <<
"\" Type=\"" << shortDesc <<
"\" >\n";
594 msg <<
"<![CDATA[\n" << longDesc <<
"\n]]>\n";
595 msg <<
"</FrameworkError>\n";
611 msg << skipped <<
"\n";
626 msg << fallback <<
"\n";
627 msg <<
"<![CDATA[\n" << err <<
"\n]]>\n";
637 msg <<
"<MemoryService>\n";
639 typedef std::vector<std::string>::const_iterator const_iterator;
640 for(const_iterator pos = memoryData.begin(), posEnd = memoryData.end(); pos != posEnd; ++pos) {
643 msg <<
"</MemoryService>\n";
652 msg <<
"<MessageSummary>\n";
653 typedef std::map<std::string, double>::const_iterator const_iterator;
654 for(const_iterator pos = messageData.begin(), posEnd = messageData.end(); pos != posEnd; ++pos) {
655 msg <<
" <" << pos->first
656 <<
" Value=\"" << pos->second <<
"\" />"
659 msg <<
"</MessageSummary>\n";
666 if(
impl_->printedReadBranches_)
return;
667 impl_->printedReadBranches_ =
true;
669 std::ostream& ost = *(
impl_->ost_);
670 ost <<
"<ReadBranches>\n";
671 for(
auto const& iBranch :
impl_->readBranches_) {
675 ost << branch <<
"\n";
677 for(
auto const& iBranch :
impl_->readBranchesSecFile_) {
681 ost << branch <<
"\n";
683 ost <<
"</ReadBranches>\n";
684 if(!
impl_->readBranchesSecSource_.empty()) {
685 ost <<
"<SecondarySourceReadBranches>\n";
686 for(
auto const& iBranch :
impl_->readBranchesSecSource_) {
689 branch.
SetAttribute(
"ReadCount", iBranch.second.value().load());
690 ost << branch <<
"\n";
692 ost <<
"</SecondarySourceReadBranches>\n";
702 std::set<std::string>
const& clonedBranches =
impl_->inputFiles_.at(
impl_->lastOpenedPrimaryInputFile_).fastClonedBranches;
703 if(clonedBranches.find(branchName) == clonedBranches.end()) {
704 ++
impl_->readBranches_[branchName];
707 ++
impl_->readBranchesSecFile_[branchName];
709 ++
impl_->readBranchesSecSource_[branchName].value();
715 std::set<std::string>& clonedBranches =
impl_->inputFiles_.at(
impl_->lastOpenedPrimaryInputFile_).fastClonedBranches;
716 for(std::set<std::string>::const_iterator it = fastClonedBranches.begin(), itEnd = fastClonedBranches.end();
718 if(clonedBranches.insert(*it).second) {
729 msg <<
"<RandomServiceStateFile>\n"
731 <<
"</RandomServiceStateFile>\n";
739 std::map<std::string, std::string>
const& metrics) {
742 msg <<
"<PerformanceReport>\n"
743 <<
" <PerformanceSummary Metric=\"" << metricClass <<
"\">\n";
745 typedef std::map<std::string, std::string>::const_iterator const_iterator;
746 for(const_iterator
iter = metrics.begin(), iterEnd = metrics.end();
iter != iterEnd; ++
iter) {
747 msg <<
" <Metric Name=\"" <<
iter->first <<
"\" "
748 <<
"Value=\"" <<
iter->second <<
"\"/>\n";
751 msg <<
" </PerformanceSummary>\n"
752 <<
"</PerformanceReport>\n";
761 std::map<std::string, std::string>
const& metrics) {
764 msg <<
"<PerformanceReport>\n"
765 <<
" <PerformanceModule Metric=\"" << metricClass <<
"\" "
766 <<
" Module=\"" << moduleName <<
"\" >\n";
768 typedef std::map<std::string, std::string>::const_iterator const_iterator;
769 for(const_iterator
iter = metrics.begin(), iterEnd = metrics.end();
iter != iterEnd; ++
iter) {
770 msg <<
" <Metric Name=\"" <<
iter->first <<
"\" "
771 <<
"Value=\"" <<
iter->second <<
"\"/>\n";
774 msg <<
" </PerformanceModule>\n"
775 <<
"</PerformanceReport>\n";
783 std::ostringstream
msg;
785 typedef std::vector<JobReport::OutputFile>::iterator iterator;
787 for(iterator
f =
impl_->outputFiles_.begin(), fEnd =
impl_->outputFiles_.end();
f != fEnd; ++
f) {
792 msg <<
"\n<LumiSections>";
794 typedef std::vector<JobReport::Token>::iterator iterator;
795 for(iterator iInput = f->contributingInputs.begin(),
796 iInputEnd = f->contributingInputs.end();
797 iInput != iInputEnd; ++iInput) {
805 msg <<
"\n</Inputs>";
void reportSkippedFile(std::string const &pfn, std::string const &lfn)
std::string outputModuleClassName
std::string physicalFileName
void associateRun(JobReport::Token token, unsigned int runNumber)
void reportMemoryInfo(std::vector< std::string > const &memoryData)
void reportInputRunNumber(unsigned int run)
void eventReadFromFile(InputType inputType, Token fileToken)
void reportFallbackAttempt(std::string const &pfn, std::string const &lfn, std::string const &err)
std::map< std::string, bool > fastCopyingInputs
std::string logicalFileName
void reportFastCopyingStatus(Token t, std::string const &inputFileName, bool fastCopying)
void reportRunNumber(JobReport::Token token, unsigned int run)
void reportRandomStateFile(std::string const &name)
S & print(S &os, JobReport::InputFile const &f)
Token inputFileOpened(std::string const &physicalFileName, std::string const &logicalFileName, std::string const &catalog, std::string const &inputType, std::string const &inputSourceClassName, std::string const &moduleLabel, std::string const &guid, std::vector< std::string > const &branchNames)
std::vector< InputFile > inputFiles_
void reportPerformanceForModule(std::string const &metricClass, std::string const &moduleName, std::map< std::string, std::string > const &metrics)
std::vector< Token > contributingInputs
tuple InputFile
Open Root file and provide MEs ############.
void insertInputForOutputs(InputType inputType, Token t)
std::string moduleName(Provenance const &provenance)
void writeInputFile(InputFile const &f)
void reportInputLumiSection(unsigned int run, unsigned int lumiSectId)
void SetAttribute(const char *name, const char *_value)
void reportPerformanceSummary(std::string const &metricClass, std::map< std::string, std::string > const &metrics)
void childAfterFork(std::string const &jobReportFile, unsigned int childIndex, unsigned int numberOfChildren)
New output file for child.
Token outputFileOpened(std::string const &physicalFileName, std::string const &logicalFileName, std::string const &catalog, std::string const &outputModuleClassName, std::string const &moduleLabel, std::string const &guid, std::string const &dataType, std::string const &branchHash, std::vector< std::string > const &branchNames)
unsigned int offset(bool)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void reportError(std::string const &shortDesc, std::string const &longDesc, int const &exitCode)
void associateInputRun(unsigned int runNumber)
S & formatFile(T const &f, S &os)
void reportReadBranch(InputType inputType, std::string const &branchName)
Inform the job report that a branch has been read.
std::size_t numEventsWritten
void reportFastClonedBranches(std::set< std::string > const &fastClonedBranches, long long nEvents)
Inform the job report that branches have been fast Cloned.
boost::scoped_ptr< JobReportImpl > impl_
Value const & findOrDefault(std::map< Key, Value > const &m, Key const &k, Value const &defaultValue)
tbb::concurrent_vector< InputFile > inputFilesSecSource_
void parentAfterFork(std::string const &jobReportFile)
void reportMessageInfo(std::map< std::string, double > const &messageData)
double S(const TLorentzVector &, const TLorentzVector &)
void associateLumiSection(JobReport::Token token, unsigned int runNumber, unsigned int lumiSection, unsigned long nEvents)
std::string dumpFiles(void)
debug/test util
void parentBeforeFork(std::string const &jobReportFile, unsigned int numberOfChildren)
void reportAnalysisFile(std::string const &fileName, std::map< std::string, std::string > const &fileData)
void outputFileClosed(Token fileToken)
void eventWrittenToFile(Token fileToken, unsigned int run, unsigned int event)
void writeOutputFile(OutputFile const &f)
std::map< unsigned int, unsigned long > lumiSectionsToNEvents
InputFile & getInputFileForToken(InputType inputType, Token t)
void reportDataType(Token fileToken, std::string const &dataType)
tbb::concurrent_vector< Token > contributingInputsSecSource
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
void inputFileClosed(InputType inputType, Token fileToken)
void associateInputLumiSection(unsigned int runNumber, unsigned int lumiSection)
void reportSkippedEvent(unsigned int run, unsigned int event)
void reportReadBranches()
OutputFile & getOutputFileForToken(Token t)
void reportLumiSection(JobReport::Token token, unsigned int run, unsigned int lumiSectId, unsigned long nEvents=0)