TIMBER  beta
Tree Interface for Making Binned Events with RDataFrame
Prefire_weight.h
1 #ifndef _TIMBER_PREFIRE_WEIGHT
2 #define _TIMBER_PREFIRE_WEIGHT
3 #include "TFile.h"
4 #include "TH2F.h"
5 #include <ROOT/RVec.hxx>
6 #include <string>
7 #include <algorithm>
8 #include <math.h>
9 #include "common.h"
10 
16  private:
17  std::string _jetmapname, _photonmapname;
18  TFile *_jetroot, *_photonroot;
19  TH2F *_jetmap, *_photonmap;
20  std::pair<float,float> _jetPtRange, _jetEtaRange, _photonPtRange, _photonEtaRange;
21  std::vector<std::pair<int, std::string>> _variations = {{0,"PrefireWeight"},{1,"PrefireWeight_Up"},{-1,"PrefireWeight_Down"}};
22  int _variation;
23 
24  float EGvalue(int jetidx, RVec<float> Photon_pt, RVec<float> Photon_eta, RVec<int> Photon_jetIdx, RVec<int> Photon_electronIdx,
25  RVec<float> Electron_pt, RVec<float> Electron_eta, RVec<int> Electron_jetIdx, RVec<int> Electron_photonIdx);
26 
27  float GetPrefireProbability(TH2F* map, float eta, float pt, float maxpt);
28  bool PhotonInRange(float pt, float eta);
29  bool JetInRange(float pt, float eta);
30  bool ObjInRange(float pt, float eta, std::pair<float,float> ptRange, std::pair<float,float> etaRange);
31 
32  public:
39  Prefire_weight(int year, bool UseEMpt=false);
40  ~Prefire_weight();
56  ROOT::VecOps::RVec<float> eval(RVec<float> Jet_pt, RVec<float> Jet_eta,
57  RVec<float> Photon_pt, RVec<float> Photon_eta, RVec<int> Photon_jetIdx, RVec<int> Photon_electronIdx,
58  RVec<float> Electron_pt, RVec<float> Electron_eta, RVec<int> Electron_jetIdx, RVec<int> Electron_photonIdx);
59 };
60 #endif
C++ class to handle the trigger prefire weighting. Based off of the equivalent NanoAOD-tools module...
Definition: Prefire_weight.h:15
Prefire_weight(int year, bool UseEMpt=false)
Construct a new Prefire_weight object.
Definition: Prefire_weight.cc:3
ROOT::VecOps::RVec< float > eval(RVec< float > Jet_pt, RVec< float > Jet_eta, RVec< float > Photon_pt, RVec< float > Photon_eta, RVec< int > Photon_jetIdx, RVec< int > Photon_electronIdx, RVec< float > Electron_pt, RVec< float > Electron_eta, RVec< int > Electron_jetIdx, RVec< int > Electron_photonIdx)
Calculate the value of the weight.
Definition: Prefire_weight.cc:91