void scanMembers(char* className){ TClass *tc; TList *keys; TDataMember *tdm; TClass *subTc; string *type; int size; string *subClassName; tc = gROOT->GetClass(className); //Ciclo sui membri della classe relativa keys = tc->GetListOfDataMembers(); tdm = (TDataMember*)keys->First(); while(tdm){ type = new string(tdm->GetTypeName()); if ((tdm->IsBasic() || (type->compare("TClonesArray") == 0)) ) { size = tdm->GetArrayDim(); if(size > 0){ for (int i = 0; i < size; i++){ printf("[%i]", tdm->GetMaxIndex(i)); } } //Here i would like to scan the TClonesArray elements too (which are classes of mine too) //TBD if(!tdm->IsBasic()) { } } tdm = (TDataMember*)keys->After(tdm); } } //Here i retrieve the first TTree i found in the file.root TTree* getFirstTree(TFile* file){ TList *keys; TKey *key; int loc; string *className; keys = file->GetListOfKeys(); key = (TKey*)keys->First(); while(key){ className = new string(key->GetClassName()); loc = className->find("Tree", 0); if(loc != string::npos){ return (TTree*)key->ReadObj(); } key = (TKey*)keys->After(key); } return NULL; } //main function void eventScan(TString filename){ gROOT->Reset(); //These library is needed to load the pamela Dictionary gSystem->Load("/home/kusanagi/mauProjects/yoda/event/.libs/libyoda.so"); TFile *tf = new TFile(filename); string *className; TTree *tr; TObjArray *toa; TBranch *tb; //Search for the TTree tr = getFirstTree(tf); //Look for the branch toa = tr->GetListOfBranches(); tb = (TBranch*)toa->First(); className = new string(tb->GetClassName()); scanMembers(className->c_str()); }