#include "TFile.h" #include "Math/Random.h" #include "Math/GSLRndmEngines.h" #include "TTree.h" #include int main() { ROOT::Math::Random rnd; rnd.SetSeed(123456); TFile training("tmva-in.root", "RECREATE"); TTree sampleTree("sampleTree","Sample tree"); double xv, yv, isSignal; sampleTree.Branch("x", &xv, "x/D"); sampleTree.Branch("y", &yv, "y/D"); sampleTree.Branch("isSignal", &isSignal, "signal/D"); isSignal = 1; const double pi = M_PI; const double r0 = 5, phi0 = pi/4, k = 3; const int sampleSize = 200000; for(int i = 0; i != sampleSize; ++i) { double r = r0 + rnd.Gaus(); double phi = phi0 * rnd.Gaus(); xv = -r0 + k*r*cos(phi); yv = r0/k + r*sin(phi); sampleTree.Fill(); } isSignal = 0; for(int i = 0; i != sampleSize; ++i) { double r = r0 + rnd.Gaus(); double phi = phi0 * rnd.Gaus(); xv = r0 - k*r*cos(phi); yv = -r0/k + r*sin(phi); sampleTree.Fill(); } sampleTree.Write(); training.Close(); return 0; }