Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-10-18 04:13:15

0001 #ifndef FWCore_Framework_global_implementors_h
0002 #define FWCore_Framework_global_implementors_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     FWCore/Framework
0006 // Class  :     implementors
0007 //
0008 /**\file implementors.h "FWCore/Framework/interface/global/implementors.h"
0009 
0010  Description: Base classes used to implement the interfaces for the edm::global::* module  abilities
0011 
0012  Usage:
0013     <usage>
0014 
0015 */
0016 //
0017 // Original Author:  Chris Jones
0018 //         Created:  Thu, 18 Jul 2013 11:52:34 GMT
0019 //
0020 
0021 // system include files
0022 #include <cstddef>
0023 #include <memory>
0024 #include <mutex>
0025 #include <string>
0026 #include <tuple>
0027 #include <utility>
0028 #include <vector>
0029 
0030 // user include files
0031 #include "FWCore/Common/interface/FWCoreCommonFwd.h"
0032 #include "FWCore/Concurrency/interface/WaitingTaskHolder.h"
0033 #include "FWCore/Concurrency/interface/WaitingTaskWithArenaHolder.h"
0034 #include "FWCore/Framework/interface/CacheHandle.h"
0035 #include "FWCore/Framework/interface/Frameworkfwd.h"
0036 #include "FWCore/Framework/interface/InputProcessBlockCacheImpl.h"
0037 #include "FWCore/Framework/interface/LuminosityBlock.h"
0038 #include "FWCore/Framework/interface/TransformerBase.h"
0039 #include "FWCore/Framework/interface/ProductRegistryHelper.h"
0040 #include "FWCore/Utilities/interface/EDGetToken.h"
0041 #include "FWCore/Utilities/interface/StreamID.h"
0042 #include "FWCore/Utilities/interface/ProcessBlockIndex.h"
0043 #include "FWCore/Utilities/interface/RunIndex.h"
0044 #include "FWCore/Utilities/interface/LuminosityBlockIndex.h"
0045 #include "FWCore/Utilities/interface/propagate_const.h"
0046 #include "DataFormats/Common/interface/Wrapper.h"
0047 
0048 // forward declarations
0049 namespace edm {
0050 
0051   class WaitingTaskWithArenaHolder;
0052   class ServiceWeakToken;
0053 
0054   namespace global {
0055     namespace impl {
0056       class EmptyType {};
0057 
0058       template <typename T, typename C>
0059       class StreamCacheHolder : public virtual T {
0060       public:
0061         StreamCacheHolder() = default;
0062         StreamCacheHolder(StreamCacheHolder<T, C> const&) = delete;
0063         StreamCacheHolder<T, C>& operator=(StreamCacheHolder<T, C> const&) = delete;
0064         ~StreamCacheHolder() override {
0065           for (auto c : caches_) {
0066             delete c;
0067           }
0068         }
0069 
0070       protected:
0071         C* streamCache(edm::StreamID iID) const { return caches_[iID.value()]; }
0072 
0073       private:
0074         void preallocStreams(unsigned int iNStreams) final { caches_.resize(iNStreams, static_cast<C*>(nullptr)); }
0075         void doBeginStream_(StreamID id) final { caches_[id.value()] = beginStream(id).release(); }
0076         void doEndStream_(StreamID id) final {
0077           endStream(id);
0078           delete caches_[id.value()];
0079           caches_[id.value()] = nullptr;
0080         }
0081         void doStreamBeginRun_(StreamID id, Run const& rp, EventSetup const& c) final { streamBeginRun(id, rp, c); }
0082         void doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c) final { streamEndRun(id, rp, c); }
0083         void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c) final {
0084           streamBeginLuminosityBlock(id, lbp, c);
0085         }
0086         void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c) final {
0087           streamEndLuminosityBlock(id, lbp, c);
0088         }
0089 
0090         virtual std::unique_ptr<C> beginStream(edm::StreamID) const = 0;
0091         virtual void streamBeginRun(edm::StreamID, edm::Run const&, edm::EventSetup const&) const {}
0092         virtual void streamBeginLuminosityBlock(edm::StreamID,
0093                                                 edm::LuminosityBlock const&,
0094                                                 edm::EventSetup const&) const {}
0095         virtual void streamEndLuminosityBlock(edm::StreamID,
0096                                               edm::LuminosityBlock const&,
0097                                               edm::EventSetup const&) const {}
0098         virtual void streamEndRun(edm::StreamID, edm::Run const&, edm::EventSetup const&) const {}
0099         virtual void endStream(edm::StreamID) const {}
0100 
0101         //When threaded we will have a container for N items whre N is # of streams
0102         std::vector<C*> caches_;
0103       };
0104 
0105       template <typename T, typename... CacheTypes>
0106       class InputProcessBlockCacheHolder : public virtual T {
0107       public:
0108         InputProcessBlockCacheHolder() = default;
0109         InputProcessBlockCacheHolder(InputProcessBlockCacheHolder const&) = delete;
0110         InputProcessBlockCacheHolder& operator=(InputProcessBlockCacheHolder const&) = delete;
0111         ~InputProcessBlockCacheHolder() override {}
0112 
0113         std::tuple<CacheHandle<CacheTypes>...> processBlockCaches(Event const& event) const {
0114           return cacheImpl_.processBlockCaches(event);
0115         }
0116 
0117         template <std::size_t ICacheType, typename DataType, typename Func>
0118         void registerProcessBlockCacheFiller(EDGetTokenT<DataType> const& token, Func&& func) {
0119           cacheImpl_.template registerProcessBlockCacheFiller<ICacheType, DataType, Func>(token,
0120                                                                                           std::forward<Func>(func));
0121         }
0122 
0123         template <typename CacheType, typename DataType, typename Func>
0124         void registerProcessBlockCacheFiller(EDGetTokenT<DataType> const& token, Func&& func) {
0125           cacheImpl_.template registerProcessBlockCacheFiller<CacheType, DataType, Func>(token,
0126                                                                                          std::forward<Func>(func));
0127         }
0128 
0129         // This is intended for use by Framework unit tests only
0130         unsigned int cacheSize() const { return cacheImpl_.cacheSize(); }
0131 
0132       private:
0133         void doSelectInputProcessBlocks(ProductRegistry const& productRegistry,
0134                                         ProcessBlockHelperBase const& processBlockHelperBase) final {
0135           cacheImpl_.selectInputProcessBlocks(productRegistry, processBlockHelperBase, *this);
0136         }
0137 
0138         void doAccessInputProcessBlock_(ProcessBlock const& pb) final {
0139           cacheImpl_.accessInputProcessBlock(pb);
0140           accessInputProcessBlock(pb);
0141         }
0142 
0143         // Alternate method to access ProcessBlocks without using the caches
0144         // Mostly intended for unit testing, but might have other uses...
0145         virtual void accessInputProcessBlock(ProcessBlock const&) {}
0146 
0147         void clearInputProcessBlockCaches() final { cacheImpl_.clearCaches(); }
0148 
0149         edm::impl::InputProcessBlockCacheImpl<CacheTypes...> cacheImpl_;
0150       };
0151 
0152       template <typename T, typename C>
0153       class RunCacheHolder : public virtual T {
0154       public:
0155         RunCacheHolder() = default;
0156         RunCacheHolder(RunCacheHolder<T, C> const&) = delete;
0157         RunCacheHolder<T, C>& operator=(RunCacheHolder<T, C> const&) = delete;
0158         ~RunCacheHolder() noexcept(false) override{};
0159 
0160       protected:
0161         void preallocRuns(unsigned int iNRuns) final { caches_.reset(new std::shared_ptr<C>[iNRuns]); }
0162 
0163         C const* runCache(edm::RunIndex iID) const { return caches_[iID].get(); }
0164 
0165       private:
0166         void doBeginRun_(Run const& rp, EventSetup const& c) final { caches_[rp.index()] = globalBeginRun(rp, c); }
0167         void doEndRun_(Run const& rp, EventSetup const& c) final {
0168           globalEndRun(rp, c);
0169           caches_[rp.index()].reset();
0170         }
0171 
0172         virtual std::shared_ptr<C> globalBeginRun(edm::Run const&, edm::EventSetup const&) const = 0;
0173         virtual void globalEndRun(edm::Run const&, edm::EventSetup const&) const = 0;
0174         std::unique_ptr<std::shared_ptr<C>[]> caches_;
0175       };
0176 
0177       template <typename T, typename C>
0178       class LuminosityBlockCacheHolder : public virtual T {
0179       public:
0180         LuminosityBlockCacheHolder() = default;
0181         LuminosityBlockCacheHolder(LuminosityBlockCacheHolder<T, C> const&) = delete;
0182         LuminosityBlockCacheHolder<T, C>& operator=(LuminosityBlockCacheHolder<T, C> const&) = delete;
0183         ~LuminosityBlockCacheHolder() noexcept(false) override{};
0184 
0185       protected:
0186         void preallocLumis(unsigned int iNLumis) final { caches_.reset(new std::shared_ptr<C>[iNLumis]); }
0187 
0188         C const* luminosityBlockCache(edm::LuminosityBlockIndex iID) const { return caches_[iID].get(); }
0189 
0190       private:
0191         void doBeginLuminosityBlock_(LuminosityBlock const& lp, EventSetup const& c) final {
0192           caches_[lp.index()] = globalBeginLuminosityBlock(lp, c);
0193         }
0194         void doEndLuminosityBlock_(LuminosityBlock const& lp, EventSetup const& c) final {
0195           globalEndLuminosityBlock(lp, c);
0196           caches_[lp.index()].reset();
0197         }
0198 
0199         virtual std::shared_ptr<C> globalBeginLuminosityBlock(edm::LuminosityBlock const&,
0200                                                               edm::EventSetup const&) const = 0;
0201         virtual void globalEndLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) const = 0;
0202         std::unique_ptr<std::shared_ptr<C>[]> caches_;
0203       };
0204 
0205       template <typename T, typename C>
0206       class EndRunSummaryProducer;
0207 
0208       template <typename T, typename C>
0209       class RunSummaryCacheHolder : public virtual T {
0210       public:
0211         RunSummaryCacheHolder() = default;
0212         RunSummaryCacheHolder(RunSummaryCacheHolder<T, C> const&) = delete;
0213         RunSummaryCacheHolder<T, C>& operator=(RunSummaryCacheHolder<T, C> const&) = delete;
0214         ~RunSummaryCacheHolder() noexcept(false) override{};
0215 
0216       private:
0217         void preallocRunsSummary(unsigned int iNRuns) final { caches_.reset(new std::shared_ptr<C>[iNRuns]); }
0218 
0219         friend class EndRunSummaryProducer<T, C>;
0220 
0221         void doBeginRunSummary_(edm::Run const& rp, EventSetup const& c) final {
0222           caches_[rp.index()] = globalBeginRunSummary(rp, c);
0223         }
0224         void doStreamEndRunSummary_(StreamID id, Run const& rp, EventSetup const& c) final {
0225           //NOTE: in future this will need to be serialized
0226           std::lock_guard<std::mutex> guard(mutex_);
0227           streamEndRunSummary(id, rp, c, caches_[rp.index()].get());
0228         }
0229         void doEndRunSummary_(Run const& rp, EventSetup const& c) final {
0230           globalEndRunSummary(rp, c, caches_[rp.index()].get());
0231           maybeClearCache(rp);
0232         }
0233 
0234         virtual std::shared_ptr<C> globalBeginRunSummary(edm::Run const&, edm::EventSetup const&) const = 0;
0235         virtual void streamEndRunSummary(StreamID, edm::Run const&, edm::EventSetup const&, C*) const = 0;
0236 
0237         virtual void globalEndRunSummary(edm::Run const&, edm::EventSetup const&, C*) const = 0;
0238 
0239         virtual void maybeClearCache(Run const& rp) { caches_[rp.index()].reset(); }
0240 
0241         std::unique_ptr<std::shared_ptr<C>[]> caches_;
0242         std::mutex mutex_;
0243       };
0244 
0245       template <typename T, typename C>
0246       class EndLuminosityBlockSummaryProducer;
0247 
0248       template <typename T, typename C>
0249       class LuminosityBlockSummaryCacheHolder : public virtual T {
0250       public:
0251         LuminosityBlockSummaryCacheHolder() = default;
0252         LuminosityBlockSummaryCacheHolder(LuminosityBlockSummaryCacheHolder<T, C> const&) = delete;
0253         LuminosityBlockSummaryCacheHolder<T, C>& operator=(LuminosityBlockSummaryCacheHolder<T, C> const&) = delete;
0254         ~LuminosityBlockSummaryCacheHolder() noexcept(false) override{};
0255 
0256       private:
0257         void preallocLumisSummary(unsigned int iNLumis) final { caches_.reset(new std::shared_ptr<C>[iNLumis]); }
0258 
0259         friend class EndLuminosityBlockSummaryProducer<T, C>;
0260 
0261         void doBeginLuminosityBlockSummary_(edm::LuminosityBlock const& lb, EventSetup const& c) final {
0262           caches_[lb.index()] = globalBeginLuminosityBlockSummary(lb, c);
0263         }
0264 
0265         void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const& lb, EventSetup const& c) final {
0266           std::lock_guard<std::mutex> guard(mutex_);
0267           streamEndLuminosityBlockSummary(id, lb, c, caches_[lb.index()].get());
0268         }
0269         void doEndLuminosityBlockSummary_(LuminosityBlock const& lb, EventSetup const& c) final {
0270           globalEndLuminosityBlockSummary(lb, c, caches_[lb.index()].get());
0271           maybeClearCache(lb);
0272         }
0273 
0274         virtual std::shared_ptr<C> globalBeginLuminosityBlockSummary(edm::LuminosityBlock const&,
0275                                                                      edm::EventSetup const&) const = 0;
0276         virtual void streamEndLuminosityBlockSummary(StreamID,
0277                                                      edm::LuminosityBlock const&,
0278                                                      edm::EventSetup const&,
0279                                                      C*) const = 0;
0280 
0281         virtual void globalEndLuminosityBlockSummary(edm::LuminosityBlock const&, edm::EventSetup const&, C*) const = 0;
0282 
0283         virtual void maybeClearCache(LuminosityBlock const& lb) { caches_[lb.index()].reset(); }
0284 
0285         std::unique_ptr<std::shared_ptr<C>[]> caches_;
0286         std::mutex mutex_;
0287       };
0288 
0289       template <typename T>
0290       class WatchProcessBlock : public virtual T {
0291       public:
0292         WatchProcessBlock() = default;
0293         WatchProcessBlock(WatchProcessBlock const&) = delete;
0294         WatchProcessBlock& operator=(WatchProcessBlock const&) = delete;
0295         ~WatchProcessBlock() noexcept(false) override {}
0296 
0297       private:
0298         void doBeginProcessBlock_(ProcessBlock const&) final;
0299         void doEndProcessBlock_(ProcessBlock const&) final;
0300 
0301         virtual void beginProcessBlock(ProcessBlock const&) {}
0302         virtual void endProcessBlock(ProcessBlock const&) {}
0303       };
0304 
0305       template <typename T>
0306       class BeginProcessBlockProducer : public virtual T {
0307       public:
0308         BeginProcessBlockProducer() = default;
0309         BeginProcessBlockProducer(BeginProcessBlockProducer const&) = delete;
0310         BeginProcessBlockProducer& operator=(BeginProcessBlockProducer const&) = delete;
0311         ~BeginProcessBlockProducer() noexcept(false) override{};
0312 
0313       private:
0314         void doBeginProcessBlockProduce_(ProcessBlock&) final;
0315 
0316         virtual void beginProcessBlockProduce(edm::ProcessBlock&) = 0;
0317       };
0318 
0319       template <typename T>
0320       class EndProcessBlockProducer : public virtual T {
0321       public:
0322         EndProcessBlockProducer() = default;
0323         EndProcessBlockProducer(EndProcessBlockProducer const&) = delete;
0324         EndProcessBlockProducer& operator=(EndProcessBlockProducer const&) = delete;
0325         ~EndProcessBlockProducer() noexcept(false) override{};
0326 
0327       private:
0328         void doEndProcessBlockProduce_(ProcessBlock&) final;
0329 
0330         virtual void endProcessBlockProduce(edm::ProcessBlock&) = 0;
0331       };
0332 
0333       template <typename T>
0334       class BeginRunProducer : public virtual T {
0335       public:
0336         BeginRunProducer() = default;
0337         BeginRunProducer(BeginRunProducer const&) = delete;
0338         BeginRunProducer& operator=(BeginRunProducer const&) = delete;
0339         ~BeginRunProducer() noexcept(false) override{};
0340 
0341       private:
0342         void doBeginRunProduce_(Run& rp, EventSetup const& c) final;
0343 
0344         virtual void globalBeginRunProduce(edm::Run&, edm::EventSetup const&) const = 0;
0345       };
0346 
0347       template <typename T>
0348       class EndRunProducer : public virtual T {
0349       public:
0350         EndRunProducer() = default;
0351         EndRunProducer(EndRunProducer const&) = delete;
0352         EndRunProducer& operator=(EndRunProducer const&) = delete;
0353         ~EndRunProducer() noexcept(false) override{};
0354 
0355       private:
0356         void doEndRunProduce_(Run& rp, EventSetup const& c) final;
0357 
0358         virtual void globalEndRunProduce(edm::Run&, edm::EventSetup const&) const = 0;
0359       };
0360 
0361       template <typename T, typename C>
0362       class EndRunSummaryProducer : public RunSummaryCacheHolder<T, C> {
0363       public:
0364         EndRunSummaryProducer() = default;
0365         EndRunSummaryProducer(EndRunSummaryProducer const&) = delete;
0366         EndRunSummaryProducer& operator=(EndRunSummaryProducer const&) = delete;
0367         ~EndRunSummaryProducer() noexcept(false) override{};
0368 
0369       private:
0370         void doEndRunProduce_(Run& rp, EventSetup const& c) final {
0371           globalEndRunProduce(rp, c, RunSummaryCacheHolder<T, C>::caches_[rp.index()].get());
0372           RunSummaryCacheHolder<T, C>::caches_[rp.index()].reset();
0373         }
0374 
0375         virtual void globalEndRunProduce(edm::Run&, edm::EventSetup const&, C const*) const = 0;
0376 
0377         // Do nothing because the cache is cleared in doEndRunProduce_
0378         void maybeClearCache(Run const&) final {}
0379       };
0380 
0381       template <typename T>
0382       class BeginLuminosityBlockProducer : public virtual T {
0383       public:
0384         BeginLuminosityBlockProducer() = default;
0385         BeginLuminosityBlockProducer(BeginLuminosityBlockProducer const&) = delete;
0386         BeginLuminosityBlockProducer& operator=(BeginLuminosityBlockProducer const&) = delete;
0387         ~BeginLuminosityBlockProducer() noexcept(false) override{};
0388 
0389       private:
0390         void doBeginLuminosityBlockProduce_(LuminosityBlock& lb, EventSetup const& c) final;
0391         virtual void globalBeginLuminosityBlockProduce(edm::LuminosityBlock&, edm::EventSetup const&) const = 0;
0392       };
0393 
0394       template <typename T>
0395       class EndLuminosityBlockProducer : public virtual T {
0396       public:
0397         EndLuminosityBlockProducer() = default;
0398         EndLuminosityBlockProducer(EndLuminosityBlockProducer const&) = delete;
0399         EndLuminosityBlockProducer& operator=(EndLuminosityBlockProducer const&) = delete;
0400         ~EndLuminosityBlockProducer() noexcept(false) override{};
0401 
0402       private:
0403         void doEndLuminosityBlockProduce_(LuminosityBlock& lb, EventSetup const& c) final;
0404         virtual void globalEndLuminosityBlockProduce(edm::LuminosityBlock&, edm::EventSetup const&) const = 0;
0405       };
0406 
0407       template <typename T, typename S>
0408       class EndLuminosityBlockSummaryProducer : public LuminosityBlockSummaryCacheHolder<T, S> {
0409       public:
0410         EndLuminosityBlockSummaryProducer() = default;
0411         EndLuminosityBlockSummaryProducer(EndLuminosityBlockSummaryProducer const&) = delete;
0412         EndLuminosityBlockSummaryProducer& operator=(EndLuminosityBlockSummaryProducer const&) = delete;
0413         ~EndLuminosityBlockSummaryProducer() noexcept(false) override{};
0414 
0415       private:
0416         void doEndLuminosityBlockProduce_(LuminosityBlock& lb, EventSetup const& c) final {
0417           globalEndLuminosityBlockProduce(lb, c, LuminosityBlockSummaryCacheHolder<T, S>::caches_[lb.index()].get());
0418           LuminosityBlockSummaryCacheHolder<T, S>::caches_[lb.index()].reset();
0419         }
0420 
0421         virtual void globalEndLuminosityBlockProduce(edm::LuminosityBlock&, edm::EventSetup const&, S const*) const = 0;
0422 
0423         // Do nothing because the cache is cleared in doEndLuminosityBlockProduce_
0424         void maybeClearCache(LuminosityBlock const&) final {}
0425       };
0426 
0427       template <typename T>
0428       class ExternalWork : public virtual T {
0429       public:
0430         ExternalWork() = default;
0431         ExternalWork(ExternalWork const&) = delete;
0432         ExternalWork& operator=(ExternalWork const&) = delete;
0433         ~ExternalWork() noexcept(false) override{};
0434 
0435       private:
0436         bool hasAcquire() const override { return true; }
0437 
0438         void doAcquire_(StreamID, Event const&, edm::EventSetup const&, WaitingTaskWithArenaHolder&) final;
0439 
0440         virtual void acquire(StreamID, Event const&, edm::EventSetup const&, WaitingTaskWithArenaHolder) const = 0;
0441       };
0442 
0443       template <typename T>
0444       class Accumulator : public virtual T {
0445       public:
0446         Accumulator() = default;
0447         Accumulator(Accumulator const&) = delete;
0448         Accumulator& operator=(Accumulator const&) = delete;
0449         ~Accumulator() noexcept(false) override{};
0450 
0451       private:
0452         bool hasAccumulator() const override { return true; }
0453 
0454         void produce(StreamID streamID, Event& ev, EventSetup const& es) const final { accumulate(streamID, ev, es); }
0455 
0456         virtual void accumulate(StreamID streamID, Event const& ev, EventSetup const& es) const = 0;
0457       };
0458 
0459       template <typename T>
0460       class Transformer : public virtual T, private TransformerBase {
0461       public:
0462         Transformer() = default;
0463         Transformer(Transformer const&) = delete;
0464         Transformer& operator=(Transformer const&) = delete;
0465         ~Transformer() noexcept(false) override{};
0466 
0467         template <typename G, typename F>
0468         void registerTransform(ProductRegistryHelper::BranchAliasSetterT<G> iSetter,
0469                                F&& iF,
0470                                std::string productInstance = std::string()) {
0471           registerTransform(edm::EDPutTokenT<G>(iSetter), std::forward<F>(iF), std::move(productInstance));
0472         }
0473 
0474         template <typename G, typename F>
0475         void registerTransform(edm::EDPutTokenT<G> iToken, F iF, std::string productInstance = std::string()) {
0476           using ReturnTypeT = decltype(iF(std::declval<G>()));
0477           TypeID returnType(typeid(ReturnTypeT));
0478           TransformerBase::registerTransformImp(
0479               *this,
0480               EDPutToken(iToken),
0481               returnType,
0482               std::move(productInstance),
0483               [f = std::move(iF)](std::any const& iGotProduct) {
0484                 auto pGotProduct = std::any_cast<edm::WrapperBase const*>(iGotProduct);
0485                 return std::make_unique<edm::Wrapper<ReturnTypeT>>(
0486                     WrapperBase::Emplace{}, f(*static_cast<edm::Wrapper<G> const*>(pGotProduct)->product()));
0487               });
0488         }
0489 
0490         template <typename G, typename P, typename F>
0491         void registerTransformAsync(edm::EDPutTokenT<G> iToken,
0492                                     P iPre,
0493                                     F iF,
0494                                     std::string productInstance = std::string()) {
0495           using CacheTypeT = decltype(iPre(std::declval<G>(), WaitingTaskWithArenaHolder()));
0496           using ReturnTypeT = decltype(iF(std::declval<CacheTypeT>()));
0497           TypeID returnType(typeid(ReturnTypeT));
0498           TransformerBase::registerTransformAsyncImp(
0499               *this,
0500               EDPutToken(iToken),
0501               returnType,
0502               std::move(productInstance),
0503               [p = std::move(iPre)](edm::WrapperBase const& iGotProduct, WaitingTaskWithArenaHolder iHolder) {
0504                 return std::any(p(*static_cast<edm::Wrapper<G> const&>(iGotProduct).product(), std::move(iHolder)));
0505               },
0506               [f = std::move(iF)](std::any const& iCache) {
0507                 return std::make_unique<edm::Wrapper<ReturnTypeT>>(WrapperBase::Emplace{},
0508                                                                    f(std::any_cast<CacheTypeT>(iCache)));
0509               });
0510         }
0511 
0512       private:
0513         size_t transformIndex_(edm::BranchDescription const& iBranch) const final {
0514           return TransformerBase::findMatchingIndex(*this, iBranch);
0515         }
0516         ProductResolverIndex transformPrefetch_(std::size_t iIndex) const final {
0517           return TransformerBase::prefetchImp(iIndex);
0518         }
0519         void transformAsync_(WaitingTaskHolder iTask,
0520                              std::size_t iIndex,
0521                              edm::EventForTransformer& iEvent,
0522                              ServiceWeakToken const& iToken) const final {
0523           return TransformerBase::transformImpAsync(std::move(iTask), iIndex, *this, iEvent);
0524         }
0525         void extendUpdateLookup(BranchType iBranchType, ProductResolverIndexHelper const& iHelper) override {
0526           if (iBranchType == InEvent) {
0527             TransformerBase::extendUpdateLookup(*this, this->moduleDescription(), iHelper);
0528           }
0529         }
0530       };
0531     }  // namespace impl
0532   }    // namespace global
0533 }  // namespace edm
0534 
0535 #endif