ATLAS Offline Software
Loading...
Searching...
No Matches
InDetPerfPlot_FakeRate.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
6// #include "TrkValHistUtils/EfficiencyPurityCalculator.h"
10#include <cmath>
11#include <regex>
12using namespace IDPVM;
13
14InDetPerfPlot_FakeRate::InDetPerfPlot_FakeRate(InDetPlotBase* pParent, const std::string& sDir, FakeRateCategory fakeRateCategory) :
15 InDetPlotBase(pParent, sDir),
23 m_fakeRateCategory{fakeRateCategory} {
24 // nop
25}
26
27void unlinked_ylabel(TEfficiency *teff, const std::string& replacement)
28{
29 if (teff) {
30 std::string title = std::regex_replace(teff->GetTitle(), std::regex("linked"), replacement);
31 std::string xlabel = teff->GetTotalHistogram()->GetXaxis()->GetTitle();
32 std::string ylabel = std::regex_replace(teff->GetTotalHistogram()->GetYaxis()->GetTitle(), std::regex("linked"), replacement);
33 std::string s = title + ";" + xlabel + ";" + ylabel;
34 teff->SetTitle(s.c_str());
35 }
36}
37
38void
40
42 std::string nameOverride = "_total";
43 book(m_fakerate_vs_eta, "fakerate_vs_eta", "fakerate_vs_eta"+nameOverride);
44 book(m_fakerate_vs_pt, "fakerate_vs_pt", "fakerate_vs_pt"+nameOverride);
45 book(m_fakerate_vs_lowpt, "fakerate_vs_lowpt", "fakerate_vs_lowpt"+nameOverride);
46 book(m_fakerate_vs_phi, "fakerate_vs_phi", "fakerate_vs_phi"+nameOverride);
47 book(m_fakerate_vs_d0, "fakerate_vs_d0", "fakerate_vs_d0"+nameOverride);
48 book(m_fakerate_vs_z0, "fakerate_vs_z0", "fakerate_vs_z0"+nameOverride);
49 book(m_fakerate_vs_mu, "fakerate_vs_mu", "fakerate_vs_mu"+nameOverride);
50 }
51 else{
52 book(m_fakerate_vs_eta, "fakerate_vs_eta");
53 book(m_fakerate_vs_pt, "fakerate_vs_pt");
54 book(m_fakerate_vs_lowpt, "fakerate_vs_lowpt");
55 book(m_fakerate_vs_phi, "fakerate_vs_phi");
56 book(m_fakerate_vs_d0, "fakerate_vs_d0");
57 book(m_fakerate_vs_z0, "fakerate_vs_z0");
58 book(m_fakerate_vs_mu, "fakerate_vs_mu");
59 }
60
61
63 std::string replacement = (m_fakeRateCategory==FakeRateCategory::Unlinked)? "unlinked" : "";
71 }
72}
73
74void
75InDetPerfPlot_FakeRate::fill(const xAOD::TrackParticle& track, const bool isFake, float weight, float mu) {
76
77 double eta = track.eta();
78 double pt = track.pt() / Gaudi::Units::GeV; // convert MeV to GeV
79 double phi = track.phi();
80 double d0 = track.d0();
81 double z0 = track.z0();
82
83 fillHisto(m_fakerate_vs_eta, eta, isFake, weight);
84 fillHisto(m_fakerate_vs_pt, pt, isFake, weight);
85 fillHisto(m_fakerate_vs_lowpt, pt, isFake, weight);
86 fillHisto(m_fakerate_vs_phi, phi, isFake, weight);
87 fillHisto(m_fakerate_vs_d0, d0, isFake, weight);
88 fillHisto(m_fakerate_vs_z0, z0, isFake, weight);
89 fillHisto(m_fakerate_vs_mu, mu, isFake, weight);
90}
91
92void
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
void unlinked_ylabel(TEfficiency *teff, const std::string &replacement)
InDetPerfPlot_FakeRate(InDetPlotBase *pParent, const std::string &dirName, FakeRateCategory fakeRateCategory=FakeRateCategory::Linked)
void fill(const xAOD::TrackParticle &track, const bool isFake, float weight, float mu)
FakeRateCategory m_fakeRateCategory
static void fillHisto(TProfile *pTprofile, const float bin, const float weight, const float weight2=1.0)
void book(Htype *&pHisto, const std::string &histoIdentifier, const std::string &nameOverride="", const std::string &folder="default")
Helper method to book histograms using an identifier string.
InDetPlotBase(InDetPlotBase *pParent, const std::string &dirName)
Constructor taking parent node and directory name for plots.
Class to retrieve associated truth from a track, implementing a cached response.
TrackParticle_v1 TrackParticle
Reference the current persistent version: