Skip to content
Snippets Groups Projects
Commit 66d19a3b authored by Adam Edward Barton's avatar Adam Edward Barton :speech_balloon:
Browse files

Merge branch 'Alignment_MT_Monitoring_Migration' into 'master'

Creation of the new Run-3 monitoring package for InDetAlignment

See merge request atlas/athena!45270
parents 181dac38 51c8e717
No related branches found
No related tags found
No related merge requests found
Showing
with 1983 additions and 4 deletions
......@@ -58,9 +58,14 @@ def AthenaMonitoringCfg(flags):
result.merge(TRTMonitoringRun3Cfg(flags))
if flags.DQ.Steering.doInDetMon:
info('Set up InDet Global monitoring')
from InDetGlobalMonitoringRun3Test.InDetGlobalMonitoringRun3TestConfig import InDetGlobalMonitoringRun3TestConfig
result.merge(InDetGlobalMonitoringRun3TestConfig(flags))
if flags.DQ.Steering.InDet.doGlobalMon:
info('Set up InDet Global monitoring')
from InDetGlobalMonitoringRun3Test.InDetGlobalMonitoringRun3TestConfig import InDetGlobalMonitoringRun3TestConfig
result.merge(InDetGlobalMonitoringRun3TestConfig(flags))
if flags.DQ.Steering.InDet.doAlignMon:
info('Set up Alignment monitoring')
from InDetAlignmentMonitoringRun3.InDetAlignmentMonitoringRun3Config import InDetAlignmentMonitoringRun3Config
result.merge(InDetAlignmentMonitoringRun3Config(flags))
if flags.DQ.Steering.doLArMon:
info('Set up LAr monitoring')
......
......@@ -367,7 +367,7 @@ if DQMonFlags.doMonitoring():
Steering.doPixelMon=DQMonFlags.doPixelMon()
Steering.doSCTMon=DQMonFlags.doSCTMon()
Steering.doTRTMon=DQMonFlags.doTRTMon()
Steering.doInDetMon=DQMonFlags.doInDetGlobalMon()
Steering.doInDetMon = Steering.InDet.doGlobalMon or Steering.InDet.doAlignMon
Steering.doLArMon=DQMonFlags.doLArMon()
Steering.doTileMon=DQMonFlags.doTileMon()
Steering.doCaloGlobalMon=DQMonFlags.doCaloMon()
......
################################################################################
# Package: InDetAlignmentMonitoringRun3
################################################################################
# Declare the package name:
atlas_subdir( InDetAlignmentMonitoringRun3 )
# Component(s) in the package:
atlas_add_component( InDetAlignmentMonitoringRun3
src/*.h src/*.cxx src/components/*.cxx
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib GaudiKernel CommissionEvent AthenaBaseComps AthenaMonitoringLib AthContainers AtlasDetDescr Identifier EventPrimitives xAODEventInfo xAODTracking TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry SCT_ReadoutGeometry InDetPrepRawData InDetRIO_OnTrack Particle TrkGeometry TrkSurfaces TrkEventPrimitives TrkParameters TrkParticleBase TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkTrack TrkTrackSummary TrkTruthData VxVertex TrkExInterfaces TrkToolInterfaces TrkVertexFitterInterfaces InDetTrackSelectionToolLib BeamSpotConditionsData InDetAlignGenToolsLib InDetTrackSplitterToolLib )
# Install files from the package:
atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
#
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
#
"""
@file IDAlignMonGenericTracksAlgCfg.py
@author Per Johansson
@date 2021
@brief Configuration for Run 3 based on IDAlignMonGenericTracks.cxx
"""
from math import pi as M_PI
def IDAlignMonGenericTracksAlgCfg(helper, alg, **kwargs):
# values
m_pTRange = 100
m_NTracksRange = 200
m_rangePixHits = 10
m_rangeSCTHits = 20
m_rangeTRTHits = 60
m_etaRange = 3
m_d0BsNbins = 100
m_d0Range = 2
m_z0Range = 250
m_d0BsRange = 0.5
# this creates a "genericTrackGroup" called "alg" which will put its histograms into the subdirectory "GenericTracks"
genericTrackGroup = helper.addGroup(alg, 'Tracks')
pathtrack = '/IDAlignMon/ExtendendTracks_NoTriggerSelection/GenericTracks'
varName = 'm_lb;LumiBlock'
title = 'Lumiblock'
genericTrackGroup.defineHistogram(varName, type='TH1F', path=pathtrack, title=title, xbins=1024, xmin=-0.5, xmax=1023.5)
varName = 'm_beamSpotX,m_beamSpotY;YBs_vs_XBs'
title = 'BeamSpot Position: y vs x'
genericTrackGroup.defineHistogram(varName, type='TH2F', path=pathtrack, title=title, xbins=100, xmin=-0.9, xmax=-0.1, ybins=100, ymin=-0.9, ymax=-0.1)
varName = 'm_beamSpotZ,m_beamSpotY;YBs_vs_ZBs'
title = 'BeamSpot Position: y vs z'
genericTrackGroup.defineHistogram(varName, type='TH2F', path=pathtrack, title=title, xbins=100, xmin=-25, xmax=-5, ybins=100, ymin=-0.9, ymax=-0.1)
varName = 'm_beamSpotX,m_beamSpotZ;XBs_vs_XZs'
title = 'BeamSpot Position: x vs z'
genericTrackGroup.defineHistogram(varName, type='TH2F', path=pathtrack, title=title, xbins=100, xmin=-25, xmax=-5, ybins=100, ymin=-0.9, ymax=-0.1)
varName = 'm_nhits_per_track;Nhits_per_track'
title = 'Number of hits per track;Number of Good Tracks;Number of Events'
genericTrackGroup.defineHistogram(varName, type='TH1F', path=pathtrack, title=title, xbins=m_NTracksRange + 1, xmin=-0.5, xmax=m_NTracksRange + 0.5)
varName = 'm_npixelhits_per_track;Npixhits_per_track'
title = 'Number of pixhits per track;Number of Good Tracks;Number of Tracks'
genericTrackGroup.defineHistogram(varName, type='TH1F', path=pathtrack, title=title, xbins=m_rangePixHits, xmin=-0.5, xmax=m_rangePixHits - 0.5)
varName = 'm_nscthits_per_track;Nscthits_per_track'
title = 'Number of scthits per track;Number of SCT hits per Tracks;Number of Tracks'
genericTrackGroup.defineHistogram(varName, type='TH1F', path=pathtrack, title=title, xbins=m_rangeSCTHits, xmin=-0.5, xmax=m_rangeSCTHits - 0.5)
varName = 'm_ntrthits_per_track;Ntrthits_per_track'
title = 'Number of trthits per track;Number of TRT hits per Tracks;Number of Tracks'
genericTrackGroup.defineHistogram(varName, type='TH1F', path=pathtrack, title=title, xbins=m_rangeTRTHits, xmin=-0.5, xmax=m_rangeTRTHits - 0.5)
varName = 'm_chi2oDoF;chi2oDoF'
title = 'chi2oDoF;Track in #chi^{2} / NDoF;Number of Tracks'
genericTrackGroup.defineHistogram(varName, type='TH1F', path=pathtrack, title=title, xbins=100, xmin=0, xmax=10)
varName = 'm_eta;eta'
title = 'eta;Track #eta;Number of Tracks'
genericTrackGroup.defineHistogram(varName, type='TH1F', path=pathtrack, title=title, xbins=80, xmin=-m_etaRange, xmax=m_etaRange)
varName = 'm_eta_pos;eta_pos'
title = 'eta for positive tracks; #eta(+);Number of Tracks'
genericTrackGroup.defineHistogram(varName, type='TH1F', path=pathtrack, title=title, xbins=25, xmin=-m_etaRange, xmax=m_etaRange)
varName = 'm_eta_neg;eta_neg'
title = 'eta for negative tracks; #eta(-);Number of Tracks'
genericTrackGroup.defineHistogram(varName, type='TH1F', path=pathtrack, title=title, xbins=25, xmin=-m_etaRange, xmax=m_etaRange)
varName = 'm_phi;phi'
title = 'phi;Track #phi;Number of Tracks'
genericTrackGroup.defineHistogram(varName, type='TH1F', path=pathtrack, title=title, xbins=80, xmin=0, xmax= 2 * M_PI)
varName = 'm_z0;z0'
title = 'z0;[mm]'
genericTrackGroup.defineHistogram(varName, type='TH1F', path=pathtrack, title=title, xbins=m_d0BsNbins, xmin=-m_z0Range, xmax=m_z0Range)
varName = 'm_z0sintheta;z0sintheta'
title = 'z0sintheta;[mm]'
genericTrackGroup.defineHistogram(varName, type='TH1F', path=pathtrack, title=title, xbins=m_d0BsNbins, xmin=-m_z0Range, xmax=m_z0Range)
varName = 'm_d0;d0'
title = 'd0;[mm]'
genericTrackGroup.defineHistogram(varName, type='TH1F', path=pathtrack, title=title, xbins=m_d0BsNbins, xmin=-m_d0Range, xmax=m_d0Range)
varName = 'm_d0_bscorr;d0_bscorr'
title = 'd0 (corrected for beamspot);d0 [mm]'
genericTrackGroup.defineHistogram(varName, type='TH1F', path=pathtrack, title=title, xbins=m_d0BsNbins, xmin=-m_d0BsRange, xmax=m_d0BsRange)
varName = 'm_pT;pT'
title = 'pT;Signed Track pT [GeV];Number of Tracks'
genericTrackGroup.defineHistogram(varName, type='TH1F', path=pathtrack, title=title, xbins=200, xmin=-m_pTRange, xmax=m_pTRange)
varName = 'm_p;P'
title = 'Track Momentum P;Signed Track P [GeV];Number of Tracks'
genericTrackGroup.defineHistogram(varName, type='TH1F', path=pathtrack, title=title, xbins=200, xmin=-m_pTRange, xmax=m_pTRange)
# end histograms
#
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
#
'''@file InDetAlignMonResidualsAlgCfg.py
@author PerJohansson
@date 2021
@brief Configuration for Run 3 based on InDetAlignMonResiduals.cxx
'''
def IDAlignMonResidualsAlgCfg(helper, alg, **kwargs):
'''Function to configures some algorithms in the monitoring system.'''
#Values
m_nBinsMuRange = 101
m_muRangeMin = -0.5
m_muRangeMax = 100.5
m_minSiResFillRange = -0.08
m_maxSiResFillRange = 0.08
m_RangeOfPullHistos = 6
m_minPIXResYFillRange = -0.4
m_maxPIXResYFillRange = 0.4
# this creates a "residualGroup" called "alg" which will put its histograms into the subdirectory "Residuals"
residualGroup = helper.addGroup(alg, 'Residuals')
pathResiduals = '/IDAlignMon/ExtendendTracks_NoTriggerSelection/Residuals'
# Histograms for the Alignment Residual monitoring:
varName = 'm_mu;mu_perEvent'
title = 'mu_perEvent;<#mu> per event;Events'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=m_nBinsMuRange, xmin=m_muRangeMin, xmax=m_muRangeMax)
varName = 'm_detType;sirescalcfailure'
title = 'Hits with ResidualPullCalculator problem;Events;DetType'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=2, xmin=0, xmax=2)
#Common for Pixel and SCT
varName = 'm_si_residualx;si_residualx'
title = 'Silicon UnBiased X Residual;Events;Residual [mm]'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=m_minSiResFillRange, xmax=m_maxSiResFillRange)
varName = 'm_si_b_residualx;si_b_residualx'
title = 'Silicon Barrel Only UnBiased X Residual;Events;Residual [mm]'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=m_minSiResFillRange, xmax=m_maxSiResFillRange)
#Pixel Barrel Plots
varName = 'm_pix_b_residualx;pix_b_residualx'
title = 'UnBiased X Residual Pixel Barrel;Events;Residual [mm]'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=m_minSiResFillRange, xmax=m_maxSiResFillRange)
varName = 'm_pix_b_biased_residualx;pix_b_biasedresidualx'
title = 'Biased X Residual Pixel Barrel;Residual [mm]'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=m_minSiResFillRange, xmax=m_maxSiResFillRange)
varName = 'm_pix_b_residualy;pix_b_residualy'
title = 'UnBiased Y Residual Pixel Barrel;Residual [mm]'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=m_minPIXResYFillRange, xmax=m_maxPIXResYFillRange)
varName = 'm_pix_b_biased_residualy;pix_b_biasedresidualy'
title = 'Biased Y Residual Pixel Barrel;Residual [mm]'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=m_minPIXResYFillRange, xmax=m_maxPIXResYFillRange)
varName = 'm_pix_b0_residualsx;pix_b0_residualx'
title = 'UnBiased X Residual Pixel Barrel 0'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=m_minSiResFillRange, xmax=m_maxSiResFillRange)
varName = 'm_pix_b1_residualsx;pix_b1_residualx'
title = 'UnBiased X Residual Pixel Barrel 1'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=m_minSiResFillRange, xmax=m_maxSiResFillRange)
varName = 'm_pix_b2_residualsx;pix_b2_residualx'
title = 'UnBiased X Residual Pixel Barrel 2'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=m_minSiResFillRange, xmax=m_maxSiResFillRange)
varName = 'm_pix_b3_residualsx;pix_b3_residualx'
title = 'UnBiased X Residual Pixel Barrel 3'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=m_minSiResFillRange, xmax=m_maxSiResFillRange)
varName = 'm_pix_b0_residualsy;pix_b0_residualy'
title = 'UnBiased Y Residual Pixel Barrel 0'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=m_minPIXResYFillRange, xmax=m_maxPIXResYFillRange)
varName = 'm_pix_b1_residualsy;pix_b1_residualy'
title = 'UnBiased Y Residual Pixel Barrel 1'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=m_minPIXResYFillRange, xmax=m_maxPIXResYFillRange)
varName = 'm_pix_b2_residualsy;pix_b2_residualy'
title = 'UnBiased Y Residual Pixel Barrel 2'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=m_minPIXResYFillRange, xmax=m_maxPIXResYFillRange)
varName = 'm_pix_b3_residualsy;pix_b3_residualy'
title = 'UnBiased Y Residual Pixel Barrel 3'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=m_minPIXResYFillRange, xmax=m_maxPIXResYFillRange)
varName = 'm_pix_b0_pullsx;pix_b0_pullx'
title = 'UnBiased X Pull Pixel Barrel 0'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=-m_RangeOfPullHistos, xmax=m_RangeOfPullHistos)
varName = 'm_pix_b1_pullsx;pix_b1_pullsx'
title = 'UnBiased X Pull Pixel Barrel 1'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=-m_RangeOfPullHistos, xmax=m_RangeOfPullHistos)
varName = 'm_pix_b2_pullsx;pix_b2_pullx'
title = 'UnBiased X Pull Pixel Barrel 2'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=-m_RangeOfPullHistos, xmax=m_RangeOfPullHistos)
varName = 'm_pix_b3_pullsx;pix_b3_pullx'
title = 'UnBiased X Pull Pixel Barrel 3'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=-m_RangeOfPullHistos, xmax=m_RangeOfPullHistos)
varName = 'm_pix_b0_pullsy;pix_b0_pully'
title = 'UnBiased Y Pull Pixel Barrel 0'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=-m_RangeOfPullHistos, xmax=m_RangeOfPullHistos)
varName = 'm_pix_b1_pullsy;pix_b1_pully'
title = 'UnBiased X Pull Pixel Barrel 1'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=-m_RangeOfPullHistos, xmax=m_RangeOfPullHistos)
varName = 'm_pix_b2_pullsy;pix_b2_pully'
title = 'UnBiased Y Pull Pixel Barrel 2'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=-m_RangeOfPullHistos, xmax=m_RangeOfPullHistos)
varName = 'm_pix_b3_pullsy;pix_b3_pully'
title = 'UnBiased Y Pull Pixel Barrel 3'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=-m_RangeOfPullHistos, xmax=m_RangeOfPullHistos)
#Pixel EndCap A plots
varName = 'm_pix_eca_residualx;pix_eca_residualx'
title = 'UnBiased X Residual Pixel EndCap A;Residual [mm]'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=m_minSiResFillRange, xmax=m_maxSiResFillRange)
varName = 'm_pix_eca_residualy;pix_eca_residualy'
title = 'UnBiased Y Residual Pixel EndCap A;Residual [mm]'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=m_minPIXResYFillRange, xmax=m_maxPIXResYFillRange)
varName = 'm_pix_eca_pullx;pix_eca_pulllx'
title = 'UnBiased X Pull Pixel EndCap A'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=-m_RangeOfPullHistos, xmax=m_RangeOfPullHistos)
varName = 'm_pix_eca_pully;pix_eca_pullly'
title = 'UnBiased Y Pull Pixel EndCap A'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=-m_RangeOfPullHistos, xmax=m_RangeOfPullHistos)
#Pixel EndCap C plots
varName = 'm_pix_ecc_residualx;pix_ecc_residualx'
title = 'UnBiased X Residual Pixel EndCap C;Residual [mm]'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=m_minSiResFillRange, xmax=m_maxSiResFillRange)
varName = 'm_pix_ecc_residualy;pix_ecc_residualy'
title = 'UnBiased Y Residual Pixel EndCap C;Residual [mm]'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=m_minPIXResYFillRange, xmax=m_maxPIXResYFillRange)
varName = 'm_pix_ecc_pullx;pix_ecc_pulllx'
title = 'UnBiased X Pull Pixel EndCap C'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=-m_RangeOfPullHistos, xmax=m_RangeOfPullHistos)
varName = 'm_pix_ecc_pully;pix_ecc_pullly'
title = 'UnBiased Y Pull Pixel EndCap C'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=-m_RangeOfPullHistos, xmax=m_RangeOfPullHistos)
#SCT
#Barrel Plots
varName = 'm_sct_b_residualx;sct_b_residualx'
title = 'UnBiased X Residual SCT Barrel;Residual [mm]'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=m_minSiResFillRange, xmax=m_maxSiResFillRange)
varName = 'm_sct_b_biased_residualx;sct_b_biasedresidualx'
title = 'Biased X Residual SCT Barrel;Residual [mm]'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=m_minSiResFillRange, xmax=m_maxSiResFillRange)
varName = 'm_sct_b0_residualsx;sct_b0_residualx'
title = 'UnBiased X Residual SCT Barrel 0'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=m_minSiResFillRange, xmax=m_maxSiResFillRange)
varName = 'm_sct_b1_residualsx;sct_b1_residualx'
title = 'UnBiased X Residual SCT Barrel 1'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=m_minSiResFillRange, xmax=m_maxSiResFillRange)
varName = 'm_sct_b2_residualsx;sct_b2_residualx'
title = 'UnBiased X Residual SCT Barrel 2'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=m_minSiResFillRange, xmax=m_maxSiResFillRange)
varName = 'm_sct_b3_residualsx;sct_b3_residualx'
title = 'UnBiased X Residual SCT Barrel 3'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=m_minSiResFillRange, xmax=m_maxSiResFillRange)
varName = 'm_sct_b0_pullsx;sct_b0_pullx'
title = 'UnBiased X Pull SCT Barrel 0'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=-m_RangeOfPullHistos, xmax=m_RangeOfPullHistos)
varName = 'm_sct_b1_pullsx;sct_b1_pullx'
title = 'UnBiased X Pull SCT Barrel 1'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=-m_RangeOfPullHistos, xmax=m_RangeOfPullHistos)
varName = 'm_sct_b2_pullsx;sct_b2_pullx'
title = 'UnBiased X Pull SCT Barrel 2'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=-m_RangeOfPullHistos, xmax=m_RangeOfPullHistos)
varName = 'm_sct_b3_pullsx;sct_b3_pullx'
title = 'UnBiased X Pull SCT Barrel 3'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=-m_RangeOfPullHistos, xmax=m_RangeOfPullHistos)
#SCT EndCap A plots
varName = 'm_sct_eca_residualx;sct_eca_residualx'
title = 'UnBiased X Residual SCT EndCap A;Residual [mm]'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=m_minSiResFillRange, xmax=m_maxSiResFillRange)
varName = 'm_sct_eca_pullx;sct_eca_pulllx'
title = 'UnBiased X Pull SCT EndCap A'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=-m_RangeOfPullHistos, xmax=m_RangeOfPullHistos)
#SCT EndCap C plots
varName = 'm_sct_ecc_residualx;sct_ecc_residualx'
title = 'UnBiased X Residual SCT EndCap C;Residual [mm]'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=m_minSiResFillRange, xmax=m_maxSiResFillRange)
varName = 'm_sct_ecc_pullx;sct_ecc_pulllx'
title = 'UnBiased X Pull SCT EndCap C'
residualGroup.defineHistogram(varName, type='TH1F', path=pathResiduals, title=title, xbins=100, xmin=-m_RangeOfPullHistos, xmax=m_RangeOfPullHistos)
# end histograms
#
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
#
####################################################
# #
# InDetAlignmentManager top algorithm #
# #
####################################################
def InDetAlignmentMonitoringRun3Config(flags):
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
acc = ComponentAccumulator()
from AthenaMonitoring import AthMonitorCfgHelper
helper = AthMonitorCfgHelper(flags, "InDetAlignmentMonitoringRun3")
from AthenaConfiguration.ComponentFactory import CompFactory
if flags.DQ.Environment in ('online', 'tier0', 'tier0Raw'):
########### here begins InDetAlignMonGenericTracksAlg ###########
kwargsIDAlignMonGenericTracksAlg = {
'vxPrimContainerName' : 'PrimaryVertices', #InDetKeys.xAODVertexContainer(),
'TrackName' : 'ExtendedTracks', #Until new config ready
'TrackName2' : 'ExtendedTracks', #Until new config ready
}
from InDetAlignmentMonitoringRun3.IDAlignMonGenericTracksAlgCfg import IDAlignMonGenericTracksAlgCfg
inDetAlignMonGenericTracksAlg = helper.addAlgorithm(CompFactory.IDAlignMonGenericTracksAlg, 'IDAlignMonGenericTracksAlg')
for k, v in kwargsIDAlignMonGenericTracksAlg.items():
setattr(inDetAlignMonGenericTracksAlg, k, v)
inDetAlignMonGenericTracksAlg.TrackSelectionTool = CompFactory.InDet.InDetTrackSelectionTool('IDAlignMonGenericTracksAlg_TrackSelectionTool')
inDetAlignMonGenericTracksAlg.TrackSelectionTool.UseTrkTrackTools = True
inDetAlignMonGenericTracksAlg.TrackSelectionTool.CutLevel = "TightPrimary"
inDetAlignMonGenericTracksAlg.TrackSelectionTool.maxNPixelHoles = 1
inDetAlignMonGenericTracksAlg.TrackSelectionTool.minNBothInnermostLayersHits = 0
inDetAlignMonGenericTracksAlg.TrackSelectionTool.minNInnermostLayerHits = 1
inDetAlignMonGenericTracksAlg.TrackSelectionTool.minPt = 5000
inDetAlignMonGenericTracksAlg.TrackSelectionTool.maxD0 = 100000
inDetAlignMonGenericTracksAlg.TrackSelectionTool.maxZ0SinTheta = 150
IDAlignMonGenericTracksAlgCfg(helper, inDetAlignMonGenericTracksAlg, **kwargsIDAlignMonGenericTracksAlg)
########### here ends InDetAlignMonGenericTracksAlg ###########
########### here starts InDetAlignMonResidualAlgs ###########
kwargsIDAlignMonResidualsAlg = {
'TrackName' : 'CombinedInDetTracks', #Until new config ready
'TrackName2' : 'CombinedInDetTracks', #Until new config ready
}
from InDetAlignmentMonitoringRun3.IDAlignMonResidualsAlgCfg import IDAlignMonResidualsAlgCfg
inDetAlignMonResidualsAlg = helper.addAlgorithm(CompFactory.IDAlignMonResidualsAlg, 'IDAlignMonResidualsAlg')
for k, v in kwargsIDAlignMonResidualsAlg.items():
setattr(inDetAlignMonResidualsAlg, k, v)
inDetAlignMonResidualsAlg.TrackSelectionTool = CompFactory.InDet.InDetTrackSelectionTool('IDAlignMonResidualsAlg_TrackSelectionTool')
inDetAlignMonResidualsAlg.TrackSelectionTool.UseTrkTrackTools = True
inDetAlignMonResidualsAlg.TrackSelectionTool.CutLevel = "TightPrimary"
inDetAlignMonResidualsAlg.TrackSelectionTool.maxNPixelHoles = 1
inDetAlignMonResidualsAlg.TrackSelectionTool.minNBothInnermostLayersHits = 0
inDetAlignMonResidualsAlg.TrackSelectionTool.minNInnermostLayerHits = 1
inDetAlignMonResidualsAlg.TrackSelectionTool.minPt = 5000
inDetAlignMonResidualsAlg.TrackSelectionTool.maxD0 = 100000
inDetAlignMonResidualsAlg.TrackSelectionTool.maxZ0SinTheta = 150
IDAlignMonResidualsAlgCfg(helper, inDetAlignMonResidualsAlg, **kwargsIDAlignMonResidualsAlg)
########### here ends InDetAlignMonResidualsAlg ###########
acc.merge(helper.result())
return acc
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
// **********************************************************************
// AlignmentMonAlg.cxx
// AUTHORS: Beate Heinemann, Tobias Golling
// Adapted to AthenaMT by Per Johansson 2021
// **********************************************************************
//main header
#include "IDAlignMonGenericTracksAlg.h"
#include <cmath>
#include "TMath.h"
#include "GaudiKernel/MsgStream.h"
#include "AtlasDetDescr/AtlasDetectorID.h"
#include "InDetIdentifier/PixelID.h"
#include "InDetIdentifier/SCT_ID.h"
#include "InDetIdentifier/TRT_ID.h"
#include "TrkTrack/TrackCollection.h"
#include "InDetRIO_OnTrack/SiClusterOnTrack.h"
#include "InDetPrepRawData/SiCluster.h"
#include "Particle/TrackParticle.h"
#include "TrkParticleBase/LinkToTrackParticleBase.h"
#include "TrkEventPrimitives/FitQuality.h"
#include "TrkEventPrimitives/LocalParameters.h"
#include "CLHEP/GenericFunctions/CumulativeChiSquare.hh"
#include "InDetAlignGenTools/IInDetAlignHitQualSelTool.h"
// *********************************************************************
// Public Methods
// *********************************************************************
IDAlignMonGenericTracksAlg::IDAlignMonGenericTracksAlg( const std::string & name, ISvcLocator* pSvcLocator ) :
AthMonitorAlgorithm(name, pSvcLocator),
m_idHelper(0),
m_pixelID(0),
m_sctID(0),
m_trtID(0),
m_barrelEta(0.8),
m_d0Range(2.0),
m_d0BsRange(0.5),
m_z0Range(250.0),
m_etaRange(3.0),
m_NTracksRange(200),
m_trackSelection( "InDet::InDetTrackSelectionTool/TrackSelectionTool", this)
{
m_hitQualityTool = ToolHandle<IInDetAlignHitQualSelTool>("");
declareProperty("Pixel_Manager" , m_Pixel_Manager);
declareProperty("SCT_Manager" , m_SCT_Manager);
declareProperty("TRT_Manager" , m_TRT_Manager);
declareProperty("TrackSelectionTool" , m_trackSelection);
declareProperty("HitQualityTool" , m_hitQualityTool);
declareProperty("useExtendedPlots" , m_extendedPlots = false);
declareProperty("d0Range" , m_d0Range);
declareProperty("d0BsRange" , m_d0BsRange);
declareProperty("z0Range" , m_z0Range);
declareProperty("etaRange" , m_etaRange);
declareProperty("pTRange" , m_pTRange);
declareProperty("NTracksRange" , m_NTracksRange);
declareProperty("doIP" , m_doIP = false);
}
IDAlignMonGenericTracksAlg::~IDAlignMonGenericTracksAlg() { }
StatusCode IDAlignMonGenericTracksAlg::initialize()
{
StatusCode sc;
//ID Helper
ATH_CHECK(detStore()->retrieve(m_idHelper, "AtlasID"));
m_pixelID = nullptr;
ATH_CHECK(detStore()->retrieve(m_pixelID, "PixelID"));
ATH_MSG_DEBUG("Initialized PixelIDHelper");
m_sctID = nullptr;
ATH_CHECK(detStore()->retrieve(m_sctID, "SCT_ID"));
ATH_MSG_DEBUG("Initialized SCTIDHelper");
m_trtID = nullptr;
ATH_CHECK(detStore()->retrieve(m_trtID, "TRT_ID"));
ATH_MSG_DEBUG("Initialized TRTIDHelper");
ATH_CHECK(m_trackSelection.retrieve());
ATH_MSG_DEBUG("Retrieved tool " << m_trackSelection);
if (m_hitQualityTool.empty()) {
ATH_MSG_DEBUG("No hit quality tool configured - not hit quality cuts will be imposed");
m_doHitQuality = false;
} else if (m_hitQualityTool.retrieve().isFailure()) {
ATH_MSG_WARNING("Could not retrieve " << m_hitQualityTool << " (to apply hit quality cuts to Si hits) ");
m_doHitQuality = false;
} else {
ATH_MSG_DEBUG("Hit quality tool setup - hit quality cuts will be applied to Si hits");
m_doHitQuality = true;
}
if (m_doIP) {
ATH_CHECK (m_trackToVertexIPEstimator.retrieve());
}
if ( m_beamSpotKey.initialize().isFailure() ) {
ATH_MSG_WARNING("Failed to retrieve beamspot service " << m_beamSpotKey << " - will use nominal beamspot at (0,0,0)");
m_hasBeamCondSvc = false;
}
else {
m_hasBeamCondSvc = true;
ATH_MSG_DEBUG("Retrieved service " << m_beamSpotKey);
}
ATH_CHECK(m_VxPrimContainerName.initialize(not m_VxPrimContainerName.key().empty()));
ATH_CHECK(m_tracksName.initialize());
return AthMonitorAlgorithm::initialize();
}
StatusCode IDAlignMonGenericTracksAlg::fillHistograms( const EventContext& ctx ) const {
using namespace Monitored;
// For histogram naming
auto genericTrackGroup = getGroup("Tracks");
//counters
int ntrkMax=0;
float xv=-999;
float yv=-999;
float zv=-999;
int nHits=0;
int nTracks=0;
int ngTracks=0;
ATH_MSG_DEBUG ("IDAlignMonGenericTracksAlg::fillHistograms ** START ** call for track collection: " << m_tracksName.key());
//get tracks
auto trks = SG::makeHandle(m_tracksName, ctx);
// check for tracks
if (not trks.isValid()) {
ATH_MSG_DEBUG ("IDAlignMonGenericTracksAlg::fillHistograms() --" << m_tracksName.key() << " could not be retrieved");
return StatusCode::RECOVERABLE;
}else {
ATH_MSG_DEBUG("IDAlignMonGenericTracksAlg: Track container " << trks.name() <<" is found.");
}
//retrieving vertices
auto handle_vxContainer = SG::makeHandle(m_VxPrimContainerName, ctx);
// if m_doIP
const xAOD::Vertex* pvtx = nullptr;
if (!handle_vxContainer.isPresent()) {
ATH_MSG_DEBUG ("InDetGlobalPrimaryVertexMonAlg: StoreGate doesn't contain primary vertex container with key "+m_VxPrimContainerName.key());
return StatusCode::SUCCESS;
}
if (!handle_vxContainer.isValid()) {
ATH_MSG_ERROR ("InDetGlobalPrimaryVertexMonAlg: Could not retrieve primary vertex container with key "+m_VxPrimContainerName.key());
return StatusCode::RECOVERABLE;
}
auto vertexContainer = handle_vxContainer.cptr();
for(const auto & vtx : *vertexContainer) {
if ( !vtx ) continue;
if ( !vtx->vxTrackAtVertexAvailable() ) continue;
const std::vector< Trk::VxTrackAtVertex >& theTrackAtVertex = vtx->vxTrackAtVertex();
int numTracksPerVertex = theTrackAtVertex.size();
ATH_MSG_DEBUG("Size of TrackAtVertex: " << numTracksPerVertex);
if (numTracksPerVertex>ntrkMax) {
ntrkMax=numTracksPerVertex;
xv=vtx->position()[0];
yv=vtx->position()[1];
zv=vtx->position()[2];
}
}
if (xv==-999 || yv==-999 || zv==-999) {
ATH_MSG_DEBUG("No vertex found => setting it to 0");
xv=0;yv=0;zv=0;
}
std::map<const xAOD::TrackParticle*, const xAOD::Vertex*> trackVertexMapTP;
if (m_doIP) fillVertexInformation(trackVertexMapTP, ctx);
float beamSpotX = 0.;
float beamSpotY = 0.;
float beamSpotZ = 0.;
float beamTiltX = 0.;
float beamTiltY = 0.;
if (m_hasBeamCondSvc) {
auto beamSpotHandle = SG::ReadCondHandle(m_beamSpotKey, ctx);
Amg::Vector3D bpos = beamSpotHandle->beamPos();
beamSpotX = bpos.x();
beamSpotY = bpos.y();
beamSpotZ = bpos.z();
beamTiltX = beamSpotHandle->beamTilt(0);
beamTiltY = beamSpotHandle->beamTilt(1);
ATH_MSG_DEBUG ("Beamspot from" << beamSpotHandle.retrieve() << ": x0 = " << beamSpotX << ", y0 = " << beamSpotY << ", z0 = " << beamSpotZ << ", tiltX = " << beamTiltX << ", tiltY = " << beamTiltY);
}
// Get EventInfo
int lb = GetEventInfo(ctx)->lumiBlock();
auto lb_m = Monitored::Scalar<int>( "m_lb", lb );
int run = GetEventInfo(ctx)->runNumber();
auto run_m = Monitored::Scalar<int>( "m_run", run );
int event = GetEventInfo(ctx)->eventNumber();
auto event_m = Monitored::Scalar<int>( "m_event", event );
fill(genericTrackGroup, lb_m);
if (m_extendedPlots) {
//Fill BeamSpot Position histos
auto beamSpotX_m = Monitored::Scalar<float>( "m_beamSpotX", beamSpotX );
auto beamSpotY_m = Monitored::Scalar<float>( "m_beamSpotY", beamSpotY );
auto beamSpotZ_m = Monitored::Scalar<float>( "m_beamSpotZ", beamSpotZ );
auto beamTiltX_m = Monitored::Scalar<float>( "m_beamTiltX", beamTiltX );
auto beamTiltY_m = Monitored::Scalar<float>( "m_beamTiltY", beamTiltY );
fill(genericTrackGroup, beamSpotX_m, beamSpotY_m);
fill(genericTrackGroup, beamSpotZ_m, beamSpotY_m);
fill(genericTrackGroup, beamSpotZ_m, beamSpotX_m);
}
if (m_doIP) {
auto handle_vxContainer = SG::makeHandle(m_VxPrimContainerName, ctx);
if (!handle_vxContainer.isPresent()) {
ATH_MSG_DEBUG ("InDetGlobalPrimaryVertexMonAlg: StoreGate doesn't contain primary vertex container with key "+m_VxPrimContainerName.key());
return StatusCode::SUCCESS;
}
if (!handle_vxContainer.isValid()) {
ATH_MSG_ERROR ("InDetGlobalPrimaryVertexMonAlg: Could not retrieve primary vertex container with key "+m_VxPrimContainerName.key());
return StatusCode::FAILURE;
}
auto vertexContainer = handle_vxContainer.cptr();
xAOD::VertexContainer::const_iterator vxI = vertexContainer->begin();
xAOD::VertexContainer::const_iterator vxE = vertexContainer->end();
for (; vxI != vxE; ++vxI) {
if ((*vxI)->type() == 1) {
pvtx = (*vxI);
}
}
}
ATH_MSG_DEBUG ("IDAlignGenericTracks: Start loop on tracks. Number of tracks " << trks->size());
for (const Trk::Track* trksItr: *trks) {
// Found track?!
if ( !trksItr || trksItr->perigeeParameters() == 0 )
{
ATH_MSG_DEBUG( "InDetAlignmentMonitoringRun3: NULL track pointer in collection" );
continue;
}
// Select tracks
if ( !m_trackSelection->accept( *trksItr) )
continue;
nTracks++;
float chisquared = 0.;
int DoF = 0;
float chi2oDoF = -999;
float trkd0 = -999;
float trkz0 = -999;
float trkphi = -999;
float trktheta = -999;
float trketa = -999;
float qOverP = -999;
float trkpt = -999;
float trkP = -999;
float charge = 0;
float trkd0c = -999;
float beamX = 0;
float beamY = 0;
float d0bscorr = -999;
// get fit quality and chi2 probability of track
const Trk::FitQuality* fitQual = trksItr->fitQuality();
const Trk::Perigee* measPer = trksItr->perigeeParameters();
const AmgSymMatrix(5)* covariance = measPer ? measPer->covariance() : nullptr;
const Trk::ImpactParametersAndSigma* myIPandSigma=nullptr;
if (m_doIP){
//Get unbiased impact parameter
if (pvtx) myIPandSigma = m_trackToVertexIPEstimator->estimate(trksItr->perigeeParameters(), pvtx, true);
}
if (covariance == NULL) {
ATH_MSG_WARNING("No measured perigee parameters assigned to the track");
}
else{
AmgVector(5) perigeeParams = measPer->parameters();
trkd0 = perigeeParams[Trk::d0];
trkz0 = perigeeParams[Trk::z0];
trkphi = perigeeParams[Trk::phi0];
trktheta = perigeeParams[Trk::theta];
trketa = measPer->eta();
qOverP = perigeeParams[Trk::qOverP]*1000.;
if(qOverP) trkP = 1/qOverP;
trkpt = measPer->pT()/1000.;
if (qOverP < 0) charge = -1;
else charge=+1;
// correct the track d0 for the vertex position
// would rather corrected for the beamline but could not find beamline
trkd0c=trkd0-(yv*cos(trkphi)-xv*sin(trkphi));
ATH_MSG_DEBUG("trkd0, trkd0c: " << trkd0 << ", " << trkd0c);
// correct the track parameters for the beamspot position
beamX = beamSpotX + tan(beamTiltX) * (trkz0-beamSpotZ);
beamY = beamSpotY + tan(beamTiltY) * (trkz0-beamSpotZ);
d0bscorr = trkd0 - ( -sin(trkphi)*beamX + cos(trkphi)*beamY );
}
if (fitQual==nullptr) {
ATH_MSG_WARNING("No fit quality assigned to the track");
}
chisquared = (fitQual) ? fitQual->chiSquared() : -1.;
DoF = (fitQual) ? fitQual->numberDoF() : -1;
if(DoF>0) chi2oDoF = chisquared/(float)DoF;
if (trkphi<0) trkphi+=2*M_PI;
ngTracks++;
ATH_MSG_DEBUG(nTracks << " is a good track!");
int nhpixB=0, nhpixECA=0, nhpixECC=0, nhsctB=0, nhsctECA=0, nhsctECC=0, nhtrtB=0, nhtrtECA=0, nhtrtECC=0;
// loop over all hits on track
ATH_MSG_VERBOSE (" starting to loop over TSOS: " << trksItr->trackStateOnSurfaces()->size());
for (const Trk::TrackStateOnSurface* tsos : *trksItr->trackStateOnSurfaces()) {
//check that we have track parameters defined for the surface (pointer is not null)
if(!(tsos->trackParameters())) {
ATH_MSG_DEBUG(" hit skipped because no associated track parameters");
continue;
}
Identifier surfaceID;
const Trk::MeasurementBase* mesb=tsos->measurementOnTrack();
// hits, outliers
if (mesb != 0 && mesb->associatedSurface().associatedDetectorElement()!=NULL) surfaceID = mesb->associatedSurface().associatedDetectorElement()->identify();
// holes, perigee
else continue;
if ( tsos->type(Trk::TrackStateOnSurface::Measurement) ){
//hit quality cuts for Si hits if tool is configured - default is NO CUTS
if (m_idHelper->is_pixel(surfaceID) || m_idHelper->is_sct(surfaceID)) {
if (m_doHitQuality) {
ATH_MSG_DEBUG("applying hit quality cuts to Silicon hit...");
const Trk::RIO_OnTrack* hit = m_hitQualityTool->getGoodHit(tsos);
if (hit == nullptr) {
ATH_MSG_DEBUG("hit failed quality cuts and is rejected.");
continue;
} else {
ATH_MSG_DEBUG("hit passed quality cuts");
}
} else {
ATH_MSG_DEBUG("hit quality cuts NOT APPLIED to Silicon hit.");
}
} // hit is Pixel or SCT
// --- pixel
if (m_idHelper->is_pixel(surfaceID)){
if(m_pixelID->barrel_ec(surfaceID) == 0){
nhpixB++;
}
else if(m_pixelID->barrel_ec(surfaceID) == 2) nhpixECA++;
else if(m_pixelID->barrel_ec(surfaceID) == -2) nhpixECC++;
}
// --- sct
else if (m_idHelper->is_sct(surfaceID)){
if(m_sctID->barrel_ec(surfaceID) == 0){
nhsctB++;
}
else if(m_sctID->barrel_ec(surfaceID) == 2) nhsctECA++;
else if(m_sctID->barrel_ec(surfaceID) == -2) nhsctECC++;
}
// --- trt
if (m_idHelper->is_trt(surfaceID)){
int barrel_ec = m_trtID->barrel_ec(surfaceID);
if(barrel_ec == 1 || barrel_ec == -1 ) {
nhtrtB++;
}
else if(barrel_ec == 2){
nhtrtECA++;
}else if(barrel_ec == -2){
nhtrtECC++;
}
}
}
}
int nhpix= nhpixB +nhpixECA + nhpixECC;
int nhsct= nhsctB +nhsctECA + nhsctECC;
int nhtrt= nhtrtB +nhtrtECA + nhtrtECC;
int nhits= nhpix+ nhsct+ nhtrt;
nHits += nhits;
auto nhits_per_track_m = Monitored::Scalar<float>( "m_nhits_per_track", nhits );
fill(genericTrackGroup, nhits_per_track_m);
auto npixelhits_per_track_m = Monitored::Scalar<float>( "m_npixelhits_per_track", nhpix );
fill(genericTrackGroup, npixelhits_per_track_m);
auto nscthits_per_track_m = Monitored::Scalar<float>( "m_nscthits_per_track", nhsct );
fill(genericTrackGroup, nscthits_per_track_m);
auto ntrthits_per_track_m = Monitored::Scalar<float>( "m_ntrthits_per_track", nhtrt );
fill(genericTrackGroup, ntrthits_per_track_m);
auto chi2oDoF_m = Monitored::Scalar<float>( "m_chi2oDoF", chi2oDoF );
fill(genericTrackGroup, chi2oDoF_m);
auto eta_m = Monitored::Scalar<float>( "m_eta", trketa );
fill(genericTrackGroup, eta_m);
if (charge>0){
auto eta_pos_m = Monitored::Scalar<float>( "m_eta_pos", trketa );
fill(genericTrackGroup, eta_pos_m);
}
else{
auto eta_neg_m = Monitored::Scalar<float>( "m_eta_neg", trketa );
fill(genericTrackGroup, eta_neg_m);
}
auto phi_m = Monitored::Scalar<float>( "m_phi", trkphi );
fill(genericTrackGroup, phi_m);
auto z0_m = Monitored::Scalar<float>( "m_z0", trkz0 );
fill(genericTrackGroup, z0_m);
float z0sintheta = trkz0*(sin(trktheta));
auto z0sintheta_m = Monitored::Scalar<float>( "m_z0sintheta", z0sintheta );
fill(genericTrackGroup, z0sintheta_m);
auto d0_m = Monitored::Scalar<float>( "m_d0", trkd0 );
fill(genericTrackGroup, d0_m);
auto d0_bscorr_m = Monitored::Scalar<float>( "m_d0_bscorr", d0bscorr );
fill(genericTrackGroup, d0_bscorr_m);
float pT = charge*trkpt;
auto pT_m = Monitored::Scalar<float>( "m_pT", pT );
fill(genericTrackGroup, pT_m);
auto p_m = Monitored::Scalar<float>( "m_p", trkP );
fill(genericTrackGroup, p_m);
delete myIPandSigma;
myIPandSigma=nullptr;
} // end of loop on trks
ATH_MSG_DEBUG("Number of good tracks from TrackCollection: " << ngTracks);
return StatusCode::SUCCESS;
}
const xAOD::Vertex* IDAlignMonGenericTracksAlg::findAssociatedVertexTP(const std::map<const xAOD::TrackParticle*, const xAOD::Vertex*>& trackVertexMapTP, const xAOD::TrackParticle *track) const
{
std::map<const xAOD::TrackParticle*, const xAOD::Vertex* >::const_iterator tpVx = trackVertexMapTP.find( track);
if (tpVx == trackVertexMapTP.end() ){
ATH_MSG_VERBOSE("Did not find the vertex. Returning 0");
return 0;
}
return (*tpVx).second;
}
const Trk::Track* IDAlignMonGenericTracksAlg::getTrkTrack(const Trk::VxTrackAtVertex *trkAtVx)const
{
//find the link to the TrackParticleBase
const Trk::ITrackLink* trkLink = trkAtVx->trackOrParticleLink();
const Trk::TrackParticleBase* trkPB(0);
if(0!= trkLink){
const Trk::LinkToTrackParticleBase* linktrkPB = dynamic_cast<const Trk::LinkToTrackParticleBase *>(trkLink);
if(0!= linktrkPB){
if(linktrkPB->isValid()) trkPB = linktrkPB->cachedElement();
}//end of dynamic_cast check
}//end of ITrackLink existance check
//cast to TrackParticle
if(trkPB){
if ( trkPB->trackElementLink()->isValid() ) {
// retrieve and refit original track
const Trk::Track* trktrk = trkPB->originalTrack();
return trktrk;
}
}
return 0;
}
bool IDAlignMonGenericTracksAlg::fillVertexInformation(std::map<const xAOD::TrackParticle*, const xAOD::Vertex*>& trackVertexMapTP, const EventContext& ctx ) const
{
ATH_MSG_DEBUG("Generic Tracks: fillVertexInformation(): Checking ");
trackVertexMapTP.clear();
// retrieving vertices
auto handle_vxContainer = SG::makeHandle(m_VxPrimContainerName, ctx);
if (!handle_vxContainer.isPresent()) {
ATH_MSG_DEBUG ("InDetGlobalPrimaryVertexMonAlg: StoreGate doesn't contain primary vertex container with key "+m_VxPrimContainerName.key());
return false;
}
if (!handle_vxContainer.isValid()) {
ATH_MSG_ERROR ("InDetGlobalPrimaryVertexMonAlg: Could not retrieve primary vertex container with key "+m_VxPrimContainerName.key());
return false;
}
auto vertexContainer = handle_vxContainer.cptr();
for(const auto & vtx : *vertexContainer) {
auto tpLinks = vtx->trackParticleLinks();
ATH_MSG_DEBUG("tpLinks size " << tpLinks.size());
if (tpLinks.size() > 4 ) {
for(auto link: tpLinks) {
const xAOD::TrackParticle *TP = *link;
if(TP) {
trackVertexMapTP.insert( std::make_pair( TP, vtx ) );
}
}
}
}
return true;
}
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef IDAlignMonGenericTracksAlg_H
#define IDAlignMonGenericTracksAlg_H
// **********************************************************************
// IDAlignMonGenericTracksAlg.h
// AUTHORS: Beate Heinemann, Tobias Golling
// Adapted to AthenaMT 2021 by Per Johansson
// **********************************************************************
#include "TrkVertexFitterInterfaces/ITrackToVertexIPEstimator.h"
#include "GaudiKernel/StatusCode.h"
#include "GaudiKernel/EventContext.h"
#include "AthenaMonitoring/AthMonitorAlgorithm.h"
#include "AthenaMonitoringKernel/Monitored.h"
#include "EventPrimitives/EventPrimitives.h"
#include "EventPrimitives/EventPrimitivesHelpers.h"
#include "xAODTracking/TrackParticle.h"
#include "xAODTracking/TrackParticleContainer.h"
#include "xAODTracking/Vertex.h"
#include "xAODTracking/VertexContainer.h"
#include "BeamSpotConditionsData/BeamSpotData.h"
#include "StoreGate/ReadHandleKey.h"
//------------TrackMon------------
#include "TrkToolInterfaces/ITrackHoleSearchTool.h"
#include "InDetTrackSelectionTool/IInDetTrackSelectionTool.h"
#include "TrkTrack/Track.h"
#include "TrkTrack/TrackCollection.h"
#include "TrkTrackSummary/TrackSummary.h"
#include "TrkToolInterfaces/ITrackSummaryTool.h"
#include <vector>
#include <map>
class AtlasDetectorID;
class PixelID;
class SCT_ID;
class TRT_ID;
namespace Trk {
class Track;
class VxTrackAtVertex;
}
class IInDetAlignHitQualSelTool;
class IDAlignMonGenericTracksAlg : public AthMonitorAlgorithm {
public:
IDAlignMonGenericTracksAlg( const std::string & name, ISvcLocator* pSvcLocator );
virtual ~IDAlignMonGenericTracksAlg();
virtual StatusCode initialize() override;
virtual StatusCode fillHistograms( const EventContext& ctx ) const override;
protected:
bool m_hasBeamCondSvc;
private:
bool fillVertexInformation(std::map<const xAOD::TrackParticle*, const xAOD::Vertex*>& trackVertexMapTP, const EventContext& ctx ) const;
const Trk::Track* getTrkTrack(const Trk::VxTrackAtVertex*)const;
const xAOD::Vertex* findAssociatedVertexTP(const std::map<const xAOD::TrackParticle*, const xAOD::Vertex*>& trackVertexMapTP, const xAOD::TrackParticle *) const;
const AtlasDetectorID* m_idHelper;
const PixelID* m_pixelID;
const SCT_ID* m_sctID;
const TRT_ID* m_trtID;
float m_barrelEta;
bool m_extendedPlots;
float m_d0Range;
float m_d0BsRange;
float m_pTRange;
float m_z0Range;
float m_etaRange;
int m_NTracksRange;
bool m_doIP;
bool m_doHitQuality;
SG::ReadHandleKey<xAOD::VertexContainer> m_VxPrimContainerName{this,"vxPrimContainerName","PrimaryVertices","Primary Vertices for Alignment Monitoring"};
SG::ReadHandleKey<TrackCollection> m_tracksKey {this, "TrackName", "ExtendedTracks", "track data key"};
SG::ReadHandleKey<TrackCollection> m_tracksName {this, "TrackName2", "ExtendedTracks", "track data key"};
SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };
ToolHandle<InDet::IInDetTrackSelectionTool> m_trackSelection; // baseline
ToolHandle<IInDetAlignHitQualSelTool> m_hitQualityTool;
PublicToolHandle< Trk::ITrackToVertexIPEstimator > m_trackToVertexIPEstimator
{this,"TrackToVertexIPEstimator","Trk::TrackToVertexIPEstimator",""};
std::string m_Pixel_Manager;
std::string m_SCT_Manager;
std::string m_TRT_Manager;
};
#endif
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
// **********************************************************************
// IDAlignMonResiduals.cxx
// AUTHORS: Beate Heinemann, Tobias Golling, Ben Cooper, John Alison, Pierfrancesco Butti
// Adapted to AthenaMT 2021 by Per Johansson
// **********************************************************************
#ifndef IDAlignMonResidualsAlg_H
#define IDAlignMonResidualsAlg_H
#include "AthenaMonitoring/AthMonitorAlgorithm.h"
#include "AthenaMonitoringKernel/Monitored.h"
#include "StoreGate/ReadHandleKey.h"
#include "EventPrimitives/EventPrimitives.h"
#include "GaudiKernel/EventContext.h"
#include "CommissionEvent/ComTime.h"
#include "InDetTrackSelectionTool/IInDetTrackSelectionTool.h"
#include "TrkTrack/Track.h"
#include "TrkTrack/TrackCollection.h"
#include "TrkParameters/TrackParameters.h"
#include "TRT_ConditionsServices/ITRT_CalDbTool.h"
#include <string>
#include <vector>
#include <vector>
class ITRT_CalDbTool;
class AtlasDetectorID;
class PixelID;
class SCT_ID;
class TRT_ID;
namespace InDetDD{
class PixelDetectorManager;
class SCT_DetectorManager;
}
namespace Trk {
class IUpdator;
class IPropagator;
class RIO_OnTrack;
class Track;
class TrackStateOnSurface;
class IResidualPullCalculator;
}
class IInDetAlignHitQualSelTool;
class IDAlignMonResidualsAlg : public AthMonitorAlgorithm {
public:
IDAlignMonResidualsAlg( const std::string & name, ISvcLocator* pSvcLocator );
virtual ~IDAlignMonResidualsAlg();
virtual StatusCode initialize() override;
virtual StatusCode fillHistograms( const EventContext& ctx ) const override;
/** Convert from an int to a string */
std::string intToString(int input);
private:
StatusCode setupTools(); //PJ setup managers and helpers, etc.
bool isEdge(const Trk::RIO_OnTrack*) const;
std::pair<const Trk::TrackStateOnSurface*, const Trk::TrackStateOnSurface*> findOverlapHit(const Trk::Track*, const Trk::RIO_OnTrack*) const;
StatusCode getSiResiduals(const Trk::Track*, const Trk::TrackStateOnSurface*, bool, double*) const;
std::unique_ptr <Trk::TrackParameters> getUnbiasedTrackParameters(const Trk::Track*, const Trk::TrackStateOnSurface*) const;
bool trackRequiresRefit(const Trk::Track*) const;
float m_maxPtEC{}; // threshold for low-pt EC distributions
//tools
const AtlasDetectorID* m_idHelper{};
const InDetDD::PixelDetectorManager* m_PIX_Mgr{};
const InDetDD::SCT_DetectorManager* m_SCT_Mgr{};
const PixelID* m_pixelID{};
const SCT_ID* m_sctID{};
const TRT_ID* m_trtID{};
SG::ReadHandleKey<TrackCollection> m_tracksKey {this,"TrackName", "CombinedInDetTracks", "track data key"};
SG::ReadHandleKey<TrackCollection> m_tracksName {this,"TrackName2","CombinedInDetTracks", "track data key"};
SG::ReadHandleKey<ComTime> m_comTimeObjectName {this, "ComTimeObjectName", "TRT_Phase"};
ToolHandle<ITRT_CalDbTool> m_trtcaldbTool;
ToolHandle<Trk::IUpdator> m_iUpdator;
ToolHandle<Trk::IPropagator> m_propagator;
ToolHandle<Trk::IResidualPullCalculator> m_residualPullCalculator; //!< The residual and pull calculator tool handle
ToolHandle<InDet::IInDetTrackSelectionTool> m_trackSelection; // baseline
ToolHandle<IInDetAlignHitQualSelTool> m_hitQualityTool;
std::string m_Pixel_Manager;
std::string m_SCT_Manager;
bool m_extendedPlots;
bool m_doHitQuality;
int m_checkrate {};
bool m_doPulls {};
const std::string m_layers[4]{"b0", "b1", "b2", "b3"}; //
};
#endif
#include "../IDAlignMonGenericTracksAlg.h"
#include "../IDAlignMonResidualsAlg.h"
DECLARE_COMPONENT( IDAlignMonGenericTracksAlg )
DECLARE_COMPONENT( IDAlignMonResidualsAlg )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment