ATLAS Offline Software
Loading...
Searching...
No Matches
RecoEfficiencyPlots.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8namespace Tau{
9
10 RecoEfficiencyPlots::RecoEfficiencyPlots(PlotBase* pParent, const std::string& sDir, std::string sTauJetContainerName):
11 PlotBase(pParent, sDir),
12 m_sTauJetContainerName(std::move(sTauJetContainerName))
13 {
14 }
15
17 {
18 m_eff_truth_pt_all = BookTProfile("RecoEff_TruthPt_All"," Matched Truth-Reco taus eff in truth pt; truth pt; eff", 26, 0., 260.0);
19 m_eff_truth_eta_all = BookTProfile("RecoEff_TruthEta_All"," Matched Truth-Reco taus eff in truth eta; truth eta; eff", 10, -2.5,2.5);
20 m_eff_mu_all = BookTProfile("RecoEff_Mu_All", "Matched Truth-Reco taus eff in mu; mu; eff", 8, 10, 90);
21
22 m_eff_truth_pt_1p = BookTProfile("RecoEff_TruthPt_1P"," Matched 1P Truth-Reco taus eff in truth pt; truth pt; eff", 26, 0., 260.0);
23 m_eff_truth_eta_1p = BookTProfile("RecoEff_TruthEta_1P"," Matched 1P Truth-Reco taus eff in truth eta; truth eta; eff", 10, -2.5,2.5);
24 m_eff_mu_1p = BookTProfile("RecoEff_Mu_1P", "Matched 1P Truth-Reco taus eff in mu; mu; eff", 8, 10, 90);
25
26 m_eff_truth_pt_3p = BookTProfile("RecoEff_TruthPt_3P"," Matched 3P Truth-Reco taus eff in truth pt; truth pt; eff", 26, 0., 260.0);
27 m_eff_truth_eta_3p = BookTProfile("RecoEff_TruthEta_3P"," Matched 3P Truth-Reco taus eff in truth eta; truth eta; eff", 10, -2.5,2.5);
28 m_eff_mu_3p = BookTProfile("RecoEff_Mu_3P", "Matched 3P Truth-Reco taus eff in mu; mu; eff", 8, 10, 90);
29
30 }
31
32 void RecoEfficiencyPlots::fill(std::vector<const xAOD::TruthParticle*> & truth_taus, std::vector<const xAOD::TauJet*> & reco_taus, float weight, float avg_mu)
33 {
34
35 static const SG::ConstAccessor<double> acc_ptvis("pt_vis");
36 static const SG::ConstAccessor<double> acc_etavis("eta_vis");
37 static const SG::ConstAccessor<char> accIsHadronicTau ("IsHadronicTau");
38 static const SG::ConstAccessor<unsigned long> acc_ntracks("numChargedPion");
39
40 for (auto truth_tau : truth_taus) {
41
42 // check that truth tau is not a null pointer
43 if(truth_tau == nullptr){ continue; }
44 // place some minimum kinematic requirements on the truth taus
45 if((acc_ptvis(*truth_tau) < 15 * Athena::Units::GeV) || (std::abs(acc_etavis(*truth_tau)) > 2.5)){ continue; }
46 // select only truth hadronic taus
47 if(!(accIsHadronicTau(*truth_tau))) { continue; }
48
49 bool isMatched = false;
50 for (auto reco_tau : reco_taus) {
51 if(truth_tau->p4().DeltaR(reco_tau->p4()) < 0.2) {
52 isMatched = true;
53 break;
54 }
55 }
56 m_eff_truth_pt_all->Fill(acc_ptvis(*truth_tau)/Athena::Units::GeV,isMatched,weight);
57 m_eff_truth_eta_all->Fill(acc_etavis(*truth_tau),isMatched,weight);
58 m_eff_mu_all->Fill(avg_mu,isMatched,weight);
59
60 if(acc_ntracks(*truth_tau) == 1){
61 m_eff_truth_pt_1p->Fill(acc_ptvis(*truth_tau)/Athena::Units::GeV,isMatched,weight);
62 m_eff_truth_eta_1p->Fill(acc_etavis(*truth_tau),isMatched,weight);
63 m_eff_mu_1p->Fill(avg_mu,isMatched,weight);
64 }
65
66 if(acc_ntracks(*truth_tau) == 3){
67 m_eff_truth_pt_3p->Fill(acc_ptvis(*truth_tau)/Athena::Units::GeV,isMatched,weight);
68 m_eff_truth_eta_3p->Fill(acc_etavis(*truth_tau),isMatched,weight);
69 m_eff_mu_3p->Fill(avg_mu,isMatched,weight);
70 }
71 }
72 }
73
74}
Wrapper to avoid constant divisions when using units.
TProfile * BookTProfile(std::string_view name, std::string_view labels, int nBinsX, float startX, float endX, float startY=-1, float endY=-1, bool prependDir=true, bool useRMS=false)
Book a TProfile histogram.
Definition PlotBase.cxx:186
PlotBase(PlotBase *parent, std::string_view sDir)
Definition PlotBase.cxx:29
Helper class to provide constant type-safe access to aux data.
RecoEfficiencyPlots(PlotBase *pParent, const std::string &sDir, std::string sTauJetContainerName)
void fill(std::vector< const xAOD::TruthParticle * > &truth_taus, std::vector< const xAOD::TauJet * > &reco_taus, float weight, float avg_mu)
STL namespace.