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");
35 Factory *factory =
new Factory(jobname,targetFile,
"AnalysisType=Regression");
36 factory->AddRegressionTree(signalTree,1.0);
37 factory->AddVariable(
"track1_pt",
'F');
38 factory->AddVariable(
"track2_pt",
'F');
39 factory->AddVariable(
"track1_phi",
'F');
40 factory->AddVariable(
"track1_phi-track2_phi",
"d#phi",
"rad");
41 factory->AddVariable(
"track1_eta",
'F');
42 factory->AddVariable(
"track1_eta-track2_eta",
"d#eta",
"rad");
43 factory->AddVariable(
"vtx_radius",
"radius",
"[cm]");
44 factory->AddTarget(
"tvtx_radius",
"radius",
"[cm]");
46 string track_pT_cut =
"";
49 string tCutInitializer = track_pT_cut;
50 TCut preTraingCuts(tCutInitializer.c_str());
51 factory->PrepareTrainingAndTestTree(preTraingCuts,
"nTrain_Regression=0:nTest_Regression=0");
52 factory->BookMethod(Types::kMLP,
"MLP_ANN",
"HiddenLayers=2000");
53 factory->BookMethod(Types::kMLP,
"MLP_ANN2",
"HiddenLayers=500,6");
56 factory->TrainAllMethods();
57 factory->TestAllMethods();
58 factory->EvaluateAllMethods();
66 string treePath =
"/sphenix/user/vassalli/gammasample/conversiononlineanalysis";
67 string treeExtension =
".root";
68 string outname =
"vtxTrain.root";
69 unsigned int nFiles=200;
71 TChain *signalTree =
handleFile(treePath,treeExtension,
"vtxingTree",nFiles);