ATLAS Offline Software
Loading...
Searching...
No Matches
TrkClassEfficiencyPlots.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 TrkClassEfficiencyPlots::TrkClassEfficiencyPlots(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_1p = BookTProfile("TrkClassEff_TruthPt_1P"," Matched 1P Truth-Reco taus TrkClass eff in truth pt; truth pt; eff", 26, 0., 260.0);
19 m_eff_truth_eta_1p = BookTProfile("TrkClassEff_TruthEta_1P"," Matched 1P Truth-Reco taus TrkClass eff in truth eta; truth eta; eff", 10, -2.5,2.5);
20 m_eff_mu_1p = BookTProfile("TrkClassEff_Mu_1P", "Matched 1P Truth-Reco taus TrkClass eff in mu; mu; eff", 8, 10, 90);
21
22 m_eff_truth_pt_3p = BookTProfile("TrkClassEff_TruthPt_3P"," Matched 3P Truth-Reco taus TrkClass eff in truth pt; truth pt; eff", 26, 0., 260.0);
23 m_eff_truth_eta_3p = BookTProfile("TrkClassEff_TruthEta_3P"," Matched 3P Truth-Reco taus TrkClass eff in truth eta; truth eta; eff", 10, -2.5,2.5);
24 m_eff_mu_3p = BookTProfile("TrkClassEff_Mu_3P", "Matched 3P Truth-Reco taus TrkClass eff in mu; mu; eff", 8, 10, 90);
25 }
26
27 void TrkClassEfficiencyPlots::fill(std::vector<const xAOD::TruthParticle*> & truth_taus, std::vector<const xAOD::TauJet*> & reco_taus, float weight, float avg_mu)
28 {
29
30 static const SG::ConstAccessor<double> acc_ptvis("pt_vis");
31 static const SG::ConstAccessor<double> acc_etavis("eta_vis");
32 static const SG::ConstAccessor<char> accIsHadronicTau ("IsHadronicTau");
33 static const SG::ConstAccessor<unsigned long> acc_ntracks("numChargedPion");
34
35 for (auto reco_tau : reco_taus) {
36
37 for (auto truth_tau : truth_taus) {
38 // check that truth tau is not a null pointer
39 if(truth_tau == nullptr){ continue; }
40 // place some minimum kinematic requirements on the truth taus
41 if((acc_ptvis(*truth_tau) < 15 * Athena::Units::GeV) || (std::abs(acc_etavis(*truth_tau)) > 2.5)){ continue; }
42 // select only truth hadronic taus
43 if(!(accIsHadronicTau(*truth_tau))) { continue; }
44
45 if(truth_tau->p4().DeltaR(reco_tau->p4()) < 0.2) {
46 bool track_num_match = false;
47 if( acc_ntracks(*truth_tau) == 1){
48 if( reco_tau->nTracks() == 1 ) { track_num_match = true; }
49 else { track_num_match = false;}
50
51 m_eff_truth_pt_1p->Fill(acc_ptvis(*truth_tau)/Athena::Units::GeV,track_num_match,weight);
52 m_eff_truth_eta_1p->Fill(acc_etavis(*truth_tau),track_num_match,weight);
53 m_eff_mu_1p->Fill(avg_mu,track_num_match,weight);
54
55 } else if ( acc_ntracks(*truth_tau) == 3){
56
57 if( reco_tau->nTracks() == 3 ) { track_num_match = true; }
58 else { track_num_match = false;}
59
60 m_eff_truth_pt_3p->Fill(acc_ptvis(*truth_tau)/Athena::Units::GeV,track_num_match,weight);
61 m_eff_truth_eta_3p->Fill(acc_etavis(*truth_tau),track_num_match,weight);
62 m_eff_mu_3p->Fill(avg_mu,track_num_match,weight);
63 }
64 break;
65 }
66 }
67 }
68 }
69}
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.
TrkClassEfficiencyPlots(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.