Skip to content
Snippets Groups Projects
Commit a69a37f1 authored by Danilo Piparo's avatar Danilo Piparo
Browse files

[Tutorials] Use in RDF/Multicore tutorials the new TFile::Get<T> method

in order to make of this code the most up-to-date set of examples possible.
parent b9044ba3
No related branches found
No related tags found
No related merge requests found
......@@ -60,8 +60,7 @@ int df007_snapshot()
// Open the new file and list the columns of the tree
TFile f1(outFileName);
TTree *t;
f1.GetObject(treeName, t);
auto t = f1.Get<TTree>(treeName);
std::cout << "These are the columns b1, b1_square and b2_vector:" << std::endl;
for (auto branch : *t->GetListOfBranches()) {
std::cout << "Branch: " << branch->GetName() << std::endl;
......@@ -75,7 +74,7 @@ int df007_snapshot()
// Open the new file and list the columns of the tree
TFile f2(outFileNameAllColumns);
f2.GetObject(treeName, t);
t = f2.Get<TTree>(treeName);
std::cout << "These are all the columns available to this tdf:" << std::endl;
for (auto branch : *t->GetListOfBranches()) {
std::cout << "Branch: " << branch->GetName() << std::endl;
......
......@@ -23,8 +23,7 @@ int imt001_parBranchProcessing()
auto file = TFile::Open("http://root.cern.ch/files/h1/dstarmb.root");
// Get the tree
TTree *tree = nullptr;
file->GetObject<TTree>("h42", tree);
auto tree = file->Get<TTree>("h42");
const auto nEntries = tree->GetEntries();
......
......@@ -42,8 +42,7 @@ int mp103_processSelector()
// #define __reproduce_davix
#if defined(__reproduce_davix)
auto fp = std::make_unique<TTree>(TFile::Open(file0));
TTree *tree;
fp->GetObject("h42", tree);
auto tree = fp->Get<TTree>("h42");
#endif
ROOT::TTreeProcessorMP pool(3);
......
......@@ -46,8 +46,7 @@ Int_t mt102_readNtuplesFillHistosAndFit()
// We define our work item
auto workItem = [&histograms](UInt_t workerID) {
TFile f(Form("mt101_multiCore_%u.root", workerID));
TNtuple *ntuple = nullptr;
f.GetObject("multiCore", ntuple);
auto ntuple = f.Get<TNtuple>("multiCore");
auto &histo = histograms.at(workerID);
for (auto index : ROOT::TSeqL(ntuple->GetEntriesFast())) {
ntuple->GetEntry(index);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment