00001 #ifndef HZZ2L2NU_INCLUDE_EWCORRECTIONWEIGHT_H_ 00002 #define HZZ2L2NU_INCLUDE_EWCORRECTIONWEIGHT_H_ 00003 00004 #include <WeightBase.h> 00005 00006 #include <map> 00007 #include <string> 00008 #include <vector> 00009 #include <utility> 00010 00011 #include <TLorentzVector.h> 00012 #include <TString.h> 00013 #include <TTreeReaderArray.h> 00014 00015 #include <Dataset.h> 00016 #include <EventCache.h> 00017 #include <Options.h> 00018 00019 00028 class EWCorrectionWeight : public WeightBase { 00029 public: 00036 EWCorrectionWeight(Dataset &dataset, Options const &options); 00037 00043 virtual double NominalWeight() const override; 00044 00051 virtual int NumVariations() const override; 00052 00059 virtual double operator()() const override; 00060 00061 virtual double RelWeight(int variation) const override; 00062 virtual std::string_view VariationName(int variation) const override; 00063 00064 private: 00066 enum class Type { 00067 None, 00068 ZZ, 00069 WZ 00070 }; 00071 00073 void readFile_and_loadEwkTable(); 00074 00076 std::vector<float> findCorrection(float sqrt_s_hat, float t_hat) const; 00077 00078 std::map<std::string,std::pair<TLorentzVector,TLorentzVector>> reconstructGenLevelBosons() const; 00079 00081 double getEwkCorrections(std::map<std::string,std::pair<TLorentzVector,TLorentzVector>> genLevelLeptons, double & error) const; 00082 00084 void Update() const; 00085 00087 Type correctionType_; 00088 00089 EventCache cache_; 00090 00092 mutable double weightNominal_; 00093 00095 mutable double weightError_; 00096 00102 int systDirection_; 00103 00104 std::vector<std::vector<float>> ewTable_; 00105 00106 mutable TTreeReaderArray<float> genPartPt_, genPartEta_, genPartPhi_, 00107 genPartMass_; 00108 mutable TTreeReaderArray<int> genPartPdgId_, genPartIdxMother_; 00109 mutable TTreeReaderValue<Float_t> generatorX1_, generatorX2_; 00110 mutable TTreeReaderValue<Int_t> generatorId1_, generatorId2_; 00111 }; 00112 00113 #endif // HZZ2L2NU_INCLUDE_EWCORRECTIONWEIGHT_H_ 00114