Revision 288629b256000aea6c9113f3425a0d1f06a484de authored by Lorenzo Moneta on 10 June 2011, 17:42:36 UTC, committed by Lorenzo Moneta on 10 June 2011, 17:42:36 UTC
Fix r39628 by insuring the copied histogram has the proper type; this fixes tutorials/seims.C git-svn-id: http://root.cern.ch/svn/root/branches/v5-30-00-patches@39677 27541ba8-7e3a-0410-8455-c3a389f83636
1 parent 00861be
StandaloneClassExample.C
#include <vector>;
void StandaloneClassExample()
{
// A simple example of how the "standalone classes" can be used
// Load the stand alone "trained LD class"
// if the example were not a ROOT macro but a stand alone program, you
// would simplye "include" this file"
gROOT->LoadMacro("weights/TMVAClassification_LD.class.C++");
std::vector<string> inputVariableNames;
// you need to use the same names as during traiing. Meant as a "consistency" check, that
// makes you aware of what you are doing. You can find the names in the "xxx.class.C" file
// just look for "training input variables". Obviously, you want to "apply" it using the
// same variables.
inputVariableNames.push_back("var1+var2");
inputVariableNames.push_back("var1-var2");
inputVariableNames.push_back("var3");
inputVariableNames.push_back("var4");
// instanticat the LD class and tell it about the variable names
// to allow it to check internally that it has actually been trained with
// THESE variables
IClassifierReader* classReader = new ReadLD(inputVariableNames);
// put your input variables into a std::vector
// (this would typically be inside an "event loop" of course..
std::vector<double> inputVariableValues;
inputVariableValues.push_back(1.);
inputVariableValues.push_back(1.6);
inputVariableValues.push_back(3.4);
inputVariableValues.push_back(2.4);
cout << "For input values: " ;
for (int i=0; i<4; i++) cout << inputVariableValues[i] << " ";
cout << endl;
// get the MVA output value for this particular event variables.
cout << "The LD MVA value is: " << classReader->GetMvaValue(inputVariableValues) << endl;
}
Computing file changes ...