ATLAS Offline Software
Loading...
Searching...
No Matches
TreeReader.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TreeReader_h
6#define TreeReader_h
7
9//
10// Class TreeReader
11// TreeReader.h
12//
13// Class for Tree reading through TFomula
15
16#include "TTree.h"
17#include "TTreeFormula.h"
18#include "TTreeFormulaManager.h"
19#include "TString.h"
20#include <map>
21#include <vector>
22/*
23class std::vector<double>;
24class std::vector<int>;
25class std::vector<std::vector<double> >;
26class std::vector<std::vector<int> >;*/
27
29class TreeReader //: public TTreeFormulaManager
30{
31 private:
32
33 TTree* m_tree;
34 int m_currentEntry = 0; // current ntuple entry stored in buffer
35 int m_entries; // total number of entries
36 bool m_isChain = false;
38 std::map<std::string, TTreeFormula*> m_formulae; // known formulae
39
40 public:
41
42 TreeReader(); // Default ctor
43 virtual ~TreeReader(); // dtor
44
45 TreeReader(TTree* n); // ctor with ntuple
46
47 void SetTree(TTree* n); //
48 double GetVariable(const char* c, int entry=-2); // return variable s for a given entry (<0 -> current entry)
49 int GetEntry(int entry=-1); // Read a given entry in the buffer (-1 -> next entry);
50 int GetEntries() { return m_entries ; }
51 TTree* GetTree() { return m_tree ; }
52 void Restart() {m_currentEntry = -1;}
53
54 ClassDef(TreeReader,1) // Integrate this class into ROOT (must be the last member)
55
56};
57
58#endif
double GetVariable(const char *c, int entry=-2)
virtual ~TreeReader()
TTree * m_tree
Definition TreeReader.h:33
int m_currentTree
Definition TreeReader.h:37
std::map< std::string, TTreeFormula * > m_formulae
Definition TreeReader.h:38
void SetTree(TTree *n)
void Restart()
Definition TreeReader.h:52
int GetEntry(int entry=-1)
int m_entries
Definition TreeReader.h:35
bool m_isChain
Definition TreeReader.h:36
int m_currentEntry
Definition TreeReader.h:34
TTree * GetTree()
Definition TreeReader.h:51
int GetEntries()
Definition TreeReader.h:50