StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StGammaTreeReader.h
1 #ifndef __StGammaTreeReader_h__
2 #define __StGammaTreeReader_h__
3 
4 #include "StMaker.h"
5 #include "StGammaEvent.h"
6 
7 #include "TChain.h"
8 #include "TString.h"
9 #include <map>
10 
11 class StGammaTreeReader : public StMaker
12 {
13 
14  public:
15 
16  StGammaTreeReader(const Char_t *name="mGammaTree", const Char_t *bname="gammas");
17  ~StGammaTreeReader(){ /* nada */ };
18 
20  void chainFile( const Char_t *name, const Char_t *matches=".root" );
21 
22  StGammaEvent *event(){ return mEvent; }
23 
24  Int_t Init();
25  Int_t Make();
26  void Clear(Option_t *opts="");
27 
29  Long64_t getNumberOfEvents(){ return mChain->GetEntries(); }
30 
32  Int_t getEvent(Long64_t entry); // read in by event
35  Int_t getEvent(Int_t runNumber, Int_t eventNumber );
36 
38  TChain *chain(){ return mChain; }
39 
41  void Test();
42 
43  virtual const char *GetCVS() const {
44  static const char cvs[]="Tag $Name: $ $Id: StGammaTreeReader.h,v 1.3 2014/08/06 11:43:18 jeromel Exp $ built " __DATE__ " " __TIME__ ;
45  return cvs;
46  }
47 
48 
49  private:
50  protected:
51 
52  Int_t index;
53  Int_t mNumberOfFiles;
54  Bool_t mIndexed;
55  void buildIndex();
56  std::map<Long64_t,Long64_t> mIndex;
57 
58  Long64_t key( Int_t run, Int_t event );
59 
60  TChain *mChain;
62  TString mBranchName;
64  void treeDetails();
65  Bool_t mFirst;
66 
67  ClassDef(StGammaTreeReader,1);
68 
69 
70 };
71 
72 #endif
void Test()
This is a &quot;self test&quot;. Do not feed it alot of data.
StGammaEvent * mEvent
TChain * chain()
Pointer to the chain itself.
Long64_t getNumberOfEvents()
Returns the total number of entries for this chain of events.
void Clear(Option_t *opts="")
User defined functions.
void chainFile(const Char_t *name, const Char_t *matches=".root")
Add a file to the list of files in the chain being processed.
Int_t getEvent(Long64_t entry)
Loads the specified entry in the chain. Access using event() defined above.