13 Int_t
main(Int_t argc, Char_t* argv[])
21 std::vector< TString > treelist;
22 treelist.push_back(
"hit_tree");
23 treelist.push_back(
"event_tree");
26 std::vector< std::pair< TString, TObject* > > branchlist;
27 branchlist.push_back(std::pair< TString, TObject* > (
"hits",(TObject*)0));
28 branchlist.push_back(std::pair< TString, TObject* > (
"events",(TObject*)0));
31 TString name = TString(argv[1]);
32 TFile* file =
new TFile(name);
35 for (
size_t tree = 0; tree < treelist.size(); tree++) {
37 TObject*
object = file->Get(treelist.at(tree));
42 if (! object->InheritsFrom(
"TTree")) {
46 TTree* thistree =
dynamic_cast<TTree*
>(object);
51 Int_t nevents = thistree->GetEntries();
52 QwMessage <<
"Number of entries in " << treelist.at(tree) <<
": "
56 for (
size_t branch = 0; branch < branchlist.size(); branch++) {
57 if (thistree->FindBranch(branchlist.at(branch).first)) {
58 thistree->SetBranchAddress(branchlist.at(branch).first,
59 &branchlist.at(branch).second);
61 QwWarning <<
"No branch " << branchlist.at(branch).first <<
" "
62 <<
"in tree " << treelist.at(tree)
68 for (Int_t event = 0;
event < nevents;
event++) {
70 thistree->GetEntry(event);
71 for (
size_t branch = 0; branch < branchlist.size(); branch++) {
72 if (branchlist.at(branch).second)
73 branchlist.at(branch).second->Print();
#define QwMessage
Predefined log drain for regular messages.
A logfile class, based on an identical class in the Hermes analyzer.
static std::ostream & endl(std::ostream &)
End of the line.
#define QwWarning
Predefined log drain for warnings.
int main(int argc, char **argv)
#define QwError
Predefined log drain for errors.