Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63

#include <iostream>
#include <sstream>
#include <string>
#include <vector>

#include "FWCore/MessageLogger/interface/JobReport.h"
#include "FWCore/Utilities/interface/InputType.h"

void work() {
  std::cout << "Testing JobReport" << std::endl;
  std::ostringstream ost;
  {
    auto theReport = std::make_unique<edm::JobReport>(&ost);

    std::vector<std::string> inputBranches;
    for (int i = 0; i < 10; i++) {
      inputBranches.push_back("Some_Input_Branch");
    }

    std::size_t inpFile = theReport->inputFileOpened(
        "InputPFN", "InputLFN", "InputCatalog", "InputType", "InputSource", "InputLabel", "InputGUID", inputBranches);

    std::vector<std::string> outputBranches;
    for (int i = 0; i < 10; i++) {
      outputBranches.push_back("Some_Output_Branch_Probably_From_HLT");
    }

    std::size_t outFile = theReport->outputFileOpened("OutputPFN",
                                                      "OutputLFN",
                                                      "OutputCatalog",
                                                      "OutputModule",
                                                      "OutputModuleName",
                                                      "OutputGUID",
                                                      "DataType",
                                                      "OutputBranchesHash",
                                                      outputBranches);

    for (int i = 0; i < 1000; i++) {
      theReport->eventReadFromFile(edm::InputType::Primary, inpFile);
      theReport->eventWrittenToFile(outFile, 1000001, i);
    }

    theReport->inputFileClosed(edm::InputType::Primary, inpFile);
    theReport->outputFileClosed(outFile);
  }
  std::cout << ost.str() << std::endl;
}

int main() {
  int rc = -1;
  try {
    work();

    rc = 0;
  }

  catch (...) {
    std::cerr << "Unknown exception caught\n";
    rc = 2;
  }
  return rc;
}