ATLAS Offline Software
MakeCorrelationMatrixPlots.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 #include "../testingMacros/atlasstyle/AtlasStyle.C"
9 #include "../testingMacros/atlasstyle/AtlasLabels.C"
10 
11 #include "TString.h"
12 #include "TCanvas.h"
13 #include "TH2D.h"
14 #include "TFile.h"
15 
16 #include <vector>
17 
19 ATLAS_NO_CHECK_FILE_THREAD_SAFETY; // standalone application
20 
21 const double fixedRangeDiff = 0;
22 const bool addExtremumInfo = true;
23 const bool addScenarioInfo = false;
24 const bool makeGrid = true;
25 const bool minRepStyle = false;
26 const bool testJER = false;
27 
28 bool useRelativeMetric = true;
29 int iEPS = 0;
30 
31 double relativeMetric(const double numerator, const double denominator)
32 {
33  if (fabs(denominator) < 1.e-3)
34  {
35  if (fabs(numerator) < 1.e-3)
36  return 1;
37  else {
38  std::cout << "Setting error code in steering" << std::endl;
39  return JESUNC_ERROR_CODE;
40  }
41  }
42  return sqrt(numerator/denominator);
43 }
44 
45 void DrawLabels(const TH2D* histo, const double fixedValue1, const double fixedValue2, const JetUncertaintiesTool* uncTool, const JetUncertaintiesTool* uncToolDiff = nullptr, const double mean = 0, const double extremum = 0, const int extremeX = -1, const int extremeY = -1)
46 {
47  // Create the tex making object
48  static TLatex* tex = []()
49  {
50  tex = new TLatex();
51  tex->SetNDC();
52  tex->SetTextSize(0.045);
53  tex->SetTextColor(kBlack);
54  return tex;
55  }();
56 
57  // Add the ATLAS label
58  ATLASLabel(0.13,minRepStyle?0.825:0.955,"",kBlack);
59 
60  // Determine the configuration type (data year, correlation scenario, reduction if applicable)
61  const TString config1 = uncTool->getConfigFile();
62  const TString config2 = uncToolDiff ? uncToolDiff->getConfigFile() : "";
63  const TString year = config1.Contains("_2011/") ? "2011"/*, #sqrt{s} = 7 TeV"*/ : config1.Contains("_2012/") ? "2012": config1.Contains("_2015/") ? "2015" : "UNKNOWN";
64  const TString jetDef = uncTool->getJetDef();
65  const TString scenario1 = config1.Contains("StrongerCorrelations") ? "stronger" : (config1.Contains("WeakerCorrelations") ? "weaker" : "nominal");
66  const TString scenario2 = config2.Contains("StrongerCorrelations") ? "stronger" : (config2.Contains("WeakerCorrelations") ? "weaker" : "nominal");
67  const TString scenarioDiff = Form("%s - %s correlation scenarios",scenario1.Data(),scenario2.Data());
68  const TString reduction1 = config1.Contains("_ByCategory") ? "category reduction" : (config1.Contains("NP") ? "global reduction" : "original");
69  const TString reduction2 = config2.Contains("_ByCategory") ? "category reduction" : (config2.Contains("NP") ? "global reduction" : "original");
70  const TString reductionDiff = Form("%s - %s",reduction1.Data(),reduction2.Data());
71 
72  TString configDescString;
73  if (uncToolDiff)
74  {
75  if (scenario1 == scenario2 && reduction1 == reduction2)
76  configDescString = "UNKNOWN COMPARISON TYPE";
77  else if (scenario1 == scenario2 && reduction1 != reduction2)
78  configDescString = Form("%s correlation scenario, %s",scenario1.Data(),reductionDiff.Data());
79  else if (scenario1 != scenario2 && reduction1 == reduction2)
80  configDescString = Form("%s%s",scenarioDiff.Data(),reduction1 == "original" ? "" : Form(", %s",reduction1.Data()));
81  else
82  configDescString = Form("%s, %s",scenarioDiff.Data(),reductionDiff.Data());
83  }
84  else
85  {
86  configDescString = Form("%s correlation scenario%s",scenario1.Data(),reduction1 == "original" ? "" : Form(", %s",reduction1.Data()));
87  }
88 
89 
90  // Add the configuration info
91  const TString fixedValString = TString(histo->GetXaxis()->GetTitle()).Contains("#it{p}") ? Form("(#eta^{jet1},#eta^{jet2}) = (%.1f,%.1f)",fixedValue1,fixedValue2) : Form("(#it{p}_{T}^{jet1},#it{p}_{T}^{jet2}) = (%ld,%ld) GeV",lround(fixedValue1),lround(fixedValue2));
92  //tex->DrawLatex(0.13,minRepStyle?0.95:0.91,Form("anti-k_{t} #it{R} = %s, %s+JES+GSC, Data %s, %s",jetDef.Contains("AntiKt4") ? "0.4" : jetDef.Contains("AntiKt6") ? "0.6" : "UNKNOWN", jetDef.Contains("EM") ? "EM" : jetDef.Contains("LC") ? "LCW" : "UNKNOWN", year.Data(),fixedValString.Data()));
93  if (minRepStyle)
94  {
95  const TString reductionString = "str.red"; //"evdm";
96  const TString selector = ""; //"#it{p}_{T}^{jet},";
97  const TString scenarioString = TString(histo->GetName()).BeginsWith("diff_")?Form("Correlation difference, Rep_{full}^{%sJES} - Rep_{%s}^{%sJES}, %s",selector.Data(),reductionString.Data(),selector.Data(),fixedValString.Data()):Form("Correlation matrix, Rep_{%s}^{%sJES}, %s",TString(histo->GetName()).Contains("_0_")?"full":reductionString.Data(),selector.Data(),fixedValString.Data());
98  tex->DrawLatex(0.13,0.8751,Form("anti-#it{k}_{t} #it{R} = %s, %s+JES %s",jetDef.Contains("AntiKt4") ? "0.4" : jetDef.Contains("AntiKt6") ? "0.6" : "UNKNOWN", jetDef.Contains("EM") ? "EM" : jetDef.Contains("LC") ? "LCW" : "UNKNOWN", year.Data()));
99  tex->DrawLatex(0.13,0.9305,scenarioString.Data());
100  }
101  else
102  {
103  tex->DrawLatex(0.48,0.960,Form("anti-#it{k}_{t} #it{R} = %s, %s+JES + #it{in situ}",jetDef.Contains("AntiKt4") ? "0.4" : jetDef.Contains("AntiKt6") ? "0.6" : "UNKNOWN", jetDef.Contains("EM") ? "EM" : jetDef.Contains("LC") ? "LCW" : "UNKNOWN"));
104  tex->DrawLatex(0.48,0.905,fixedValString.Data());
105  tex->DrawLatex(0.13,0.905,Form("Data %s, #sqrt{s} = %d TeV",year.Data(),year=="2012"?8:year=="2011"?7:year=="2015"||year=="2016"?13:0));
106  }
107 
108 
109  if (addScenarioInfo)
110  {
111  tex->DrawLatex(0.15,0.84,configDescString.Data());
112  tex->DrawLatex(0.15,0.79,TString(uncTool->getAnalysisFile().c_str()).Contains("Unknown") ? "unknown flavour composition" : TString(uncTool->getAnalysisFile().c_str()).Contains("InclusiveJets") ? "inclusive jets composition" : "Unexpected flavour composition file");
113  }
114 
115 
116  if (addExtremumInfo && extremeX > 0 && extremeY > 0)
117  {
118  if (TString(histo->GetXaxis()->GetTitle()).Contains("#it{p}"))
119  tex->DrawLatex(0.01,0.015,Form("Mean value %.2f, max %.2f at (%ld,%ld) GeV",round(100*mean)/100.,round(100*extremum)/100.,lround(histo->GetXaxis()->GetBinCenter(extremeX)),lround(histo->GetYaxis()->GetBinCenter(extremeY))));
120  else
121  tex->DrawLatex(0.01,0.015,Form("Mean value %.2f, max %.2f at (%.2f,%.2f)",round(100*mean)/100.,round(100*extremum)/100.,histo->GetXaxis()->GetBinCenter(extremeX),histo->GetYaxis()->GetBinCenter(extremeY)));
122  }
123 }
124 
125 void FormatHisto(TH2D* histo)
126 {
127  histo->SetTitleSize(0.06,"z");
128  histo->SetLabelSize(0.04,"z");
129  histo->SetTitleOffset(1.225,"x");
130  histo->SetTitleOffset(1.05,"y");
131  histo->SetTitleOffset(0.76,"z");
132  histo->SetLabelOffset(0.002,"x");
133  histo->GetXaxis()->SetMoreLogLabels();
134 }
135 
136 void PlotCorrelationHistos(const TString& outFile, TCanvas* canvas, TFile* outHistFile, const std::vector<JetUncertaintiesTool*>& providers, const std::vector<TH2D*>& corrMats, const double fixedValue1, const double fixedValue2)
137 {
138  // First make the difference histograms
139  // Must be now as colz bug fixes axis range once draw is called
140  std::vector<TH2D*> corrMatDiffs;
141  std::vector< std::pair<JetUncertaintiesTool*,JetUncertaintiesTool*> > diffProviders;
142  for (size_t iHisto = 0; iHisto + 1 < corrMats.size(); ++iHisto)
143  {
144  // Take the difference
145  TH2D* diff = new TH2D(*corrMats.at(iHisto));
146  diff->SetName(Form("diff_%s",diff->GetName()));
147 
148  // Subtract, watching for kinematic limits and relative metric
149  for (int binX = 1; binX <= diff->GetNbinsX(); ++binX)
150  for (int binY = 1; binY <= diff->GetNbinsY(); ++binY)
151  if (corrMats.at(iHisto)->GetBinContent(binX,binY) < -100)
152  diff->SetBinContent(binX,binY,corrMats.at(iHisto)->GetBinContent(binX,binY));
153  else if (useRelativeMetric)
154  diff->SetBinContent(binX,binY,relativeMetric(corrMats.at(iHisto)->GetBinContent(binX,binY),corrMats.at(iHisto+1)->GetBinContent(binX,binY)));
155  else
156  diff->SetBinContent(binX,binY,corrMats.at(iHisto)->GetBinContent(binX,binY) - corrMats.at(iHisto+1)->GetBinContent(binX,binY));
157 
158  //diff->Add(corrMats.at(iHisto+1),-1);
159  //for (int binX = 1; binX <= diff->GetNbinsX(); ++binX)
160  // for (int binY = 1; binY <= diff->GetNbinsY(); ++binY)
161  // if (corrMats.at(iHisto)->GetBinContent(binX,binY) < -100)
162  // diff->SetBinContent(binX,binY,corrMats.at(iHisto)->GetBinContent(binX,binY));
163 
164  // Now store
165  corrMatDiffs.push_back(diff);
166  diffProviders.emplace_back(providers.at(iHisto),providers.at(iHisto+1));
167  }
168 
169  // Now make the initial plots
170  for (size_t iHisto = 0; iHisto < corrMats.size(); ++iHisto)
171  {
172  TH2D* histo = corrMats.at(iHisto);
173  histo->GetZaxis()->SetTitle("correlation");
174  histo->GetZaxis()->SetRangeUser(0.0,1.0);
176  histo->Draw("colz");
177  DrawLabels(histo,fixedValue1,fixedValue2,providers.at(iHisto));
178 
179  if (outFile != "NONE" && !outFile.EndsWith(".eps"))
180  canvas->Print(outFile);
181  else if (outFile != "NONE")
182  canvas->Print(TString(outFile).ReplaceAll(".eps",Form("-%d.eps",++iEPS)));
183 
184  if (outHistFile)
185  {
186  outHistFile->cd();
187  histo->Write(histo->GetName());
188  canvas->cd();
189  }
190  }
191 
192  // Now make the difference plots
193  for (size_t iHisto = 0; iHisto < corrMatDiffs.size(); ++iHisto)
194  {
195  TH2D* histo = corrMatDiffs.at(iHisto);
196 
197  // Determine the maximum difference
198  // Matrix is not necessarily symmetric (only symmetric if fixed1 == fixed2)
199  // Be careful to ignore kinematic limits (set outside scale on purpose)
200  double meanDiff = 0;
201  double maxDiff = 0;
202  int maxX = -1;
203  int maxY = -1;
204  unsigned long long numValidBins = 0;
205  for (int binX = 1; binX <= histo->GetNbinsX(); ++binX)
206  for (int binY = 1; binY <= histo->GetNbinsY(); ++binY)
207  {
208  // Check kinematic limits
209  if (histo->GetBinContent(binX,binY) < -100)
210  continue;
211 
212  // Adjust the mean and max
213  meanDiff += histo->GetBinContent(binX,binY);
214  numValidBins++;
215  if (fabs(histo->GetBinContent(binX,binY)) > fabs(maxDiff))
216  {
217  maxDiff = histo->GetBinContent(binX,binY);
218  maxX = binX;
219  maxY = binY;
220  }
221  }
222  //meanDiff /= histo->GetNbinsX()*histo->GetNbinsY();
223  if (numValidBins > 0)
224  meanDiff /= numValidBins;
225 
226  // Set the range to the maximum (rounded up to nearest multiple of 5) if requested
227  if (fixedRangeDiff < 1.e-3)
228  {
229  const double maxDiffRounded = static_cast<int>(fabs(maxDiff)*20+1)/20.;
230  histo->GetZaxis()->SetRangeUser(-maxDiffRounded,maxDiffRounded);
231  }
232  else
233  histo->GetZaxis()->SetRangeUser(-fixedRangeDiff,fixedRangeDiff);
234 
235  // Now plot
236  histo->GetZaxis()->SetTitle("correlation difference");
238  histo->Draw("colz");
239  DrawLabels(histo,fixedValue1,fixedValue2,diffProviders.at(iHisto).first,diffProviders.at(iHisto).second,meanDiff,maxDiff,maxX,maxY);
240 
241  if (outFile != "NONE" && !outFile.EndsWith(".eps"))
242  canvas->Print(outFile);
243  else if (outFile != "NONE")
244  canvas->Print(TString(outFile).ReplaceAll(".eps",Form("-%d.eps",++iEPS)));
245 
246  if (outHistFile && corrMatDiffs.size() == 1)
247  {
248  outHistFile->cd();
249  histo->Write(histo->GetName());
250  canvas->cd();
251  }
252  }
253 }
254 
255 void MakeCorrelationPlots(const TString& outFile, TCanvas* canvas, TFile* outHistFile, const std::vector<JetUncertaintiesTool*>& providers,const std::vector< std::pair<double,double> >& fixedEta,const std::vector< std::pair<double,double> >& fixedPt)
256 {
257  const TString release = providers.at(0)->getRelease();
258  const double minPtVal = release.EndsWith("TLA") ? 75 : 17;
259  const double maxPtVal = testJER ? 1500 : release.EndsWith("TLA") ? 1000 : (release.BeginsWith("2011") || release.BeginsWith("2012")) ? 2500 : 3000;
260  const double minEtaVal = 0;
261  const double maxEtaVal = release.EndsWith("TLA") ? 2.8 : 4.5;
262 
263  // First the pT correlation plots
264  canvas->SetLogx(true);
265  canvas->SetLogy(true);
266  for (size_t iFixed = 0; iFixed < fixedEta.size(); ++iFixed)
267  {
268  const double etaVal1 = fixedEta.at(iFixed).first;
269  const double etaVal2 = fixedEta.at(iFixed).second;
270 
271  printf("Processing (eta1,eta2) = (%.2f,%.2f)\n",etaVal1,etaVal2);
272 
273  // Make the initial histograms
274  std::vector<TH2D*> corrPt;
275  for (size_t iProv = 0; iProv < providers.size(); ++iProv)
276  {
277  corrPt.push_back(providers.at(iProv)->getPtCorrelationMatrix(100,minPtVal,maxPtVal,etaVal1,etaVal2));
278  corrPt.back()->GetXaxis()->SetTitle("#it{p}_{T}^{jet} [GeV]");
279  corrPt.back()->GetYaxis()->SetTitle(corrPt.back()->GetXaxis()->GetTitle());
280 
281  // Switch to 1-corr if Sasha's requested metric
282  if (useRelativeMetric)
283  for (int binX = 1; binX <= corrPt.back()->GetNbinsX(); ++binX)
284  for (int binY = 1; binY <= corrPt.back()->GetNbinsY(); ++binY)
285  if (corrPt.back()->GetBinContent(binX,binY) > -100) {
286  corrPt.back()->SetBinContent(binX,binY,1-corrPt.back()->GetBinContent(binX,binY));
287  }
288  }
289 
290  // Now plot them and the difference histograms
291  PlotCorrelationHistos(outFile,canvas,outHistFile,providers,corrPt,etaVal1,etaVal2);
292 
293  }
294 
295  // Now the eta correlation plots
296  canvas->SetLogx(false);
297  canvas->SetLogy(false);
298  for (size_t iFixed = 0; iFixed < fixedPt.size(); ++iFixed)
299  {
300  const double ptVal1 = fixedPt.at(iFixed).first;
301  const double ptVal2 = fixedPt.at(iFixed).second;
302 
303  printf("Processing (pT1,pT2) = (%.0f,%.0f)\n",ptVal1,ptVal2);
304 
305  // Make the initial histograms
306  std::vector<TH2D*> corrEta;
307  for (size_t iProv = 0; iProv < providers.size(); ++iProv)
308  {
309  corrEta.push_back(providers.at(iProv)->getEtaCorrelationMatrix(round(10*(maxEtaVal-minEtaVal)),minEtaVal,maxEtaVal,ptVal1,ptVal2));
310  corrEta.back()->GetXaxis()->SetTitle("#eta^{jet}");
311  corrEta.back()->GetYaxis()->SetTitle(corrEta.back()->GetXaxis()->GetTitle());
312 
313  // Switch to 1-corr if Sasha's requested metric
314  if (useRelativeMetric)
315  for (int binX = 1; binX <= corrEta.back()->GetNbinsX(); ++binX)
316  for (int binY = 1; binY <= corrEta.back()->GetNbinsY(); ++binY)
317  if (corrEta.back()->GetBinContent(binX,binY) > -100)
318  corrEta.back()->SetBinContent(binX,binY,1-corrEta.back()->GetBinContent(binX,binY));
319  }
320 
321  // Now plot them and the difference histograms
322  PlotCorrelationHistos(outFile,canvas,outHistFile,providers,corrEta,ptVal1,ptVal2);
323  }
324 }
325 
326 
327 
329 {
330  if (argc != 7 && argc != 8 && argc != 9)
331  {
332  printf("Expected arguments:\n");
333  printf("\t1. Output file (ps, pdf, eps)\n");
334  printf("\t2. Jet definition(s), semicolon delimited\n");
335  printf("\t3. MC type\n");
336  printf("\t4. Config file(s), semicolon delimited\n");
337  printf("\t\tDifferences will be performed by left minus right\n");
338  printf("\t\tExample: A;B;C --> A,B,C,A-B,B-C\n");
339  printf("\t5. Fixed eta values to consider for pT correlations, semicolon delimited\n");
340  printf("\t Note: Comma-delimited pairs if specifying both eta1 and eta2\n");
341  printf("\t6. Fixed pT values to consider for eta correlations, semicolon delimited\n");
342  printf("\t Note: Comma-delimited pairs if specifying both pt1 and pt2\n");
343  printf("\t Note: Expected units are GeV, not MeV\n");
344  printf("\t7. Output histogram root file (OPTIONAL)\n");
345  printf("\t8. Whether to switch to relative differences (OPTIONAL, default \"false\")\n");
346  return 1;
347  }
348  TFile* outHistFile = nullptr;
349  TString outFile = argv[1];
350  std::vector<TString> jetDefs = jet::utils::vectorize<TString>(argv[2],";");
351  TString mcType = argv[3];
352  std::vector<TString> configs = jet::utils::vectorize<TString>(argv[4],";");
353  std::vector<TString> fixedEtaS = jet::utils::vectorize<TString>(argv[5],";");
354  std::vector<TString> fixedPtS = jet::utils::vectorize<TString>(argv[6],";");
355  if (argc > 7)
356  outHistFile = TFile::Open(argv[7],"RECREATE");
357  if (argc > 8)
359 
360 #ifdef XAOD_STANDALONE
361  StatusCode::enableFailure();
362 #endif // XAOD_STANDALONE
363 
364  if (configs.empty())
365  {
366  printf("Failed to find any configs: %s\n",argv[4]);
367  return 2;
368  }
369 
370  // Ensure we have to do something
371  if (fixedEtaS.empty() && fixedPtS.empty())
372  {
373  printf("No fixed pT or eta values were specified, nothing to do.\n");
374  return 2;
375  }
376 
377  // Convert fixed value singlets or pairs to pairs
378  std::vector< std::pair<double,double> > fixedEta;
379  std::vector< std::pair<double,double> > fixedPt;
380  if (makeGrid)
381  {
382  for (size_t iEta1 = 0; iEta1 < fixedEtaS.size(); ++iEta1)
383  for (size_t iEta2 = 0; iEta2 < fixedEtaS.size(); ++iEta2)
384  fixedEta.emplace_back(jet::utils::getTypeObjFromString<double>(fixedEtaS.at(iEta1)),jet::utils::getTypeObjFromString<double>(fixedEtaS.at(iEta2)));
385  }
386  else
387  {
388  for (size_t iEta = 0; iEta < fixedEtaS.size(); ++iEta)
389  {
390  std::vector<double> temp = jet::utils::vectorize<double>(fixedEtaS.at(iEta),",");
391  if (temp.size() == 1 && !makeGrid)
392  fixedEta.emplace_back(temp.at(0),temp.at(0));
393  else if (temp.size() == 2)
394  fixedEta.emplace_back(temp.at(0),temp.at(1));
395  else
396  {
397  printf("Specified a fixed eta term which is not 1 or 2 values: %s\n",fixedEtaS.at(iEta).Data());
398  printf("Unsure of how to interpret this term, exiting.\n");
399  return 3;
400  }
401  }
402  }
403 
404  if (makeGrid)
405  {
406  for (size_t iPt1 = 0; iPt1 < fixedPtS.size(); ++iPt1)
407  for (size_t iPt2 = 0; iPt2 < fixedPtS.size(); ++iPt2)
408  fixedPt.emplace_back(jet::utils::getTypeObjFromString<double>(fixedPtS.at(iPt1)),jet::utils::getTypeObjFromString<double>(fixedPtS.at(iPt2)));
409  }
410  else
411  {
412  for (size_t iPt = 0; iPt < fixedPtS.size(); ++iPt)
413  {
414  std::vector<double> temp = jet::utils::vectorize<double>(fixedPtS.at(iPt),",");
415  if (temp.size() == 1)
416  fixedPt.emplace_back(temp.at(0),temp.at(0));
417  else if (temp.size() == 2)
418  fixedPt.emplace_back(temp.at(0),temp.at(1));
419  else
420  {
421  printf("Specified a fixed pt term which is not 1 or 2 values: %s\n",fixedPtS.at(iPt).Data());
422  printf("Unsure of how to interpret this term, exiting.\n");
423  return 4;
424  }
425  }
426  }
427 
428  // Create the canvas
429  SetAtlasStyle();
430  gStyle->SetPalette(1);
431  TCanvas* canvas = new TCanvas("canvas");
432  canvas->SetMargin(0.12,0.15,minRepStyle?0.13:0.135,minRepStyle?0.18:0.115);
433  canvas->SetFillStyle(4000);
434  canvas->SetFillColor(0);
435  canvas->SetFrameBorderMode(0);
436  canvas->cd();
437 
438  // If this is not an eps, start the output
439  if (outFile != "NONE" && !outFile.EndsWith(".eps"))
440  canvas->Print(outFile+"[");
441 
442 
443  // Run once per jet type
444  for (size_t iJetDef = 0; iJetDef < jetDefs.size(); ++iJetDef)
445  {
446  const TString jetDef = jetDefs.at(iJetDef);
447 
448  // Create the providers
449  std::vector<JetUncertaintiesTool*> providers;
450  printf("Processing %zu config(s)...\n",configs.size());
451  for (size_t iConfig = 0; iConfig < configs.size(); ++iConfig)
452  {
453  // Make a new provider
454  providers.push_back(new JetUncertaintiesTool(Form("%s_%zu",jetDef.Data(),iConfig)));
455 
456  //Set properties
457  if (providers.back()->setProperty("JetDefinition",jetDef.Data()).isFailure())
458  {
459  printf("Failed to set JetDefinition to %s\n",jetDef.Data());
460  return 5;
461  }
462  if (providers.back()->setProperty("MCType",mcType.Data()).isFailure())
463  {
464  printf("Failed to set MCType to %s\n",mcType.Data());
465  return 6;
466  }
467  if (providers.back()->setProperty("ConfigFile",configs.at(iConfig).Data()).isFailure())
468  {
469  printf("Failed to set ConfigFile to %s\n",configs.at(iConfig).Data());
470  return 7;
471  }
472 
474  //if (IsDijet())
475  //{
476  // const TString dijetAnalysisFile = "../testingMacros/random_stuff/MJESForInclusiveJets_MC11b.root";
477  // if (providers.back()->setProperty("AnalysisFile",dijetAnalysisFile.Data()).isFailure())
478  // {
479  // printf("Failed to set AnalysisFile to %s\n",dijetAnalysisFile.Data());
480  // exit(7);
481  // }
482  //}
483 
484  // Set to use GeV
485  if (providers.back()->setScaleToGeV().isFailure())
486  {
487  printf("Failed to set tool scale to GeV for config: %s\n",configs.at(iConfig).Data());
488  return 8;
489  }
490 
491  // Done setting properties, initialize the tool
492  if (providers.back()->initialize().isFailure())
493  {
494  printf("Failed to initialize tool for config: %s\n",configs.at(iConfig).Data());
495  return 9;
496  }
497  }
498 
499  // Make the plots
500  MakeCorrelationPlots(outFile,canvas,outHistFile,providers,fixedEta,fixedPt);
501 
502  // Clean up
503  for (size_t iProv = 0; iProv < providers.size(); ++iProv)
504  delete providers.at(iProv);
505  providers.clear();
506  }
507 
508  // If this is not an eps, end the output
509  if (outFile != "NONE" && !outFile.EndsWith(".eps"))
510  canvas->Print(outFile+"]");
511 
512  // If an output histogram file exists, close it
513  if (outHistFile)
514  {
515  outHistFile->Close();
516  outHistFile = nullptr;
517  }
518 
519  return 0;
520 }
521 
minRepStyle
const bool minRepStyle
Definition: MakeCorrelationMatrixPlots.cxx:25
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
addExtremumInfo
const bool addExtremumInfo
Definition: MakeCorrelationMatrixPlots.cxx:22
PlotCorrelationHistos
void PlotCorrelationHistos(const TString &outFile, TCanvas *canvas, TFile *outHistFile, const std::vector< JetUncertaintiesTool * > &providers, const std::vector< TH2D * > &corrMats, const double fixedValue1, const double fixedValue2)
Definition: MakeCorrelationMatrixPlots.cxx:136
ATLAS_NOT_THREAD_SAFE
int main ATLAS_NOT_THREAD_SAFE(int argc, char *argv[])
Definition: MakeCorrelationMatrixPlots.cxx:328
mean
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
Definition: dependence.cxx:254
SetAtlasStyle
void SetAtlasStyle()
Definition: InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Macro/AtlasStyle.h:17
DrawLabels
void DrawLabels(const TH2D *histo, const double fixedValue1, const double fixedValue2, const JetUncertaintiesTool *uncTool, const JetUncertaintiesTool *uncToolDiff=nullptr, const double mean=0, const double extremum=0, const int extremeX=-1, const int extremeY=-1)
Definition: MakeCorrelationMatrixPlots.cxx:45
iEPS
int iEPS
Definition: MakeCorrelationMatrixPlots.cxx:29
MuonGM::round
float round(const float toRound, const unsigned int decimals)
Definition: Mdt.cxx:27
mc.diff
diff
Definition: mc.SFGenPy8_MuMu_DD.py:14
fixedRangeDiff
const double fixedRangeDiff
Definition: MakeCorrelationMatrixPlots.cxx:21
python.AtlRunQueryAMI.year
year
Definition: AtlRunQueryAMI.py:225
useRelativeMetric
bool useRelativeMetric
Definition: MakeCorrelationMatrixPlots.cxx:28
Helpers.h
JESUNC_ERROR_CODE
#define JESUNC_ERROR_CODE
Definition: Reconstruction/Jet/JetUncertainties/JetUncertainties/Helpers.h:23
Trk::binY
@ binY
Definition: BinningType.h:48
main
int main(int, char **)
Main class for all the CppUnit test classes
Definition: CppUnit_SGtestdriver.cxx:141
CalculateHighPtTerm.jetDef
dictionary jetDef
Definition: ICHEP2016/CalculateHighPtTerm.py:28
JetUncertaintiesTool::getConfigFile
virtual std::string getConfigFile() const
Definition: JetUncertaintiesTool.h:70
JetUncertaintiesTool
Definition: JetUncertaintiesTool.h:44
LArCellNtuple.argv
argv
Definition: LArCellNtuple.py:152
DeMoAtlasDataLoss.canvas
dictionary canvas
Definition: DeMoAtlasDataLoss.py:187
MakeCorrelationPlots
void MakeCorrelationPlots(const TString &outFile, TCanvas *canvas, TFile *outHistFile, const std::vector< JetUncertaintiesTool * > &providers, const std::vector< std::pair< double, double > > &fixedEta, const std::vector< std::pair< double, double > > &fixedPt)
Definition: MakeCorrelationMatrixPlots.cxx:255
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:19
addScenarioInfo
const bool addScenarioInfo
Definition: MakeCorrelationMatrixPlots.cxx:23
Trk::binX
@ binX
Definition: BinningType.h:47
ReadTripsProbsFromCool.denominator
denominator
Definition: ReadTripsProbsFromCool.py:96
ParseInputs.jetDefs
list jetDefs
Definition: Final2012/ParseInputs.py:102
DQPostProcessTest.outFile
outFile
Comment Out Those You do not wish to run.
Definition: DQPostProcessTest.py:36
python.EventInfoMgtInit.release
release
Definition: EventInfoMgtInit.py:23
testJER
const bool testJER
Definition: MakeCorrelationMatrixPlots.cxx:26
JetUncertaintiesTool::getAnalysisFile
virtual std::string getAnalysisFile() const
Definition: JetUncertaintiesTool.h:72
python.selector.AtlRunQuerySelectorLhcOlc.selector
selector
Definition: AtlRunQuerySelectorLhcOlc.py:610
ATLAS_NO_CHECK_FILE_THREAD_SAFETY
ATLAS_NO_CHECK_FILE_THREAD_SAFETY
Definition: MakeCorrelationMatrixPlots.cxx:19
DeMoStatus.ATLASLabel
def ATLASLabel(x, y, text="")
ATLASLabel copied from atlastyle package, as import does not work for unknown reasons.
Definition: DeMoStatus.py:51
relativeMetric
double relativeMetric(const double numerator, const double denominator)
Definition: MakeCorrelationMatrixPlots.cxx:31
FormatHisto
void FormatHisto(TH2D *histo)
Definition: MakeCorrelationMatrixPlots.cxx:125
plotBeamSpotCompare.histo
histo
Definition: plotBeamSpotCompare.py:414
checker_macros.h
Define macros for attributes used to control the static checker.
xAOD::iEta
setScale setgFexType iEta
Definition: gFexJetRoI_v1.cxx:77
JetUncertaintiesTool::getJetDef
virtual std::string getJetDef() const
Definition: JetUncertaintiesTool.h:68
jet::utils::getTypeObjFromString< bool >
bool getTypeObjFromString< bool >(const std::string &str, bool &obj)
Definition: Reconstruction/Jet/JetUncertainties/Root/Helpers.cxx:33
JetUncertaintiesTool.h
makeGrid
const bool makeGrid
Definition: MakeCorrelationMatrixPlots.cxx:24