TChain* chain = new TChain("myTree"); // create a TChain chain->Add("file1.root"); // add root files to the TChain chain->Add("file2.root"); Int_t eventID; chain->SetBranchAddress("eventID", &eventID); // set the branch address of the variable of interest chain->GetEntry(0); // retrieve the first entry of the TChain cout << "Event ID: " << eventID << endl; // print the value of the variable
TChain* chain = new TChain("myTree"); // create a TChain chain->Add("file1.root"); // add root files to the TChain chain->Add("file2.root"); Int_t eventID; chain->SetBranchAddress("eventID", &eventID); // set the branch address of the variable of interest for (Long64_t i=0; iThese examples use the ROOT package library for C++.GetEntries(); i++) { // loop over all entries chain->GetEntry(i); // retrieve the i-th entry cout << "Event ID: " << eventID << endl; // print the value of the variable }