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 // $Id: BranchMapReader.h,v 1.11 2010/02/11 17:19:09 ewv Exp $
20 //
21 
22 // system include files
23 #include <memory>
24 #include "TUUID.h"
25 
26 // 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 
50  TFile* currentFile_;
51  TTree* eventTree_;
53  TTree* runTree_;
54  TUUID fileUUID_;
55  Long_t eventEntry_;
57  Long_t runEntry_;
59  };
60  }
61 
63  public:
64  BranchMapReader(TFile* file);
66 
67  // ---------- const member functions ---------------------
68 
69  // ---------- static member functions --------------------
70 
71  // ---------- member functions ---------------------------
72  bool updateFile(TFile* file);
73  bool updateEvent(Long_t eventEntry);
74  bool updateLuminosityBlock(Long_t luminosityBlockEntry);
75  bool updateRun(Long_t runEntry);
77  int getFileVersion(TFile* file);
78  int getFileVersion() const { return fileVersion_;}
79 
80  TFile* getFile() const { return strategy_->currentFile_; }
81  TTree* getEventTree() const { return strategy_->eventTree_; }
82  TTree* getLuminosityBlockTree() const { return strategy_->luminosityBlockTree_; }
83  TTree* getRunTree() const { return strategy_->runTree_; }
84  TUUID getFileUUID() const { return strategy_->fileUUID_; }
85  Long_t getEventEntry() const { return strategy_->eventEntry_; }
86  Long_t getLuminosityBlockEntry() const { return strategy_->luminosityBlockEntry_; }
87  Long_t getRunEntry() const { return strategy_->runEntry_; }
88  const std::vector<edm::BranchDescription>& getBranchDescriptions();
89 
90  // ---------- member data --------------------------------
91  private:
92  std::auto_ptr<internal::BMRStrategy> newStrategy(TFile* file, int fileVersion);
93  std::auto_ptr<internal::BMRStrategy> strategy_;
95  };
96 }
97 
98 #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 edm::BranchDescription productToBranch(const edm::ProductID &pid)=0
virtual const std::vector< edm::BranchDescription > & getBranchDescriptions()=0
BMRStrategy(TFile *file, int fileVersion)
TUUID getFileUUID() const
list file
Definition: dbtoweb.py:253
bool updateEvent(Long_t eventEntry)
Long_t getLuminosityBlockEntry() const
bool updateFile(TFile *file)
const edm::BranchDescription productToBranch(const edm::ProductID &pid)
TFile * getFile() const
virtual bool updateRun(Long_t runEntry)=0
bool updateLuminosityBlock(Long_t luminosityBlockEntry)
Long_t getRunEntry() const
Long_t getEventEntry() const
const std::vector< edm::BranchDescription > & getBranchDescriptions()
TTree * getEventTree() const
virtual bool updateLuminosityBlock(Long_t luminosityBlockEntry)=0
virtual edm::BranchID productToBranchID(const edm::ProductID &pid)=0
virtual bool updateEvent(Long_t eventEntry)=0
bool updateRun(Long_t runEntry)
TTree * getRunTree() const
TTree * getLuminosityBlockTree() const