This macro provides an example of using a trained model with PyTorch and make inference using SOFIE and RDataFrame This macro uses as input an ONNX model generated with the Python tutorial TMVA_SOFIE_PyTorch_HiggsModel.py You need to run that macro before to generate the trained PyTorch model and also the corresponding header file with SOFIE which can then be used for inference
Execute in this order:
python3 TMVA_SOFIE_PyTorch_HiggsModel.py
root TMVA_SOFIE_RDataFrame.C
#include "HiggsModel.hxx"
#include <array>
#include <vector>
std::cout <<
"Running using " <<
nslots <<
" threads" << std::endl;
};
auto h1 =
df1.DefineSlot(
"DNN_Value",
evalModel, {
"m_jj",
"m_jjj",
"m_lv",
"m_jlv",
"m_bb",
"m_wbb",
"m_wwbb"})
.Histo1D({"h_sig", "", 100, 0, 1}, "DNN_Value");
auto h2 =
df2.DefineSlot(
"DNN_Value",
evalModel, {
"m_jj",
"m_jjj",
"m_lv",
"m_jlv",
"m_bb",
"m_wbb",
"m_wwbb"})
.Histo1D({"h_bkg", "", 100, 0, 1}, "DNN_Value");
h2->DrawClone();
}
#define R__ADD_INCLUDE_PATH(PATH)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
R__EXTERN TStyle * gStyle
ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree ,...
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual TObject * DrawClone(Option_t *option="") const
Draw a clone of this object in the current selected pad with: gROOT->SetSelectedPad(c1).
void SetOptStat(Int_t stat=1)
The type of information printed in the histogram statistics box can be selected via the parameter mod...
void EnableImplicitMT(UInt_t numthreads=0)
Enable ROOT's implicit multi-threading for all objects and methods that provide an internal paralleli...
- Author
- Lorenzo Moneta
Definition in file TMVA_SOFIE_RDataFrame.C.