I am an absolute beginner in ROOT with fair C++ experience; please accept my naive question, and kindly try to make your answer as simple as possible.
I have a TChain from which I copy trees from its files. I then declare a new tree which is the old tree copied. I also added branches to that new tree. Now, I want to fill those branches with variables.
Variables are declared in my script as:
TTreeReaderValue<Float_t> tau_0_pt(myReader, “tau_0_pt”);
The script is complaining about the process of filling the branches as follows:
error: member reference base type ‘float’ is not a structure or union
tau_0_pt->Fill();
TString fname;
TFile *input[n];
for (Int_t i=0; i<n; i++){
//The following block is old code that should be removed,
// left to indicate what the issues were.
//This line will not incorporate the index i
//fname = “.filename[i]”;
//This line will try to open a file called "fname".
// The pointer input will be overwritten on every loop and input will only
// point to the last file open, while all the others will still be open.
//input = TFile::Open(“fname”);
//This will create a filename that is appended with index i.
fname = Form("filename_%d", i);
std::cout << "Opening filename: '" << fname << "'\n";
//This will open a file with the name stored in the variable fname.
//This will store each pointer to the files separately.
input[n] = TFile.Open(fname);
}