14from os.path
import exists
16ROOT.TMVA.PyMethodBase.PyInitialize()
20modelFile =
"Higgs_trained_model.h5"
22if not exists(modelFile):
23 raise FileNotFoundError(
"You need to run TMVA_Higgs_Classification.C to generate the Keras trained model")
26model = ROOT.TMVA.Experimental.SOFIE.PyKeras.Parse(modelFile)
30model.OutputGenerated(
"Higgs_trained_model.hxx")
34print(
"compiling SOFIE model and functor....")
35ROOT.gInterpreter.Declare(
'#include "Higgs_trained_model.hxx"')
36modelName =
"Higgs_trained_model"
37ROOT.gInterpreter.Declare(
'auto sofie_functor = TMVA::Experimental::SofieFunctor<7,TMVA_SOFIE_'+modelName+
'::Session>(0);')
40inputFile =
"http://root.cern/files/Higgs_data.root"
42h1 = df1.Define(
"DNN_Value",
"sofie_functor(rdfslot_,m_jj, m_jjj, m_lv, m_jlv, m_bb, m_wbb, m_wwbb)").Histo1D((
"h_sig",
"", 100, 0, 1),
"DNN_Value")
45h2 = df2.Define(
"DNN_Value",
"sofie_functor(rdfslot_,m_jj, m_jjj, m_lv, m_jlv, m_bb, m_wbb, m_wwbb)").Histo1D((
"h_bkg",
"", 100, 0, 1),
"DNN_Value")
50print(
"Number of signal entries",h1.GetEntries())
51print(
"Number of background entries",h2.GetEntries())
53h1.SetLineColor(ROOT.kRed)
54h2.SetLineColor(ROOT.kBlue)
57ROOT.gStyle.SetOptStat(0)
ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree ,...
unsigned int RunGraphs(std::vector< RResultHandle > handles)
Trigger the event loop of multiple RDataFrames concurrently.