Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
reconstructionPerformance.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file reconstructionPerformance.C
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2019-2021 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #include <array>
10 #include <string>
11 #include <vector>
12 #include <iostream>
13 
14 #include <TCanvas.h>
15 #include <TEfficiency.h>
16 #include <TProfile.h>
17 #include <TFile.h>
18 
19 #include "CommonUtils.h"
20 
26 void reconstructionPerformance(std::vector<std::string> inputFileNames) {
27  std::array<TCanvas*, 3> emho = {nullptr, nullptr, nullptr};
28  std::vector<std::string> tags = {"eta", "pT"};
29  std::vector<std::string> params = {"trackeff", "nMeasurements", "nHoles",
30  "nOutliers", "nStates"};
31 
32  // Create the Canvae
33  unsigned int itag = 0;
34  for (const auto& t : tags) {
35  std::string name = "efd_" + t;
36  std::string label = "Efficiency, Fakes, Duplicate vs. " + t;
37  emho[itag] =
38  new TCanvas(name.c_str(), label.c_str(), itag * 10, 10, 1800, 300);
39  emho[itag]->Divide(5, 1);
40  ++itag;
41  }
42 
43  unsigned int imode = 1;
44  for (auto fileName : inputFileNames) {
45  // The appropriate file
46  auto file = TFile::Open(fileName.c_str(), "read");
47  unsigned int itag = 0;
48  for (const auto& t : tags) {
49  unsigned int ipar = 0;
50  for (const auto& p : params) {
51  std::string hName = p + std::string("_vs_") + t;
52  emho[itag]->cd(ipar+1);
53  auto h = file->Get(hName.c_str());
54  auto heff = dynamic_cast<TEfficiency*>(h);
55  if (heff != nullptr){
56  setEffStyle(heff, imode);
57  } else {
58  auto hprof = dynamic_cast<TProfile*>(h);
59  if (hprof != nullptr){
60  setHistStyle(hprof, imode);
61  }
62  }
63  std::string dOpt = imode == 1 ? "" : "same";
64  h->Draw(dOpt.c_str());
65  ++ipar;
66  }
67  ++itag;
68  }
69  ++imode;
70  }
71 }
72