Hi experts,
I have created a class, imported it into root via pragma links, and LinkDef and DictGen etc. I have made a tree with the branch structure determined by this class. For some reason I cannot read the leaves on the structure. For example,
void analyzer::Init(TFile *inFile,Option_t *options[])
{
inTree = (TTree*)inFile->Get("usertree");
mainBranchIn = (TBranch*)inTree->FindBranch("midasBranch");
nLeavesIn = (int)mainBranchIn->GetNleaves();
leafListIn = (TList*)mainBranchIn->GetListOfLeaves();
cout << "nleaves is : " << nLeavesIn << "\n";
for (int i = 0 ; i <nLeavesIn;i++) cout <<"\n"<< leafListIn->At(i)->GetName()<< "\n";
nevents=(int)inTree->GetEntries();
}
When I run this I get nleaves=1. And the leaf list has only one element–“midasBranch”.
I define my class as follows:
class midasEvent{
public :
Double32_t adc[392]; //[0, 0, 32]
Short_t tdc[384];
Double32_t cath[640]; //[0, 4096, 12]
UShort_t rdgt_b0[1000];
UShort_t rdgt_deg[1000];
UShort_t rdgt_tgt[1000];
midasEvent();
virtual ~midaEvent();
};
To set branches according to this class I use:
mevent = new midasEvent();
int buffersize = 16000;
int splitlevel = 4;
usertree->Branch("midasBranch", "midasEvent", &mevent, buffersize, splitlevel);
I know this is successfully written, because I can read the file. A snapshot of the root browser with the output is attached.
Many thanks for any help you can offer!