CMS 3D CMS Logo

FWTTreeCache.h
Go to the documentation of this file.
1 #ifndef Fireworks_Core_FWTTreeCache_h
2 #define Fireworks_Core_FWTTreeCache_h
3 
4 #include "TTreeCache.h"
5 
6 #include <set>
7 #include <string>
8 
9 class FWTTreeCache : public TTreeCache {
10  std::set<std::string> m_branch_set;
11  bool m_silent_low_level = false;
12 
13  static int s_default_size;
14  static bool s_logging;
15  static bool s_prefetching;
16 
17 protected:
18  bool is_branch_in_cache(const char *name) { return (m_branch_set.find(name) != m_branch_set.end()); }
19 
20  bool start_learning() {
21  if (fIsLearning)
22  return true;
23  fIsLearning = true;
24  return false;
25  }
26  void stop_learning() { fIsLearning = false; }
27 
28  struct LearnGuard {
32 
36  f_tc->m_silent_low_level = true;
37  }
39  if (!f_was_learning)
42  }
43  };
44 
45 public:
46  FWTTreeCache();
47  FWTTreeCache(TTree *tree, Int_t buffersize = 0);
48  ~FWTTreeCache() override;
49 
50  static void LoggingOn();
51  static void LoggingOff();
52  static bool IsLogging();
53  static void PrefetchingOn();
54  static void PrefetchingOff();
55  static bool IsPrefetching();
56  static void SetDefaultCacheSize(int def_size);
57  static int GetDefaultCacheSize();
58 
59  Int_t AddBranchTopLevel(const char *bname);
60  Int_t DropBranchTopLevel(const char *bname);
61 
62  void BranchAccessCallIn(const TBranch *b);
63 
64  // virtuals from TTreeCache, just wrappers for info printouts
65  Int_t AddBranch(TBranch *b, Bool_t subbranches = kFALSE) override;
66  Int_t AddBranch(const char *branch, Bool_t subbranches = kFALSE) override;
67  Int_t DropBranch(TBranch *b, Bool_t subbranches = kFALSE) override;
68  Int_t DropBranch(const char *branch, Bool_t subbranches = kFALSE) override;
69 };
70 
71 #endif
static void PrefetchingOn()
Definition: FWTTreeCache.cc:25
static void LoggingOff()
Definition: FWTTreeCache.cc:22
~FWTTreeCache() override
Definition: FWTTreeCache.cc:13
static bool s_logging
Definition: FWTTreeCache.h:14
Int_t AddBranchTopLevel(const char *bname)
Definition: FWTTreeCache.cc:34
static void PrefetchingOff()
Definition: FWTTreeCache.cc:26
static bool IsLogging()
Definition: FWTTreeCache.cc:23
static bool IsPrefetching()
Definition: FWTTreeCache.cc:27
static int s_default_size
Definition: FWTTreeCache.h:13
LearnGuard(FWTTreeCache *tc)
Definition: FWTTreeCache.h:33
static int GetDefaultCacheSize()
Definition: FWTTreeCache.cc:30
Int_t AddBranch(TBranch *b, Bool_t subbranches=kFALSE) override
Definition: FWTTreeCache.cc:87
Int_t DropBranch(TBranch *b, Bool_t subbranches=kFALSE) override
void stop_learning()
Definition: FWTTreeCache.h:26
void BranchAccessCallIn(const TBranch *b)
Definition: FWTTreeCache.cc:78
static bool s_prefetching
Definition: FWTTreeCache.h:15
bool m_silent_low_level
Definition: FWTTreeCache.h:11
std::set< std::string > m_branch_set
Definition: FWTTreeCache.h:10
double b
Definition: hdecay.h:118
Definition: tree.py:1
Int_t DropBranchTopLevel(const char *bname)
Definition: FWTTreeCache.cc:58
static void LoggingOn()
Definition: FWTTreeCache.cc:21
bool start_learning()
Definition: FWTTreeCache.h:20
static void SetDefaultCacheSize(int def_size)
Definition: FWTTreeCache.cc:29
bool is_branch_in_cache(const char *name)
Definition: FWTTreeCache.h:18