Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-12-05 03:11:53

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