本文整理汇总了C++中tmva::Factory::GetMethod方法的典型用法代码示例。如果您正苦于以下问题:C++ Factory::GetMethod方法的具体用法?C++ Factory::GetMethod怎么用?C++ Factory::GetMethod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tmva::Factory
的用法示例。
在下文中一共展示了Factory::GetMethod方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TMVAClassification
//.........这里部分代码省略.........
// As an example how to use the ROOT plugin mechanism, book BDT via
// plugin mechanism
if (Use["Plugin"]) {
//
// first the plugin has to be defined, which can happen either through the following line in the local or global .rootrc:
//
// # plugin handler plugin name(regexp) class to be instanciated library constructor format
// [email protected]@MethodBase: ^BDT TMVA::MethodBDT TMVA.1 "MethodBDT(TString,TString,DataSet&,TString)"
//
// or by telling the global plugin manager directly
gPluginMgr->AddHandler("[email protected]@MethodBase", "BDT", "TMVA::MethodBDT", "TMVA.1", "MethodBDT(TString,TString,DataSet&,TString)");
factory->BookMethod( TMVA::Types::kPlugins, "BDT",
"!H:!V:NTrees=400:BoostType=AdaBoost:SeparationType=GiniIndex:nCuts=20:PruneMethod=CostComplexity:PruneStrength=50" );
}
// --------------------------------------------------------------------------------------------------
// ---- Now you can tell the factory to train, test, and evaluate the MVAs
// Train MVAs using the set of training events
factory->TrainAllMethods();
// ---- Evaluate all MVAs using the set of test events
factory->TestAllMethods();
// ----- Evaluate and compare performance of all configured MVAs
factory->EvaluateAllMethods();
if (Use["Cuts"]) {
for( unsigned iEff=1; iEff<11; ++iEff ) {
TMVA::IMethod* method = (TMVA::IMethod*)factory->GetMethod("Cuts");
TMVA::MethodCuts* cuts = dynamic_cast<TMVA::MethodCuts*>(method);
std::string optcutsdir = "optcuts_" + selectionName + "_" + charge;
std::string mkdir_command = "mkdir -p " + optcutsdir;
system(mkdir_command.c_str());
char cutsFileName[500];
sprintf( cutsFileName, "%s/cuts_Seff%d.txt", optcutsdir.c_str(), 10*iEff );
ofstream ofs(cutsFileName);
std::vector<Double_t> cutsMin, cutsMax;
cuts->GetCuts((float)iEff*0.10, cutsMin, cutsMax);
bool found_pT1 = false;
bool found_pT2 = false;
bool found_NJ = false;
bool found_NbJ = false;
bool found_NbJmed = false;
for( unsigned iCut=0; iCut<cutsMin.size(); ++iCut) {
TString varName = factory->DefaultDataSetInfo().GetVariableInfo(iCut).GetInternalName();
if( varName=="TMath_Min_pT1,pT2_") {
ofs << "pT1 " << cutsMin[iCut] << " " << cutsMax[iCut] << std::endl;
ofs << "pT2 " << cutsMin[iCut] << " " << cutsMax[iCut] << std::endl;
found_pT1 = true;
found_pT2 = true;
} else {
ofs << varName << " " << cutsMin[iCut] << " " << cutsMax[iCut] << std::endl;
}
if( varName=="pT1" ) found_pT1 = true;
if( varName=="pT2" ) found_pT2 = true;
if( varName=="NJ" ) found_NJ = true;