forked from LLRCMS/KLUBAnalysis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHHReweight5D.h
64 lines (49 loc) · 2.02 KB
/
HHReweight5D.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
58
59
60
61
62
63
64
/*
** class : HHReweight5D
** 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. 31/05/2017: Updated to 5D reweight
*/
#ifndef HHREWEIGHT_H
#define HHREWEIGHT_H
#include <array>
#include <iostream>
#include <memory>
#include <string>
#include <fstream>
#include <utility>
#include "TH1.h"
#include "TH2.h"
#include "TAxis.h"
#include "TFile.h"
#define NCOEFFSA 15
class HHReweight5D{
public:
HHReweight5D(std::string coeffFile, const TH2* hInput, bool useAbsEta=true);
~HHReweight5D();
double getWeight(double kl, double kt, double c2, double cg, double c2g, double mhh, double cth);
double getWeight(double kl, double kt, double mhh, double cth); // kl, kt only
private:
void readInputFile(std::string coeffFile);
// double functionGF(double kl, double kt, double c2, double cg, double c2g, double A1, double A3, double A7);
double functionGF(double kl, double kt, double c2, double cg, double c2g, std::array<double, NCOEFFSA> const &A);
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_SM_;
std::shared_ptr<TH2> h_sumv1_;
std::array<std::shared_ptr<TH2>, NCOEFFSA> h_A_vec_;
// double A1_13TeV_;
// double A3_13TeV_;
// double A7_13TeV_;
std::array<double, NCOEFFSA> A_13TeV_;
// the distribution of the input events
// must the all the generated events before preselections
std::shared_ptr<TH2> h_input_;
bool useAbsEta_;
};
#endif