CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/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 // user include files
00022 #include "DataFormats/Common/interface/EDProductGetter.h"
00023 #include "DataFormats/Common/interface/WrapperHolder.h"
00024 #include "DataFormats/Common/interface/WrapperOwningHolder.h"
00025 #include "FWCore/FWLite/interface/BranchMapReader.h"
00026 
00027 // system include files
00028 #include "Rtypes.h"
00029 #include <map>
00030 
00031 // forward declarations
00032 class TBranch;
00033 class TFile;
00034 class TTree;
00035 
00036 class BareRootProductGetter : public edm::EDProductGetter {
00037 
00038    public:
00039       BareRootProductGetter();
00040       virtual ~BareRootProductGetter();
00041 
00042       // ---------- const member functions ---------------------
00043       virtual edm::WrapperHolder getIt(edm::ProductID const&) const;
00044 
00045       // ---------- static member functions --------------------
00046 
00047       // ---------- member functions ---------------------------
00048 
00049       struct Buffer {
00050         Buffer(edm::WrapperOwningHolder const& iProd, TBranch* iBranch, void* iAddress,
00051                TClass* iClass) :
00052         product_(iProd), branch_(iBranch), address_(iAddress), eventEntry_(-1),
00053         class_(iClass) {}
00054         Buffer() : product_(), branch_(), address_(), eventEntry_(-1),class_(0) {}
00055 
00056         edm::WrapperOwningHolder product_;
00057         TBranch* branch_;
00058         void* address_; //the address to pass to Root since as of 5.13 they cache that info
00059         Long_t eventEntry_; //the event Entry used with the last GetEntry call
00060         TClass* class_;
00061       };
00062    private:
00063       BareRootProductGetter(BareRootProductGetter const&); // stop default
00064 
00065       BareRootProductGetter const& operator=(BareRootProductGetter const&); // stop default
00066 
00067       // ---------- member data --------------------------------
00068       void setupNewFile(TFile*) const;
00069       TBranch* findBranch(edm::ProductID const&) const;
00070       Buffer* createNewBuffer(edm::ProductID const&) const;
00071 
00072 //      mutable TFile* presentFile_;
00073 //      mutable TTree* eventTree_;
00074 //      mutable Long_t eventEntry_;
00075 //      typedef std::map<edm::ProductID,edm::BranchDescription> IdToBranchDesc;
00076 //      mutable IdToBranchDesc idToBranchDesc_;
00077       typedef std::map<edm::ProductID, Buffer> IdToBuffers;
00078       mutable IdToBuffers idToBuffers_;
00079       mutable fwlite::BranchMapReader branchMap_;
00080 };
00081 
00082 #endif