Hello,
I am using the make selector class and in that class’ methods I would like to access branch values using the TLeaf::GetValue() method. My final goal is to loop over all possible branches in a tree and plot them with respect to one another. But I am having trouble. Here is my code at present. Can anyone help?
void selector::Loop( ){
TObjArray *branchList;
branchList = fChain->GetListOfBranches();
nBranch = fChain->GetNbranches();
TString varnames[nBranch];
TLeaf *var[nBranch];
double value_i;
for (Long64_t jentry=0; jentry<nentries;jentry++) {
Long64_t ientry = LoadTree(jentry);
nb = fChain->GetEntry(jentry);
for(int i=0;i<nBranch;i++){
varnames[i] = branchList->At(i)->GetName();
var[i] = fChain->GetBranch(varnames[i])->GetLeaf(varnames[i]);
value_i = var[i]->GetValue();
h1_master[i]->Fill(value_i,weight);
}
}
I get the following errors
selector.C:159: error: invalid use of incomplete type ‘struct TLeaf’
/root-5.34.21/include/TBranch.h:45: error: forward declaration of ‘struct TLeaf’