CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/FWCore/FWLite/src/BareRootProductGetter.h

Go to the documentation of this file.
00001 #ifndef FWLite_BareRootProductGetter_h
00002 #define FWLite_BareRootProductGetter_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     FWLite
00006 // Class  :     BareRootProductGetter
00007 // 
00016 //
00017 // Original Author:  Chris Jones
00018 //         Created:  Tue May 23 11:03:27 EDT 2006
00019 //
00020 
00021 // system include files
00022 #include <map>
00023 #include "boost/shared_ptr.hpp"
00024 #include "Rtypes.h"
00025 
00026 // user include files
00027 #include "DataFormats/Common/interface/EDProductGetter.h"
00028 #include "DataFormats/Common/interface/EDProduct.h"
00029 #include "FWCore/FWLite/interface/BranchMapReader.h"
00030 
00031 // forward declarations
00032 class TBranch;
00033 class TFile;
00034 class TTree;
00035 
00036 class BareRootProductGetter : public edm::EDProductGetter
00037 {
00038 
00039    public:
00040       BareRootProductGetter();
00041       virtual ~BareRootProductGetter();
00042 
00043       // ---------- const member functions ---------------------
00044       virtual edm::EDProduct const* getIt(edm::ProductID const&) const;
00045       
00046       // ---------- static member functions --------------------
00047 
00048       // ---------- member functions ---------------------------
00049 
00050       struct Buffer {
00051         Buffer(edm::EDProduct* iProd, TBranch* iBranch, void* iAddress,
00052                TClass* iClass) :
00053         product_(iProd), branch_(iBranch), address_(iAddress), eventEntry_(-1),
00054         class_(iClass) {}
00055         Buffer() : product_(), branch_(), address_(), eventEntry_(-1),class_(0) {}
00056         
00057         boost::shared_ptr<edm::EDProduct const> product_;
00058         TBranch* branch_;
00059         void* address_; //the address to pass to Root since as of 5.13 they cache that info
00060         Long_t eventEntry_; //the event Entry used with the last GetEntry call
00061         TClass* class_;
00062       };
00063    private:
00064       BareRootProductGetter(const BareRootProductGetter&); // stop default
00065 
00066       const BareRootProductGetter& operator=(const BareRootProductGetter&); // stop default
00067 
00068       // ---------- member data --------------------------------
00069       void setupNewFile(TFile*) const;
00070       TBranch* findBranch(const edm::ProductID& ) const;
00071       Buffer* createNewBuffer(const edm::ProductID& ) const;
00072       
00073 //      mutable TFile* presentFile_;
00074 //      mutable TTree* eventTree_;
00075 //      mutable Long_t eventEntry_;
00076 //      typedef std::map<edm::ProductID,edm::BranchDescription> IdToBranchDesc;
00077 //      mutable IdToBranchDesc idToBranchDesc_;
00078       typedef std::map<edm::ProductID, Buffer> IdToBuffers;
00079       mutable IdToBuffers idToBuffers_;
00080       mutable fwlite::BranchMapReader branchMap_;
00081 };
00082 
00083 
00084 #endif