CMS 3D CMS Logo

Functions
convertXMLToGBRForestROOT.cc File Reference
#include "CommonTools/MVAUtils/interface/GBRForestTools.h"
#include "TFile.h"
#include <boost/filesystem.hpp>
#include <iostream>

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 8 of file convertXMLToGBRForestROOT.cc.

References gather_cfg::cout, createGBRForest(), PATTauDiscriminantCutMultiplexer_cfi::inputFileName, and PostProcessorHGCAL_cfi::outputFileName.

8  {
9  if (argc != 3) {
10  std::cout << "Please pass a (gzipped) BDT weight file and a name for the output ROOT file." << std::endl;
11  return 1;
12  }
13 
14  char *inputFileName = argv[1];
15  char *outputFileName = argv[2];
16 
17  if (!boost::filesystem::exists(inputFileName)) {
18  std::cout << "Input file " << inputFileName << " does not exists." << std::endl;
19  return 1;
20  }
21 
22  if (boost::filesystem::exists(outputFileName)) {
23  std::cout << "Output file " << outputFileName << " already exists." << std::endl;
24  return 1;
25  }
26 
27  auto gbrForest = createGBRForest(inputFileName);
28  std::cout << "Read GBRForest " << inputFileName << " successfully." << std::endl;
29 
30  TFile{outputFileName, "RECREATE"}.WriteObject(gbrForest.get(), "gbrForest");
31  std::cout << "GBRForest written to " << outputFileName << " successfully." << std::endl;
32 
33  return 0;
34 }
std::unique_ptr< const GBRForest > createGBRForest(const std::string &weightsFile)