CMS 3D CMS Logo

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

Generated on Tue Jun 9 17:36:12 2009 for CMSSW by  doxygen 1.5.4