11 #include <boost/algorithm/string.hpp>
17 inline static const std::vector<double>
pt_JERC_edges = {15, 17, 20, 23, 27, 30, 35, 40, 45, 57, 72, 90, 120, 150, 200, 300, 400, 550, 750, 1000, 1500, 2000, 2500, 3000, 3500, 4000, 4500, 5000, 5500, 6000, 6500, 7000, 7500, 8000, 8500, 9000, 9500};
22 inline static const std::vector<double>
abseta_edges = { 0.000, 0.261, 0.522, 0.783, 1.044, 1.305, 1.566, 1.740, 1.930, 2.043, 2.172, 2.322, 2.500, 2.650, 2.853, 2.964, 3.139, 3.489, 3.839, 5.191 };
26 inline static const std::map<int,std::vector<double>>
rho_edges = {
27 { 2016, {0, 6.69, 12.39, 18.09, 23.79, 29.49, 35.19, 40.9, 999} },
28 { 2017, {0, 7.47, 13.49, 19.52, 25.54, 31.57, 37.59, 999} },
29 { 2018, {0, 7.35, 13.26, 19.17, 25.08, 30.99, 36.9, 999} }
32 inline static const std::map<int,int>
nRhoBins = {
38 inline static const std::map<int,std::vector<TString>>
rhoBins = {
39 { 2016,
MakeTitle(
rho_edges.at(2016),
"#rho",
false,
false, [](
double v) { return Form(
"%.2f", v);}) },
40 { 2017,
MakeTitle(
rho_edges.at(2017),
"#rho",
false,
false, [](
double v) { return Form(
"%.2f", v);}) },
41 { 2018,
MakeTitle(
rho_edges.at(2018),
"#rho",
false,
false, [](
double v) { return Form(
"%.2f", v);}) }
46 inline static const std::vector<double>
eta_unc_edges = {-5.4, -5.0, -4.4, -4.0, -3.5, -3.0, -2.8, -2.6, -2.4, -2.2, -2.0, -1.8, -1.6, -1.4, -1.2, -1.0, -0.8, -0.6, -0.4, -0.2, 0.0 , 0.2 , 0.4 , 0.6 , 0.8 , 1.0 , 1.2 , 1.4 , 1.6 , 1.8 , 2.0 , 2.2 , 2.4 , 2.6 , 2.8 , 3.0, 3.5 , 4.0 , 4.4 , 5.0 , 5.4};
49 inline static const std::vector<std::string>
JES_variations {
"AbsoluteStat",
"AbsoluteScale",
"AbsoluteMPFBias",
"Fragmentation",
"SinglePionECAL",
"SinglePionHCAL",
"FlavorQCD",
"RelativeJEREC1",
"RelativeJEREC2",
"RelativeJERHF",
"RelativePtBB",
"RelativePtEC1",
"RelativePtEC2",
"RelativePtHF",
"RelativeBal",
"RelativeSample",
"RelativeFSR",
"RelativeStatFSR",
"RelativeStatEC",
"RelativeStatHF",
"PileUpDataMC",
"PileUpPtRef",
"PileUpPtBB",
"PileUpPtEC1",
"PileUpPtEC2",
"PileUpPtHF"};
51 inline static const float w = 0.8;
53 inline std::vector<double>
getBinning (
int nBins,
float first,
float last)
55 std::vector<double>
bins(nBins+1);
56 for(
int i = 0; i <= nBins; ++i)
57 bins[i] = first + ((last-first)/nBins) * i;
64 for (
size_t i = 1; i<v.size(); ++i) {
65 if (v[i] > v[i-1])
continue;
66 std::cerr << i <<
' ' << v[i] <<
' ' << v[i-1] <<
'\n';
78 std::vector<float> edges;
83 std::cout << edges.size() << std::endl;
92 if (metainfo.
Find(
"flags",
"labels",
"CHS" ))
return "chs";
93 if (metainfo.
Find(
"flags",
"labels",
"PUPPI"))
return "Puppi";
95 std::cerr <<
orange <<
"Couldn't identify CHS or PUPPI. Running default "
96 "CHS for Run 2 (PUPPI foir Run 3)\n" <<
def;
98 auto year = metainfo.
Get<
int>(
"flags",
"year");
99 if (
year > 2019)
return "Puppi";
100 if (
year > 2014)
return "chs";
109 regex r(
"^(Summer|Fall|Autumn|Winter|Spring)[0-9]{2}[A-Za-z0-9]*");
110 smatch campaign_short;
111 if (!regex_search(
campaign, campaign_short, r))
112 BOOST_THROW_EXCEPTION( invalid_argument(
"The campaign could not be identified"));
113 return campaign_short.str();
120 const std::string&
key =
"")
123 s <<
"Available corrections:";
124 for (
const auto& correction: corrections) {
125 bool found = correction.first ==
key;
127 s <<
' ' << correction.first;
135 template<
typename CorrectionType>
138 const std::string& type,
139 const std::string& level,
140 const std::string& suffix)
142 namespace al = boost::algorithm;
143 for (
const auto& correction: corrections) {
144 if (!al::starts_with(correction.first,
campaign) ||
145 !al::contains (correction.first, type) ||
146 !al::contains (correction.first, level) ||
147 !al::ends_with (correction.first, suffix))
150 return correction.second;
153 BOOST_THROW_EXCEPTION(
155 "No `"s +
campaign +
"*"s + type +
"*" + level +
"*"s + suffix
156 +
"` correction can be found in the given tables."s
166 auto year = metainfo.
Get<
int>(
"flags",
"year"),
167 R = metainfo.
Get<
int>(
"flags",
"R");
169 std::string warning =
"Not a standard jet size.\n";
171 if (R != 4 && R != 8)
173 return R < 6 ? 4 : 8;
176 if (R != 5 && R != 7)
178 return R < 6 ? 5 : 7;