ATLAS Offline Software
Loading...
Searching...
No Matches
HitsOnTracksPlots.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
9
11#include "HitsOnTracksPlots.h"
13
14
19 PlotMgr* pParent,
20 const std::string& dirName,
21 const std::string& anaTag,
22 const std::string& testType,
23 const std::string& refType,
24 bool isITk, bool doGlobalPlots, bool doTruthMuPlots, bool do1D, bool doExpert ) :
25 PlotMgr( dirName, anaTag, pParent ),
26 m_testType( testType ), m_refType( refType ),
27 m_isITk( isITk ), m_doGlobalPlots( doGlobalPlots ),
28 m_doTruthMuPlots( doTruthMuPlots ), m_do1D( do1D ), m_doExpert( doExpert )
29{
33}
34
35
40 PlotMgr* pParent,
41 const std::string& dirName,
42 const std::string& anaTag,
43 const std::string& trackType,
44 bool isITk, bool doGlobalPlots, bool doTruthMuPlots, bool doExpert ) :
45 PlotMgr( dirName, anaTag, pParent ),
46 m_testType( trackType ), m_refType( trackType ),
47 m_isITk( isITk ), m_doGlobalPlots( doGlobalPlots ),
48 m_doTruthMuPlots( doTruthMuPlots ), m_do1D( true ), m_doExpert( doExpert )
49{
53}
54
55
60{
61 StatusCode sc = bookPlots();
62 if( sc.isFailure() ) {
63 ATH_MSG_ERROR( "Failed to book hits on tracks plots" );
64 }
65}
66
67
69{
70 ATH_MSG_DEBUG( "Booking hits on tracks plots in " << getDirectory() );
71
74 if( m_do1D ) {
75 for( unsigned int ih=0; ih<m_NHITPARAMS; ih++ ) {
77 }
78
79 if( not m_isITk ) {
80 for( unsigned int ih=0; ih<m_NRUN3HITPARAMS; ih++ ) {
82 }
83 }
84 }
85
86 for( unsigned int i=0; i<NPARAMS; i++ ) {
89 for( unsigned int ih=0; ih<m_NHITPARAMS; ih++ ) {
91 m_testType+"_"+m_hitParamName[ih]+"_vs_"+m_refType+"_"+m_paramName[i] ) );
92 }
93
94 if( not m_isITk ) {
95 for( unsigned int ih=0; ih<m_NRUN3HITPARAMS; ih++ ) {
97 m_testType+"_"+m_run3HitParamName[ih]+"_vs_"+m_refType+"_"+m_paramName[i] ) );
98 }
99 }
100
103 for( unsigned int j=i+1; j<NPARAMS; j++ ) {
104 for( unsigned int ih=0; ih<m_NHITPARAMS; ih++ ) {
106 m_testType+"_"+m_hitParamName[ih]+"_vs_"+m_refType+"_"+m_paramName[i]+"_vs_"+m_paramName[j] ) );
107 }
108
109 if( not m_isITk ) {
110 for( unsigned int ih=0; ih<m_NRUN3HITPARAMS; ih++ ) {
112 m_testType+"_"+m_run3HitParamName[ih]+"_vs_"+m_refType+"_"+m_paramName[i]+"_vs_"+m_paramName[j] ) );
113 }
114 }
115 } // close j loop over NPARAMS
116 } // close i loop over NPARAMS
117
118 if( m_doGlobalPlots ) {
119 for( unsigned int i=0; i<NPARAMSMU; i++ ) {
120 if( not m_doTruthMuPlots and i==TRUTHMU ) continue;
121 if( m_do1D ) {
124 for( unsigned int ih=0; ih<m_NHITPARAMS; ih++ ) {
126 m_testType+"_"+m_hitParamName[ih]+"_vs_"+m_paramMuName[i] ) );
127 }
128
129 if( not m_isITk ) {
130 for( unsigned int ih=0; ih<m_NRUN3HITPARAMS; ih++ ) {
132 m_testType+"_"+m_run3HitParamName[ih]+"_vs_"+m_paramMuName[i] ) );
133 }
134 }
135 } // close if m_do1D
136
139 for( unsigned int j=0; j<NPARAMS; j++ ) {
140 for( unsigned int ih=0; ih<m_NHITPARAMS; ih++ ) {
142 m_testType+"_"+m_hitParamName[ih]+"_vs_"+m_paramMuName[i]+"_vs_"+m_refType+"_"+m_paramName[j] ) );
143 }
144
145 if( not m_isITk ) {
146 for( unsigned int ih=0; ih<m_NRUN3HITPARAMS; ih++ ) {
148 m_testType+"_"+m_run3HitParamName[ih]+"_vs_"+m_paramMuName[i]+"_vs_"+m_refType+"_"+m_paramName[j] ) );
149 }
150 }
151 } // close j loop over NPARAMS
152 } // close i loop over NPARAMSMU
153 } // end if m_doGlobalPlots
154
155 return StatusCode::SUCCESS;
156}
157
158
164template< typename PTEST, typename PREF >
166 const PTEST& ptest, const PREF& pref, float truthMu, float actualMu, float weight )
167{
169 float hitP[ NHITPARAMSTOT ];
170 hitP[ NInnerMostPixelHits ] = nInnerMostPixelHits( ptest );
176 hitP[ NPixelHits ] = nPixelHits( ptest );
177 hitP[ NPixelHoles ] = nPixelHoles( ptest );
178 hitP[ NPixelSharedHits ] = nPixelSharedHits( ptest );
179 hitP[ PixeldEdx ] = pixeldEdx( ptest );
180 hitP[ NSCTHits ] = nSCTHits( ptest );
181 hitP[ NSCTHoles ] = nSCTHoles( ptest );
182 hitP[ NSCTSharedHits ] = nSCTSharedHits( ptest );
189 hitP[ NPixelOutliers ] = nPixelOutliers( ptest );
190 hitP[ NPixelContribLayers ] = nPixelContribLayers( ptest );
191 hitP[ NPixelSplitHits ] = nPixelSplitHits( ptest );
192 hitP[ NPixelGangedHits ] = nPixelGangedHits( ptest );
194 hitP[ NPixelDeadSensors ] = nPixelDeadSensors( ptest );
195 hitP[ NSCTOutliers ] = nSCTOutliers( ptest );
196 hitP[ NSCTDoubleHoles ] = nSCTDoubleHoles( ptest );
197 hitP[ NSCTDeadSensors ] = nSCTDeadSensors( ptest );
198
199 float hitRun3P[ NRUN3HITPARAMSTOT ];
200 hitRun3P[ NTRTHits ] = ( not m_isITk ) ? nTRTHits( ptest ) : -9999.;
201 hitRun3P[ NTRTHitsXe ] = ( not m_isITk ) ? nTRTHitsXe( ptest ) : -9999.;
202 hitRun3P[ NTRTHitsAr ] = ( not m_isITk ) ? nTRTHitsAr( ptest ) : -9999.;
203 hitRun3P[ NTRTHighThresholdHits ] = ( not m_isITk ) ? nTRTHighThresholdHits( ptest ) : -9999.;
204 hitRun3P[ NTRTHighThresholdHitsXe ] = ( not m_isITk ) ? nTRTHighThresholdHitsXe( ptest ) : -9999.;
205 hitRun3P[ NTRTHighThresholdHitsAr ] = ( not m_isITk ) ? nTRTHighThresholdHitsAr( ptest ) : -9999.;
206
208 float refP[ NPARAMS ];
209 refP[ PT ] = pT( pref ) / Gaudi::Units::GeV;
210 refP[ ETA ] = eta( pref );
211 refP[ PHI ] = phi( pref );
212
214 float muP[ NPARAMSMU ];
215 muP[ TRUTHMU ] = truthMu;
216 muP[ ACTUALMU ] = actualMu;
217
219
221 if( m_do1D ) {
222 for( unsigned int ih=0; ih<m_NHITPARAMS; ih++ ) {
223 ATH_CHECK( fill( m_hits[ih], hitP[ih], weight ) );
224 }
225
226 if( not m_isITk ) {
227 for( unsigned int ih=0; ih<m_NRUN3HITPARAMS; ih++ ) {
228 ATH_CHECK( fill( m_hitsRun3[ih], hitRun3P[ih], weight ) );
229 }
230 }
231 }
232
233 for( unsigned int i=0; i<NPARAMS; i++ ) {
235 for( unsigned int ih=0; ih<m_NHITPARAMS; ih++ ) {
236 ATH_CHECK( fill( m_hits_vs[ih][i], refP[i], hitP[ih], weight ) );
237 }
238
239 if( not m_isITk ) {
240 for( unsigned int ih=0; ih<m_NRUN3HITPARAMS; ih++ ) {
241 ATH_CHECK( fill( m_hitsRun3_vs[ih][i], refP[i], hitRun3P[ih], weight ) );
242 }
243 }
244
246 for( unsigned int j=i+1; j<NPARAMS; j++ ) {
247 for( unsigned int ih=0; ih<m_NHITPARAMS; ih++ ) {
248 ATH_CHECK( fill( m_hits_vs2D[ih][i][j], refP[i], refP[j], hitP[ih], weight ) );
249 }
250
251 if( not m_isITk ) {
252 for( unsigned int ih=0; ih<m_NRUN3HITPARAMS; ih++ ) {
253 ATH_CHECK( fill( m_hitsRun3_vs2D[ih][i][j], refP[i], refP[j], hitRun3P[ih], weight ) );
254 }
255 }
256 } // close j loop over NPARAMS
257 } // close i loop over NPARAMS
258
259 if( m_doGlobalPlots ) {
260 for( unsigned int i=0; i<NPARAMSMU; i++ ) {
261 if( not m_doTruthMuPlots and i==TRUTHMU ) continue;
262 if( m_do1D ) {
264 for( unsigned int ih=0; ih<m_NHITPARAMS; ih++ ) {
265 ATH_CHECK( fill( m_hits_vsMu[ih][i], muP[i], hitP[ih], weight ) );
266 }
267
268 if( not m_isITk ) {
269 for( unsigned int ih=0; ih<m_NRUN3HITPARAMS; ih++ ) {
270 ATH_CHECK( fill( m_hitsRun3_vsMu[ih][i], muP[i], hitRun3P[ih], weight ) );
271 }
272 }
273 } // close if m_do1D
274
276 for( unsigned int j=0; j<NPARAMS; j++ ) {
277 for( unsigned int ih=0; ih<m_NHITPARAMS; ih++ ) {
278 ATH_CHECK( fill( m_hits_vsMu_vs[ih][i][j], muP[i], refP[j], hitP[ih], weight ) );
279 }
280
281 if( not m_isITk ) {
282 for( unsigned int ih=0; ih<m_NRUN3HITPARAMS; ih++ ) {
283 ATH_CHECK( fill( m_hitsRun3_vsMu_vs[ih][i][j], muP[i], refP[j], hitRun3P[ih], weight ) );
284 }
285 }
286 } // close j loop over NPARAMS
287 } // close i loop over NPARAMSMU
288 } // end if m_doGlobalPlots
289
290 return StatusCode::SUCCESS;
291}
292
294 const xAOD::TrackParticle&, const xAOD::TrackParticle&, float, float, float );
295
297 const xAOD::TruthParticle&, const xAOD::TruthParticle&, float, float, float );
298
300 const xAOD::TrackParticle&, const xAOD::TruthParticle&, float, float, float );
301
303 const xAOD::TruthParticle&, const xAOD::TrackParticle&, float, float, float );
304
305
311template< typename PARTICLE >
313 const PARTICLE& particle, float truthMu, float actualMu, float weight )
314{
315 ATH_CHECK( fillPlots< PARTICLE >( particle, particle, truthMu, actualMu, weight ) );
316 return StatusCode::SUCCESS;
317}
318
320 const xAOD::TrackParticle&, float, float, float );
321
323 const xAOD::TruthParticle&, float, float, float );
324
325
330{
331 ATH_MSG_DEBUG( "Finalising hits on tracks plots" );
333}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
static Double_t * pref
static Double_t sc
Utility methods to access track/truth particles parmeters in a consitent way in this package.
std::string m_run3HitParamName[NRUN3HITPARAMSTOT]
TProfile2D * m_hitsRun3_vsMu_vs[NRUN3HITPARAMSTOT][NPARAMSMU][NPARAMS]
HitsOnTracksPlots(PlotMgr *pParent, const std::string &dirName, const std::string &anaTag, const std::string &testType, const std::string &refType, bool isITk, bool doGlobalPlots=false, bool doTruthMuPlots=false, bool do1D=false, bool doExpert=false)
Constructor A for test_Hits-vs-reference plots e.g.
std::string m_paramName[NPARAMS]
TProfile * m_hits_vsMu[NHITPARAMSTOT][NPARAMSMU]
TProfile plots vs mu (truth and actual)
TProfile2D * m_hits_vs2D[NHITPARAMSTOT][NPARAMS][NPARAMS]
TProfile2D plots vs NPARAMS vs NPARAMS.
TProfile * m_hits_vs[NHITPARAMSTOT][NPARAMS]
TProfile plots vs NPARAMS.
TProfile2D * m_hitsRun3_vs2D[NRUN3HITPARAMSTOT][NPARAMS][NPARAMS]
void finalizePlots()
Print out final stats on histograms.
TProfile * m_hitsRun3_vs[NRUN3HITPARAMSTOT][NPARAMS]
TH1 * m_hitsRun3[NRUN3HITPARAMSTOT]
StatusCode fillPlots(const PTEST &ptest, const PREF &pref, float truthMu, float actualMu, float weight)
Dedicated fill method A (for tracks and/or truth particles) for test_Hits-vs-reference plots.
TH1 * m_hits[NHITPARAMSTOT]
1D plots
void initializePlots()
Book the histograms.
std::string m_hitParamName[NHITPARAMSTOT]
std::string m_paramMuName[NPARAMSMU]
TProfile * m_hitsRun3_vsMu[NRUN3HITPARAMSTOT][NPARAMSMU]
TProfile2D * m_hits_vsMu_vs[NHITPARAMSTOT][NPARAMSMU][NPARAMS]
TProfile2D plots vs mu (truth and actual) vs NPARAMS.
@ NInnerMostPixelOutliers
for greater detail level plots
StatusCode retrieveAndBook(P *&pHisto, const std::string &identifier, const std::string &folderOverride="", const std::string &nameOverride="")
Definition PlotMgr.h:64
PlotMgr(const std::string &dirName, const std::string &anaTag, PlotMgr *pParent=nullptr)
Constructor taking parent node and directory name for plots pParent = nullptr by default to book plot...
Definition PlotMgr.cxx:25
const std::string & getDirectory()
Definition PlotBase.h:88
float nTRTHighThresholdHits(const U &p)
float nInnerMostPixelSharedEndcapHits(const U &p)
float nInnerMostPixelSplitHits(const U &p)
float nInnerMostPixelSplitEndcapHits(const U &p)
float nExpectedInnerMostPixelHits(const U &p)
float nPixelHoles(const U &p)
float nPixelSharedHits(const U &p)
float pT(const U &p)
Accessor utility function for getting the value of pT.
float nNextToInnerMostPixelHits(const U &p)
float nPixelContribLayers(const U &p)
float nPixelGangedHits(const U &p)
float nInnerMostPixelEndcapOutliers(const U &p)
float nSCTSharedHits(const U &p)
float nPixelDeadSensors(const U &p)
float nSCTHoles(const U &p)
float nTRTHighThresholdHitsXe(const U &p)
float nNextToInnerMostPixelEndcapHits(const U &p)
float nSCTHits(const U &p)
float nSCTDeadSensors(const U &p)
float nSCTDoubleHoles(const U &p)
float nInnerMostPixelSharedHits(const U &p)
float nTRTHits(const U &p)
float nTRTHitsAr(const U &p)
float pixeldEdx(const U &p)
float nTRTHighThresholdHitsAr(const U &p)
float nTRTHitsXe(const U &p)
float nInnerMostPixelHits(const U &p)
float nPixelOutliers(const U &p)
float nInnerMostPixelOutliers(const U &p)
float nPixelSplitHits(const U &p)
float nPixelHits(const U &p)
float nExpectedNextToInnerMostPixelHits(const U &p)
float nSCTOutliers(const U &p)
float nInnerMostPixelEndcapHits(const U &p)
float nPixelGangedHitsFlaggedFakes(const U &p)
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TruthParticle_v1 TruthParticle
Typedef to implementation.
void fill(H5::Group &out_file, size_t iterations)