本文整理汇总了C++中tmva::Reader::SetMsgType方法的典型用法代码示例。如果您正苦于以下问题:C++ Reader::SetMsgType方法的具体用法?C++ Reader::SetMsgType怎么用?C++ Reader::SetMsgType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tmva::Reader
的用法示例。
在下文中一共展示了Reader::SetMsgType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TMVAClassificationApplication
void TMVAClassificationApplication( TString myMethodList = "" )
{
#ifdef __CINT__
gROOT->ProcessLine( ".O0" ); // turn off optimization in CINT
#endif
//---------------------------------------------------------------
// This loads the library
TMVA::Tools::Instance();
// set verbosity
//TMVA::Tools::Instance().Log().SetMinType(kINFO);
// Default MVA methods to be trained + tested
std::map<std::string,int> Use;
Use["BDT"] = 1; // uses Adaptive Boost
Use["Category"] = 1;
std::cout << std::endl;
std::cout << "==> Start TMVAClassificationApplication" << std::endl;
// Select methods (don't look at this code - not of interest)
if (myMethodList != "") {
for (std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++) it->second = 0;
std::vector<TString> mlist = gTools().SplitString( myMethodList, ',' );
for (UInt_t i=0; i<mlist.size(); i++) {
std::string regMethod(mlist[i]);
if (Use.find(regMethod) == Use.end()) {
std::cout << "Method \"" << regMethod
<< "\" not known in TMVA under this name. Choose among the following:" << std::endl;
for (std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++) {
std::cout << it->first << " ";
}
std::cout << std::endl;
return;
}
Use[regMethod] = 1;
}
}
// --------------------------------------------------------------------------------------------------
// --- Create the Reader object
TMVA::Reader *reader = new TMVA::Reader( "Color:!Silent" );
reader->SetMsgType(kINFO);
// CMS STATS:
//
// Create a set of variables and declare them to the reader
// - the variable names MUST corresponds in name and type to those given in the weight file(s) used
Float_t met;
Float_t HT;
Float_t minMLB;
Float_t leptonJetsMETSum;
reader->AddVariable( "met", &met );
reader->AddVariable( "HT", &HT );
reader->AddVariable( "minMLB", &minMLB );
reader->AddVariable( "leptonJetsMETSum", &leptonJetsMETSum );
// CMS STATS:
// *** VERY IMPORTANT! ***
// TMVA notoriously has problems with integer and other non-float branches.
// Better not to use them at all and convert them to Float_t. If you happen
// to have integer branches that you need, as in this example, you should create
// corresponding float spectator variables and assign them in the event loop.
//
// Spectator variables declared in the training have to be added to the reader, too
//
// Note that the corresponding branches are integer, so we create floats too!
Int_t nBTag;
Int_t nJets;
Int_t nLeptons;
Int_t isMuon1;
Int_t isMuon2;
Int_t isMuon3;
Int_t isMuon4;
Float_t nBTagFloat;
Float_t nJetsFloat;
Float_t nLeptonsFloat;
Float_t isMuon1Float;
Float_t isMuon2Float;
Float_t isMuon3Float;
Float_t isMuon4Float;
Float_t leptonSumMass;
reader->AddSpectator( "nBTag", &nBTagFloat );
reader->AddSpectator( "nJets", &nJetsFloat );
reader->AddSpectator( "nLeptons", &nLeptonsFloat );
reader->AddSpectator( "isMuon1", &isMuon1Float );
reader->AddSpectator( "isMuon2", &isMuon2Float );
reader->AddSpectator( "isMuon3", &isMuon3Float );
reader->AddSpectator( "isMuon4", &isMuon4Float );
reader->AddSpectator( "leptonSumMass", &leptonSumMass );
//.........这里部分代码省略.........