7 #if not defined(__CINT__) || defined(__MAKECINT__)
9 #include "TMVA/Factory.h"
10 #include "TMVA/Tools.h"
16 TChain *all =
new TChain(treename.c_str());
18 for (
int i = 0;
i < filecount; ++
i)
23 temp = name+
string(s.str())+extension;
24 all->Add(temp.c_str());
33 TString jobname(factoryname.c_str());
34 TFile *targetFile =
new TFile(outfile.c_str(),
"RECREATE");
36 factory->AddSignalTree(signalTree,1.0);
37 factory->AddBackgroundTree(backTree,1.0);
39 factory->AddBackgroundTree(bgTree2,1.0);
41 factory->AddSpectator(
"track_layer",
'I');
42 factory->AddSpectator(
"track_pT",
'F');
43 factory->AddSpectator(
"track_dca",
'F');
44 factory->AddSpectator(
"cluster_prob",
'F');
45 factory->AddSpectator(
"abs(track_deta)",
'F');
46 factory->AddSpectator(
"abs(cluster_deta)",
'F');
47 factory->AddSpectator(
"abs(cluster_dphi)",
'F');
48 factory->AddSpectator(
"abs(track_dlayer)",
'I');
49 factory->AddSpectator(
"approach_dist",
'F');
50 factory->AddVariable(
"vtx_radius",
'F');
54 factory->AddVariable(
"photon_m",
'F');
55 factory->AddVariable(
"photon_pT",
'F');
57 string track_layer_cut =
"track_layer>-1.";
58 string track_pT_cut =
"track_pT>2.0";
59 string track_dca_cut =
"50>track_dca>0";
60 string em_prob_cut =
"cluster_prob>-0.1";
61 string track_deta_cut =
".0082>=track_deta";
62 string track_dlayer_cut =
"2>=abs(track_dlayer)";
63 string approach_dist_cut =
"69.34>approach_dist>0";
64 string vtx_radius_cut =
"vtx_radius>0";
66 string tCutInitializer = track_pT_cut+
"&&"+em_prob_cut+
"&&"+track_layer_cut;
67 TCut preTraingCuts(tCutInitializer.c_str());
69 factory->PrepareTrainingAndTestTree(preTraingCuts,
"nTrain_Signal=0:nTrain_Background=0:nTest_Signal=0:nTest_Background=0");
75 factory->BookMethod(Types::kCuts,
"Cuts");
76 factory->TrainAllMethods();
77 factory->TestAllMethods();
78 factory->EvaluateAllMethods();
86 string treePath =
"/sphenix/user/vassalli/RecoConversionTests/truthconversionembededonlineanalysis";
87 string treeExtension =
".root";
88 string outname =
"cutTrainA.root";
89 unsigned int nFiles=100;
95 TChain *signalTree =
handleFile(treePath,treeExtension,
"cutTreeSignal",nFiles);
96 TChain *backtrackTree =
handleFile(treePath,treeExtension,
"trackBackTree",nFiles);
97 TChain *backpairTree =
handleFile(treePath,treeExtension,
"pairBackTree",nFiles);
98 TChain *backVtxTree =
handleFile(treePath,treeExtension,
"vtxBackTree",nFiles);
101 makeFactory(signalTree,backVtxTree,outname,
"vtxback");