void WorkOnPad(TPad* pad) { TIter nextobj(pad->GetListOfPrimitives()); TObject *obj; while (obj = nextobj()) { //cout << "Pad Object: " << obj->GetName() << endl; if(obj->InheritsFrom("TPad")) { WorkOnPad((TPad*)obj); } else if(obj->InheritsFrom("TH1")) { WorkOnHist((TH1*)obj); } } }
TH1 *hist_extract(TPad *c) { TIter nextobj(c->GetListOfPrimitives()); for( TObject *ptr; NULL!=(ptr=nextobj.Next()); ) { printf("==========>>> %s\n",ptr->GetName()); } }
void c_V(void) { TIter nextobj(gDirectory->GetListOfKeys()); TObject *ptr=nextobj.Next(); if( ptr==NULL ) { printf("No objects found!\n"); return; } TCanvas *c=gDirectory->Get(ptr->GetName()); c->Draw(); TPad *p=c->cd(1); hist_extract(p); }