[cernRoot]how to get tree name?

   TIter nextkey( root_file->GetListOfKeys() );
   TKey *key, *oldkey=0;
   while ( (key = (TKey*)nextkey())) {

      TObject *obj = key->ReadObj();
      if ( obj->IsA()->InheritsFrom( TTree::Class() ) ) {
         Tree_data = (TTree*)obj;
         break;
      }
   }

你可能感兴趣的:(C++,cernRoot)