Hello, I have the following piece of code, where I chain a series of Ttree in 2 sets and I want to compare each branch from these 2 sets.
[code]{
TChain SLAC = new TChain(“MeritTuple”);
TChain LYON = new TChain(“MeritTuple”);
char nome[200];
for (int i=0;i<10;i++){
sprintf(nome,“noMask/allGamma-GR-v15r39-noMask-%06i-merit.root”,i);
//cout << nome << endl;
SLAC.Add(nome);
sprintf(nome,“Lyon-noMask/allGamma-GR-v15r39-Lyon-noMask-%06i-merit.root”,i);
//cout << nome << endl;
LYON.Add(nome);
}
SLAC->AddFriend(LYON,“LYON”);
TObjArray brlist = SLAC->GetListOfBranches();
int nbr = brlist->GetEntries();
TIterator itr=brlist->MakeIterator();
char buffer[200];
for(int i=0;i!=nbr;i++){
char* name=itr()->GetName();
std::cout<<name<<std::endl;
sts=TString(name);
if(sts.Last(’]’)!=-1) continue;
sprintf(buffer,"%s-LYON.%s!=0",name,name);
int brentries=SLAC->GetEntries(buffer);
//std::cout<<sts<<":"<<brentries<<std::endl;
}
}[/code]
As is, my code crash at the second iteration, and it seems to crash at char* name=itr()->GetName();
But if I comment int brentries=SLAC->GetEntries(buffer); then the loop correctly iterates until the end!!!
What am I doing wrong???
thanks in advance (I am using a recent svn build).
Johann
- modified to use the [ code ] … [ \ code ] markup