TIMBER  beta
Tree Interface for Making Binned Events with RDataFrame
JetSmearer.h
1 #ifndef _TIMBER_JETSMEARER
2 #define _TIMBER_JETSMEARER
3 // Requires CMSSW
4 #include <string>
5 #include <vector>
6 #include <cstdlib>
7 #include <unistd.h>
8 #include <math.h>
9 #include <limits>
10 #include <random>
11 
12 #include <TRandom3.h>
13 #include <TFile.h>
14 #include <TF1.h>
15 #include <TString.h>
16 #include <TSystem.h>
17 #include <ROOT/RVec.hxx>
18 #include <Math/GenVector/LorentzVector.h>
19 #include <Math/GenVector/PtEtaPhiM4D.h>
20 #include <Math/Vector4Dfwd.h>
21 #include "JME_common.h"
22 #include "common.h"
23 
24 using namespace ROOT::VecOps;
25 using LorentzV = ROOT::Math::PtEtaPhiMVector;
26 
33  private:
34  float _dRMax, _dPtMaxFactor;
35 
36  public:
45  GenJetMatcher(float dRMax, float dPtMaxFactor = 3);
54  LorentzV match(LorentzV& jet, RVec<LorentzV> genJets, float resolution);
55 };
56 
62 class JetSmearer {
63  private:
64  const std::string _jetType, _jerTag;
65  const std::vector<float> _jmrVals;
66 
67  std::mt19937 _rnd;
68  JERpaths _path;
69  JME::JetParameters _paramsSF;
70  JME::JetParameters _paramsRes;
71  JME::JetResolution _jer;
72  JME::JetResolutionScaleFactor _jerSF;
73 
74  std::vector<Variation> _variationIndex;
75 
76  std::shared_ptr<GenJetMatcher> _genJetMatcher;
77  static constexpr const double MIN_JET_ENERGY = 1e-2;
78 
79  TF1* _puppisd_res_central;
80  TF1* _puppisd_res_forward;
81 
82  public:
90  JetSmearer( std::string jerTag, std::string jetType);
98  JetSmearer(std::vector<float> jmrVals);
99 
100  ~JetSmearer();
120  std::vector<float> GetSmearValsPt(LorentzV jet, RVec<LorentzV> genJets, float fixedGridRhoFastjetAll);
141  std::vector<float> GetSmearValsM(LorentzV jet, RVec<LorentzV> genJets);
147  TFile* GetPuppiJMRFile();
153  TF1* GetPuppiSDResolutionCentral();
159  TF1* GetPuppiSDResolutionForward();
160 };
161 #endif
C++ class to handle the extraction of JER objects starting from the JER tags and jet types...
Definition: JME_common.h:96
C++ class to handle the smearing of jet pt and mass using the JER and JMR inputs, respectively...
Definition: JetSmearer.h:62
C++ class to match single reconstructed jet (represented as a Lorentz vector) to the closest generato...
Definition: JetSmearer.h:32