Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/RooAbsDataFiller.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  * Project: RooFit
0003  * Authors:
0004  *   Stephan Hageboeck, CERN 2021
0005  *
0006  * Copyright (c) 2024, CERN
0007  *
0008  * Redistribution and use in source and binary forms,
0009  * with or without modification, are permitted according to the terms
0010  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)
0011  */
0012 
0013 #ifndef RooFit_RooFitCore_RooAbsDataFiller_h
0014 #define RooFit_RooFitCore_RooAbsDataFiller_h
0015 
0016 #include <RooArgSet.h>
0017 #include <RooDataHist.h>
0018 #include <RooDataSet.h>
0019 #include <RooRealVar.h>
0020 
0021 #include <vector>
0022 #include <mutex>
0023 #include <cstddef>
0024 #include <string>
0025 
0026 class TTreeReader;
0027 
0028 namespace RooFit {
0029 namespace Detail {
0030 
0031 class RooAbsDataFiller {
0032 public:
0033    RooAbsDataFiller();
0034 
0035    /// Move constructor. It transfers ownership of the internal RooAbsData object.
0036    RooAbsDataFiller(RooAbsDataFiller &&other) : _events{std::move(other._events)}, _eventSize{other._eventSize} {}
0037 
0038    /// Copy is discouraged.
0039    /// Use `rdataframe.Book<...>(std::move(absDataHelper), ...)` instead.
0040    RooAbsDataFiller(const RooAbsDataFiller &) = delete;
0041    /// RDataFrame interface method.
0042    void Initialize();
0043    /// RDataFrame interface method. No tasks.
0044    void InitTask(TTreeReader *, unsigned int) {}
0045    /// RDataFrame interface method.
0046    std::string GetActionName() { return "RooDataSetHelper"; }
0047 
0048    void ExecImpl(std::size_t nValues, std::vector<double>& vector);
0049    void Finalize();
0050 
0051    virtual RooAbsData &GetAbsData() = 0;
0052 
0053 protected:
0054    void FillAbsData(const std::vector<double> &events, unsigned int eventSize);
0055 
0056    std::mutex _mutexDataset;
0057    std::size_t _numInvalid = 0;
0058 
0059    std::vector<std::vector<double>> _events; // One vector of values per data-processing slot
0060    std::size_t _eventSize;                   // Number of variables in dataset
0061    std::size_t _nValues;                     // Number of variables in dataframe
0062 
0063    bool _isWeighted = false;
0064    bool _isDataHist = false;
0065 };
0066 
0067 } // namespace Detail
0068 } // namespace RooFit
0069 
0070 
0071 #endif