Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:01:05

0001 /*
0002  * =====================================================================================
0003  *
0004  *       Filename:  TMVAZipReader.h
0005  *
0006  *    Description:  A stupid function that initializes a TMVA Reader
0007  *                  using a gzipped or non-zipped xml file.
0008  *
0009  *                  The file will be unzipped if it ends in .gz or .gzip
0010  *                  It will be passed as normal if it ends in .xml
0011  *
0012  *                  This file is header-only.
0013  *
0014  *          Usage:  loadTMVAWeights(&myReader, "BDT", "path_to_file.xml.gz");
0015  *
0016  *
0017  *         Author:  Evan Friis, evan.friis@cern.ch
0018  *        Company:  UW Madison
0019  *
0020  * =====================================================================================
0021  */
0022 
0023 #ifndef CommonTools_MVAUtils_TMVAZipReader_h
0024 #define CommonTools_MVAUtils_TMVAZipReader_h
0025 
0026 #include "TMVA/IMethod.h"
0027 #include "TMVA/Reader.h"
0028 #include <string>
0029 
0030 namespace reco::details {
0031 
0032   bool hasEnding(std::string const& fullString, std::string const& ending);
0033   char* readGzipFile(const std::string& weightFile);
0034 
0035   TMVA::IMethod* loadTMVAWeights(TMVA::Reader* reader,
0036                                  const std::string& method,
0037                                  const std::string& weightFile,
0038                                  bool verbose = false);
0039 
0040 }  // namespace reco::details
0041 
0042 #endif