00001 #ifndef HZZ2L2NU_INCLUDE_RUNSAMPLER_H_ 00002 #define HZZ2L2NU_INCLUDE_RUNSAMPLER_H_ 00003 00004 #include <optional> 00005 #include <vector> 00006 #include <utility> 00007 00008 #include <TTreeReaderValue.h> 00009 00010 #include <Dataset.h> 00011 #include <EventCache.h> 00012 #include <Options.h> 00013 #include <TabulatedRandomGenerator.h> 00014 00015 00034 class RunSampler { 00035 public: 00037 using run_t = int32_t; 00038 00039 RunSampler(Dataset &dataset, Options const &options, 00040 TabulatedRngEngine &rngEngine); 00041 00050 run_t operator()() const; 00051 00052 private: 00054 void Build() const; 00055 00062 void LoadData(YAML::Node const &config); 00063 00069 bool samplingEnabled_; 00070 00072 EventCache cache_; 00073 00075 mutable run_t currentRun_; 00076 00082 mutable std::optional<TTreeReaderValue<UInt_t>> srcRun_; 00083 00085 TabulatedRandomGenerator tabulatedRng_; 00086 00095 std::vector<std::pair<double, run_t>> cumulProb_; 00096 }; 00097 00098 #endif // HZZ2L2NU_INCLUDE_RUNSAMPLER_H_