std::unique_ptr<TFile> myFile(TFile::Open("RAW148OS_treeFF01.root", "READ"));
auto tree = myFile->Get<TTree>("Analysis_All");
int variable;
tree->SetBranchAddress("Fragment_Velocity", &variable);
for (int iEntry = 0; tree->LoadTree(iEntry) >= 0; ++iEntry) {
// Load the data for the given tree entry
tree->GetEntry(iEntry);
// Now, `variable` is set to the value of the branch
// "branchName" in tree entry `iEntry`
std::cout << variable << std::endl;
}
Is it better now ?