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
FWTTreeCache::FWTTreeCache
FWTTreeCache()
Definition: FWTTreeCache.cc:9
FWTTreeCache::IsLogging
static bool IsLogging()
Definition: FWTTreeCache.cc:23
FWTTreeCache::GetDefaultCacheSize
static int GetDefaultCacheSize()
Definition: FWTTreeCache.cc:30
FWTTreeCache::SetDefaultCacheSize
static void SetDefaultCacheSize(int def_size)
Definition: FWTTreeCache.cc:29
FWTTreeCache::s_prefetching
static bool s_prefetching
Definition: FWTTreeCache.h:15
FWTTreeCache::stop_learning
void stop_learning()
Definition: FWTTreeCache.h:26
FWTTreeCache::LearnGuard::f_tc
FWTTreeCache * f_tc
Definition: FWTTreeCache.h:29
FWTTreeCache::AddBranch
Int_t AddBranch(TBranch *b, Bool_t subbranches=kFALSE) override
Definition: FWTTreeCache.cc:87
MicroEventContent_cff.branch
branch
Definition: MicroEventContent_cff.py:152
tree
Definition: tree.py:1
FWTTreeCache::LearnGuard::f_was_silent_ll
bool f_was_silent_ll
Definition: FWTTreeCache.h:31
FWTTreeCache::LearnGuard
Definition: FWTTreeCache.h:28
FWTTreeCache::m_silent_low_level
bool m_silent_low_level
Definition: FWTTreeCache.h:11
FWTTreeCache::m_branch_set
std::set< std::string > m_branch_set
Definition: FWTTreeCache.h:10
FWTTreeCache::LoggingOff
static void LoggingOff()
Definition: FWTTreeCache.cc:22
FWTTreeCache::~FWTTreeCache
~FWTTreeCache() override
Definition: FWTTreeCache.cc:13
FWTTreeCache::LearnGuard::~LearnGuard
~LearnGuard()
Definition: FWTTreeCache.h:38
FWTTreeCache::IsPrefetching
static bool IsPrefetching()
Definition: FWTTreeCache.cc:27
FWTTreeCache::LoggingOn
static void LoggingOn()
Definition: FWTTreeCache.cc:21
FWTTreeCache::start_learning
bool start_learning()
Definition: FWTTreeCache.h:20
b
double b
Definition: hdecay.h:118
FWTTreeCache::BranchAccessCallIn
void BranchAccessCallIn(const TBranch *b)
Definition: FWTTreeCache.cc:78
FWTTreeCache::PrefetchingOff
static void PrefetchingOff()
Definition: FWTTreeCache.cc:26
FWTTreeCache
Definition: FWTTreeCache.h:9
FWTTreeCache::PrefetchingOn
static void PrefetchingOn()
Definition: FWTTreeCache.cc:25
FWTTreeCache::s_default_size
static int s_default_size
Definition: FWTTreeCache.h:13
FWTTreeCache::LearnGuard::f_was_learning
bool f_was_learning
Definition: FWTTreeCache.h:30
FWTTreeCache::DropBranchTopLevel
Int_t DropBranchTopLevel(const char *bname)
Definition: FWTTreeCache.cc:58
FWTTreeCache::DropBranch
Int_t DropBranch(TBranch *b, Bool_t subbranches=kFALSE) override
Definition: FWTTreeCache.cc:101
FWTTreeCache::is_branch_in_cache
bool is_branch_in_cache(const char *name)
Definition: FWTTreeCache.h:18
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
FWTTreeCache::s_logging
static bool s_logging
Definition: FWTTreeCache.h:14
FWTTreeCache::LearnGuard::LearnGuard
LearnGuard(FWTTreeCache *tc)
Definition: FWTTreeCache.h:33
FWTTreeCache::AddBranchTopLevel
Int_t AddBranchTopLevel(const char *bname)
Definition: FWTTreeCache.cc:34