Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:55:44

0001 // Author: Enrico Guiraud, CERN  02/2021
0002 
0003 /*************************************************************************
0004  * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers.               *
0005  * All rights reserved.                                                  *
0006  *                                                                       *
0007  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0008  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0009  *************************************************************************/
0010 
0011 #ifndef ROOT_RJITTEDVARIATION
0012 #define ROOT_RJITTEDVARIATION
0013 
0014 #include "ROOT/RDF/RVariationBase.hxx"
0015 #include "ROOT/RStringView.hxx"
0016 
0017 #include <memory>
0018 
0019 class TTreeReader;
0020 
0021 namespace ROOT {
0022 namespace Internal {
0023 namespace RDF {
0024 
0025 /// A wrapper around a concrete RVariation, which forwards all calls to it
0026 /// RJittedVariation is a placeholder that is inserted in the computation graph in place of a RVariation
0027 /// that will be just-in-time compiled. Jitted code will assign the concrete RVariation to this RJittedVariation
0028 /// before the event-loop starts.
0029 class RJittedVariation : public RVariationBase {
0030    std::unique_ptr<RVariationBase> fConcreteVariation = nullptr;
0031 
0032 public:
0033    RJittedVariation(const std::vector<std::string> &colNames, std::string_view variationName,
0034                     const std::vector<std::string> &variationTags, std::string_view type,
0035                     const RColumnRegister &colRegister, RLoopManager &lm, const ColumnNames_t &inputColNames)
0036       : RVariationBase(colNames, variationName, variationTags, type, colRegister, lm, inputColNames)
0037    {
0038    }
0039    ~RJittedVariation() override;
0040 
0041    void SetVariation(std::unique_ptr<RVariationBase> c) { fConcreteVariation = std::move(c); }
0042 
0043    void InitSlot(TTreeReader *r, unsigned int slot) final;
0044    void *GetValuePtr(unsigned int slot, const std::string &column, const std::string &variation) final;
0045    const std::type_info &GetTypeId() const final;
0046    void Update(unsigned int slot, Long64_t entry) final;
0047    void FinalizeSlot(unsigned int slot) final;
0048 };
0049 
0050 } // namespace RDF
0051 } // namespace Internal
0052 } // namespace ROOT
0053 
0054 #endif // ROOT_RJITTEDVARIATION