22int df015_LazyDataSource()
28 auto fileNameUrl =
"http://root.cern.ch/files/tutorials/df014_CsvDataSource_MuRun2010B.csv";
29 auto fileName =
"df015_CsvDataSource_MuRun2010B.csv";
33 auto csv_rdf =
FromCSV(fileName);
36 std::string px1Name =
"px1";
37 auto px1 = csv_rdf.Take<
double>(px1Name);
38 std::string py1Name =
"py1";
39 auto py1 = csv_rdf.Take<
double>(py1Name);
43 auto df =
MakeLazyDataFrame(std::make_pair(px1Name, px1), std::make_pair(py1Name, py1));
46 auto ptFormula = [](
double px,
double py) {
return sqrt(px * px + py * py); };
47 auto pt_h = df.Define(
"pt", ptFormula, {
"px1",
"py1"})
48 .Histo1D<double>({
"pt",
"Muon p_{T};p_{T} [GeV/c];", 128, 0, 128},
"pt");
R__EXTERN TSystem * gSystem
virtual Bool_t Cp(const char *dst, Bool_t progressbar=kTRUE, UInt_t buffersize=1000000)
Allows to copy this file to the dst URL.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
VecExpr< UnaryOp< Sqrt< T >, VecExpr< A, T, D >, T >, T, D > sqrt(const VecExpr< A, T, D > &rhs)
RDataFrame MakeLazyDataFrame(std::pair< std::string, RResultPtr< std::vector< ColumnTypes > > > &&... colNameProxyPairs)
Factory method to create a Lazy RDataFrame.
RDataFrame FromCSV(std::string_view fileName, bool readHeaders=true, char delimiter=',', Long64_t linesChunkSize=-1LL, std::unordered_map< std::string, char > &&colTypes={})
Factory method to create a CSV RDataFrame.