|
15 | 15 | std::string filew_name_; |
16 | 16 | std::string osample_; |
17 | 17 | std::vector<std::string> sam_list_; |
| 18 | + std::vector<std::string> hist_list_; |
18 | 19 | TFile filew_; |
19 | | - TH1F hw_; |
| 20 | + std::vector<TH1F> hw_; |
20 | 21 |
|
21 | 22 | ReWeightingOperator(std::string filew_name, std::string osample) : |
22 | 23 | filew_name_(filew_name), |
|
25 | 26 | sam_list_ = {"SM","BM2","BM3","BM4","BM5","BM6", |
26 | 27 | "BM7","BM8","BM9","BM10","BM11","BM12","BM13","BMbox"}; |
27 | 28 |
|
| 29 | + //DEBUG - edit with same order of same list! |
| 30 | + hist_list_ = {"SM","BM2","BM3","BM4","BM5","BM6", |
| 31 | + "BM7","BM8","BM9","BM10","BM11","BM12","BM13","BMbox"}; |
| 32 | + |
28 | 33 | //get histogram related to sample |
29 | 34 | std::string hanme = osample; //DEBUG |
30 | 35 | filew_ = TFile::Open(filew_name.c_str()); |
31 | | - hw_ = (TH1F*)filew_.Get(hanme.c_str()); |
32 | | - |
| 36 | + for (int i=0; i<hist_list_.size(); i++) { |
| 37 | + TH1F h = (TH1F)filew_.Get(hist_list_.at(i).c_str()); |
| 38 | + hw_.push_back(h); |
| 39 | + } |
33 | 40 | } |
34 | 41 |
|
35 | 42 | virtual ~ReWeightingOperator() {} |
|
45 | 52 | weight_map["ReWeighting_"+sam] = 1.0; |
46 | 53 | } |
47 | 54 |
|
48 | | - for (const auto & sam : sam_list_) { |
| 55 | + for (unsigned int i=0; i<sam_list_.size(); i++) { |
49 | 56 |
|
50 | 57 | //example on how to call ev variables |
51 | 58 | float costh = ev.tl_genhh_.at(0).costhst(); |
|
56 | 63 | float mergecostSum = 0; |
57 | 64 | // for ii in range(1,11) : mergecostSum+= sumHBenchBin.GetBinContent(bmhh,ii) DEBUG |
58 | 65 | if (mergecostSum >0) { |
59 | | - weight = (hw_.GetBinContent(mhh,costh) / mergecostSum); |
| 66 | + weight = (hw_.at(i).GetBinContent(mhh,costh) / mergecostSum); |
60 | 67 | } |
61 | | - weight_map.at("ReWeighting_"+sam) *= weight; |
| 68 | + weight_map.at("ReWeighting_"+sam_list_.at(i)) *= weight; |
62 | 69 | } |
63 | 70 |
|
64 | 71 | // add weights to event info |
|
0 commit comments