/usr/include/root/TMVA/Reader.h is in libroot-tmva-dev 5.34.14-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | // @(#)root/tmva $Id$
// Author: Andreas Hoecker, Peter Speckmayer, Joerg Stelzer, Helge Voss, Kai Voss, Eckhard von Toerne, Jan Therhaag
/**********************************************************************************
* Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
* Package: TMVA *
* Class : Reader *
* Web : http://tmva.sourceforge.net *
* *
* Description: *
* Reader class to be used in the user application to interpret the trained *
* MVAs in an analysis context *
* *
* Authors (alphabetical order): *
* Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland *
* Peter Speckmayer <peter.speckmayer@cern.ch> - CERN, Switzerland *
* Joerg Stelzer <Joerg.Stelzer@cern.ch> - CERN, Switzerland *
* Jan Therhaag <Jan.Therhaag@cern.ch> - U of Bonn, Germany *
* Eckhard v. Toerne <evt@uni-bonn.de> - U of Bonn, Germany *
* Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, Germany *
* Kai Voss <Kai.Voss@cern.ch> - U. of Victoria, Canada *
* *
* Copyright (c) 2005-2011: *
* CERN, Switzerland *
* U. of Victoria, Canada *
* MPI-K Heidelberg, Germany *
* U. of Bonn, Germany *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted according to the terms listed in LICENSE *
* (http://ttmva.sourceforge.net/LICENSE) *
**********************************************************************************/
#ifndef ROOT_TMVA_Reader
#define ROOT_TMVA_Reader
//////////////////////////////////////////////////////////////////////////
// //
// Reader //
// //
// Reader class to be used in the user application to interpret the //
// trained MVAs in an analysis context //
// //
//////////////////////////////////////////////////////////////////////////
#ifndef ROOT_TMVA_Configurable
#include "TMVA/Configurable.h"
#endif
#ifndef ROOT_TMVA_Types
#include "TMVA/Types.h"
#endif
#ifndef ROOT_TMVA_DataSetInfo
#include "TMVA/DataSetInfo.h"
#endif
#ifndef ROOT_TMVA_DataInputHandler
#include "TMVA/DataInputHandler.h"
#endif
#ifndef ROOT_TMVA_DataSetManager
#include "TMVA/DataSetManager.h"
#endif
#include <vector>
#include <map>
#include <stdexcept>
namespace TMVA {
class IMethod;
class MethodBase;
class DataSetInfo;
class MethodCuts;
class Reader : public Configurable {
public:
// without prior specification of variables
Reader( const TString& theOption="", Bool_t verbose = 0 );
// STL types
Reader( std::vector<std::string>& varNames, const TString& theOption = "", Bool_t verbose = 0 );
Reader( const std::string& varNames, const TString& theOption, Bool_t verbose = 0 ); // format: "var1:var2:..."
// Root types
Reader( std::vector<TString>& varNames, const TString& theOption = "", Bool_t verbose = 0 );
Reader( const TString& varNames, const TString& theOption, Bool_t verbose = 0 ); // format: "var1:var2:..."
virtual ~Reader( void );
// book MVA method via weight file
IMethod* BookMVA( const TString& methodTag, const TString& weightfile );
IMethod* BookMVA( TMVA::Types::EMVA methodType, const char* xmlstr );
IMethod* FindMVA( const TString& methodTag );
// special function for Cuts to avoid dynamic_casts in ROOT macros,
// which are not properly handled by CINT
MethodCuts* FindCutsMVA( const TString& methodTag );
// returns the MVA response for given event
Double_t EvaluateMVA( const std::vector<Float_t> &, const TString& methodTag, Double_t aux = 0 );
Double_t EvaluateMVA( const std::vector<Double_t>&, const TString& methodTag, Double_t aux = 0 );
Double_t EvaluateMVA( MethodBase* method, Double_t aux = 0 );
Double_t EvaluateMVA( const TString& methodTag, Double_t aux = 0 );
// returns error on MVA response for given event
// NOTE: must be called AFTER "EvaluateMVA(...)" call !
Double_t GetMVAError() const { return fMvaEventError; }
Double_t GetMVAErrorLower() const { return fMvaEventError; }
Double_t GetMVAErrorUpper() const { return fMvaEventErrorUpper; }
// regression response
const std::vector< Float_t >& EvaluateRegression( const TString& methodTag, Double_t aux = 0 );
const std::vector< Float_t >& EvaluateRegression( MethodBase* method, Double_t aux = 0 );
Float_t EvaluateRegression( UInt_t tgtNumber, const TString& methodTag, Double_t aux = 0 );
// multiclass response
const std::vector< Float_t >& EvaluateMulticlass( const TString& methodTag, Double_t aux = 0 );
const std::vector< Float_t >& EvaluateMulticlass( MethodBase* method, Double_t aux = 0 );
Float_t EvaluateMulticlass( UInt_t clsNumber, const TString& methodTag, Double_t aux = 0 );
// probability and rarity accessors (see Users Guide for definition of Rarity)
Double_t GetProba ( const TString& methodTag, Double_t ap_sig=0.5, Double_t mvaVal=-9999999 );
Double_t GetRarity( const TString& methodTag, Double_t mvaVal=-9999999 );
// accessors
virtual const char* GetName() const { return "Reader"; }
Bool_t Verbose( void ) const { return fVerbose; }
void SetVerbose( Bool_t v ) { fVerbose = v; }
const DataSetInfo& DataInfo() const { return fDataSetInfo; }
DataSetInfo& DataInfo() { return fDataSetInfo; }
void AddVariable( const TString& expression, Float_t* );
void AddVariable( const TString& expression, Int_t* );
void AddSpectator( const TString& expression, Float_t* );
void AddSpectator( const TString& expression, Int_t* );
private:
DataSetManager* fDataSetManager; // DSMTEST
TString GetMethodTypeFromFile( const TString& filename );
// this booking method is internal
IMethod* BookMVA( Types::EMVA method, const TString& weightfile );
DataSetInfo fDataSetInfo; // the data set
DataInputHandler fDataInputHandler;
// Init Reader class
void Init( void );
// Decode Constructor string (or TString) and fill variable name std::vector
void DecodeVarNames( const std::string& varNames );
void DecodeVarNames( const TString& varNames );
void DeclareOptions();
Bool_t fVerbose; // verbosity
Bool_t fSilent; // silent mode
Bool_t fColor; // color mode
Bool_t fCalculateError; // error calculation mode
Double_t fMvaEventError; // per-event error returned by MVA
Double_t fMvaEventErrorUpper; // per-event error returned by MVA
std::map<TString, IMethod*> fMethodMap; // map of methods
std::vector<Float_t> fTmpEvalVec; // temporary evaluation vector (if user input is v<double>)
mutable MsgLogger* fLogger; // message logger
MsgLogger& Log() const { return *fLogger; }
ClassDef(Reader,0) // Interpret the trained MVAs in an analysis context
};
}
#endif
|