ATLAS Offline Software
Loading...
Searching...
No Matches
InDetRttPlots.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
9
10#include "InDetRttPlots.h"
17#include <cmath> // std::isnan()
18#include <limits>
19
20InDetRttPlots::InDetRttPlots(InDetPlotBase* pParent, const std::string& sDir, const InDetRttPlotConfig & cfg) : InDetPlotBase(pParent, sDir),
21 m_config(cfg){
22
24 this->m_iDetailLevel = m_config.detailLevel;
25 if (m_config.doTrackParameters){
26 m_trackParameters = std::make_unique<InDetPerfPlot_TrackParameters>(this, "Tracks/Selected/Parameters", m_config.hasHGTDReco);
27 m_unmatchedBiasPlots = std::make_unique<InDetPerfPlot_Resolution>(this, "Tracks/Selected/Bias", true, m_config.hasHGTDReco); // d0 bias plots
28 }
29 if (m_config.doNTracks) m_nTracks = std::make_unique<InDetPerfPlot_nTracks>(this, "Tracks/Tracks");
30 if (m_config.doHitResidualPlot) m_hitResidualPlot= std::make_unique<InDetPerfPlot_HitResidual>(this, "Tracks/Hits/Residuals", m_config.isITk);
31 if (m_config.doHitEffPlot) m_hitEffPlot= std::make_unique<InDetPerfPlot_HitEfficiency>(this, "Tracks/Hits/Efficiency", m_config.isITk);
32 if (m_config.doFakePlots) m_fakePlots= std::make_unique<InDetPerfPlot_FakeRate>(this, "Tracks/FakeRate");
33 if (m_config.doResolutionPlotPrim) m_resolutionPlotPrim= std::make_unique<InDetPerfPlot_Resolution>(this, "Tracks/Matched/Resolutions/Primary", false, m_config.hasHGTDReco);
34 if (m_config.doResolutionPlotPrim_truthFromB) m_resolutionPlotPrim_truthFromB= std::make_unique<InDetPerfPlot_Resolution>(this, "Tracks/Matched/Resolutions/TruthFromB", false, m_config.hasHGTDReco);
35 if (m_config.doHitsRecoTracksPlots) m_hitsRecoTracksPlots= std::make_unique<InDetPerfPlot_Hits>(this, "Tracks/Selected/HitsOnTracks", m_config.isITk);
36 if (m_config.doEffPlots) m_effPlots= std::make_unique<InDetPerfPlot_Efficiency>(this, "Tracks/Efficiency", m_config.doTechEffPlots, m_config.isITk);
37 if (m_config.doDuplicatePlots) m_duplicatePlots = std::make_unique<InDetPerfPlot_Duplicate>(this, "Tracks/Duplicate");
38
39 // Vertex plots
40 if (m_config.doVerticesVsMuPlots)
41 m_verticesVsMuPlots = std::make_unique<InDetPerfPlot_VerticesVsMu>
42 (this, "Vertices/AllPrimaryVertices");
43 if (m_config.doVertexPlots)
44 m_vertexPlots = std::make_unique<InDetPerfPlot_Vertex>
45 (this, "Vertices/AllPrimaryVertices", m_config.isITk,
46 m_config.doVertexTrackPlots);
47 if (m_config.doHardScatterVertexPlots)
48 m_hardScatterVertexPlots = std::make_unique<InDetPerfPlot_Vertex>
49 (this, "Vertices/HardScatteringVertex", m_config.isITk,
50 m_config.doVertexTrackPlots);
51 if (m_config.doHardScatterVertexTruthMatchingPlots)
53 std::make_unique<InDetPerfPlot_VertexTruthMatching>
54 (this, "Vertices/HardScatteringVertex", m_iDetailLevel, m_config.isITk);
55
56 if (m_config.doTrtExtensionPlots) m_trtExtensionPlots= std::make_unique<InDetPerfPlot_TRTExtension>(this, "Tracks/TRTExtension");
57 if (m_config.doNtupleTruthToReco) m_ntupleTruthToReco= std::make_unique<InDetPerfNtuple_TruthToReco>(this, "Ntuples", "TruthToReco");
58 if (m_config.doResolutionPlotSecd) m_resolutionPlotSecd = std::make_unique<InDetPerfPlot_Resolution>(this, "Tracks/Matched/Resolutions/Secondary", false, m_config.hasHGTDReco);
59 if (m_config.doHitsMatchedTracksPlots) m_hitsMatchedTracksPlots = std::make_unique<InDetPerfPlot_Hits>(this, "Tracks/Matched/HitsOnTracks", m_config.isITk);
60 if (m_config.doHitsFakeTracksPlots) m_hitsFakeTracksPlots = std::make_unique<InDetPerfPlot_Hits>(this, "Tracks/Fakes/HitsOnTracks", m_config.isITk);
61 if (m_config.doVertexTruthMatchingPlots) m_vertexTruthMatchingPlots = std::make_unique<InDetPerfPlot_VertexTruthMatching>(this, "Vertices/AllPrimaryVertices", m_iDetailLevel, m_config.isITk);
62
63 if (m_config.doEfficienciesPerAuthor){
64 m_effSiSPSeededFinderPlots = std::make_unique<InDetPerfPlot_Efficiency>(this, "TracksByAuthor/SiSPSeededFinder/Tracks/Efficiency", false, m_config.isITk);
65 m_effInDetExtensionProcessorPlots = std::make_unique<InDetPerfPlot_Efficiency>(this, "TracksByAuthor/InDetExtensionProcessor/Tracks/Efficiency", false, m_config.isITk);
66 m_effTRTSeededTrackFinderPlots = std::make_unique<InDetPerfPlot_Efficiency>(this, "TracksByAuthor/TRTSeededTrackFinder/Tracks/Efficiency", false, m_config.isITk);
67 m_effTRTStandalonePlots = std::make_unique<InDetPerfPlot_Efficiency>(this, "TracksByAuthor/TRTStandalone/Tracks/Efficiency", false, m_config.isITk);
68 m_effSiSpacePointsSeedMaker_LargeD0Plots = std::make_unique<InDetPerfPlot_Efficiency>(this, "TracksByAuthor/SiSpacePointsSeedMaker_LargeD0/Tracks/Efficiency", false, m_config.isITk);
69 }
70
71 if (m_config.doFakesPerAuthor){
72 m_fakeSiSPSeededFinderPlots = std::make_unique<InDetPerfPlot_FakeRate>(this, "TracksByAuthor/SiSPSeededFinder/Tracks/FakeRate");
73 m_fakeInDetExtensionProcessorPlots = std::make_unique<InDetPerfPlot_FakeRate>(this, "TracksByAuthor/InDetExtensionProcessor/Tracks/FakeRate");
74 m_fakeTRTSeededTrackFinderPlots = std::make_unique<InDetPerfPlot_FakeRate>(this, "TracksByAuthor/TRTSeededTrackFinder/Tracks/FakeRate");
75 m_fakeTRTStandalonePlots = std::make_unique<InDetPerfPlot_FakeRate>(this, "TracksByAuthor/TRTStandalone/Tracks/FakeRate");
76 m_fakeSiSpacePointsSeedMaker_LargeD0Plots = std::make_unique<InDetPerfPlot_FakeRate>(this, "TracksByAuthor/SiSpacePointsSeedMaker_LargeD0/Tracks/FakeRate");
77 }
78
79 if (m_config.doTrackParametersPerAuthor){
80 m_trkParaSiSPSeededFinderPlots = std::make_unique<InDetPerfPlot_TrackParameters>(this, "TracksByAuthor/SiSPSeededFinder/Tracks/Parameters", m_config.hasHGTDReco);
81 m_trkParaInDetExtensionProcessorPlots = std::make_unique<InDetPerfPlot_TrackParameters>(this, "TracksByAuthor/InDetExtensionProcessor/Tracks/Parameters", m_config.hasHGTDReco);
82 m_trkParaTRTSeededTrackFinderPlots = std::make_unique<InDetPerfPlot_TrackParameters>(this, "TracksByAuthor/TRTSeededTrackFinder/Tracks/Parameters", m_config.hasHGTDReco);
83 m_trkParaTRTStandalonePlots = std::make_unique<InDetPerfPlot_TrackParameters>(this, "TracksByAuthor/TRTStandalone/Tracks/Parameters", m_config.hasHGTDReco);
84 m_trkParaSiSpacePointsSeedMaker_LargeD0Plots= std::make_unique<InDetPerfPlot_TrackParameters>(this, "TracksByAuthor/SiSpacePointsSeedMaker_LargeD0/Tracks/Parameters", m_config.hasHGTDReco);
85 }
86
87 if (m_config.doResolutionsPerAuthor){
88 m_resSiSPSeededFinderPlots = std::make_unique<InDetPerfPlot_Resolution>(this, "TracksByAuthor/SiSPSeededFinder/Tracks/Resolution", false, m_config.hasHGTDReco);
89 m_resInDetExtensionProcessorPlots = std::make_unique<InDetPerfPlot_Resolution>(this, "TracksByAuthor/InDetExtensionProcessor/Tracks/Resolution", false, m_config.hasHGTDReco);
90 m_resTRTSeededTrackFinderPlots = std::make_unique<InDetPerfPlot_Resolution>(this, "TracksByAuthor/TRTSeededTrackFinder/Tracks/Resolution", false, m_config.hasHGTDReco);
91 m_resTRTStandalonePlots = std::make_unique<InDetPerfPlot_Resolution>(this, "TracksByAuthor/TRTStandalone/Tracks/Resolution", false, m_config.hasHGTDReco);
92 m_resSiSpacePointsSeedMaker_LargeD0Plots = std::make_unique<InDetPerfPlot_Resolution>(this, "TracksByAuthor/SiSpacePointsSeedMaker_LargeD0/Tracks/Resolution", false, m_config.hasHGTDReco);
93 }
94
95 if (m_config.doHitsRecoTracksPlotsPerAuthor){
96 m_hitsSiSPSeededFinderPlots = std::make_unique<InDetPerfPlot_Hits>(this, "TracksByAuthor/SiSPSeededFinder/Tracks/HitsOnTracks", m_config.isITk);
97 m_hitsInDetExtensionProcessorPlots = std::make_unique<InDetPerfPlot_Hits>(this, "TracksByAuthor/InDetExtensionProcessor/Tracks/HitsOnTracks", m_config.isITk);
98 m_hitsTRTSeededTrackFinderPlots = std::make_unique<InDetPerfPlot_Hits>(this, "TracksByAuthor/TRTSeededTrackFinder/Tracks/HitsOnTracks", m_config.isITk);
99 m_hitsTRTStandalonePlots = std::make_unique<InDetPerfPlot_Hits>(this, "TracksByAuthor/TRTStandalone/Tracks/HitsOnTracks", m_config.isITk);
100 m_hitsSiSpacePointsSeedMaker_LargeD0Plots = std::make_unique<InDetPerfPlot_Hits>(this, "TracksByAuthor/SiSpacePointsSeedMaker_LargeD0/Tracks/HitsOnTracks", m_config.isITk);
101 }
102
103 if (m_config.doTrkInJetPlots) m_trkInJetPlots = std::make_unique<InDetPerfPlot_TrkInJet>(this, "TracksInJets/Tracks");
104 if (m_config.doTrkInJetPlots_matched) m_trkInJetPlots_matched = std::make_unique<InDetPerfPlot_TrkInJet>(this, "TracksInJets/Matched",false);
105 if (m_config.doTrkInJetPlots_fake) m_trkInJetPlots_fake = std::make_unique<InDetPerfPlot_TrkInJet>(this, "TracksInJets/Fakes",false);
106 if (m_config.doTrkInJetPlots_bjets) m_trkInJetPlots_bjets = std::make_unique<InDetPerfPlot_TrkInJet>(this, "TracksInBJets/Tracks");
107 if (m_config.doTrkInJetPlots_matched_bjets) m_trkInJetPlots_matched_bjets = std::make_unique<InDetPerfPlot_TrkInJet>(this, "TracksInBJets/Matched",false);
108 if (m_config.doTrkInJetPlots_fake_bjets) m_trkInJetPlots_fake_bjets = std::make_unique<InDetPerfPlot_TrkInJet>(this, "TracksInBJets/Fakes",false);
109 if (m_config.doTrkInJetPlots_truthFromB) m_trkInJetPlots_truthFromB = std::make_unique<InDetPerfPlot_TrkInJet>(this, "TracksInBJets/TruthFromB");
110
113}
114//
115//Fill plots for matched particles
116//
117
118void
119InDetRttPlots::fill(const xAOD::TrackParticle& particle, const xAOD::TruthParticle& truthParticle, bool isFromB, float mu, float weight) {
120 // fill measurement bias, resolution, and pull plots
121
122 // fill ITK resolutions (bias / resolutions)
123 static const SG::ConstAccessor<float> tpTruthProbKeyAcc("truthMatchProbability");
124 if (tpTruthProbKeyAcc.isAvailable(particle)) {
125 const float prob = tpTruthProbKeyAcc(particle);
126 int uniqueID = HepMC::uniqueID(truthParticle);
127 if (!HepMC::is_simulation_particle(&truthParticle) && uniqueID != HepMC::UNDEFINED_ID && prob > 0.5) {
128 if (m_resolutionPlotPrim) m_resolutionPlotPrim->fill(particle, truthParticle, weight);
129 } else if (HepMC::is_simulation_particle(&truthParticle) && prob > 0.7 && m_iDetailLevel >= 200) {
130 if (m_resolutionPlotSecd) m_resolutionPlotSecd->fill(particle, truthParticle, weight);
131 }
132 if ( isFromB ) {
133 if (m_resolutionPlotPrim_truthFromB) m_resolutionPlotPrim_truthFromB->fill(particle, truthParticle, weight);
134 }
135
136 if(m_config.doResolutionsPerAuthor && m_iDetailLevel >= 200 and ( !HepMC::is_simulation_particle(&truthParticle) and uniqueID != HepMC::UNDEFINED_ID and prob > 0.5)){
137 std::bitset<xAOD::TrackPatternRecoInfo::NumberOfTrackRecoInfo> patternInfo = particle.patternRecoInfo();
138
139 bool isSiSpSeededFinder = patternInfo.test(xAOD::TrackPatternRecoInfo::SiSPSeededFinder);
140 bool isInDetExtensionProcessor = patternInfo.test(xAOD::TrackPatternRecoInfo::InDetExtensionProcessor);
141 bool isTRTSeededTrackFinder = patternInfo.test(xAOD::TrackPatternRecoInfo::TRTSeededTrackFinder);
142 bool isTRTStandalone = patternInfo.test(xAOD::TrackPatternRecoInfo::TRTStandalone);
143 bool isSiSpacePointsSeedMaker_LargeD0 = patternInfo.test(xAOD::TrackPatternRecoInfo::SiSpacePointsSeedMaker_LargeD0);
144
145 if(isSiSpSeededFinder and not isInDetExtensionProcessor) m_resSiSPSeededFinderPlots->fill(particle, truthParticle, weight);
146 if(isInDetExtensionProcessor and not (isTRTSeededTrackFinder or isSiSpacePointsSeedMaker_LargeD0)) m_resInDetExtensionProcessorPlots->fill(particle, truthParticle, weight);
147 if(isTRTSeededTrackFinder and not isTRTStandalone) m_resTRTSeededTrackFinderPlots->fill(particle, truthParticle, weight);
148 if(isTRTStandalone) m_resTRTStandalonePlots->fill(particle, truthParticle, weight);
149 if(isSiSpacePointsSeedMaker_LargeD0) m_resSiSpacePointsSeedMaker_LargeD0Plots->fill(particle, truthParticle, weight);
150
151 }
152
153 if (m_trtExtensionPlots && !HepMC::is_simulation_particle(&truthParticle) && uniqueID != HepMC::UNDEFINED_ID && prob > 0.5 ) m_trtExtensionPlots->fill(particle, truthParticle, weight);
154 }
155
157 int uniqueID = HepMC::uniqueID(truthParticle);
158 if (!HepMC::is_simulation_particle(&truthParticle) && uniqueID != HepMC::UNDEFINED_ID) {
159 m_hitsMatchedTracksPlots->fill(particle, mu, weight);
160 }
161 }
162}
163
164//
165//Fill basic track properties for reconstructed tracks
166//
167
168void
169InDetRttPlots::fill(const xAOD::TrackParticle& particle, float weight) {
170 if (m_hitResidualPlot) m_hitResidualPlot->fill(particle, weight);
171 if (m_hitEffPlot) m_hitEffPlot->fill(particle, weight);
172 // fill pt plots
173 if (m_trackParameters) m_trackParameters->fill(particle, weight);
174 if (m_unmatchedBiasPlots) m_unmatchedBiasPlots->fill(particle, weight);
175
176 if(m_config.doTrackParametersPerAuthor){
177 std::bitset<xAOD::TrackPatternRecoInfo::NumberOfTrackRecoInfo> patternInfo = particle.patternRecoInfo();
178
179 bool isSiSpSeededFinder = patternInfo.test(0);
180 bool isInDetExtensionProcessor = patternInfo.test(3);
181 bool isTRTSeededTrackFinder = patternInfo.test(4);
182 bool isTRTStandalone = patternInfo.test(20);
183 bool isSiSpacePointsSeedMaker_LargeD0 = patternInfo.test(49);
184
185 if(isSiSpSeededFinder and not isInDetExtensionProcessor) m_trkParaSiSPSeededFinderPlots->fill(particle, weight);
186 else if(isInDetExtensionProcessor and not (isTRTSeededTrackFinder or isSiSpacePointsSeedMaker_LargeD0)) m_trkParaInDetExtensionProcessorPlots->fill(particle, weight);
187 else if(isTRTSeededTrackFinder and not isTRTStandalone) m_trkParaTRTSeededTrackFinderPlots->fill(particle, weight);
188 else if(isTRTStandalone) m_trkParaTRTStandalonePlots->fill(particle, weight);
189 else if(isSiSpacePointsSeedMaker_LargeD0) m_trkParaSiSpacePointsSeedMaker_LargeD0Plots->fill(particle, weight);
190
191 }
192
193 if (m_trtExtensionPlots) m_trtExtensionPlots->fill(particle, weight);
194}
195
196void
197InDetRttPlots::fill(const xAOD::TrackParticle& particle, const float mu, const unsigned int nVtx, float weight) {
198
199 if (m_trtExtensionPlots) m_trtExtensionPlots->fill(particle, mu, nVtx, weight);
200 if (m_hitsRecoTracksPlots) m_hitsRecoTracksPlots->fill(particle, mu, weight);
201
202 if(m_config.doHitsRecoTracksPlotsPerAuthor){
203 std::bitset<xAOD::TrackPatternRecoInfo::NumberOfTrackRecoInfo> patternInfo = particle.patternRecoInfo();
204
205 bool isSiSpSeededFinder = patternInfo.test(0);
206 bool isInDetExtensionProcessor = patternInfo.test(3);
207 bool isTRTSeededTrackFinder = patternInfo.test(4);
208 bool isTRTStandalone = patternInfo.test(20);
209 bool isSiSpacePointsSeedMaker_LargeD0 = patternInfo.test(49);
210
211 if(isSiSpSeededFinder and not isInDetExtensionProcessor) m_hitsSiSPSeededFinderPlots->fill(particle, mu, weight);
212 else if(isInDetExtensionProcessor and not (isTRTSeededTrackFinder or isSiSpacePointsSeedMaker_LargeD0)) m_hitsInDetExtensionProcessorPlots->fill(particle, mu, weight);
213 else if(isTRTSeededTrackFinder and not isTRTStandalone) m_hitsTRTSeededTrackFinderPlots->fill(particle, mu, weight);
214 else if(isTRTStandalone) m_hitsTRTStandalonePlots->fill(particle, mu, weight);
215 else if(isSiSpacePointsSeedMaker_LargeD0) m_hitsSiSpacePointsSeedMaker_LargeD0Plots->fill(particle, mu, weight);
216
217 }
218
219}
220
221void
222InDetRttPlots::fill(const unsigned int ntracksFull, const unsigned int ntracksCentral,
223 const unsigned int ntracksPt1GeV, const unsigned int truthMu,
224 const float actualMu, const unsigned int nvertices,
225 const float weight) {
226
227 if (m_nTracks) m_nTracks->fill(ntracksFull, ntracksCentral, ntracksPt1GeV, truthMu, actualMu, nvertices, weight);
228
229}
230//
231//Fill plots for selected truth particle
232//
233
234void
235InDetRttPlots::fill(const xAOD::TruthParticle& truthParticle, float weight) {
236 // fill truth plots
237 if (m_trackParameters) m_trackParameters->fill(truthParticle, weight);
238}
239
240//
241//Fill Efficiencies
242//
243
244void
246(const xAOD::TruthParticle& truth, const xAOD::TrackParticle* track,
247 const bool isGood, const unsigned int truthMu, const float actualMu, float weight) {
248 if (m_effPlots) m_effPlots->fill(truth, isGood, truthMu, actualMu, weight);
249
250 if(m_config.doEfficienciesPerAuthor){
251
252 bool isGoodSiSPSeededFinder = false;
253 bool isGoodInDetExtensionProcessor = false;
254 bool isGoodTRTSeededTrackFinder = false;
255 bool isGoodTRTStandalone = false;
256 bool isGoodSiSpacePointsSeedMaker_LargeD0 = false;
257
258 if(isGood && track){
259 std::bitset<xAOD::TrackPatternRecoInfo::NumberOfTrackRecoInfo> patternInfo = track->patternRecoInfo();
260
261 bool isSiSpSeededFinder = patternInfo.test(0);
262 bool isInDetExtensionProcessor = patternInfo.test(3);
263 bool isTRTSeededTrackFinder = patternInfo.test(4);
264 bool isTRTStandalone = patternInfo.test(20);
265 bool isSiSpacePointsSeedMaker_LargeD0 = patternInfo.test(49);
266
267 isGoodSiSPSeededFinder = isSiSpSeededFinder and not isInDetExtensionProcessor;
268 isGoodInDetExtensionProcessor = isInDetExtensionProcessor and
269 not (isTRTSeededTrackFinder or isSiSpacePointsSeedMaker_LargeD0);
270 isGoodTRTSeededTrackFinder = isTRTSeededTrackFinder and not isTRTStandalone;
271 isGoodTRTStandalone = isTRTStandalone;
272 isGoodSiSpacePointsSeedMaker_LargeD0 = isSiSpacePointsSeedMaker_LargeD0;
273
274 }
275
276 m_effSiSPSeededFinderPlots->fill(truth, isGoodSiSPSeededFinder,
277 truthMu, actualMu, weight);
278 m_effInDetExtensionProcessorPlots->fill(truth, isGoodInDetExtensionProcessor,
279 truthMu, actualMu, weight);
280 m_effTRTSeededTrackFinderPlots->fill(truth, isGoodTRTSeededTrackFinder,
281 truthMu, actualMu, weight);
282 m_effTRTStandalonePlots->fill(truth, isGoodTRTStandalone, truthMu, actualMu, weight);
283 m_effSiSpacePointsSeedMaker_LargeD0Plots->fill(truth, isGoodSiSpacePointsSeedMaker_LargeD0,
284 truthMu, actualMu, weight);
285 }
286
287}
288
290(const xAOD::TruthParticle& truth, const bool isGood,
291 const unsigned int truthMu, const float actualMu, float weight) {
292 if(m_effPlots) m_effPlots->fillTechnicalEfficiency(truth, isGood, truthMu, actualMu, weight);
293}
294
295//
296//Fill Fake Rates
297//
299(const xAOD::TruthParticle& truth,
300 const std::vector<const xAOD::TrackParticle*>& tracks, float weight) {
301 m_duplicatePlots->fill(truth, tracks.size(), weight);
302}
303
304
305//
306//Fill Fake Rates
307//
308
309void
310InDetRttPlots::fillFakeRate(const xAOD::TrackParticle& track, const bool isFake, const float mu, float weight){
311
312 if (m_hitsFakeTracksPlots and isFake) m_hitsFakeTracksPlots->fill(track, mu, weight);
313 if(m_config.doFakesPerAuthor){
314 std::bitset<xAOD::TrackPatternRecoInfo::NumberOfTrackRecoInfo> patternInfo = track.patternRecoInfo();
315
316 bool isSiSpSeededFinder = patternInfo.test(0);
317 bool isInDetExtensionProcessor = patternInfo.test(3);
318 bool isTRTSeededTrackFinder = patternInfo.test(4);
319 bool isTRTStandalone = patternInfo.test(20);
320 bool isSiSpacePointsSeedMaker_LargeD0 = patternInfo.test(49);
321
322 if(isSiSpSeededFinder and not isInDetExtensionProcessor) m_fakeSiSPSeededFinderPlots->fill(track, isFake, weight, mu); //No extensions
323 if(isInDetExtensionProcessor and not (isTRTSeededTrackFinder or isSiSpacePointsSeedMaker_LargeD0)) m_fakeInDetExtensionProcessorPlots->fill(track, isFake, weight, mu); //Extensions but not Back-tracking
324 if(isTRTSeededTrackFinder and not isTRTStandalone) m_fakeTRTSeededTrackFinderPlots->fill(track, isFake, weight, mu); //BackTracking
325 if(isTRTStandalone) m_fakeTRTStandalonePlots->fill(track, isFake, weight, mu); //TRT standalone
326 if(isSiSpacePointsSeedMaker_LargeD0) m_fakeSiSpacePointsSeedMaker_LargeD0Plots->fill(track, isFake, weight, mu);
327 }
328
329 if(m_fakePlots) m_fakePlots->fill(track, isFake, weight, mu);
330}
331
332
333
334//
335//Fill Vertexing Plots
336//
337void
338InDetRttPlots::fill(const xAOD::VertexContainer& vertexContainer, const xAOD::Vertex* recoHardScatter, const std::vector<const xAOD::TruthVertex*>& truthHSVertices, const std::vector<const xAOD::TruthVertex*>& truthPUVertices, const float actualMu, float weight) {
339 // fill vertex-specific properties, for all vertices and for hard-scattering vertex
340
341 for (const auto& vtx : vertexContainer.stdcont()) {
342 if (vtx->vertexType() == xAOD::VxType::NoVtx) {
343 ATH_MSG_DEBUG("IN InDetRttPlots::fill, found xAOD::VxType::NoVtx");
344 continue; // skip dummy vertex
345 }
346 if (m_vertexPlots) m_vertexPlots->fill(*vtx, weight);
347 ATH_MSG_DEBUG("IN InDetRttPlots::fill, filling for all vertices");
348 }
349
350 if (recoHardScatter) {
351 if (m_hardScatterVertexPlots) m_hardScatterVertexPlots->fill(*recoHardScatter, weight);
353 if(!truthHSVertices.empty() ) m_hardScatterVertexTruthMatchingPlots->fill(*recoHardScatter,truthHSVertices[0],weight);
354 else m_hardScatterVertexTruthMatchingPlots->fill(*recoHardScatter,nullptr,weight);
355 }
356 ATH_MSG_DEBUG("IN InDetRttPlots::fill, filling for all HS vertex");
357 }
358
359 if(m_vertexTruthMatchingPlots) m_vertexTruthMatchingPlots->fill(recoHardScatter, vertexContainer, truthHSVertices, truthPUVertices,actualMu, weight);
360}
361
362
363void
364InDetRttPlots::fill(const xAOD::VertexContainer& vertexContainer, const unsigned int truthMu, const float actualMu, float weight) {
365 if (m_verticesVsMuPlots) m_verticesVsMuPlots->fill(vertexContainer, truthMu, actualMu, weight);
366}
367
368//
369//Fill Counters
370//
371void
372InDetRttPlots::fillCounter(const unsigned int freq, const InDetPerfPlot_nTracks::CounterCategory counter, float weight) {
373 if (m_nTracks) m_nTracks->fill(freq, counter, weight);
374}
375
376//Track in Jet Plots
377void
378InDetRttPlots::fill(const xAOD::TrackParticle& track, const xAOD::Jet& jet, bool isBjet, bool isFake, bool truthIsFromB, float weight){
379 if (m_trkInJetPlots) m_trkInJetPlots->fill(track, jet,weight);
380 if (isFake){
381 if (m_trkInJetPlots_fake) m_trkInJetPlots_fake->fill(track,jet,weight);
382 if (isBjet && m_trkInJetPlots_fake_bjets) m_trkInJetPlots_fake_bjets->fill(track,jet,weight);
383 }
384 else {
385 if (m_trkInJetPlots_matched) m_trkInJetPlots_matched->fill(track,jet,weight);
386 if (isBjet && m_trkInJetPlots_matched_bjets) m_trkInJetPlots_matched_bjets->fill(track,jet,weight);
387 }
388 if(isBjet){
389 if (m_trkInJetPlots_bjets) m_trkInJetPlots_bjets->fill(track, jet,weight);
390 if ( truthIsFromB && m_trkInJetPlots_truthFromB) m_trkInJetPlots_truthFromB->fill(track, jet,weight);
391 }
392}
393
394void
395InDetRttPlots::fillEfficiency(const xAOD::TruthParticle& truth, const xAOD::Jet& jet, bool isEfficient, bool isBjet, bool truthIsFromB, float weight) {
396 if (m_trkInJetPlots) m_trkInJetPlots->fillEfficiency(truth, jet, isEfficient, weight);
397 if(isBjet && m_trkInJetPlots_bjets) m_trkInJetPlots_bjets->fillEfficiency(truth, jet, isEfficient, weight);
398
399 if ( isBjet and m_trkInJetPlots_truthFromB and truthIsFromB ) { // truth is from B
400 m_trkInJetPlots_truthFromB->fillEfficiency(truth, jet, isEfficient, weight);
401 }
402}
403
404void
405InDetRttPlots::fillFakeRate(const xAOD::TrackParticle& track, const xAOD::Jet& jet, bool isFake, bool isBjet, bool truthIsFromB, float weight) {
406 if (m_trkInJetPlots) m_trkInJetPlots->fillFakeRate(track, jet, isFake, weight);
407 if(isBjet && m_trkInJetPlots_bjets) m_trkInJetPlots_bjets->fillFakeRate(track, jet, isFake, weight);
408
409 if ( isBjet and m_trkInJetPlots_truthFromB and truthIsFromB ) { // truth is from B
410 m_trkInJetPlots_truthFromB->fillFakeRate(track, jet, isFake, weight);
411 }
412}
413
414//IDPVM Ntuple
415void
417 // Fill track only entries with dummy truth values
419 m_ntupleTruthToReco->fillTrack(track, vtx);
420 m_ntupleTruthToReco->fillTree();
421 }
422}
423
424void
426 // Fill truth only entries with dummy track values
428 m_ntupleTruthToReco->fillTruth(truth);
429 m_ntupleTruthToReco->fillTree();
430 }
431}
432
433void
434InDetRttPlots::fillNtuple(const xAOD::TrackParticle& track, const xAOD::TruthParticle& truth, const xAOD::Vertex* vtx, const int truthMatchRanking) {
435 // Fill track and truth entries
437 m_ntupleTruthToReco->fillTrack(track, vtx, truthMatchRanking);
438 m_ntupleTruthToReco->fillTruth(truth);
439 m_ntupleTruthToReco->fillTree();
440 }
441}
#define ATH_MSG_DEBUG(x,...)
Helper class to provide constant type-safe access to aux data.
if(pathvar)
const PtrVector & stdcont() const
Return the underlying std::vector of the container.
InDetPlotBase(InDetPlotBase *pParent, const std::string &dirName)
Constructor taking parent node and directory name for plots.
std::unique_ptr< InDetPerfPlot_Hits > m_hitsFakeTracksPlots
InDetRttPlots(InDetPlotBase *pParent, const std::string &dirName, const InDetRttPlotConfig &config)
std::unique_ptr< InDetPerfPlot_Hits > m_hitsTRTStandalonePlots
std::unique_ptr< InDetPerfPlot_Efficiency > m_effSiSPSeededFinderPlots
std::unique_ptr< InDetPerfPlot_TrkInJet > m_trkInJetPlots_matched_bjets
std::unique_ptr< InDetPerfPlot_Efficiency > m_effTRTStandalonePlots
std::unique_ptr< InDetPerfPlot_FakeRate > m_fakeSiSPSeededFinderPlots
std::unique_ptr< InDetPerfPlot_TrackParameters > m_trackParameters
plot members.
std::unique_ptr< InDetPerfPlot_Resolution > m_resolutionPlotSecd
std::unique_ptr< InDetPerfPlot_Resolution > m_resolutionPlotPrim_truthFromB
std::unique_ptr< InDetPerfPlot_Resolution > m_resTRTSeededTrackFinderPlots
void fillEfficiency(const xAOD::TruthParticle &truth, const xAOD::TrackParticle *track, const bool isGood, const unsigned int truthMu, const float actualMu, float weight)
Fill for efficiency plots.
std::unique_ptr< InDetPerfPlot_FakeRate > m_fakeTRTSeededTrackFinderPlots
void fillDuplicate(const xAOD::TruthParticle &truth, const std::vector< const xAOD::TrackParticle * > &tracks, float weight)
fill for duplicate plots
std::unique_ptr< InDetPerfPlot_Hits > m_hitsSiSPSeededFinderPlots
std::unique_ptr< InDetPerfPlot_TrkInJet > m_trkInJetPlots_fake
std::unique_ptr< InDetPerfPlot_Efficiency > m_effInDetExtensionProcessorPlots
std::unique_ptr< InDetPerfPlot_TrackParameters > m_trkParaSiSpacePointsSeedMaker_LargeD0Plots
std::unique_ptr< InDetPerfPlot_Resolution > m_resolutionPlotPrim
void fillNtuple(const xAOD::TrackParticle &track, const xAOD::Vertex *vtx)
std::unique_ptr< InDetPerfPlot_Efficiency > m_effPlots
std::unique_ptr< InDetPerfPlot_Hits > m_hitsRecoTracksPlots
std::unique_ptr< InDetPerfPlot_nTracks > m_nTracks
std::unique_ptr< InDetPerfPlot_TrkInJet > m_trkInJetPlots
std::unique_ptr< InDetPerfPlot_Resolution > m_resInDetExtensionProcessorPlots
void fill(const xAOD::TrackParticle &particle, const xAOD::TruthParticle &truthParticle, bool truthIsFromB=false, float mu=0.0, float weight=1.0)
fill for things needing truth and track only
std::unique_ptr< InDetPerfPlot_Resolution > m_unmatchedBiasPlots
std::unique_ptr< InDetPerfPlot_FakeRate > m_fakeSiSpacePointsSeedMaker_LargeD0Plots
std::unique_ptr< InDetPerfPlot_Resolution > m_resTRTStandalonePlots
std::unique_ptr< InDetPerfPlot_TrackParameters > m_trkParaTRTSeededTrackFinderPlots
std::unique_ptr< InDetPerfPlot_VerticesVsMu > m_verticesVsMuPlots
std::unique_ptr< InDetPerfPlot_VertexTruthMatching > m_hardScatterVertexTruthMatchingPlots
std::unique_ptr< InDetPerfPlot_Hits > m_hitsMatchedTracksPlots
std::unique_ptr< InDetPerfPlot_Efficiency > m_effTRTSeededTrackFinderPlots
std::unique_ptr< InDetPerfPlot_Resolution > m_resSiSPSeededFinderPlots
std::unique_ptr< InDetPerfPlot_FakeRate > m_fakePlots
std::unique_ptr< InDetPerfPlot_FakeRate > m_fakeInDetExtensionProcessorPlots
std::unique_ptr< InDetPerfPlot_Efficiency > m_effSiSpacePointsSeedMaker_LargeD0Plots
std::unique_ptr< InDetPerfPlot_TrackParameters > m_trkParaSiSPSeededFinderPlots
std::unique_ptr< InDetPerfPlot_Hits > m_hitsTRTSeededTrackFinderPlots
std::unique_ptr< InDetPerfPlot_TrkInJet > m_trkInJetPlots_bjets
std::unique_ptr< InDetPerfPlot_VertexTruthMatching > m_vertexTruthMatchingPlots
std::unique_ptr< InDetPerfPlot_TrkInJet > m_trkInJetPlots_fake_bjets
std::unique_ptr< InDetPerfPlot_Duplicate > m_duplicatePlots
void fillCounter(const unsigned int freq, const InDetPerfPlot_nTracks::CounterCategory counter, float weight)
fill for Counters
std::unique_ptr< InDetPerfPlot_TRTExtension > m_trtExtensionPlots
std::unique_ptr< InDetPerfPlot_TrackParameters > m_trkParaTRTStandalonePlots
std::unique_ptr< InDetPerfPlot_FakeRate > m_fakeTRTStandalonePlots
void fillFakeRate(const xAOD::TrackParticle &track, const xAOD::Jet &jet, const bool isFake, bool isBjet=false, bool truthIsFromB=false, float weight=1.0)
void fillTechnicalEfficiency(const xAOD::TruthParticle &truth, const bool isGood, const unsigned int truthMu, const float actualMu, float weight)
std::unique_ptr< InDetPerfPlot_Hits > m_hitsInDetExtensionProcessorPlots
std::unique_ptr< InDetPerfPlot_Hits > m_hitsSiSpacePointsSeedMaker_LargeD0Plots
std::unique_ptr< InDetPerfPlot_Vertex > m_hardScatterVertexPlots
std::unique_ptr< InDetPerfNtuple_TruthToReco > m_ntupleTruthToReco
std::unique_ptr< InDetPerfPlot_HitEfficiency > m_hitEffPlot
std::unique_ptr< InDetPerfPlot_Vertex > m_vertexPlots
std::unique_ptr< InDetPerfPlot_TrkInJet > m_trkInJetPlots_matched
InDetRttPlotConfig m_config
configuration object
std::unique_ptr< InDetPerfPlot_TrkInJet > m_trkInJetPlots_truthFromB
std::unique_ptr< InDetPerfPlot_Resolution > m_resSiSpacePointsSeedMaker_LargeD0Plots
std::unique_ptr< InDetPerfPlot_HitResidual > m_hitResidualPlot
std::unique_ptr< InDetPerfPlot_TrackParameters > m_trkParaInDetExtensionProcessorPlots
void setDetailLevel(int iDetailLevel)
Definition PlotBase.cxx:55
int m_iDetailLevel
Definition PlotBase.h:102
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.
int uniqueID(const T &p)
constexpr int UNDEFINED_ID
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (TODO update to be s...
@ NoVtx
Dummy vertex. TrackParticle was not used in vertex fit.
Jet_v1 Jet
Definition of the current "jet version".
TrackParticle_v1 TrackParticle
Reference the current persistent version:
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
TruthParticle_v1 TruthParticle
Typedef to implementation.
@ SiSPSeededFinder
Tracks from SiSPSeedFinder.
@ TRTStandalone
TRT Standalone.
@ InDetExtensionProcessor
Tracks with InDetExtensionProcessor used.
@ SiSpacePointsSeedMaker_LargeD0
@ TRTSeededTrackFinder
Tracks from TRT Seeded Track finder.
helper struct - steer the configuration from the parent tool's side