/** * copyright https://mit-license.org * File : tmp2.cpp * Author : chenxu * Date : 0 2020-06-21 21:19:15 * Last Modified Date: 1 2021-05-31 18:48:52 * Last Modified By : chenxu */ #include using namespace std; #include #include #include #include using namespace ROOT; class xy_t{ public: double x; double y; xy_t():x(-1),y(-1){} ~xy_t(){}; ClassDef(xy_t,1); }; void tmp2() { xy_t xy; { TFile * f1 = new TFile("f1.root", "RECREATE"); TTree * t1 = new TTree("t1", "t1"); t1->Branch("xy", &xy); xy.x = xy.y = 1; t1->Fill(); t1->Write(); f1->Close(); } { TFile * f1 = new TFile("f2.root", "RECREATE"); TTree * t1 = new TTree("t1", "t1"); t1->Branch("xy", &xy); xy.x = xy.y = 1; t1->Fill(); t1->Write(); f1->Close(); } RDataFrame aData("t1", "f*.root"); aData.Snapshot("t1", "o1.root", {"x"}); // aData.Snapshot("t1", "o1.root"); RDataFrame aData2("t1", "o1.root"); aData2.Foreach([](double x){cout<