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