26 if (!in)
return false;
30 if (!getline(in,
line))
break;
31 if (!
line.empty() &&
line[0] !=
'#') {
32 istringstream istr(
line);
34 double xSect, kFact, xSectDw, xSectUp;
35 string s_shower, s_xSectDw, s_xSectUp;
37 istr >>
dsid >> xSect >> kFact >> s_shower >> s_xSectDw >> s_xSectUp;
38 if (!s_shower.empty() && s_shower[0] !=
'#') {
39 shower = stringToShower(s_shower);
42 "ERROR!! TopDataPreparation::SampleXsection::readFromFile: unknown showering (which is needed for btagging SF!!!) : "
43 << s_shower <<
" for DSID= " <<
dsid << endl;
46 if (!s_xSectDw.empty() && s_xSectDw[0] !=
'#') {
47 xSectDw =
atof(s_xSectDw.c_str());
48 if (!s_xSectUp.empty()) {
49 xSectUp =
atof(s_xSectUp.c_str());
51 cerr <<
"ERROR!! SampleXsection::readFromFile: xSectDw of " <<
dsid <<
" is defined ( " << s_xSectDw <<
52 " ), but not xSectUp" << endl;
65 setSample(
dsid, xSect, kFact, shower, xSectDw, xSectUp);
74 const double xSectDw,
const double xSectUp) {
77 map<int, pair<double, double> >::const_iterator
it = m_Xsects.find(
dsid);
78 if (
it != m_Xsects.end()) {
79 cerr <<
"ERROR!! SampleXsection::setSample: duplicate entry ! DSID= " <<
dsid << endl;
83 m_Xsects[
dsid] = pair<double, double>(xSect, kFact);
84 m_Uncert[
dsid] = pair<double, double>(xSectDw, xSectUp);
85 m_Showering[
dsid] = shower;
89 map<int, pair<double, double> >::const_iterator
it = m_Xsects.find(
dsid);
90 if (
it != m_Xsects.end())
return it->second.first;
96 map<int, pair<double, double> >::const_iterator
it = m_Xsects.find(
dsid);
97 if (
it != m_Xsects.end())
return it->second.second;
103 map<int, pair<double, double> >::const_iterator
it = m_Xsects.find(
dsid);
104 if (
it != m_Xsects.end())
return (
it->second.first) * (
it->second.second);
110 map<int, pair<double, double> >::const_iterator
it = m_Uncert.find(
dsid);
111 if (
it != m_Uncert.end())
return it->second.first;
117 map<int, pair<double, double> >::const_iterator
it = m_Uncert.find(
dsid);
118 if (
it != m_Uncert.end())
return it->second.second;
124 map<int, pair<double, double> >::const_iterator
it = m_Uncert.find(
dsid);
125 if (
it != m_Uncert.end())
return it->second;
127 pair<double, double>
temp = pair<double, double>(-1, -1);
132 map<int, showering >::const_iterator
it = m_Showering.find(
dsid);
133 if (
it != m_Showering.end()) {
137 shower = applyTranslation(shower);
147 return showerToString(getShowering(
dsid));
156 if (shower == showering::pythia)
return 0;
157 else if (shower == showering::herwigpp || shower == showering::herwig)
160 else if (shower == showering::pythia8)
return 2;
161 else if (shower == showering::sherpa)
return 3;
162 else if (shower == showering::sherpa21)
return 4;
163 else if (shower == showering::amcatnlopythia8)
return 5;
164 else if (shower == showering::herwigpp713)
return 6;
165 else if (shower == showering::sherpa228)
return 7;
166 else if (shower == showering::sherpa2210)
return 8;
167 else if (shower == showering::herwigpp721)
return 9;
168 else if (shower == showering::sherpa2212)
return 10;
169 else if (shower == showering::amcatnloherwig7)
return 11;
172 "==========================================================================================================================================="
174 std::cout <<
"ERROR:TopDataPreparation: The DSID " <<
dsid <<
175 " does not have a showering algorithm defined!!! This is needed for MC/MC SF!!! ---> EXIT." << std::endl;
176 std::cout <<
"\t" << std::endl;
184 const std::string& stringName = showerToString(shower);
187 auto itr = m_translator.find(stringName);
188 if (itr == m_translator.end()) {
192 return stringToShower(itr->second);
197 if (shower == showering::pythia)
return "pythia";
198 else if (shower == showering::herwig)
return "herwig";
199 else if (shower == showering::herwigpp)
return "herwig";
200 else if (shower == showering::sherpa)
return "sherpa";
201 else if (shower == showering::sherpa21)
return "sherpa21";
202 else if (shower == showering::pythia8)
return "pythia8";
203 else if (shower == showering::amcatnlopythia8)
return "amcatnlopythia8";
204 else if (shower == showering::herwigpp713)
return "herwigpp713";
205 else if (shower == showering::sherpa228)
return "sherpa228";
206 else if (shower == showering::sherpa2210)
return "sherpa2210";
207 else if (shower == showering::herwigpp721)
return "herwigpp721";
208 else if (shower == showering::sherpa2212)
return "sherpa2212";
209 else if (shower == showering::amcatnloherwig7)
return "amcatnloherwig7";
215 if (
name ==
"pythia")
return showering::pythia;
216 else if (
name ==
"herwig")
return showering::herwig;
217 else if (
name ==
"sherpa")
return showering::sherpa;
218 else if (
name ==
"sherpa21")
return showering::sherpa21;
219 else if (
name ==
"pythia8")
return showering::pythia8;
220 else if (
name ==
"herwigpp")
return showering::herwigpp;
221 else if (
name ==
"amcatnlopythia8")
return showering::amcatnlopythia8;
222 else if (
name ==
"herwigpp713")
return showering::herwigpp713;
223 else if (
name ==
"sherpa228")
return showering::sherpa228;
224 else if (
name ==
"sherpa2210")
return showering::sherpa2210;
225 else if (
name ==
"herwigpp721")
return showering::herwigpp721;
226 else if (
name ==
"sherpa2212")
return showering::sherpa2212;
227 else if (
name ==
"amcatnloherwig7")
return showering::amcatnloherwig7;