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 if (m_iDetailLevel >= 100){
43 book(m_reco_HGTDChi2, "reco_HGTDChi2");
44 book(m_reco_timeResolution, "reco_timeResolution");
45 book(m_reco_meanTime, "reco_meanTime");
46 book(m_reco_meanTimeResolution, "reco_meanTimeResolution");
47 }
48 book(m_reco_hasValidTime_eff_vs_eta, "reco_hasValidTime_eff_vs_eta");
49 }
50
51 book(m_truth_d0, "truth_d0");
52 book(m_truth_z0, "truth_z0");
53 book(m_truth_z0sin, "truth_z0sin");
54 book(m_truth_phi, "truth_phi");
55 book(m_truth_theta, "truth_theta");
56 book(m_truth_eta, "truth_eta");
57 book(m_truth_qoverp, "truth_qoverp");
58 book(m_truth_pt, "truth_pt");
59 book(m_truth_lowpt, "truth_lowpt");
60 book(m_truth_prodR, "truth_prodR");
61 book(m_truth_prodZ, "truth_prodZ");
62 book(m_truth_time, "truth_time");
63
64 book(m_reco_pt_vs_eta, "reco_pt_vs_eta");
65 book(m_reco_phi_vs_eta, "reco_phi_vs_eta");
66
67 book(m_reco_d0_z0, "reco_d0_vs_z0");
68 book(m_reco_d0_z0sin, "reco_d0_vs_z0sin");
69
70 book(m_truth_pt_vs_eta, "truth_pt_vs_eta");
71 book(m_truth_phi_vs_eta, "truth_phi_vs_eta");
72
73 book(m_truth_hits, "truth_hits");
74 book(m_truth_hits_vs_eta, "truth_hits_vs_eta");
75
76}
77
78void
80
81 // quantities with xAOD::TruthParticle accessors:
82 float eta = particle.eta();
83 float pt = particle.pt() / Gaudi::Units::GeV;
84 float phi = particle.phi();
85
86 static const SG::ConstAccessor<float> d0Acc("d0");
87 static const SG::ConstAccessor<float> z0Acc("z0");
88 static const SG::ConstAccessor<float> thetaAcc("theta");
89 static const SG::ConstAccessor<float> qOverPAcc("qOverP");
90 static const SG::ConstAccessor<float> prodRAcc("prodR");
91 static const SG::ConstAccessor<float> prodZAcc("prodZ");
92 static const SG::ConstAccessor<float> timeAcc("time");
93 float d0 = d0Acc.isAvailable(particle) ? d0Acc(particle) : -9999.;
94 float z0 = z0Acc.isAvailable(particle) ? z0Acc(particle) : -9999.;
95 float theta = thetaAcc.isAvailable(particle) ? thetaAcc(particle) : -9999.;
96 float z0sin = (z0Acc.isAvailable(particle) && z0Acc(particle)) ? z0 * std::sin(theta) : -9999.;
97 float qOverP = qOverPAcc.isAvailable(particle) ? qOverPAcc(particle) : -9999.;
98 float prodR = prodRAcc.isAvailable(particle) ? prodRAcc(particle) : -9999.;
99 float prodZ = prodZAcc.isAvailable(particle) ? prodZAcc(particle) : -9999.;
100 float time = timeAcc.isAvailable(particle) ? timeAcc(particle) : -9999.;
101
102 if(d0 > -9000.) fillHisto(m_truth_d0, d0, weight);
103 if(z0 > -9000.) fillHisto(m_truth_z0, z0, weight);
104 if(theta > -9000.) fillHisto(m_truth_theta, theta, weight);
105 if(phi > -9000.) fillHisto(m_truth_phi, phi, weight);
106 if(z0sin > -9000.) fillHisto(m_truth_z0sin, z0sin, weight);
107 if(qOverP > -9000.) fillHisto(m_truth_qoverp, qOverP, weight);
108 if(prodR > -9000.) fillHisto(m_truth_prodR, prodR, weight);
109 if(prodZ > -9000.) fillHisto(m_truth_prodZ, prodZ, weight);
110 if(time > -9000.) fillHisto(m_truth_time, time, weight);
111
112 fillHisto(m_truth_eta, eta, weight);
113 fillHisto(m_truth_pt, pt, weight);
114 fillHisto(m_truth_lowpt, pt, weight);
115
116 fillHisto(m_truth_pt_vs_eta, pt, eta, weight);
118
119 static const SG::AuxElement::ConstAccessor< float > nSilHitsAcc("nSilHits");
120 if (nSilHitsAcc.isAvailable(particle)) {
121 float hits = nSilHitsAcc(particle);
122 fillHisto(m_truth_hits, hits, weight);
123 fillHisto(m_truth_hits_vs_eta, eta, hits, weight);
124 }
125}
126
127void
129
130 float pt = particle.pt() / Gaudi::Units::GeV;
131 float eta = particle.eta();
132 float phi = particle.phi0();
133
134 float chi2 = particle.chiSquared();
135 float ndof = particle.numberDoF();
136 float chi2Overndof = ndof > 0 ? chi2 / ndof : 0;
137
138
139 fillHisto(m_reco_d0, particle.d0(), weight);
140 fillHisto(m_reco_z0, particle.z0(), weight);
141 fillHisto(m_reco_z0sin, particle.z0()* std::sin(particle.theta()), weight);
142
143 fillHisto(m_reco_phi, phi, weight);
144 fillHisto(m_reco_theta, particle.theta(), weight);
145 fillHisto(m_reco_eta, eta, weight);
146 fillHisto(m_reco_qoverp, particle.qOverP(), weight);
147 fillHisto(m_reco_pt, pt, weight);
148 fillHisto(m_reco_lowpt, pt, weight);
149
150 fillHisto(m_reco_pt_vs_eta, pt, eta, weight);
152
153 fillHisto(m_reco_d0_z0, particle.d0(), particle.z0(), weight);
154 fillHisto(m_reco_d0_z0sin, particle.d0(), particle.z0()*std::sin(particle.theta()), weight);
155
156 fillHisto(m_reco_chi2, chi2, weight);
157 fillHisto(m_reco_ndof, ndof, weight);
158 fillHisto(m_reco_chi2Overndof, chi2Overndof, weight);
159
160 std::bitset<xAOD::TrackPatternRecoInfo::NumberOfTrackRecoInfo> patternInfo = particle.patternRecoInfo();
161 for(unsigned int i = 0; i < xAOD::TrackPatternRecoInfo::NumberOfTrackRecoInfo; i++){
162 if(patternInfo.test(i)) fillHisto(m_reco_author, i, weight);
163 }
164
165 if(m_hasHGTDReco){
166 static const SG::Accessor< uint8_t > accValidTime("hasValidTime");
167 static const SG::Accessor< float > accTime("time");
168 if( accValidTime.isAvailable(particle) && accTime.isAvailable(particle) ) {
169 if (particle.hasValidTime()) {
170 fillHisto(m_reco_time, particle.time(), weight);
171 if (m_iDetailLevel >= 100){
172 static const SG::Accessor<float> hgtdMeanTime("HGTDMeanTime");
173 static const SG::Accessor<float> hgtdMeanTimeResolution("HGTDMeanTimeResolution");
174 static const SG::Accessor<float> hgtdTimeResolution("timeResolution");
175 static const SG::ConstAccessor<float> hgtdChi2("HGTDChi2");
176
177 if (hgtdMeanTime.isAvailable(particle)) {
178 float chi2 = hgtdChi2(particle);
179 fillHisto(m_reco_HGTDChi2, chi2>0 ? log10(chi2) : -std::numeric_limits<float>::infinity(), weight);
180 fillHisto(m_reco_meanTime, hgtdMeanTime(particle), weight);
181 fillHisto(m_reco_meanTimeResolution, hgtdMeanTimeResolution(particle), weight);
182 fillHisto(m_reco_timeResolution, hgtdTimeResolution(particle), weight);
183 }
184 }
185 }
186 }
187
188 if( accValidTime.isAvailable(particle) ) {
189 fillHisto(m_reco_hasValidTime_eff_vs_eta, eta, particle.hasValidTime(), weight);
190 }
191 }
192
193}
194
195void
197
198 //
199 //Pie
200 //
201
202}
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)
InDetPlotBase(InDetPlotBase *pParent, const std::string &dirName)
Constructor taking parent node and directory name for plots.
void book(Htype *&pHisto, std::string_view histoIdentifier, std::string_view nameOverride="", std::string_view folder="default")
Helper method to book histograms using an identifier string.
int m_iDetailLevel
Definition PlotBase.h:102
Helper class to provide type-safe access to aux data.
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