diff --git a/DataQuality/DataQualityTools/python/DQTLumiMonAlg.py b/DataQuality/DataQualityTools/python/DQTLumiMonAlg.py index 28df47023aa73c43a324a468d4a5b1e034e3e70a..9e77d611740c2014b836414e8177e84cac5951d0 100644 --- a/DataQuality/DataQualityTools/python/DQTLumiMonAlg.py +++ b/DataQuality/DataQualityTools/python/DQTLumiMonAlg.py @@ -17,9 +17,9 @@ def DQTLumiMonAlgConfig(flags, isOld=False): # triggers, and the final using only electron triggers. DQTLumiMonAlgConfigByTriggerChain(helper, DQTLumiMonAlg) DQTLumiMonAlgConfigByTriggerChain(helper, DQTLumiMonAlg, - 'CATEGORY_monitoring_muonIso','EF_muX') + 'CATEGORY_monitoring_muonIso','EF_muX') DQTLumiMonAlgConfigByTriggerChain(helper, DQTLumiMonAlg, - 'CATEGORY_primary_single_ele','EF_eX') + 'CATEGORY_primary_single_ele','EF_eX') if isOld: return helper.result() else: @@ -28,7 +28,6 @@ def DQTLumiMonAlgConfig(flags, isOld=False): result.merge(AtlasGeometryCfg(flags)) return result - def DQTLumiMonAlgConfigByTriggerChain(helper, algConfObj, triggerChain='', triggerPath=''): monAlg = helper.addAlgorithm(algConfObj, 'DQTLumiMonAlg'+triggerPath) @@ -39,50 +38,56 @@ def DQTLumiMonAlgConfigByTriggerChain(helper, algConfObj, triggerChain='', trigg else: triggerPath = 'AnyTrigger' - groupName = 'default' groupPath = 'GLOBAL/Luminosity/'+triggerPath - group = helper.addGroup(monAlg, groupName, groupPath, 'run') + group = helper.addGroup(monAlg, 'default', groupPath, 'run') pixelgroup = helper.addGroup(monAlg, 'pixel', groupPath, 'run') nLooseT = 'Number of Loose Vertices' nTightT = 'Number of Tight Vertices' nPixClusterT = 'Number of Pixel Clusters' + # Vertex parameters. A vertex + monAlg.TightTrackWeight = 0.01 + monAlg.TightNTracks = 4 + + # Plots of luminosity variables as a function of lb number group.defineHistogram('LB,avgLumi', type='TProfile', xbins=1000, xmin=0, xmax=10000, - title='Average Lumi vs LB',opt='kAddBinsDynamically') + title='Average Lumi vs LB', opt='kAddBinsDynamically') group.defineHistogram('LB,avgIntPerXing', type='TProfile', xbins=1000, xmin=0, xmax=10000, - title='Average Mu vs LB',opt='kAddBinsDynamically') + title='Average Mu vs LB', opt='kAddBinsDynamically') group.defineHistogram('LB,lumiPerBCID', type='TProfile', xbins=1000, xmin=0, xmax=10000, - title='Instantaneous Luminosity vs LB',opt='kAddBinsDynamically') + title='Instantaneous Luminosity vs LB', opt='kAddBinsDynamically') group.defineHistogram('LB,intPerXing', type='TProfile', xbins=1000, xmin=0, xmax=10000, - title='Instaneous interactions vs LB',opt='kAddBinsDynamically') + title='Instaneous interactions vs LB', opt='kAddBinsDynamically') group.defineHistogram('LB,duration', type='TProfile', xbins=1000, xmin=0, xmax=10000, - title='Lumi Block time in sec vs LB',opt='kAddBinsDynamically') + title='Lumi Block time in sec vs LB', opt='kAddBinsDynamically') group.defineHistogram('LB,avgLiveFrac', type='TProfile', xbins=1000, xmin=0, xmax=10000, title='Average live fraction lumi over all BCIDs vs LB', opt='kAddBinsDynamically') group.defineHistogram('LB,liveFracPerBCID', type='TProfile', xbins=1000, xmin=0, xmax=10000, - title='Current BCID lumi vs LB',opt='kAddBinsDynamically') + title='Current BCID lumi vs LB', opt='kAddBinsDynamically') group.defineHistogram('LB,lumiWeight', type='TProfile', xbins=1000, xmin=0, xmax=10000, - title='Current BCID lumi vs LB',opt='kAddBinsDynamically') - + title='Current BCID lumi vs LB', opt='kAddBinsDynamically') group.defineHistogram('LB,avgMu', type='TProfile', xbins=200, xmin=0.5, xmax=200.5, title='Number of interactions per event;LB;<#mu>_{LB}', opt='kAddBinsDynamically') + + # Vertex counts vs. lb number (loose and tight) group.defineHistogram('LB,nLooseVtx', type='TProfile', xbins=200, xmin=0.5, xmax=200.5, title=nLooseT+' per event;LB;<NlooseVtx/event>_{LB}', opt='kAddBinsDynamically') group.defineHistogram('LB,nTightVtx', type='TProfile', xbins=200, xmin=0.5, xmax=200.5, title=nTightT+' per event;LB;<NtightVtx/event>_{LB}', opt='kAddBinsDynamically') - group.defineHistogram('LB,nLooseVtx;nLooseVtx_perAvgMu', weight='avgMuInverse', - xbins=200, xmin=0.5, xmax=200.5,type='TProfile', - title=nLooseT+' per event per Mu;LB;<NlooseVtx/event/#mu>_{LB}', - opt='kAddBinsDynamically') - group.defineHistogram('LB,nTightVtx;nTightVtx_perAvgMu', weight='avgMuInverse', - xbins=200, xmin=0.5, xmax=200.5,type='TProfile', - title=nTightT+' per event per Mu;LB;<NtightVtx/event/#mu>_{LB}', - opt='kAddBinsDynamically') + # Vertex counts per avg mu vs. lb number. (Same as above, just weighted.) + group.defineHistogram('LB,nLooseVtxPerAvgMu', type='TProfile', opt='kAddBinsDynamically', + xbins=200, xmin=0.5, xmax=200.5, + title=nLooseT+' per event per Mu;LB;<NlooseVtx/event/#mu>_{LB}') + group.defineHistogram('LB,nTightVtxPerAvgMu', type='TProfile', opt='kAddBinsDynamically', + xbins=200, xmin=0.5, xmax=200.5, + title=nTightT+' per event per Mu;LB;<NtightVtx/event/#mu>_{LB}') + + # Vertex counts vs. avg mu. group.defineHistogram('aveMu,nLooseVtx', type='TProfile', xbins=250, xmin=0, xmax=25, title=nLooseT+' per event;#mu;NlooseVtx/event', opt='kAddBinsDynamically') @@ -90,57 +95,62 @@ def DQTLumiMonAlgConfigByTriggerChain(helper, algConfObj, triggerChain='', trigg title=nTightT+' per event;#mu;NtightVtx/event', opt='kAddBinsDynamically') - pixelgroup.defineHistogram('LB,nClustersAll', type='TProfile', xbins=200, xmin=0.5, xmax=200.5, - title=nPixClusterT+', all;LB;<NclustersAll/event>_{LB}', - opt='kAddBinsDynamically') - pixelgroup.defineHistogram('LB,nClustersECA', type='TProfile', xbins=200, xmin=0.5, xmax=200.5, - title=nPixClusterT+', endcap A;LB;<NlustersECA/event>_{LB}', - opt='kAddBinsDynamically') - pixelgroup.defineHistogram('LB,nClustersECC', type='TProfile', xbins=200, xmin=0.5, xmax=200.5, - title=nPixClusterT+', endcap C;LB;<NclustersECC/event>_{LB}', - opt='kAddBinsDynamically') - pixelgroup.defineHistogram('LB,nClustersB0', type='TProfile', xbins=200, xmin=0.5, xmax=200.5, - title=nPixClusterT+', barrel layer 0;LB;<NclustersB0/event>_{LB}', - opt='kAddBinsDynamically') - pixelgroup.defineHistogram('LB,nClustersB1', type='TProfile', xbins=200, xmin=0.5, xmax=200.5, - title=nPixClusterT+', barrel layer 1;LB;<NclustersB1/event>_{LB}', - opt='kAddBinsDynamically') - pixelgroup.defineHistogram('LB,nClustersB2', type='TProfile', xbins=200, xmin=0.5, xmax=200.5, - title=nPixClusterT+', barrel layer 2;LB;<NclustersB2/event>_{LB}', - opt='kAddBinsDynamically') - pixelgroup.defineHistogram('LB,nClustersAll;LB_vs_nClustersAll_perAvgMu', opt='kAddBinsDynamically', - xbins=200, xmin=0.5, xmax=200.5, type='TProfile', weight='avgMuInverse', - title=nPixClusterT+' per Mu, all;LB;<NclustersAll/event/#mu>_{LB}') - pixelgroup.defineHistogram('LB,nClustersECA;LB_vs_nClustersECA_perAvgMu', opt='kAddBinsDynamically', - xbins=200, xmin=0.5, xmax=200.5, type='TProfile', weight='avgMuInverse', - title=nPixClusterT+' per Mu, endcap A;LB;<NlustersECA/event/#mu>_{LB}') - pixelgroup.defineHistogram('LB,nClustersECC;LB_vs_nClustersECC_perAvgMu', opt='kAddBinsDynamically', - xbins=200, xmin=0.5, xmax=200.5, type='TProfile', weight='avgMuInverse', - title=nPixClusterT+' per Mu, endcap C;LB;<NclustersECC/event/#mu>_{LB}') - pixelgroup.defineHistogram('LB,nClustersB0;LB_vs_nClustersB0_perAvgMu', opt='kAddBinsDynamically', - xbins=200, xmin=0.5, xmax=200.5, type='TProfile', weight='avgMuInverse', - title=nPixClusterT+' per Mu, barrel layer 0;LB;<NclustersB0/event/#mu>_{LB}') - pixelgroup.defineHistogram('LB,nClustersB1;LB_vs_nClustersB1_perAvgMu', opt='kAddBinsDynamically', - xbins=200, xmin=0.5, xmax=200.5, type='TProfile', weight='avgMuInverse', - title=nPixClusterT+' per Mu, barrel layer 1;LB;<NclustersB1/event/#mu>_{LB}') - pixelgroup.defineHistogram('LB,nClustersB2;LB_vs_nClustersB2_perAvgMu', opt='kAddBinsDynamically', - xbins=200, xmin=0.5, xmax=200.5, type='TProfile', weight='avgMuInverse', - title=nPixClusterT+' per Mu, barrel layer 2;LB;<NclustersB2/event/#mu>_{LB}') - pixelgroup.defineHistogram('aveMu,nClustersAll', type='TProfile', xbins=250, xmin=0, xmax=25, - title=nPixClusterT+', all;#mu;NclustersAll/event', - opt='kAddBinsDynamically') - pixelgroup.defineHistogram('aveMu,nClustersECA', type='TProfile', xbins=250, xmin=0, xmax=25, - title=nPixClusterT+', endcap A;#mu;NclustersECA/event', - opt='kAddBinsDynamically') - pixelgroup.defineHistogram('aveMu,nClustersECC', type='TProfile', xbins=250, xmin=0, xmax=25, - title=nPixClusterT+', endcap C;#mu;NclustersECC/event', - opt='kAddBinsDynamically') - pixelgroup.defineHistogram('aveMu,nClustersB0', type='TProfile', xbins=250, xmin=0, xmax=25, - title=nPixClusterT+', barrel layer 0;#mu;NclustersB0/event', - opt='kAddBinsDynamically') - pixelgroup.defineHistogram('aveMu,nClustersB1', type='TProfile', xbins=250, xmin=0, xmax=25, - title=nPixClusterT+', barrel layer 1;#mu;NclustersB1/event', - opt='kAddBinsDynamically') - pixelgroup.defineHistogram('aveMu,nClustersB2', type='TProfile', xbins=250, xmin=0, xmax=25, - title=nPixClusterT+', barrel layer 2;#mu;NclustersB2/event', - opt='kAddBinsDynamically') + # Pixel clusters vs lb number. All, and then eparately for each endcap and barrel layer. + pixelgroup.defineHistogram('LB,nClustersAll', type='TProfile', opt='kAddBinsDynamically', + xbins=200, xmin=0.5, xmax=200.5, + title=nPixClusterT+', all;LB;<NclustersAll/event>_{LB}') + pixelgroup.defineHistogram('LB,nClustersECA', type='TProfile', opt='kAddBinsDynamically', + xbins=200, xmin=0.5, xmax=200.5, + title=nPixClusterT+', endcap A;LB;<NlustersECA/event>_{LB}') + pixelgroup.defineHistogram('LB,nClustersECC', type='TProfile', opt='kAddBinsDynamically', + xbins=200, xmin=0.5, xmax=200.5, + title=nPixClusterT+', endcap C;LB;<NclustersECC/event>_{LB}') + pixelgroup.defineHistogram('LB,nClustersB0', type='TProfile', opt='kAddBinsDynamically', + xbins=200, xmin=0.5, xmax=200.5, + title=nPixClusterT+', barrel layer 0;LB;<NclustersB0/event>_{LB}') + pixelgroup.defineHistogram('LB,nClustersB1', type='TProfile', opt='kAddBinsDynamically', + xbins=200, xmin=0.5, xmax=200.5, + title=nPixClusterT+', barrel layer 1;LB;<NclustersB1/event>_{LB}') + pixelgroup.defineHistogram('LB,nClustersB2', type='TProfile', opt='kAddBinsDynamically', + xbins=200, xmin=0.5, xmax=200.5, + title=nPixClusterT+', barrel layer 2;LB;<NclustersB2/event>_{LB}') + + # Pixel clusters per avg mu vs. lb number. (Same as above, just weighted.) + pixelgroup.defineHistogram('LB,nClustersAllPerAvgMu', type='TProfile', opt='kAddBinsDynamically', + xbins=200, xmin=0.5, xmax=200.5, + title=nPixClusterT+' per Mu, all;LB;<NclustersAll/event/#mu>_{LB}') + pixelgroup.defineHistogram('LB,nClustersECAPerAvgMu', type='TProfile', opt='kAddBinsDynamically', + xbins=200, xmin=0.5, xmax=200.5, + title=nPixClusterT+' per Mu, endcap A;LB;<NlustersECA/event/#mu>_{LB}') + pixelgroup.defineHistogram('LB,nClustersECCPerAvgMu', type='TProfile', opt='kAddBinsDynamically', + xbins=200, xmin=0.5, xmax=200.5, + title=nPixClusterT+' per Mu, endcap C;LB;<NclustersECC/event/#mu>_{LB}') + pixelgroup.defineHistogram('LB,nClustersB0PerAvgMu', type='TProfile', opt='kAddBinsDynamically', + xbins=200, xmin=0.5, xmax=200.5, + title=nPixClusterT+' per Mu, barrel layer 0;LB;<NclustersB0/event/#mu>_{LB}') + pixelgroup.defineHistogram('LB,nClustersB1PerAvgMu', type='TProfile', opt='kAddBinsDynamically', + xbins=200, xmin=0.5, xmax=200.5, + title=nPixClusterT+' per Mu, barrel layer 1;LB;<NclustersB1/event/#mu>_{LB}') + pixelgroup.defineHistogram('LB,nClustersB2PerAvgMu', type='TProfile', opt='kAddBinsDynamically', + xbins=200, xmin=0.5, xmax=200.5, + title=nPixClusterT+' per Mu, barrel layer 2;LB;<NclustersB2/event/#mu>_{LB}') + + # Pixel clusters vs. avg mu. All, then separately for each endcap and barrel layer. + pixelgroup.defineHistogram('aveMu,nClustersAll', type='TProfile', opt='kAddBinsDynamically', + xbins=250, xmin=0, xmax=25, + title=nPixClusterT+', all;#mu;NclustersAll/event') + pixelgroup.defineHistogram('aveMu,nClustersECA', type='TProfile', opt='kAddBinsDynamically', + xbins=250, xmin=0, xmax=25, + title=nPixClusterT+', endcap A;#mu;NclustersECA/event') + pixelgroup.defineHistogram('aveMu,nClustersECC', type='TProfile', opt='kAddBinsDynamically', + xbins=250, xmin=0, xmax=25, + title=nPixClusterT+', endcap C;#mu;NclustersECC/event') + pixelgroup.defineHistogram('aveMu,nClustersB0', type='TProfile', opt='kAddBinsDynamically', + xbins=250, xmin=0, xmax=25, + title=nPixClusterT+', barrel layer 0;#mu;NclustersB0/event') + pixelgroup.defineHistogram('aveMu,nClustersB1', type='TProfile', opt='kAddBinsDynamically', + xbins=250, xmin=0, xmax=25, + title=nPixClusterT+', barrel layer 1;#mu;NclustersB1/event') + pixelgroup.defineHistogram('aveMu,nClustersB2', type='TProfile', opt='kAddBinsDynamically', + xbins=250, xmin=0, xmax=25, + title=nPixClusterT+', barrel layer 2;#mu;NclustersB2/event') diff --git a/DataQuality/DataQualityTools/src/DQTLumiMonAlg.cxx b/DataQuality/DataQualityTools/src/DQTLumiMonAlg.cxx index 205298679af88fd1f43d509ea58f8a1c968a73a5..8c4fcb568a709783dec668fcd0c60e57faf6dbc3 100644 --- a/DataQuality/DataQualityTools/src/DQTLumiMonAlg.cxx +++ b/DataQuality/DataQualityTools/src/DQTLumiMonAlg.cxx @@ -31,8 +31,7 @@ StatusCode DQTLumiMonAlg::fillHistograms(const EventContext& ctx) const { auto lumiBlock = Scalar<int>("LB", eventInfo->lumiBlock()); auto avgMu = Scalar("avgMu", eventInfo->averageInteractionsPerCrossing()); - auto avgMuInverse = Scalar("avgMuInverse",0.0); - if (avgMu>0) avgMuInverse = 1./avgMu; + float avgMuInverse = avgMu>0 ? 1./avgMu : 0.; auto avgLumi = Scalar("avgLumi", lbAverageLuminosity(ctx)); auto avgIntPerXing = Scalar("avgIntPerXing", lbAverageInteractionsPerCrossing(ctx)); @@ -44,32 +43,29 @@ StatusCode DQTLumiMonAlg::fillHistograms(const EventContext& ctx) const { auto lumiWeight = Scalar("lumiWeight", lbLumiWeight(ctx)); RH<xAOD::VertexContainer> vertices(m_VertexContainerKey,ctx); - auto nVtxLoose = Scalar<int>("nVtxLoose",0); - auto nVtxTight = Scalar<int>("nVtxTight",0); + auto nLooseVtx = Scalar<int>("nLooseVtx",0); + auto nTightVtx = Scalar<int>("nTightVtx",0); if ( vertices.isValid() ) { for ( const auto vertex : *vertices ) { if (!vertex || !vertex->vxTrackAtVertexAvailable()) continue; - nVtxLoose++; + nLooseVtx++; auto tracks = vertex->vxTrackAtVertex(); int nGoodTracks = std::count_if(tracks.begin(),tracks.end(), [this](const auto track){return track.weight()>=m_tightTrackWeight;}); if ( nGoodTracks>=m_tightNTracks ) - nVtxTight++; + nTightVtx++; } } else { ATH_MSG_WARNING("Could not retrieve Vertex Container."); } + auto nLooseVtxPerAvgMu = Scalar<int>("nLooseVtxPerAvgMu",nLooseVtx*avgMuInverse); + auto nTightVtxPerAvgMu = Scalar<int>("nTightVtxPerAvgMu",nTightVtx*avgMuInverse); - fill(group,lumiBlock,avgMu,avgMuInverse,avgLumi,avgIntPerXing,lumiPerBCID,intPerXing, - duration,avgLiveFrac,liveFracPerBCID,lumiWeight,nVtxLoose,nVtxTight); + fill(group,lumiBlock,avgMu,avgLumi,avgIntPerXing,lumiPerBCID,intPerXing,duration, + avgLiveFrac,liveFracPerBCID,lumiWeight,nLooseVtx,nTightVtx,nLooseVtxPerAvgMu, + nTightVtxPerAvgMu); - auto nClustersAll = Scalar<int>("nClustersAll",0); - auto nClustersECA = Scalar<int>("nClustersECA",0); - auto nClustersECC = Scalar<int>("nClustersECC",0); - auto nClustersB0 = Scalar<int>("nClustersB0",0); - auto nClustersB1 = Scalar<int>("nClustersB1",0); - auto nClustersB2 = Scalar<int>("nClustersB2",0); if ( m_environment!=Environment_t::AOD ) { RH<InDet::PixelClusterContainer> pixelClusters(m_PixelClustersKey,ctx); RH<PixelID> pixelID(m_PixelIDKey,ctx); @@ -78,6 +74,12 @@ StatusCode DQTLumiMonAlg::fillHistograms(const EventContext& ctx) const { } else if ( !pixelID.isValid() ) { ATH_MSG_WARNING("Could not retrieve Pixel ID."); } else { + auto nClustersAll = Scalar<int>("nClustersAll",0); + auto nClustersECA = Scalar<int>("nClustersECA",0); + auto nClustersECC = Scalar<int>("nClustersECC",0); + auto nClustersB0 = Scalar<int>("nClustersB0",0); + auto nClustersB1 = Scalar<int>("nClustersB1",0); + auto nClustersB2 = Scalar<int>("nClustersB2",0); for ( auto cluster : *pixelClusters ) { if (!cluster) continue; @@ -96,8 +98,18 @@ StatusCode DQTLumiMonAlg::fillHistograms(const EventContext& ctx) const { } ATH_MSG_DEBUG("nClustersAll is " << nClustersAll); } - fill("pixel",lumiBlock,avgMu,nClustersAll,nClustersECA,nClustersECC, - nClustersB0,nClustersB1,nClustersB2,avgMuInverse); + auto nClustersAllPerAvgMu = Scalar<int>("nClustersAllPerAvg",nClustersAll*avgMuInverse); + auto nClustersECAPerAvgMu = Scalar<int>("nClustersECAPerAvg",nClustersECA*avgMuInverse); + auto nClustersECCPerAvgMu = Scalar<int>("nClustersECCPerAvg",nClustersECC*avgMuInverse); + auto nClustersB0PerAvgMu = Scalar<int>("nClustersB0PerAvg",nClustersB0*avgMuInverse); + auto nClustersB1PerAvgMu = Scalar<int>("nClustersB1PerAvg",nClustersB1*avgMuInverse); + auto nClustersB2PerAvgMu = Scalar<int>("nClustersB2PerAvg",nClustersB2*avgMuInverse); + + fill("pixel",lumiBlock,avgMu, + nClustersAll,nClustersECA,nClustersECC, + nClustersB0,nClustersB1,nClustersB2, + nClustersAllPerAvgMu,nClustersECAPerAvgMu,nClustersECCPerAvgMu, + nClustersB0PerAvgMu,nClustersB1PerAvgMu,nClustersB2PerAvgMu); } }