Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@pn11
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pn11/98d0eea88d0bfd18f4a5 to your computer and use it in GitHub Desktop.
Save pn11/98d0eea88d0bfd18f4a5 to your computer and use it in GitHub Desktop.
指定したROOTファイルに含まれるTTreeの中身を表示するだけのプログラム。
#include<iostream>
#include<TList.h>
#include<TFile.h>
int main(int argc, char* argv[]){
using namespace std;
TFile *f1 = new TFile(argv[1]);
TList *l1 = f1->GetListOfKeys();
const Int_t nentry = l1->GetEntries();
TObject *obj[nentry];
for (int ientry = 0; ientry < nentry; ientry++){
obj[ientry] = f1->Get(l1->At(ientry)->GetName());
string clstr = obj[ientry]->ClassName();
// cout << clstr << endl;
if (clstr == "TTree"){
// cout << "TTree: " << obj[ientry]->GetName() <<endl;
obj[ientry]->Print();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment