File indexing completed on 2024-04-06 12:02:17
0001
0002
0003
0004
0005
0006 #ifndef CondFormats_JetMETObjects_FactorizedJetCorrectorCalculator_h
0007 #define CondFormats_JetMETObjects_FactorizedJetCorrectorCalculator_h
0008
0009 #include <vector>
0010 #include <string>
0011 #include "TLorentzVector.h"
0012
0013 class SimpleJetCorrector;
0014 class JetCorrectorParameters;
0015
0016 class FactorizedJetCorrectorCalculator {
0017 public:
0018 class VariableValues {
0019 public:
0020 friend class FactorizedJetCorrector;
0021 friend class FactorizedJetCorrectorCalculator;
0022 VariableValues();
0023 void setNPV(int fNPV);
0024 void setJetEta(float fEta);
0025 void setJetPt(float fPt);
0026 void setJetE(float fE);
0027 void setJetPhi(float fE);
0028 void setJetEMF(float fEMF);
0029 void setJetA(float fA);
0030 void setRho(float fRho);
0031 void setJPTrawP4(const TLorentzVector& fJPTrawP4);
0032 void setJPTrawOff(float fJPTrawOff);
0033 void setLepPx(float fLepPx);
0034 void setLepPy(float fLepPy);
0035 void setLepPz(float fLepPz);
0036 void setAddLepToJet(bool fAddLepToJet);
0037
0038 void reset();
0039
0040 private:
0041
0042 int mNPV;
0043 float mJetE;
0044 float mJetEta;
0045 float mJetPt;
0046 float mJetPhi;
0047 float mJetEMF;
0048 float mJetA;
0049 float mRho;
0050 float mJPTrawE;
0051 float mJPTrawEt;
0052 float mJPTrawPt;
0053 float mJPTrawEta;
0054 float mJPTrawOff;
0055 float mLepPx;
0056 float mLepPy;
0057 float mLepPz;
0058 bool mAddLepToJet;
0059 bool mIsNPVset;
0060 bool mIsJetEset;
0061 bool mIsJetPtset;
0062 bool mIsJetPhiset;
0063 bool mIsJetEtaset;
0064 bool mIsJetEMFset;
0065 bool mIsJetAset;
0066 bool mIsRhoset;
0067 bool mIsJPTrawP4set;
0068 bool mIsJPTrawOFFset;
0069 bool mIsLepPxset;
0070 bool mIsLepPyset;
0071 bool mIsLepPzset;
0072 bool mIsAddLepToJetset;
0073 };
0074
0075 enum VarTypes {
0076 kJetPt,
0077 kJetEta,
0078 kJetPhi,
0079 kJetE,
0080 kJetEMF,
0081 kRelLepPt,
0082 kPtRel,
0083 kNPV,
0084 kJetA,
0085 kRho,
0086 kJPTrawE,
0087 kJPTrawEt,
0088 kJPTrawPt,
0089 kJPTrawEta,
0090 kJPTrawOff
0091 };
0092 enum LevelTypes { kL1, kL2, kL3, kL4, kL5, kL6, kL7, kL1fj, kL1JPT, kL2L3Res };
0093 FactorizedJetCorrectorCalculator();
0094 FactorizedJetCorrectorCalculator(const std::string& fLevels,
0095 const std::string& fTags,
0096 const std::string& fOptions = "");
0097 FactorizedJetCorrectorCalculator(const std::vector<JetCorrectorParameters>& fParameters);
0098 FactorizedJetCorrectorCalculator(const FactorizedJetCorrectorCalculator&) = delete;
0099 FactorizedJetCorrectorCalculator& operator=(const FactorizedJetCorrectorCalculator&) = delete;
0100 ~FactorizedJetCorrectorCalculator();
0101 float getCorrection(VariableValues&) const;
0102 std::vector<float> getSubCorrections(VariableValues&) const;
0103
0104 private:
0105
0106 float getLepPt(const VariableValues&) const;
0107 float getRelLepPt(const VariableValues&) const;
0108 float getPtRel(const VariableValues&) const;
0109 std::string parseOption(const std::string& ss, const std::string& type) const;
0110 std::string removeSpaces(const std::string& ss) const;
0111 std::vector<std::string> parseLevels(const std::string& ss) const;
0112 void initCorrectors(const std::string& fLevels, const std::string& fFiles, const std::string& fOptions);
0113 void checkConsistency(const std::vector<std::string>& fLevels, const std::vector<std::string>& fTags);
0114 std::vector<float> fillVector(const std::vector<VarTypes>& fVarTypes, const VariableValues&) const;
0115 std::vector<VarTypes> mapping(const std::vector<std::string>& fNames) const;
0116
0117 std::vector<LevelTypes> mLevels;
0118 std::vector<std::vector<VarTypes> > mParTypes, mBinTypes;
0119 std::vector<SimpleJetCorrector const*> mCorrectors;
0120 };
0121 #endif