import ROOT ROOT.gROOT.ProcessLine(".x rootlogon.C") ROOT.gROOT.ProcessLine('gROOT->SetStyle("Plain")') fname="outfiles/MC/sphere/drift_86.0/no_error/Cosmics_FopiMC_86ar85_1_recl.reco.root" rfile=ROOT.TFile(fname,'read') tree=rfile.Get('cbmsim') tree.SetBranchStatus('*',0) act_tree=['CutCosmics','DelTrack','TrackFitStat_0','TpcSPHit','TpcCluster'] for branch in act_tree: tree.SetBranchStatus(branch+'.*',1) ev=-1 for e in tree: ev+=1 print ev if ev>3: exit()