44 tree->SetBranchAddress(
"x", &
x);
45 tree->SetBranchAddress(
"y", &
y);
46 tree->SetBranchAddress(
"eventID", &eventID);
48 for (
Int_t n = 0;
n < nPoints; ++
n) {
49 x = rng.Gaus(offset, scale);
50 y = rng.Gaus(offset, scale);
60 tree->ResetBranchAddresses();
64int TMVACrossValidationApplication()
81 TString jobname(
"TMVACrossEvaluation");
84 TString weightfile =
TString(
"dataset/weights/") + jobname +
"_" + methodName +
TString(
".weights.xml");
87 if (weightfileExists) {
88 reader->
BookMVA(methodName, weightfile);
90 std::cout <<
"Weightfile for method " << methodName <<
" not found."
91 " Did you run TMVACrossValidation with a specified"
92 " splitExpr?" << std::endl;
99 TString weightfile =
TString(
"dataset/weights/") + jobname +
"_" + methodName +
TString(
".weights.xml");
102 if (weightfileExists) {
103 reader->
BookMVA(methodName, weightfile);
105 std::cout <<
"Weightfile for method " << methodName <<
" not found."
106 " Did you run TMVACrossValidation with a specified"
107 " splitExpr?" << std::endl;
114 tree->Branch(
"x", &
x,
"x/F");
115 tree->Branch(
"y", &
y,
"y/F");
116 tree->Branch(
"eventID", &eventID,
"eventID/I");
118 fillTree(
tree, 1000, 1.0, 1.0, 100);
119 fillTree(
tree, 1000, -1.0, 1.0, 101);
120 tree->SetBranchAddress(
"x", &
x);
121 tree->SetBranchAddress(
"y", &
y);
122 tree->SetBranchAddress(
"eventID", &eventID);
126 TH1F histBDTG{
"BDTG",
"BDTG", nbin, -1, 1};
127 TH1F histFisher{
"Fisher",
"Fisher", nbin, -1, 1};
130 for (
Long64_t ievt = 0; ievt <
tree->GetEntries(); ievt++) {
131 tree->GetEntry(ievt);
136 histBDTG.Fill(valBDTG);
137 histFisher.Fill(valFisher);
140 tree->ResetBranchAddresses();
144 TFile *target =
new TFile(
"TMVACrossEvaluationApp.root",
"RECREATE");
160int main(
int argc,
char **argv)
162 TMVACrossValidationApplication();
R__EXTERN TSystem * gSystem
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
virtual void Close(Option_t *option="")
Close a file.
1-D histogram with a float per channel (see TH1 documentation)}
The Reader class serves to use the MVAs in a specific analysis context.
Double_t EvaluateMVA(const std::vector< Float_t > &, const TString &methodTag, Double_t aux=0)
Evaluate a std::vector<float> of input data for a given method The parameter aux is obligatory for th...
IMethod * BookMVA(const TString &methodTag, const TString &weightfile)
read method name from weight file
void AddSpectator(const TString &expression, Float_t *)
Add a float spectator or expression to the reader.
void AddVariable(const TString &expression, Float_t *)
Add a float variable or expression to the reader.
Random number generator class based on M.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
A TTree represents a columnar dataset.
int main(int argc, char **argv)