本文整理汇总了C++中Factory::AddSpectator方法的典型用法代码示例。如果您正苦于以下问题:C++ Factory::AddSpectator方法的具体用法?C++ Factory::AddSpectator怎么用?C++ Factory::AddSpectator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Factory
的用法示例。
在下文中一共展示了Factory::AddSpectator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeFactory
void makeFactory(TTree* signalTree, TTree* backTree,std::string outfile,std::string factoryname, TTree* bgTree2=NULL)
{
using namespace TMVA;
TString jobname(factoryname.c_str());
TFile *targetFile = new TFile(outfile.c_str(),"RECREATE");
Factory *factory = new Factory(jobname,targetFile);
factory->AddSignalTree(signalTree,1.0);
factory->AddBackgroundTree(backTree,1.0);
if(bgTree2){
factory->AddBackgroundTree(bgTree2,1.0);
}
factory->AddVariable("track_deta",'F');
factory->AddVariable("track_dlayer",'I');
factory->AddVariable("track_layer",'I');
factory->AddVariable("track_pT",'F');
// factory->AddVariable("approach_dist",'F');
factory->AddVariable("vtx_radius",'F');
//factory->AddVariable("vtx_chi2",'F'); //until reco vtx works this is meaningless
factory->AddVariable("vtxTrack_dist",'F');
//factory->AddVariable("photon_m",'F');
//factory->AddVariable("photon_pT",'F');
factory->AddVariable("cluster_prob",'F');
factory->AddSpectator("vtx_chi2",'F'); //until reco vtx works this is meaningless
string track_pT_cut = "track_pT>0";
string vtx_radius_cut = "vtx_radius>0";
string em_prob_cut = "cluster_prob>=0";
//do I need photon cuts?
string tCutInitializer = em_prob_cut+"&&"+ vtx_radius_cut+"&&"+track_pT_cut+"&&track_dlayer>=0&&track_layer>=0&&approach_dist>0&&vtxTrack_dist>0&&photon_m>0&&photon_pT>0";
TCut preTraingCuts(tCutInitializer.c_str());
factory->PrepareTrainingAndTestTree(preTraingCuts,"nTrain_Signal=0:nTrain_Background=0:nTest_Signal=0:nTest_Background=0");
factory->BookMethod( TMVA::Types::kLikelihood, "LikelihoodD",
"!H:!V:!TransformOutput:PDFInterpol=Spline2:NSmoothSig[0]=20:NSmoothBkg[0]=20:NSmooth=5:NAvEvtPerBin=50:VarTransform=Decorrelate" );
factory->BookMethod(Types::kCuts,"Cuts","");
/*factory->BookMethod( Types::kKNN, "kNN", "" ); //>100k events
factory->BookMethod( Types::kPDERS, "PDERS", "" );//>100k events*/
/*factory->BookMethod( Types::kPDEFoam, "PDEFoam", "VolFrac=.0588i:SigBgSeparate=True" );//>10k events
factory->BookMethod( Types::kFisher, "Fisher", "" );
factory->BookMethod( Types::kLD, "LD" );*/
/*would need to have the options tuned
* factory->BookMethod( Types::kFDA, "FDA", "Formula=(0)+(1)*x0+(2)*x1+(3)*x2+(4)*x3:\
ParRanges=(-1,1);(-10,10);(-10,10);(-10,10);(-10,10):\
FitMethod=MINUIT:\
ErrorLevel=1:PrintLevel=-1:FitStrategy=2:UseImprove:UseMinos:SetBatch" );*/
/* nerual network that would need to be worked on
* factory->BookMethod( Types::kMLP, "MLP_ANN", "<options>" );*/
factory->TrainAllMethods();
factory->TestAllMethods();
factory->EvaluateAllMethods();
targetFile->Write();
targetFile->Close();
}