File indexing completed on 2024-08-22 04:57:38
0001 #ifndef FWCore_FWLite_BareRootProductGetterBase_h
0002 #define FWCore_FWLite_BareRootProductGetterBase_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 #include "DataFormats/Common/interface/WrapperBase.h"
0027 #include "DataFormats/Common/interface/EDProductGetter.h"
0028 #include "FWCore/FWLite/interface/BranchMapReader.h"
0029 #include "FWCore/Utilities/interface/propagate_const.h"
0030
0031
0032 #include "Rtypes.h"
0033 #include <map>
0034 #include <memory>
0035 #include <vector>
0036
0037
0038 class TBranch;
0039 class TClass;
0040
0041 namespace edm {
0042 class BranchID;
0043 class ProductID;
0044 class ThinnedAssociation;
0045 }
0046
0047 class BareRootProductGetterBase : public edm::EDProductGetter {
0048 public:
0049 BareRootProductGetterBase();
0050 ~BareRootProductGetterBase() override;
0051 BareRootProductGetterBase(BareRootProductGetterBase const&) = delete;
0052 BareRootProductGetterBase const& operator=(BareRootProductGetterBase const&) = delete;
0053
0054
0055 edm::WrapperBase const* getIt(edm::ProductID const&) const override;
0056
0057
0058
0059
0060
0061
0062
0063 std::optional<std::tuple<edm::WrapperBase const*, unsigned int>> getThinnedProduct(edm::ProductID const&,
0064 unsigned int key) const override;
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077 void getThinnedProducts(edm::ProductID const&,
0078 std::vector<edm::WrapperBase const*>& foundContainers,
0079 std::vector<unsigned int>& keys) const override;
0080
0081
0082
0083
0084
0085
0086
0087
0088 edm::OptionalThinnedKey getThinnedKeyFrom(edm::ProductID const& parent,
0089 unsigned int key,
0090 edm::ProductID const& thinned) const override;
0091
0092 private:
0093
0094
0095
0096 unsigned int transitionIndex_() const override { return 0u; }
0097
0098 edm::WrapperBase const* getIt(edm::BranchID const&, Long_t eventEntry) const;
0099
0100 virtual TFile* currentFile() const = 0;
0101
0102 struct Buffer {
0103 Buffer(edm::WrapperBase const* iProd, TBranch* iBranch, void* iAddress, TClass* iClass)
0104 : product_(iProd), branch_(iBranch), address_(iAddress), eventEntry_(-1), class_(iClass) {}
0105 Buffer() : product_(), branch_(), address_(), eventEntry_(-1), class_(nullptr) {}
0106
0107 std::shared_ptr<edm::WrapperBase const> product_;
0108 edm::propagate_const<TBranch*> branch_;
0109 void* address_;
0110 Long_t eventEntry_;
0111 edm::propagate_const<TClass*> class_;
0112 };
0113
0114 Buffer* createNewBuffer(edm::BranchID const&) const;
0115 edm::ThinnedAssociation const* getThinnedAssociation(edm::BranchID const& branchID, Long_t eventEntry) const;
0116
0117
0118
0119 typedef std::map<edm::BranchID, Buffer> IdToBuffers;
0120 mutable IdToBuffers idToBuffers_;
0121 mutable fwlite::BranchMapReader branchMap_;
0122 };
0123 #endif