Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:28:44

0001 
0002 #include <iostream>
0003 #include <sstream>
0004 #include <string>
0005 #include <vector>
0006 
0007 #include "FWCore/MessageLogger/interface/JobReport.h"
0008 #include "FWCore/Utilities/interface/InputType.h"
0009 
0010 void work() {
0011   std::cout << "Testing JobReport" << std::endl;
0012   std::ostringstream ost;
0013   {
0014     auto theReport = std::make_unique<edm::JobReport>(&ost);
0015 
0016     std::vector<std::string> inputBranches;
0017     for (int i = 0; i < 10; i++) {
0018       inputBranches.push_back("Some_Input_Branch");
0019     }
0020 
0021     std::size_t inpFile = theReport->inputFileOpened(
0022         "InputPFN", "InputLFN", "InputCatalog", "InputType", "InputSource", "InputLabel", "InputGUID", inputBranches);
0023 
0024     std::vector<std::string> outputBranches;
0025     for (int i = 0; i < 10; i++) {
0026       outputBranches.push_back("Some_Output_Branch_Probably_From_HLT");
0027     }
0028 
0029     std::size_t outFile = theReport->outputFileOpened("OutputPFN",
0030                                                       "OutputLFN",
0031                                                       "OutputCatalog",
0032                                                       "OutputModule",
0033                                                       "OutputModuleName",
0034                                                       "OutputGUID",
0035                                                       "DataType",
0036                                                       "OutputBranchesHash",
0037                                                       outputBranches);
0038 
0039     for (int i = 0; i < 1000; i++) {
0040       theReport->eventReadFromFile(edm::InputType::Primary, inpFile);
0041       theReport->eventWrittenToFile(outFile, 1000001, i);
0042     }
0043 
0044     theReport->inputFileClosed(edm::InputType::Primary, inpFile);
0045     theReport->outputFileClosed(outFile);
0046   }
0047   std::cout << ost.str() << std::endl;
0048 }
0049 
0050 int main() {
0051   int rc = -1;
0052   try {
0053     work();
0054 
0055     rc = 0;
0056   }
0057 
0058   catch (...) {
0059     std::cerr << "Unknown exception caught\n";
0060     rc = 2;
0061   }
0062   return rc;
0063 }