Logo ROOT   master
Reference Guide
TBranchProxyDirector.h
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Author: Philippe Canal 13/05/2003
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2004, Rene Brun, Fons Rademakers and al. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TBranchProxyDirector
13 #define ROOT_TBranchProxyDirector
14 
15 #include "Rtypes.h"
16 #include <vector>
17 #include <list>
18 #include <algorithm>
19 
20 class TH1F;
21 class TTree;
22 
23 namespace ROOT {
24 namespace Detail {
25  class TBranchProxy;
26  class TFriendProxy;
27 }
28 
29 namespace Internal{
30  class TFriendProxy;
31 
32  // Helper function to call SetReadEntry on all TFriendProxy
33  void ResetReadEntry(TFriendProxy *fp);
34 
36 
37  //This class could actually be the selector itself.
38  TTree *fTree; // TTree we are currently looking at.
39  Long64_t fEntry; // Entry currently being read (in the local TTree rather than the TChain)
40 
41  std::list<Detail::TBranchProxy*> fDirected;
42  std::vector<TFriendProxy*> fFriends;
43 
46 
47  public:
48 
50  TBranchProxyDirector(TTree* tree, Int_t i); // cint has (had?) a problem casting int to long long
51 
53  void Attach(TFriendProxy* f);
54  TH1F* CreateHistogram(const char *options);
55 
56  /// Return the current 'local' entry number; i.e. in the 'local' TTree rather than the TChain.
57  /// This value will be passed directly to TBranch::GetEntry.
58  Long64_t GetReadEntry() const { return fEntry; }
59 
60  TTree* GetTree() const { return fTree; };
61  // void Print();
62 
63  /// Move to a new entry to read
64  /// entry is the 'local' entry number; i.e. in the 'local' TTree rather than the TChain.
65  /// This value will be passed directly to TBranch::GetEntry.
66  void SetReadEntry(Long64_t entry) {
67  fEntry = entry;
68  if (!fFriends.empty()) {
69  std::for_each(fFriends.begin(), fFriends.end(), ResetReadEntry);
70  }
71  }
72  TTree* SetTree(TTree *newtree);
73  Bool_t Notify();
74 
75  };
76 
77 } // namespace Internal
78 } // namespace ROOT
79 
80 #endif
long long Long64_t
Definition: RtypesCore.h:71
Returns the available number of logical cores.
Definition: StringConv.hxx:21
1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:571
#define f(i)
Definition: RSha256.hxx:104
int Int_t
Definition: RtypesCore.h:43
bool Bool_t
Definition: RtypesCore.h:61
void SetReadEntry(Long64_t entry)
Move to a new entry to read entry is the &#39;local&#39; entry number; i.e.
TH1F * CreateHistogram(const char *options)
std::vector< TFriendProxy * > fFriends
void ResetReadEntry(TFriendProxy *fp)
std::list< Detail::TBranchProxy * > fDirected
Long64_t GetReadEntry() const
Return the current &#39;local&#39; entry number; i.e.
TBranchProxyDirector(const TBranchProxyDirector &)
TBranchProxyDirector & operator=(const TBranchProxyDirector &)
Definition: tree.py:1
A TTree represents a columnar dataset.
Definition: TTree.h:78
Base class for all the proxy object.
Definition: TBranchProxy.h:68
void Attach(Detail::TBranchProxy *p)