ATLAS Offline Software
Loading...
Searching...
No Matches
InDetPerfPlot_TrackParameters.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
9
10
12
15#include <cmath>
16using namespace IDPVM;
17
18InDetPerfPlot_TrackParameters::InDetPerfPlot_TrackParameters(InDetPlotBase* pParent, const std::string& sDir, bool hasHGTDReco) :
19 InDetPlotBase(pParent, sDir), m_hasHGTDReco{hasHGTDReco}{
20 //nop
21 //variable initialised at declaration
22}
23
24void
26
27 book(m_reco_d0, "reco_d0");
28 book(m_reco_z0, "reco_z0");
29 book(m_reco_z0sin, "reco_z0sin");
30 book(m_reco_phi, "reco_phi");
31 book(m_reco_theta, "reco_theta");
32 book(m_reco_eta, "reco_eta");
33 book(m_reco_qoverp, "reco_qoverp");
34 book(m_reco_pt, "reco_pt");
35 book(m_reco_lowpt, "reco_lowpt");
36 book(m_reco_chi2, "reco_chi2");
37 book(m_reco_ndof, "reco_ndof");
38 book(m_reco_chi2Overndof, "reco_chi2Overndof");
39 book(m_reco_author, "reco_author");
40 if(m_hasHGTDReco){
41 book(m_reco_time, "reco_time");
42 book(m_reco_hasValidTime_eff_vs_eta, "reco_hasValidTime_eff_vs_eta");
43 }
44
45 book(m_truth_d0, "truth_d0");
46 book(m_truth_z0, "truth_z0");
47 book(m_truth_z0sin, "truth_z0sin");
48 book(m_truth_phi, "truth_phi");
49 book(m_truth_theta, "truth_theta");
50 book(m_truth_eta, "truth_eta");
51 book(m_truth_qoverp, "truth_qoverp");
52 book(m_truth_pt, "truth_pt");
53 book(m_truth_lowpt, "truth_lowpt");
54 book(m_truth_prodR, "truth_prodR");
55 book(m_truth_prodZ, "truth_prodZ");
56 book(m_truth_time, "truth_time");
57
58 book(m_reco_pt_vs_eta, "reco_pt_vs_eta");
59 book(m_reco_phi_vs_eta, "reco_phi_vs_eta");
60
61 book(m_reco_d0_z0, "reco_d0_vs_z0");
62 book(m_reco_d0_z0sin, "reco_d0_vs_z0sin");
63
64 book(m_truth_pt_vs_eta, "truth_pt_vs_eta");
65 book(m_truth_phi_vs_eta, "truth_phi_vs_eta");
66
67 book(m_truth_hits, "truth_hits");
68 book(m_truth_hits_vs_eta, "truth_hits_vs_eta");
69
70}
71
72void
74
75 // quantities with xAOD::TruthParticle accessors:
76 float eta = particle.eta();
77 float pt = particle.pt() / Gaudi::Units::GeV;
78 float phi = particle.phi();
79
80 static const SG::ConstAccessor<float> d0Acc("d0");
81 static const SG::ConstAccessor<float> z0Acc("z0");
82 static const SG::ConstAccessor<float> thetaAcc("theta");
83 static const SG::ConstAccessor<float> qOverPAcc("qOverP");
84 static const SG::ConstAccessor<float> prodRAcc("prodR");
85 static const SG::ConstAccessor<float> prodZAcc("prodZ");
86 static const SG::ConstAccessor<float> timeAcc("time");
87 float d0 = d0Acc.isAvailable(particle) ? d0Acc(particle) : -9999.;
88 float z0 = z0Acc.isAvailable(particle) ? z0Acc(particle) : -9999.;
89 float theta = thetaAcc.isAvailable(particle) ? thetaAcc(particle) : -9999.;
90 float z0sin = (z0Acc.isAvailable(particle) && z0Acc(particle)) ? z0 * std::sin(theta) : -9999.;
91 float qOverP = qOverPAcc.isAvailable(particle) ? qOverPAcc(particle) : -9999.;
92 float prodR = prodRAcc.isAvailable(particle) ? prodRAcc(particle) : -9999.;
93 float prodZ = prodZAcc.isAvailable(particle) ? prodZAcc(particle) : -9999.;
94 float time = timeAcc.isAvailable(particle) ? timeAcc(particle) : -9999.;
95
96 if(d0 > -9000.) fillHisto(m_truth_d0, d0, weight);
97 if(z0 > -9000.) fillHisto(m_truth_z0, z0, weight);
98 if(theta > -9000.) fillHisto(m_truth_theta, theta, weight);
99 if(phi > -9000.) fillHisto(m_truth_phi, phi, weight);
100 if(z0sin > -9000.) fillHisto(m_truth_z0sin, z0sin, weight);
101 if(qOverP > -9000.) fillHisto(m_truth_qoverp, qOverP, weight);
102 if(prodR > -9000.) fillHisto(m_truth_prodR, prodR, weight);
103 if(prodZ > -9000.) fillHisto(m_truth_prodZ, prodZ, weight);
104 if(time > -9000.) fillHisto(m_truth_time, time, weight);
105
106 fillHisto(m_truth_eta, eta, weight);
107 fillHisto(m_truth_pt, pt, weight);
108 fillHisto(m_truth_lowpt, pt, weight);
109
110 fillHisto(m_truth_pt_vs_eta, pt, eta, weight);
112
113 static const SG::AuxElement::ConstAccessor< float > nSilHitsAcc("nSilHits");
114 if (nSilHitsAcc.isAvailable(particle)) {
115 float hits = nSilHitsAcc(particle);
116 fillHisto(m_truth_hits, hits, weight);
117 fillHisto(m_truth_hits_vs_eta, eta, hits, weight);
118 }
119}
120
121void
123
124 float pt = particle.pt() / Gaudi::Units::GeV;
125 float eta = particle.eta();
126 float phi = particle.phi0();
127
128 float chi2 = particle.chiSquared();
129 float ndof = particle.numberDoF();
130 float chi2Overndof = ndof > 0 ? chi2 / ndof : 0;
131
132
133 fillHisto(m_reco_d0, particle.d0(), weight);
134 fillHisto(m_reco_z0, particle.z0(), weight);
135 fillHisto(m_reco_z0sin, particle.z0()* std::sin(particle.theta()), weight);
136
137 fillHisto(m_reco_phi, phi, weight);
138 fillHisto(m_reco_theta, particle.theta(), weight);
139 fillHisto(m_reco_eta, eta, weight);
140 fillHisto(m_reco_qoverp, particle.qOverP(), weight);
141 fillHisto(m_reco_pt, pt, weight);
142 fillHisto(m_reco_lowpt, pt, weight);
143
144 fillHisto(m_reco_pt_vs_eta, pt, eta, weight);
146
147 fillHisto(m_reco_d0_z0, particle.d0(), particle.z0(), weight);
148 fillHisto(m_reco_d0_z0sin, particle.d0(), particle.z0()*std::sin(particle.theta()), weight);
149
150 fillHisto(m_reco_chi2, chi2, weight);
151 fillHisto(m_reco_ndof, ndof, weight);
152 fillHisto(m_reco_chi2Overndof, chi2Overndof, weight);
153
154 std::bitset<xAOD::TrackPatternRecoInfo::NumberOfTrackRecoInfo> patternInfo = particle.patternRecoInfo();
155 for(unsigned int i = 0; i < xAOD::TrackPatternRecoInfo::NumberOfTrackRecoInfo; i++){
156 if(patternInfo.test(i)) fillHisto(m_reco_author, i, weight);
157 }
158
159 if(m_hasHGTDReco){
160 static const SG::Accessor< uint8_t > accValidTime("hasValidTime");
161 static const SG::Accessor< float > accTime("time");
162 if( accValidTime.isAvailable(particle) && accTime.isAvailable(particle) ) {
163 if (particle.hasValidTime()) {
164 fillHisto(m_reco_time, particle.time(), weight);
165 }
166 }
167
168 if( accValidTime.isAvailable(particle) ) {
169 fillHisto(m_reco_hasValidTime_eff_vs_eta, eta, particle.hasValidTime(), weight);
170 }
171 }
172
173}
174
175void
177
178 //
179 //Pie
180 //
181
182}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
Scalar theta() const
theta method
Helper class to provide constant type-safe access to aux data.
InDetPerfPlot_TrackParameters(InDetPlotBase *pParent, const std::string &dirName, bool hasHGTDReco)
void fill(const xAOD::TrackParticle &particle, float weight)
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.
Helper class to provide type-safe access to aux data.
SG::ConstAccessor< T, ALLOC > ConstAccessor
Definition AuxElement.h:570
Helper class to provide constant type-safe access to aux data.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
double chi2(TH1 *h0, TH1 *h1)
Class to retrieve associated truth from a track, implementing a cached response.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TruthParticle_v1 TruthParticle
Typedef to implementation.
@ NumberOfTrackRecoInfo
maximum number of enums