本文整理汇总了C++中tmva::Factory::Print方法的典型用法代码示例。如果您正苦于以下问题:C++ Factory::Print方法的具体用法?C++ Factory::Print怎么用?C++ Factory::Print使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tmva::Factory
的用法示例。
在下文中一共展示了Factory::Print方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TMVAClassification_ttV
//.........这里部分代码省略.........
//fsignal->Close();
cout<<"begin"<<endl;
//TFile* fbackground = TFile::Open("/opt/sbg/data/data1/cms/echabert/ttbarMET/ProdAlexMars13/CMSSW_5_3_2_patch4/src/NTuple/NTupleAnalysis/macros/TTbarMET/backup_outputProof08-04-13_18-01-24/proof_tt-dilepton.root");
cout<<fsignal<<" "<<signal<<endl;
// Background (has event weights)
//background->SetBranchAddress( "weight", &weight );
//for (UInt_t ivar=0; ivar<4; ivar++) background->SetBranchAddress( Form( "var%i", ivar+1 ), &(treevars[ivar]) );
background->SetBranchAddress("Vcand",&vcand);
//background->SetBranchAddress("VCand/Mqq",&vcand.Mqq);
//background->SetBranchAddress("VCand/Pt_qq",&vcand.Pt_qq);
cout<<"here"<<endl;
for (UInt_t i=0; i<background->GetEntries(); i++) {
//cout<<"GetEntry "<<i<<endl;
background->GetEntry(i);
//cout<<"done"<<endl;
//for (UInt_t ivar=0; ivar<4; ivar++) vars[ivar] = treevars[ivar];
vars[0] = vcand.Mqq;
vars[1] = vcand.Pt_qq;
//cout<<vars[0]<<" "<<vars[1]<<endl;
// add training and test events; here: first half is training, second is testing
// note that the weight can also be event-wise
//if (i < background->GetEntries()/2) factory->AddBackgroundTrainingEvent( vars, backgroundWeight*weight );
//else factory->AddBackgroundTestEvent ( vars, backgroundWeight*weight );
//cout<<"toto"<<endl;
if (i < background->GetEntries()/2) factory->AddBackgroundTrainingEvent( vars, backgroundWeight);
else factory->AddBackgroundTestEvent ( vars, backgroundWeight);
//cout<<"toto"<<endl;
//return ;
}
*/
cout<<"eND"<<endl;
factory->EvaluateAllVariables();
factory->Print();
//return;
// --- end ------------------------------------------------------------
//
// --- end of tree registration
// Set individual event weights (the variables must exist in the original TTree)
// for signal : factory->SetSignalWeightExpression ("weight1*weight2");
// for background: factory->SetBackgroundWeightExpression("weight1*weight2");
//Commented by Eric: factory->SetBackgroundWeightExpression( "weight" );
// Apply additional cuts on the signal and background samples (can be different)
TCut mycuts = ""; // for example: TCut mycuts = "abs(var1)<0.5 && abs(var2-0.5)<1";
TCut mycutb = ""; // for example: TCut mycutb = "abs(var1)<0.5";
// Tell the factory how to use the training and testing events
//
// If no numbers of events are given, half of the events in the tree are used
// for training, and the other half for testing:
// factory->PrepareTrainingAndTestTree( mycut, "SplitMode=random:!V" );
// To also specify the number of testing events, use:
// factory->PrepareTrainingAndTestTree( mycut,
// "NSigTrain=3000:NBkgTrain=3000:NSigTest=3000:NBkgTest=3000:SplitMode=Random:!V" );
cout<<"Prepare it"<<endl;
factory->PrepareTrainingAndTestTree( mycuts, mycutb,
"nTrain_Signal=0:nTrain_Background=0:SplitMode=Random:NormMode=NumEvents:!V" );
cout<<"Prepare it : DONE"<<endl;
// ---- Book MVA methods
//
// Please lookup the various method configuration options in the corresponding cxx files, eg:
// src/MethoCuts.cxx, etc, or here: http://tmva.sourceforge.net/optionRef.html
// it is possible to preset ranges in the option string in which the cut optimisation should be done: