939{
944
945
953
954
955
956 std::vector<TH1D*> totalHists;
957 std::vector<TGraphErrors*> totalGraphs;
958 std::vector< std::vector<TGraphErrors*> > compGraphs;
959
960
967
968
969
970
972 IsBjet(*
jet) =
false;
974
975
981
982 size_t indexHelper = 0;
983
984
985 for (size_t iProv = 0; iProv < providers.size(); ++iProv)
986 {
988
989
992
993
994 else
995 {
998 }
999
1000
1002 {
1003 jet->setAttribute(
"PartonTruthLabelID",
optHelper.FixedTruthLabel());
1004 std::cout <<
"Fixed PartonTruthLabelID to " <<
optHelper.FixedTruthLabel() << std::endl;
1005 }
1006
1007
1009 {
1011 std::cout << "Fixed LargeRJetTruthLabel" << std::endl;
1012 }
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027 totalHists.push_back(new TH1D(Form("Total_%zu_hist",iProv),"",scanBins.size()-1,&scanBins[0]));
1028 TH1D* totalHist = totalHists.back();
1029 totalHist->SetFillColor(590);
1030 totalHist->SetLineWidth(0);
1031
1032
1033 totalGraphs.push_back(new TGraphErrors());
1034 TGraphErrors* totalGraph = totalGraphs.back();
1035 totalGraph->SetName(Form("Total_%zu_graph",iProv));
1036 totalGraph->SetLineStyle(1);
1037 totalGraph->SetLineWidth(2);
1038 totalGraph->SetLineColor(kBlack);
1039
1040
1042
1043
1044 int PTindex = static_cast<int>(allIndices.size());
1046 if (TString(provider->
getComponentName(iComp).c_str()).Contains(
"PunchThrough",TString::kIgnoreCase))
1047 {
1048 PTindex = iComp;
1049 break;
1050 }
1051
1052
1053 std::vector<TGraphErrors*> provCompGraphs;
1054
1055
1056 for (
size_t iComp = 0; iComp < compSetIndices.at(iProv).
size(); ++iComp)
1057 {
1058
1059 provCompGraphs.push_back(new TGraphErrors());
1060 TGraphErrors* compGraph = provCompGraphs.back();
1061 compGraph->SetName(labelNames.at(iProv).at(iComp));
1062 compGraph->SetLineStyle(indexHelper+1);
1063 compGraph->SetLineColor(indexHelper+2 < 5 ? indexHelper+2 : indexHelper+3 < 13 ? indexHelper+3 : indexHelper+4);
1064 if (indexHelper+3 == 10) compGraph->SetLineColor(kYellow-9);
1065 compGraph->SetLineWidth(doComparison?3:4);
1068 indexHelper++;
1069 }
1070
1071
1072 for (int iScan = 1; iScan < frame->GetNbinsX()+2; ++iScan)
1073 {
1074 const double binValue = iScan == 1 ? frame->GetBinLowEdge(iScan)+1.e-3 : iScan == frame->GetNbinsX()+1 ? frame->GetBinLowEdge(iScan)-1.e-3 : frame->GetBinLowEdge(iScan);
1075
1076
1077 const double pt = (fixedIsEta ? binValue :
fixedValue)*1.e3;
1079 const double mass = mOverPtIsMass ? mOverPt*1.e3 : mOverPt*
pt;
1081
1082
1090
1091
1092
1093 bool isZero = false;
1094 if (
optHelper.DoCompare() && TString(provider->
getRelease().c_str()).Contains(
"2015_Prerec_"))
1095 if (pt > 1.5e6) isZero = true;
1096
1097
1098
1099 std::vector<jet::CompScaleVar::TypeEnum> scaleVars =
optHelper.GetScaleVars();
1100 if (
optHelper.TagScaleFactorName() !=
"")
1101 {
1102 jet->setAttribute(
optHelper.TagScaleFactorName().Data(),1.0);
1103
1104 }
1105
1106
1107 for (
size_t iComp = 0; iComp < compSetIndices.at(iProv).
size(); ++iComp)
1108 {
1109
1110
1111 TGraphErrors* compGraph = provCompGraphs.at(iComp);
1113 compGraph->SetPoint(iScan-1,binValue,compUnc);
1114 }
1115
1116
1118 totalGraph->SetPoint(iScan-1,binValue,totalUnc);
1119
1120 }
1121
1122
1123 compGraphs.push_back(provCompGraphs);
1124
1125
1126 for (int iScan = 1; iScan < frame->GetNbinsX()+1; ++iScan)
1127 {
1128 const double binValue = frame->GetBinCenter(iScan);
1129
1130
1131 const double pt = (fixedIsEta ? binValue :
fixedValue)*1.e3;
1133 const double mass = mOverPtIsMass ? mOverPt*1.e3 : mOverPt*
pt;
1135
1136
1144
1145
1146 bool isZero = false;
1147 if (
optHelper.DoCompare() && TString(provider->
getRelease().c_str()).Contains(
"2015_Prerec_"))
1148 if (pt > 1.5e6) isZero = true;
1149
1151 }
1152 }
1153
1154
1155
1156
1157 delete eInfos;
1158
1159
1161
1162
1163 if (!fixedIsEta)
1164 {
1165 for (size_t iProv = 0; iProv < providers.size(); ++iProv)
1166 {
1167 TH1D* totalHist = totalHists.at(iProv);
1168
1170 TH1D* rebinnedTotal = new TH1D(Form("Rebinned_%s",totalHist->GetName()),"",rebinnedBins.size()-1,&rebinnedBins[0]);
1171 rebinnedTotal->SetFillColor(590);
1172 rebinnedTotal->SetLineWidth(0);
1173 for(int iBin = 1; iBin < rebinnedTotal->GetNbinsX()+1; ++iBin)
1174 rebinnedTotal->SetBinContent(iBin,totalHist->Interpolate(rebinnedTotal->GetBinCenter(iBin)));
1175 delete totalHists[iProv];
1176 totalHists[iProv] = rebinnedTotal;
1177 }
1178 }
1179
1180
1184 else canvas->SetLogx(
false);
1185 frame->Draw("");
1186
1189 {
1190 frame->GetXaxis()->SetRangeUser(
xrange.first,
xrange.second);
1191 }
1192 else if (
optHelper.IsLargeR()) frame->GetXaxis()->SetRangeUser(200,3.e3);
1193 else if (fixedIsEta) frame->GetXaxis()->SetRangeUser(17,3.0e3);
1194 else frame->GetXaxis()->SetRangeUser(-4.5,4.5);
1195
1197 {
1199 frame->GetYaxis()->SetRangeUser(0,
maxYuser);
1200 }
1201 else
1202 {
1205 }
1206
1207
1208
1209 TH1D* comparisonHist = 0;
1210 TGraphErrors * comparisonGraph = 0;
1211 if (doComparison) {
1212 comparisonHist = totalHists.at(providers.size()-1);
1213 totalHists.pop_back();
1214 comparisonGraph = totalGraphs.at(providers.size()-1);
1215 totalGraphs.pop_back();
1216 }
1217
1218
1219
1220
1221 if (doCompareOnly) {
1223 totalGraphs.at(
index)->SetLineColor(1000+
index);
1224 totalGraphs.at(
index)->SetLineStyle(1);
1225 totalGraphs.at(
index)->SetLineWidth(2);
1226 totalHists.at(
index)->SetLineColor(1000+
index);
1227 totalHists.at(
index)->SetLineStyle(1);
1228 totalHists.at(
index)->SetLineWidth(2);
1229 totalGraphs.at(
index)->Draw(
"l same");
1230 }
1231 }
else if (providers.size() == 1 &&
optHelper.DrawTotal())
1232 totalHists.at(0)->Draw("histF same");
1233 else if ((providers.size() == 2) && doComparison) {
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1247 {
1248
1249 comparisonGraph->SetLineWidth(6);
1250 }
1251
1253 {
1254 comparisonHist->SetLineColor(kGreen+3);
1255 comparisonHist->SetFillColor(kTeal+5);
1256 }
1257 else
1258 {
1259 comparisonHist->SetLineColor(kTeal+5);
1260 comparisonHist->SetFillColor(kTeal-9);
1261 }
1262
1263 comparisonHist->Draw("histF same");
1264 totalHists.at(0)->Draw("histF same");
1265
1266 }
1267
1268 if (!doCompareOnly) {
1269 for (size_t iProv = 0; iProv < providers.size(); ++iProv)
1270 {
1271 if (doComparison) {
1272 if (iProv == providers.size()-1) continue;
1273
1274 comparisonGraph->SetLineColor(comparisonHist->GetLineColor());
1275 comparisonGraph->Draw("l same");
1276 totalGraphs.at(0)->Draw("l same");
1277 }
else if (
optHelper.DrawTotal()) totalGraphs.at(iProv)->Draw(
"l same");
1278 for (
size_t iComp = 0; iComp < compGraphs.at(iProv).
size(); ++iComp)
1279 compGraphs.at(iProv).at(iComp)->Draw("l same");
1280 }
1281 }
1282
1283
1285
1287 for (
size_t i=0;
i<providers.size();
i++) {
1288 const TString thisconfname = providers.at(i)->getConfigFile().c_str();
1289 if (!(thisconfname.Contains(
"_2012/")))
sign =
false;
1290 }
1291 bool sameRelease = true;
1292 const TString release0 = providers.at(0)->getRelease();
1293 for (
size_t i=1;
i<providers.size(); ++
i)
1294 if (providers.at(i)->getRelease() != release0)
1295 sameRelease = false;
1297 {
1299 if (providers.size() == 1 || (providers.size()==2 && doComparison) ||
sign || sameRelease)
1301
1302 if (mOverPtIsMass)
1303 DrawText(Form(
"|#eta_{jet}| < 2, m = %.0f GeV%s",mOverPt,
optHelper.SpecifyTagger()?Form(
", %s tagged",
getTagType(providers.at(0)).Data()):
""),kBlack,0.73);
1304 else
1305 DrawText(Form(
"|#eta_{jet}| < 2, m_{jet}/#it{p}_{T}^{jet} = %.2f%s",mOverPt,
optHelper.SpecifyTagger()?Form(
", %s tagged",
getTagType(providers.at(0)).Data()):
""),kBlack,0.73);
1306 }
1307 else
1308 {
1309
1310
1311
1312
1313
1314
1315
1317 if (providers.size() == 1 || (providers.size()==2 && doComparison) ||
sign || sameRelease)
1319 if (mOverPtIsMass)
1320 DrawText(fixedIsEta?Form(
"#eta = %.1f, m = %.0f GeV",fixedValue,mOverPt):Form(
"#it{p}_{T}^{jet} = %.0f GeV",fixedValue),kBlack,TString(providers.at(0)->getJetDef().c_str()).Contains(
"Trimmed") ? 0.74 : 0.805);
1321 else if (
optHelper.GetFixedMoverPtVals().size() > 1)
1322 DrawText(fixedIsEta?Form(
"#eta = %.1f, m/p_{T} = %.2f",fixedValue,mOverPt):Form(
"#it{p}_{T}^{jet} = %.0f GeV",fixedValue),kBlack,TString(providers.at(0)->getJetDef().c_str()).Contains(
"Trimmed") ? 0.74 : 0.805);
1323 else
1324 DrawText(fixedIsEta?Form(
"#eta = %.1f",fixedValue):Form(
"#it{p}_{T}^{jet} = %.0f GeV",fixedValue),kBlack,TString(providers.at(0)->getJetDef().c_str()).Contains(
"Trimmed") ? 0.74 : 0.805);
1326
1327 }
1328
1329
1330 double legx=0.41, legy=0.78,
dy = 0.045;
1332 legy = 0.68;
1333 else if (TString(providers.at(0)->getJetDef().c_str()).Contains("Trimmed"))
1334 legy = 0.73;
1335
1336 if (doCompareOnly) {
1337 for (
size_t i=0;
i < totalGraphs.size();
i++) {
1338 const TString
title = labelNames.at(i).at(0);
1340 }
1341 }
1342 if ((providers.size() == 1 || (providers.size() == 2 && doComparison)) &&
optHelper.DrawTotal()) {
1345 }
1346 if (doComparison) {
1347 const TString
title = labelNames.at(providers.size()-1).at(0);
1350 else
1351 {
1352 if (fixedIsEta)
DrawFillLabel(title,legx,legy-=dy,comparisonHist);
1353 else DrawFillLabel(title,legx,legy-=dy,comparisonHist,
false);
1354 }
1355 }
1356 for (size_t iProv = 0; iProv < providers.size(); ++iProv)
1357 for (
size_t iComp = 0; iComp < compGraphs.at(iProv).
size(); ++iComp)
1358 {
1359 const TGraphErrors* compGraph = compGraphs.at(iProv).at(iComp);
1360 const TString
label = compGraph->GetName();
1361 if (
label.Contains(
"#splitline"))
1362 {
1366 }
1373 else
1375 }
1376
1377
1378 frame->Draw("axis same");
1379
1380
1382 {
1385 else
1386 canvas->Print(TString(outFile).ReplaceAll(
outFile.EndsWith(
".eps")?
".eps":
".png",Form(
"/fig_%s_%s.%s",fixedIsEta?
"eta":
"pt",fixedIsEta?Form(
"%.1f",fixedValue):Form(
"%.0f",fixedValue),
outFile.EndsWith(
".eps")?
"eps":
"png")));
1387 }
1388 else
1389 {
1390
1391 printf(
"Preparing to dump to file: %s\n",
optHelper.GetDumpFile().Data());
1392 TFile* dumpFile = TFile::Open(
optHelper.GetDumpFile(),
"NEW");
1393 dumpFile->cd();
1394 for (size_t iSet = 0; iSet < compGraphs.size(); ++iSet)
1395 {
1396 for (
size_t iComp = 0 ; iComp < compGraphs.at(iSet).
size(); ++iComp)
1397 {
1398 compGraphs.at(iSet).at(iComp)->Write();
1399 }
1400 }
1401 dumpFile->Close();
1402 }
1403
1404
1405 for (size_t iProv = 0; iProv < providers.size(); ++iProv)
1406 {
1407 if (doComparison && iProv == providers.size()-1) continue;
1408 else {
1409 delete totalHists.at(iProv);
1410 delete totalGraphs.at(iProv);
1411 }
1412 for (
size_t iComp = 0; iComp < compGraphs.at(iProv).
size(); ++iComp)
1413 delete compGraphs.at(iProv).at(iComp);
1414 }
1415 delete comparisonHist;
1416 delete comparisonGraph;
1417
1418}
Scalar eta() const
pseudorapidity method
void DrawJetLabel(const JetUncertaintiesTool *provider, const double yPos)
void DrawYearLabel(const JetUncertaintiesTool *provider, const double yPos)
double getQuadratureSumUncertainty(const JetUncertaintiesTool *provider, const std::vector< int > &compIndices, const xAOD::Jet &jet, const xAOD::EventInfo &eInfo, const int PTindex)
void applyPublicFormat(TGraph &graph)
void DrawFillLabel(TString txt, double x, double y, TH1 *h, bool logX=optHelper.LogPt(), bool logY=false)
void setPileupShiftsForYear(const JetUncertaintiesTool *provider, xAOD::EventInfo *eInfo, const xAOD::Jet *jet=NULL)
TString getTagType(const JetUncertaintiesTool *provider)
void DrawAtlasLabel(const TString &label=optHelper.GetATLASLabel(), const bool right=true)
void DrawScenarioLabel(const JetUncertaintiesTool *provider, const double yPos)
const T * at(size_type n) const
Access an element, as an rvalue.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::Accessor< T, ALLOC > Accessor
JetFourMomAccessor is an extension of JetAttributeAccessor::AccessorWrapper<xAOD::JetFourMom_t> Acces...
Tool for accessing xAOD files outside of Athena.
A relatively simple transient store for objects created in analysis.
void xrange(TH1 *h, bool symmetric)
int enumToInt(const TypeEnum type)
TString getJetScaleString(const TypeEnum type)
std::vector< double > getUniformBins(const size_t numBins, const double minVal, const double maxVal)
Jet_v1 Jet
Definition of the current "jet version".
EventInfoContainer_v1 EventInfoContainer
Define the latest version of the container.
EventInfo_v1 EventInfo
Definition of the latest event info version.
EventInfoAuxContainer_v1 EventInfoAuxContainer
Define the latest version of the auxiliary container.
JetAuxContainer_v1 JetAuxContainer
Definition of the current jet auxiliary container.
JetContainer_v1 JetContainer
Definition of the current "jet container version".
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.