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