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