StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StjTreeReader.cxx
1 // $Id: StjTreeReader.cxx,v 1.4 2015/08/14 16:38:28 rfatemi Exp $
2 // Copyright (C) 2008 Tai Sakuma <sakuma@bnl.gov>
3 #include "StjTreeReader.h"
4 
5 #include "StjTreeIndex.h"
6 
7 #include <TTree.h>
8 
9 ClassImp(StjTreeReader)
10 
11 void StjTreeReader::Init()
12 {
13  _tree->BuildIndex("runNumber", "eventId");
14  SetBranchAddress(_tree);
15 }
16 
17 Long64_t StjTreeReader::GetEntryWithIndex(const StjTreeIndex& idx)
18 {
19  return GetEntryWithIndex(idx.big(), idx.small());
20 }
21 
22 Long64_t StjTreeReader::GetEntryWithIndex(Int_t big, Int_t small)
23 {
24  clearEntry();
25 
26  Long64_t ret = _tree->GetEntryWithIndex(big, small);
27 
28  if(ret <= 0) return ret;
29 
30  readEntry();
31 
32  return ret;
33 }