|
| 1 | +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. |
| 2 | +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. |
| 3 | +// All rights not expressly granted are reserved. |
| 4 | +// |
| 5 | +// This software is distributed under the terms of the GNU General Public |
| 6 | +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". |
| 7 | +// |
| 8 | +// In applying this license CERN does not waive the privileges and immunities |
| 9 | +// granted to it by virtue of its status as an Intergovernmental Organization |
| 10 | +// or submit itself to any jurisdiction. |
| 11 | + |
| 12 | +#include "FlatTrackSmearer.h" |
| 13 | +#include "TrackUtilities.h" |
| 14 | + |
| 15 | +#include <TAxis.h> |
| 16 | +#include <TCanvas.h> |
| 17 | +#include <TColor.h> |
| 18 | +#include <TGraph.h> |
| 19 | + |
| 20 | +void drawTrackSmearer(const std::vector<std::pair<int, std::string>>& filenames = {{11, "/tmp/lut/lutCov.acts.11.2T.dNdEta5.dat"}, |
| 21 | + {13, "/tmp/lut/lutCov.acts.13.2T.dNdEta5.dat"}, |
| 22 | + {211, "/tmp/lut/lutCov.acts.211.2T.dNdEta5.dat"}, |
| 23 | + {2212, "/tmp/lut/lutCov.acts.2212.2T.dNdEta5.dat"}, |
| 24 | + {321, "/tmp/lut/lutCov.acts.321.2T.dNdEta5.dat"}}) |
| 25 | +{ |
| 26 | + |
| 27 | + o2::delphes::TrackSmearer trackSmearer; |
| 28 | + |
| 29 | + TCanvas* cPtReso = new TCanvas("cPtReso", "cPtReso", 800, 600); |
| 30 | + TCanvas* cPtEff = new TCanvas("cPtEff", "cPtEff", 800, 600); |
| 31 | + |
| 32 | + for (const auto& [pdg, filename] : filenames) { |
| 33 | + trackSmearer.loadTable(pdg, filename.c_str(), true); |
| 34 | + TGraph* gPt = new TGraph(); |
| 35 | + gPt->SetName(Form("gPt_%d", pdg)); |
| 36 | + gPt->GetXaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})"); |
| 37 | + gPt->GetYaxis()->SetTitle("pt resolution"); |
| 38 | + |
| 39 | + TGraph* gPtEff = new TGraph(); |
| 40 | + gPtEff->SetName(Form("gPtEff_%d", pdg)); |
| 41 | + gPtEff->GetXaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})"); |
| 42 | + gPtEff->GetYaxis()->SetTitle("efficiency"); |
| 43 | + |
| 44 | + for (int i = 0; i < trackSmearer.getLUTHeader(pdg)->ptmap.nbins; i++) { |
| 45 | + const float pt = trackSmearer.getLUTHeader(pdg)->ptmap.eval(i); |
| 46 | + const float res = trackSmearer.getPtRes(pdg, 0, 0., pt); |
| 47 | + gPt->AddPoint(pt, res / pt); |
| 48 | + const float eff = trackSmearer.getEfficiency(pdg, 0, 0., pt); |
| 49 | + gPtEff->AddPoint(pt, eff); |
| 50 | + } |
| 51 | + |
| 52 | + int color = 0; |
| 53 | + if (pdg == 11) { |
| 54 | + color = TColor::GetColor("#e41a1c"); |
| 55 | + } else if (pdg == 13) { |
| 56 | + color = TColor::GetColor("#377eb8"); |
| 57 | + } else if (pdg == 211) { |
| 58 | + color = TColor::GetColor("#4daf4a"); |
| 59 | + } else if (pdg == 2212) { |
| 60 | + color = TColor::GetColor("#984ea3"); |
| 61 | + } else if (pdg == 321) { |
| 62 | + color = TColor::GetColor("#ff7f00"); |
| 63 | + } |
| 64 | + gPt->SetLineColor(color); |
| 65 | + gPtEff->SetLineColor(color); |
| 66 | + |
| 67 | + cPtReso->cd(); |
| 68 | + if (cPtReso->GetListOfPrimitives()->GetEntries() == 0) { |
| 69 | + gPt->Draw("ALP"); |
| 70 | + } else { |
| 71 | + gPt->Draw("LP SAME"); |
| 72 | + } |
| 73 | + cPtEff->cd(); |
| 74 | + if (cPtEff->GetListOfPrimitives()->GetEntries() == 0) { |
| 75 | + gPtEff->Draw("ALP"); |
| 76 | + } else { |
| 77 | + gPtEff->Draw("LP SAME"); |
| 78 | + } |
| 79 | + gPt->SaveAs("/tmp/gPt.root"); |
| 80 | + } |
| 81 | +} |
0 commit comments