![]() |
|
|||
File indexing completed on 2025-08-06 08:14:35
0001 // Class: ReadCuts 0002 // Automatically generated by MethodBase::MakeClass 0003 // 0004 0005 /* configuration options ===================================================== 0006 0007 #GEN -*-*-*-*-*-*-*-*-*-*-*- general info -*-*-*-*-*-*-*-*-*-*-*- 0008 0009 Method : Cuts::Cuts 0010 TMVA Release : 4.2.1 [262657] 0011 ROOT Release : 6.16/00 [397312] 0012 Creator : vassalli 0013 Date : Tue Jul 23 11:56:01 2019 0014 Host : Linux cvmfswrite01.sdcc.bnl.gov 3.10.0-693.11.6.el7.x86_64 #1 SMP Wed Jan 3 18:09:42 CST 2018 x86_64 x86_64 x86_64 GNU/Linux 0015 Dir : /direct/phenix+u/vassalli/sphenix/single/Training 0016 Training events: 16285 0017 Analysis type : [Classification] 0018 0019 0020 #OPT -*-*-*-*-*-*-*-*-*-*-*-*- options -*-*-*-*-*-*-*-*-*-*-*-*- 0021 0022 # Set by User: 0023 # Default: 0024 V: "False" [Verbose output (short form of "VerbosityLevel" below - overrides the latter one)] 0025 VerbosityLevel: "Default" [Verbosity level] 0026 VarTransform: "None" [List of variable transformations performed before training, e.g., "D_Background,P_Signal,G,N_AllClasses" for: "Decorrelation, PCA-transformation, Gaussianisation, Normalisation, each for the given class of events ('AllClasses' denotes all events of all classes, if no class indication is given, 'All' is assumed)"] 0027 H: "False" [Print method-specific help message] 0028 CreateMVAPdfs: "False" [Create PDFs for classifier outputs (signal and background)] 0029 IgnoreNegWeightsInTraining: "False" [Events with negative weights are ignored in the training (but are included for testing and performance evaluation)] 0030 FitMethod: "GA" [Minimisation Method (GA, SA, and MC are the primary methods to be used; the others have been introduced for testing purposes and are depreciated)] 0031 EffMethod: "EffSel" [Selection Method] 0032 CutRangeMin[0]: "-1.000000e+00" [Minimum of allowed cut range (set per variable)] 0033 CutRangeMin[1]: "-1.000000e+00" 0034 CutRangeMin[2]: "-1.000000e+00" 0035 CutRangeMin[3]: "-1.000000e+00" 0036 CutRangeMin[4]: "-1.000000e+00" 0037 CutRangeMin[5]: "-1.000000e+00" 0038 CutRangeMin[6]: "-1.000000e+00" 0039 CutRangeMin[7]: "-1.000000e+00" 0040 CutRangeMin[8]: "-1.000000e+00" 0041 CutRangeMin[9]: "-1.000000e+00" 0042 CutRangeMax[0]: "-1.000000e+00" [Maximum of allowed cut range (set per variable)] 0043 CutRangeMax[1]: "-1.000000e+00" 0044 CutRangeMax[2]: "-1.000000e+00" 0045 CutRangeMax[3]: "-1.000000e+00" 0046 CutRangeMax[4]: "-1.000000e+00" 0047 CutRangeMax[5]: "-1.000000e+00" 0048 CutRangeMax[6]: "-1.000000e+00" 0049 CutRangeMax[7]: "-1.000000e+00" 0050 CutRangeMax[8]: "-1.000000e+00" 0051 CutRangeMax[9]: "-1.000000e+00" 0052 VarProp[0]: "NotEnforced" [Categorisation of cuts] 0053 VarProp[1]: "NotEnforced" 0054 VarProp[2]: "NotEnforced" 0055 VarProp[3]: "NotEnforced" 0056 VarProp[4]: "NotEnforced" 0057 VarProp[5]: "NotEnforced" 0058 VarProp[6]: "NotEnforced" 0059 VarProp[7]: "NotEnforced" 0060 VarProp[8]: "NotEnforced" 0061 VarProp[9]: "NotEnforced" 0062 ## 0063 0064 0065 #VAR -*-*-*-*-*-*-*-*-*-*-*-* variables *-*-*-*-*-*-*-*-*-*-*-*- 0066 0067 NVar 10 0068 track_deta track_deta track_deta track_deta 'F' [5.96046447754e-08,1.94615316391] 0069 track_dlayer track_dlayer track_dlayer track_dlayer 'I' [-31,31] 0070 track_layer track_layer track_layer track_layer 'I' [0,38] 0071 track_pT track_pT track_pT track_pT 'F' [0.169785350561,79.8480682373] 0072 approach_dist approach_dist approach_dist approach_dist 'F' [1.25233009385e-06,44.061088562] 0073 vtx_radius vtx_radius vtx_radius vtx_radius 'F' [3.56204419596e-37,102.31892395] 0074 vtx_chi2 vtx_chi2 vtx_chi2 vtx_chi2 'F' [5.22654283354e-38,23.2217674255] 0075 vtxTrackRZ_dist vtxTrackRZ_dist vtxTrackRZ_dist vtxTrackRZ_dist 'F' [0,114.041381836] 0076 photon_pT photon_pT photon_pT photon_pT 'F' [0.00301368604414,12548.6572266] 0077 cluster_prob cluster_prob cluster_prob cluster_prob 'F' [0,0.999658644199] 0078 NSpec 0 0079 0080 0081 ============================================================================ */ 0082 0083 #include <array> 0084 #include <vector> 0085 #include <cmath> 0086 #include <string> 0087 #include <iostream> 0088 0089 #ifndef IClassifierReader__def 0090 #define IClassifierReader__def 0091 0092 class IClassifierReader { 0093 0094 public: 0095 0096 // constructor 0097 IClassifierReader() : fStatusIsClean( true ) {} 0098 virtual ~IClassifierReader() {} 0099 0100 // return classifier response 0101 virtual double GetMvaValue( const std::vector<double>& inputValues ) const = 0; 0102 0103 // returns classifier status 0104 bool IsStatusClean() const { return fStatusIsClean; } 0105 0106 protected: 0107 0108 bool fStatusIsClean; 0109 }; 0110 0111 #endif 0112 0113 class ReadCuts : public IClassifierReader { 0114 0115 public: 0116 0117 // constructor 0118 ReadCuts( std::vector<std::string>& theInputVars ) 0119 : IClassifierReader(), 0120 fClassName( "ReadCuts" ), 0121 fNvars( 10 ) 0122 { 0123 // the training input variables 0124 const char* inputVars[] = { "track_deta", "track_dlayer", "track_layer", "track_pT", "approach_dist", "vtx_radius", "vtx_chi2", "vtxTrackRZ_dist", "photon_pT", "cluster_prob" }; 0125 0126 // sanity checks 0127 if (theInputVars.size() <= 0) { 0128 std::cout << "Problem in class \"" << fClassName << "\": empty input vector" << std::endl; 0129 fStatusIsClean = false; 0130 } 0131 0132 if (theInputVars.size() != fNvars) { 0133 std::cout << "Problem in class \"" << fClassName << "\": mismatch in number of input values: " 0134 << theInputVars.size() << " != " << fNvars << std::endl; 0135 fStatusIsClean = false; 0136 } 0137 0138 // validate input variables 0139 for (size_t ivar = 0; ivar < theInputVars.size(); ivar++) { 0140 if (theInputVars[ivar] != inputVars[ivar]) { 0141 std::cout << "Problem in class \"" << fClassName << "\": mismatch in input variable names" << std::endl 0142 << " for variable [" << ivar << "]: " << theInputVars[ivar].c_str() << " != " << inputVars[ivar] << std::endl; 0143 fStatusIsClean = false; 0144 } 0145 } 0146 0147 // initialize min and max vectors (for normalisation) 0148 fVmin[0] = 0; 0149 fVmax[0] = 0; 0150 fVmin[1] = 0; 0151 fVmax[1] = 0; 0152 fVmin[2] = 0; 0153 fVmax[2] = 0; 0154 fVmin[3] = 0; 0155 fVmax[3] = 0; 0156 fVmin[4] = 0; 0157 fVmax[4] = 0; 0158 fVmin[5] = 0; 0159 fVmax[5] = 0; 0160 fVmin[6] = 0; 0161 fVmax[6] = 0; 0162 fVmin[7] = 0; 0163 fVmax[7] = 0; 0164 fVmin[8] = 0; 0165 fVmax[8] = 0; 0166 fVmin[9] = 0; 0167 fVmax[9] = 0; 0168 0169 // initialize input variable types 0170 fType[0] = 'F'; 0171 fType[1] = 'I'; 0172 fType[2] = 'I'; 0173 fType[3] = 'F'; 0174 fType[4] = 'F'; 0175 fType[5] = 'F'; 0176 fType[6] = 'F'; 0177 fType[7] = 'F'; 0178 fType[8] = 'F'; 0179 fType[9] = 'F'; 0180 0181 // initialize constants 0182 Initialize(); 0183 0184 } 0185 0186 // destructor 0187 virtual ~ReadCuts() { 0188 Clear(); // method-specific 0189 } 0190 0191 // the classifier response 0192 // "inputValues" is a vector of input values in the same order as the 0193 // variables given to the constructor 0194 double GetMvaValue( const std::vector<double>& inputValues ) const override; 0195 0196 private: 0197 0198 // method-specific destructor 0199 void Clear(); 0200 0201 // common member variables 0202 const char* fClassName; 0203 0204 const size_t fNvars; 0205 size_t GetNvar() const { return fNvars; } 0206 char GetType( int ivar ) const { return fType[ivar]; } 0207 0208 // normalisation of input variables 0209 double fVmin[10]; 0210 double fVmax[10]; 0211 double NormVariable( double x, double xmin, double xmax ) const { 0212 // normalise to output range: [-1, 1] 0213 return 2*(x - xmin)/(xmax - xmin) - 1.0; 0214 } 0215 0216 // type of input variable: 'F' or 'I' 0217 char fType[10]; 0218 0219 // initialize internal variables 0220 void Initialize(); 0221 double GetMvaValue__( const std::vector<double>& inputValues ) const; 0222 0223 // private members (method specific) 0224 // not implemented for class: "ReadCuts" 0225 }; 0226 inline double ReadCuts::GetMvaValue( const std::vector<double>& inputValues ) const 0227 { 0228 // classifier response value 0229 double retval = 0; 0230 0231 // classifier response, sanity check first 0232 if (!IsStatusClean()) { 0233 std::cout << "Problem in class \"" << fClassName << "\": cannot return classifier response" 0234 << " because status is dirty" << std::endl; 0235 retval = 0; 0236 } 0237 else { 0238 retval = GetMvaValue__( inputValues ); 0239 } 0240 0241 return retval; 0242 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |