Rooters,
This question is motivated out of a recurring seg-fault error that I have been dealing with, but that would be too much of a mess to actually post and ask for help debugging. So, I only ask for some education as to the inner-workings of TChain so that I can fix it myself.
Here is the situation:
Ntuple 1: NT1.root
NT1.root contains a TTree “NTree” which contains the following branches: [A, B, C, D]
Ntuple 2: NT2.root
NT2.root contains a TTree “NTree” wich contains these following branches: [A, C, D, E]
To Create a TChain for my analysis I use the following:
TChain DataChain = new TChain("NTree");
DataChain->Add("NT1.root");
DataChain->Add("NT2.root");
I have subsequently set up a NTree Class using MakeClass() that initializes branches [A, B, C, D, E];
Therefore, in my analysis function, I fill the branches via the following:
NTree(DataChain)->A->GetEntry(i); //Works All the time
NTree(DataChain)->B->GetEntry(i); //Causes Segfault when NT2.root is open
NTree(DataChain)->C->GetEntry(i); //Works All the time
NTree(DataChain)->D->GetEntry(i); //Works All the time
NTree(DataChain)->E->GetEntry(i); //Causes Segfault when NT1.root is open
Thus, my question is the following, how do I make the above GetEntry calls robust to this? I have tried a few methods ( i.e. if(B != NULL){…Get Entry…} ) but none of them seem to work.
Thanks for your help and patience with me.
~Austin
