forked from LLRCMS/KLUBAnalysis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHHReweight.h
57 lines (45 loc) · 1.64 KB
/
HHReweight.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
** class : HHReweight
** author : L. Cadamuro (LLR)
** date : 17 Feb 2017
** brief : Compute a reweight coefficient to transform an input distribution into a general point in kl, kt plane
*/
#ifndef HHREWEIGHT_H
#define HHREWEIGHT_H
#include <iostream>
#include <memory>
#include <string>
#include <fstream>
#include <utility>
#include "TH1.h"
#include "TH2.h"
#include "TAxis.h"
#include "TFile.h"
class HHReweight{
public:
HHReweight(std::string coeffFile, const TH2* hInput);
~HHReweight();
double getWeight(double kl, double kt, double mhh, double cth);
private:
void readInputFile(std::string coeffFile);
double functionGF(double kl, double kt, double c2, double cg, double c2g, double A1, double A3, double A7);
std::vector<std::string> tokenize(std::string input);
std::pair<int,int> find2DBin(TH2* h, double x, double y);
// adapted from ROOT to check histogram consistency
bool CheckConsistency(const TH1* h1, const TH1* h2);
bool CheckAxisLimits(const TAxis *a1, const TAxis *a2 );
bool CheckBinLimits(const TAxis* a1, const TAxis * a2);
// the coefficients of the reweight - read from the input file
std::shared_ptr<TH2> h_A1_;
std::shared_ptr<TH2> h_A3_;
std::shared_ptr<TH2> h_A7_;
std::shared_ptr<TH2> h_SM_;
std::shared_ptr<TH2> h_sumv1_;
double A1_13TeV_;
double A3_13TeV_;
double A7_13TeV_;
// the distribution of the input events
// must the all the generated events before preselections
std::shared_ptr<TH2> h_input_;
};
#endif