00001 #ifndef HZZ2L2NU_INCLUDE_L1TPREFIRING_H_ 00002 #define HZZ2L2NU_INCLUDE_L1TPREFIRING_H_ 00003 00004 #include <WeightBase.h> 00005 00006 #include <optional> 00007 00008 #include <TTreeReaderValue.h> 00009 00010 #include <Dataset.h> 00011 #include <Options.h> 00012 00013 00023 class L1TPrefiringWeight : public WeightBase { 00024 public: 00025 L1TPrefiringWeight(Dataset &dataset, Options const &options); 00026 00027 virtual double NominalWeight() const override { 00028 return (enabled_) ? **srcWeightNominal_ : 1.; 00029 } 00030 00031 virtual int NumVariations() const override { 00032 return (enabled_) ? 2 : 0; 00033 } 00034 00035 virtual double operator()() const override { 00036 return (enabled_) ? *defaultWeight_->Get() : 1.; 00037 } 00038 00039 virtual double RelWeight(int variation) const override; 00040 virtual std::string_view VariationName(int variation) const override; 00041 00042 private: 00043 bool enabled_; 00044 mutable std::optional<TTreeReaderValue<Float_t>> srcWeightNominal_, 00045 srcWeightUp_, srcWeightDown_; 00046 00053 TTreeReaderValue<Float_t> *defaultWeight_; 00054 }; 00055 00056 #endif // HZZ2L2NU_INCLUDE_L1TPREFIRING_H_ 00057