test
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 fwlite {
35  namespace internal {
36  class BMRStrategy {
37  public:
38  BMRStrategy(TFile* file, int fileVersion);
39  virtual ~BMRStrategy();
40 
41  virtual bool updateFile(TFile* file) = 0;
42  virtual bool updateEvent(Long_t eventEntry) = 0;
43  virtual bool updateLuminosityBlock(Long_t luminosityBlockEntry) = 0;
44  virtual bool updateRun(Long_t runEntry) = 0;
45  virtual bool updateMap() = 0;
47  virtual const edm::BranchDescription& productToBranch(const edm::ProductID& pid) = 0;
48  virtual const std::vector<edm::BranchDescription>& getBranchDescriptions() = 0;
49  virtual const edm::BranchListIndexes& branchListIndexes() const = 0;
50 
51  TFile* currentFile_;
52  TTree* eventTree_;
54  TTree* runTree_;
55  TUUID fileUUID_;
56  Long_t eventEntry_;
58  Long_t runEntry_;
60  };
61  }
62 
64  public:
65  BranchMapReader(TFile* file);
67 
68  // ---------- const member functions ---------------------
69 
70  // ---------- static member functions --------------------
71 
72  // ---------- member functions ---------------------------
73  bool updateFile(TFile* file);
74  bool updateEvent(Long_t eventEntry);
75  bool updateLuminosityBlock(Long_t luminosityBlockEntry);
76  bool updateRun(Long_t runEntry);
78  int getFileVersion(TFile* file);
79  int getFileVersion() const { return fileVersion_;}
80 
81  TFile* getFile() const { return strategy_->currentFile_; }
82  TTree* getEventTree() const { return strategy_->eventTree_; }
83  TTree* getLuminosityBlockTree() const { return strategy_->luminosityBlockTree_; }
84  TTree* getRunTree() const { return strategy_->runTree_; }
85  TUUID getFileUUID() const { return strategy_->fileUUID_; }
86  Long_t getEventEntry() const { return strategy_->eventEntry_; }
87  Long_t getLuminosityBlockEntry() const { return strategy_->luminosityBlockEntry_; }
88  Long_t getRunEntry() const { return strategy_->runEntry_; }
89  const std::vector<edm::BranchDescription>& getBranchDescriptions();
90  const edm::BranchListIndexes& branchListIndexes() const { strategy_->updateMap(); return strategy_->branchListIndexes(); }
91 
92  // ---------- member data --------------------------------
93  private:
94  std::auto_ptr<internal::BMRStrategy> newStrategy(TFile* file, int fileVersion);
95  std::auto_ptr<internal::BMRStrategy> strategy_;
97  };
98 }
99 
100 #endif
virtual bool updateFile(TFile *file)=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
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
virtual edm::BranchID productToBranchID(const edm::ProductID &pid)=0
tuple pid
Definition: sysUtil.py:22
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()
const edm::BranchListIndexes & branchListIndexes() const
TTree * getLuminosityBlockTree() const