|
12 | 12 |
|
13 | 13 | public: |
14 | 14 |
|
15 | | - int a_; |
16 | | - std::vector<std::string> sam_list; |
17 | | - |
18 | | - ReWeightingOperator( int a) : |
19 | | - a_(a) |
20 | | - { |
21 | | - sam_list = {"SM","BM2","BM3","BM4","BM5","BM6", |
| 15 | + std::string filew_name_; |
| 16 | + std::string osample_; |
| 17 | + std::vector<std::string> sam_list_; |
| 18 | + TFile filew_; |
| 19 | + TH1F hw_; |
| 20 | + |
| 21 | + ReWeightingOperator(std::string filew_name, std::string osample) : |
| 22 | + filew_name_(filew_name), |
| 23 | + osample_(osample) |
| 24 | + { |
| 25 | + sam_list_ = {"SM","BM2","BM3","BM4","BM5","BM6", |
22 | 26 | "BM7","BM8","BM9","BM10","BM11","BM12","BM13","BMbox"}; |
| 27 | + |
| 28 | + //get histogram related to sample |
| 29 | + std::string hanme = osample; //DEBUG |
| 30 | + filew_ = TFile::Open(filew_name.c_str()); |
| 31 | + hw_ = (TH1F*)filew_.Get(hanme.c_str()); |
| 32 | + |
23 | 33 | } |
24 | 34 |
|
25 | 35 | virtual ~ReWeightingOperator() {} |
|
30 | 40 | std::map<std::string, float> weight_map; |
31 | 41 |
|
32 | 42 | // inititialize all weights to 1.0 - safety |
33 | | - for (const auto & sam : sam_list) { |
| 43 | + for (const auto & sam : sam_list_) { |
34 | 44 | // at(syst) would return exception when no element exists |
35 | 45 | weight_map["ReWeighting_"+sam] = 1.0; |
36 | 46 | } |
37 | 47 |
|
38 | | - for (const auto & sam : sam_list) { |
| 48 | + for (const auto & sam : sam_list_) { |
39 | 49 |
|
40 | 50 | //example on how to call ev variables |
41 | | - float costh = ev.dihiggs_.at(0).costhst(); |
42 | | - float mhh = ev.dihiggs_.at(0).mass(); |
| 51 | + float costh = ev.tl_genhh_.at(0).costhst(); |
| 52 | + float mhh = ev.tl_genhh_.at(0).mass(); |
43 | 53 |
|
44 | 54 | //code to get weight |
45 | | - //........... |
46 | 55 | float weight = 1.; |
47 | | - //code to get weight |
48 | | - |
| 56 | + float mergecostSum = 0; |
| 57 | + // for ii in range(1,11) : mergecostSum+= sumHBenchBin.GetBinContent(bmhh,ii) DEBUG |
| 58 | + if (mergecostSum >0) { |
| 59 | + weight = (hw_.GetBinContent(mhh,costh) / mergecostSum); |
| 60 | + } |
49 | 61 | weight_map.at("ReWeighting_"+sam) *= weight; |
50 | 62 | } |
51 | 63 |
|
|
0 commit comments