Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
hepsim:jas4pp [2020/11/05 14:21] hepsim17 |
hepsim:jas4pp [2021/02/13 23:12] hepsim17 [Reading LCIO files] |
||
---|---|---|---|
Line 195: | Line 195: | ||
Also, look at concrete example of how to analyze single particles in [[: | Also, look at concrete example of how to analyze single particles in [[: | ||
+ | |||
+ | ====== | ||
+ | |||
+ | Jas4pp natively reads ROOT files including files created using ROOT 6 (ROOT3, 4 and 5 are also supported). For example, one can read ROOT trees/ | ||
+ | One can find some examples in the directory " | ||
+ | |||
+ | <hidden Show example of a Python code here> | ||
+ | <code python> | ||
+ | from hep.io.root.interfaces import TTree | ||
+ | from hep.io.root import RootFileReader | ||
+ | |||
+ | reader = RootFileReader(" | ||
+ | |||
+ | tree = reader.get(" | ||
+ | maxevents=tree.getEntries() | ||
+ | |||
+ | leaves = tree.getLeaves() | ||
+ | nrleaves=leaves.size() | ||
+ | |||
+ | print "Nr of events=", | ||
+ | print "Nr of leaves=", | ||
+ | |||
+ | print " | ||
+ | for l in xrange( nrleaves ): | ||
+ | print " | ||
+ | |||
+ | print "Run over events" | ||
+ | f0=leaves.get(0); | ||
+ | f1=leaves.get(1); | ||
+ | f2=leaves.get(2); | ||
+ | for i in xrange(tree.getEntries()): | ||
+ | print f0.getValue(i), | ||
+ | |||
+ | </ | ||
+ | </ | ||
+ | |||
+ | The example directory also shows how to read histograms. | ||
+ | Similar examples can be made using Java or Groovy scripting. | ||
+ | |||
+ | The supported ROOT interfaces are: | ||
+ | |||
+ | <hidden show more details on ROOT interfaces here> | ||
+ | TArrayC | ||
+ | TArrayD | ||
+ | TArrayF | ||
+ | TArrayI | ||
+ | TArray | ||
+ | TArrayL | ||
+ | TAttAxis | ||
+ | TAttFill | ||
+ | TAttLine | ||
+ | TAttMarker | ||
+ | TAxis | ||
+ | TBasket | ||
+ | TBranchClones | ||
+ | TBranchElement | ||
+ | TBranch | ||
+ | TBranchObject | ||
+ | TClonesArray | ||
+ | TCollection | ||
+ | TDatime | ||
+ | TDirectory | ||
+ | TFile | ||
+ | TGraph | ||
+ | TH1D | ||
+ | TH1F | ||
+ | TH1 | ||
+ | TH2D | ||
+ | TH2F | ||
+ | TH2 | ||
+ | TKey | ||
+ | TLeafB | ||
+ | TLeafC | ||
+ | TLeafD | ||
+ | TLeafElement | ||
+ | TLeafF | ||
+ | TLeafI | ||
+ | TLeaf | ||
+ | TLeafL | ||
+ | TLeafObject | ||
+ | TLeafO | ||
+ | TLeafS | ||
+ | TList | ||
+ | TMap | ||
+ | TNamed | ||
+ | TObjArray | ||
+ | TObject | ||
+ | TProfile | ||
+ | TSeqCollection | ||
+ | TStreamerBase | ||
+ | TStreamerBasicPointer | ||
+ | TStreamerBasicType | ||
+ | TStreamerElement | ||
+ | TStreamerInfo | ||
+ | TStreamerLoop | ||
+ | TStreamerObjectAny | ||
+ | TStreamerObject | ||
+ | TStreamerObjectPointer | ||
+ | TStreamerString | ||
+ | TString | ||
+ | TTree | ||
+ | </ | ||
+ | |||
+ | One can browser histogram (or ROOT objects) using this: | ||
+ | |||
+ | <code python> | ||
+ | import rootio | ||
+ | rootio.HBrowser(" | ||
+ | rootio.Browser(" | ||
+ | </ | ||
+ | |||
+ | You will see the browsers: | ||
+ | |||
+ | {{: | ||
+ | |||
+ | {{: | ||
+ | |||
+ | The script that call these browsers | ||
+ | |||
+ | Jas4pp does not support ROOT files with complex objects created using ROOT 6, i.e. TH1D, TH2D and TGraph. | ||
====== Using GUI mode ====== | ====== Using GUI mode ====== |