CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
BranchMapReader.h
Go to the documentation of this file.
1 #ifndef FWLite_BranchMapReader_h
2 #define FWLite_BranchMapReader_h
3 // -*- C++ -*-
4 //
5 // Package: FWLite
6 // Class : BranchMapReader
7 //
16 //
17 // Original Author: Dan Riley
18 // Created: Tue May 20 10:31:32 EDT 2008
19 //
20 
21 // system include files
22 #include <memory>
23 #include "TUUID.h"
24 
25 // user include files
28 
29 // forward declarations
30 class TFile;
31 class TTree;
32 class TBranch;
33 
34 namespace edm {
35  class ThinnedAssociationsHelper;
36 }
37 
38 namespace fwlite {
39  namespace internal {
40  class BMRStrategy {
41  public:
42  BMRStrategy(TFile* file, int fileVersion);
43  virtual ~BMRStrategy();
44 
45  virtual bool updateFile(TFile* file) = 0;
46  virtual bool updateEvent(Long_t eventEntry) = 0;
47  virtual bool updateLuminosityBlock(Long_t luminosityBlockEntry) = 0;
48  virtual bool updateRun(Long_t runEntry) = 0;
49  virtual bool updateMap() = 0;
51  virtual const edm::BranchDescription& productToBranch(const edm::ProductID& pid) = 0;
52  virtual const edm::BranchDescription& branchIDToBranch(const edm::BranchID& bid) const = 0;
53  virtual const std::vector<edm::BranchDescription>& getBranchDescriptions() = 0;
54  virtual const edm::BranchListIndexes& branchListIndexes() const = 0;
56 
57  TFile* currentFile_;
58  TTree* eventTree_;
60  TTree* runTree_;
61  TUUID fileUUID_;
62  Long_t eventEntry_;
64  Long_t runEntry_;
66  };
67  }
68 
70  public:
71  BranchMapReader(TFile* file);
73 
74  // ---------- const member functions ---------------------
75 
76  // ---------- static member functions --------------------
77 
78  // ---------- member functions ---------------------------
79  bool updateFile(TFile* file);
80  bool updateEvent(Long_t eventEntry);
81  bool updateLuminosityBlock(Long_t luminosityBlockEntry);
82  bool updateRun(Long_t runEntry);
83  edm::BranchID productToBranchID(const edm::ProductID& pid) { return strategy_->productToBranchID(pid); }
85  const edm::BranchDescription& branchIDToBranch(const edm::BranchID& bid) const { return strategy_->branchIDToBranch(bid); }
86  int getFileVersion(TFile* file);
87  int getFileVersion() const { return fileVersion_;}
88 
89  TFile* getFile() const { return strategy_->currentFile_; }
90  TTree* getEventTree() const { return strategy_->eventTree_; }
91  TTree* getLuminosityBlockTree() const { return strategy_->luminosityBlockTree_; }
92  TTree* getRunTree() const { return strategy_->runTree_; }
93  TUUID getFileUUID() const { return strategy_->fileUUID_; }
94  Long_t getEventEntry() const { return strategy_->eventEntry_; }
95  Long_t getLuminosityBlockEntry() const { return strategy_->luminosityBlockEntry_; }
96  Long_t getRunEntry() const { return strategy_->runEntry_; }
97  const std::vector<edm::BranchDescription>& getBranchDescriptions();
98  const edm::BranchListIndexes& branchListIndexes() const { strategy_->updateMap(); return strategy_->branchListIndexes(); }
99  const edm::ThinnedAssociationsHelper& thinnedAssociationsHelper() const { return strategy_->thinnedAssociationsHelper(); }
100 
101  // ---------- member data --------------------------------
102  private:
103  std::auto_ptr<internal::BMRStrategy> newStrategy(TFile* file, int fileVersion);
104  std::auto_ptr<internal::BMRStrategy> strategy_;
106  };
107 }
108 
109 #endif
virtual bool updateFile(TFile *file)=0
virtual const edm::BranchDescription & branchIDToBranch(const edm::BranchID &bid) const =0
std::auto_ptr< internal::BMRStrategy > newStrategy(TFile *file, int fileVersion)
std::auto_ptr< internal::BMRStrategy > strategy_
virtual const std::vector< edm::BranchDescription > & getBranchDescriptions()=0
BMRStrategy(TFile *file, int fileVersion)
TUUID getFileUUID() const
bool updateEvent(Long_t eventEntry)
Long_t getLuminosityBlockEntry() const
bool updateFile(TFile *file)
TFile * getFile() const
virtual bool updateRun(Long_t runEntry)=0
const edm::BranchDescription & branchIDToBranch(const edm::BranchID &bid) const
bool updateLuminosityBlock(Long_t luminosityBlockEntry)
Long_t getRunEntry() const
Long_t getEventEntry() const
TTree * getEventTree() const
std::vector< BranchListIndex > BranchListIndexes
const edm::BranchDescription & productToBranch(const edm::ProductID &pid)
virtual bool updateLuminosityBlock(Long_t luminosityBlockEntry)=0
virtual const edm::BranchDescription & productToBranch(const edm::ProductID &pid)=0
const edm::ThinnedAssociationsHelper & thinnedAssociationsHelper() const
virtual edm::BranchID productToBranchID(const edm::ProductID &pid)=0
tuple pid
Definition: sysUtil.py:22
virtual const edm::ThinnedAssociationsHelper & thinnedAssociationsHelper() const =0
virtual bool updateEvent(Long_t eventEntry)=0
bool updateRun(Long_t runEntry)
virtual const edm::BranchListIndexes & branchListIndexes() const =0
TTree * getRunTree() const
const std::vector< edm::BranchDescription > & getBranchDescriptions()
edm::BranchID productToBranchID(const edm::ProductID &pid)
const edm::BranchListIndexes & branchListIndexes() const
TTree * getLuminosityBlockTree() const