From 87e51e93b01b4906b0a5172fe64bd0b56dd1dde5 Mon Sep 17 00:00:00 2001 From: Leonid Serkin <lserkin@cern.ch> Date: Fri, 28 Feb 2020 16:07:16 +0100 Subject: [PATCH] InDetMonitoringGlobal for Run3 --- .../InDetRecExample/share/InDetMonitoring.py | 2 +- .../share/InDetMonitoringGlobalRun3Test.py | 70 ++++ .../CMakeLists.txt | 56 +++ .../InDetGlobalBeamSpotMonAlg.h | 90 +++++ .../InDetGlobalPrimaryVertexMonAlg.h | 88 ++++ .../InDetGlobalTrackMonAlg.h | 147 +++++++ .../python/InDetGlobalBeamSpotMonAlgCfg.py | 97 +++++ .../InDetGlobalMonitoringRun3TestConfig.py | 108 +++++ .../InDetGlobalPrimaryVertexMonAlgCfg.py | 74 ++++ .../python/InDetGlobalTrackMonAlgCfg.py | 152 +++++++ .../src/InDetGlobalBeamSpotMonAlg.cxx | 286 +++++++++++++ .../src/InDetGlobalPrimaryVertexMonAlg.cxx | 177 ++++++++ .../src/InDetGlobalTrackMonAlg.cxx | 378 ++++++++++++++++++ .../InDetGlobalMonitoringRun3Test_entries.cxx | 7 + 14 files changed, 1731 insertions(+), 1 deletion(-) create mode 100644 InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringGlobalRun3Test.py create mode 100644 InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/CMakeLists.txt create mode 100644 InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/InDetGlobalMonitoringRun3Test/InDetGlobalBeamSpotMonAlg.h create mode 100644 InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/InDetGlobalMonitoringRun3Test/InDetGlobalPrimaryVertexMonAlg.h create mode 100644 InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/InDetGlobalMonitoringRun3Test/InDetGlobalTrackMonAlg.h create mode 100644 InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/python/InDetGlobalBeamSpotMonAlgCfg.py create mode 100644 InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/python/InDetGlobalMonitoringRun3TestConfig.py create mode 100644 InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/python/InDetGlobalPrimaryVertexMonAlgCfg.py create mode 100644 InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/python/InDetGlobalTrackMonAlgCfg.py create mode 100644 InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/src/InDetGlobalBeamSpotMonAlg.cxx create mode 100644 InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/src/InDetGlobalPrimaryVertexMonAlg.cxx create mode 100644 InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/src/InDetGlobalTrackMonAlg.cxx create mode 100644 InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/src/components/InDetGlobalMonitoringRun3Test_entries.cxx diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoring.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoring.py index 1b9a83faadb7..ea0ca51d6aee 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoring.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoring.py @@ -11,7 +11,7 @@ from InDetRecExample.InDetJobProperties import InDetFlags if InDetFlags.doMonitoringGlobal() or InDetFlags.doMonitoringPrimaryVertexingEnhanced(): - include("InDetRecExample/InDetMonitoringGlobal.py") + include("InDetRecExample/InDetMonitoringGlobalRun3Test.py") if InDetFlags.doMonitoringPixel(): include( "InDetRecExample/InDetMonitoringPixel.py") if InDetFlags.doMonitoringSCT(): diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringGlobalRun3Test.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringGlobalRun3Test.py new file mode 100644 index 000000000000..3037c877c07c --- /dev/null +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringGlobalRun3Test.py @@ -0,0 +1,70 @@ +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# + +''' +@file InDetMonitoringGlobalRun3Test.py +@brief Top configuration of InDetMonitoringGlobalRun3Test in Run 3 style but in Run 2 environment +''' + +doInDetGlobalTrackMonAlg = True +doInDetGlobalPrimaryVertexMonAlg = True + +from InDetGlobalMonitoringRun3Test.InDetGlobalMonitoringRun3TestConf import InDetGlobalTrackMonAlg +from InDetGlobalMonitoringRun3Test.InDetGlobalTrackMonAlgCfg import InDetGlobalTrackMonAlgCfg + +from InDetGlobalMonitoringRun3Test.InDetGlobalMonitoringRun3TestConf import InDetGlobalPrimaryVertexMonAlg +from InDetGlobalMonitoringRun3Test.InDetGlobalPrimaryVertexMonAlgCfg import InDetGlobalPrimaryVertexMonAlgCfg + + +from InDetRecExample.InDetKeys import InDetKeys + + +kwargsInDetGlobalTrackMonAlg = { + 'DoIBL' : True, #InDetFlags.doIBL(), #Turn on/off IBL histograms + 'TrackName' : 'CombinedInDetTracks', #InDetKeys.Tracks() + 'TrackName2' : 'CombinedInDetTracks', # + 'TrackName3' : 'CombinedInDetTracks', # + } + +kwargsInDetGlobalPrimaryVertexMonAlg = { + 'vxContainerName' : 'PrimaryVertices', #InDetKeys.xAODVertexContainer(), + 'vxContainerNameWithOutBeamConstraint' : 'VxPrimaryCandidateWithBeamConstraint', #InDetKeys.PrimaryVerticesWithoutBeamConstraint(), + 'vxContainerNameSplit' : 'VxPrimaryCandidateSplitStream', #InDetKeys.PrimaryVerticesSplitStream(), + 'doEnhancedMonitoring' : False # InDetFlags.doMonitoringPrimaryVertexingEnhanced() + } + +from AthenaMonitoring.DQMonFlags import DQMonFlags + +# old magic +from AthenaMonitoring import AthMonitorCfgHelperOld +helper = AthMonitorCfgHelperOld(DQMonFlags, "InDetGlobalMonitoringRun3Test") + + +if doInDetGlobalTrackMonAlg: + inDetGlobalTrackMonAlg = helper.addAlgorithm(InDetGlobalTrackMonAlg, 'InDetGlobalTrackMonAlg') + for k, v in kwargsInDetGlobalTrackMonAlg.items(): + setattr(inDetGlobalTrackMonAlg, k, v) + + inDetGlobalTrackMonAlg.TrackSelectionTool.UseTrkTrackTools = True + inDetGlobalTrackMonAlg.TrackSelectionTool.CutLevel = "TightPrimary" + inDetGlobalTrackMonAlg.TrackSelectionTool.maxNPixelHoles = 1 + inDetGlobalTrackMonAlg.TrackSelectionTool.minPt = 5000 + inDetGlobalTrackMonAlg.TrackSelectionTool.TrackSummaryTool = InDetTrackSummaryTool + inDetGlobalTrackMonAlg.TrackSelectionTool.Extrapolator = InDetExtrapolator + + inDetGlobalTrackMonAlg.Tight_TrackSelectionTool.UseTrkTrackTools = True + inDetGlobalTrackMonAlg.Tight_TrackSelectionTool.CutLevel = "TightPrimary" + inDetGlobalTrackMonAlg.Tight_TrackSelectionTool.minPt = 5000 + inDetGlobalTrackMonAlg.Tight_TrackSelectionTool.TrackSummaryTool = InDetTrackSummaryTool + inDetGlobalTrackMonAlg.Tight_TrackSelectionTool.Extrapolator = InDetExtrapolator + + InDetGlobalTrackMonAlgCfg(helper, inDetGlobalTrackMonAlg, **kwargsInDetGlobalTrackMonAlg) + +if doInDetGlobalPrimaryVertexMonAlg: + myInDetGlobalPrimaryVertexMonAlg = helper.addAlgorithm(InDetGlobalPrimaryVertexMonAlg, 'InDetGlobalPrimaryVertexMonAlg') + for k, v in kwargsInDetGlobalPrimaryVertexMonAlg.items(): + setattr(myInDetGlobalPrimaryVertexMonAlg, k, v) + InDetGlobalPrimaryVertexMonAlgCfg(helper, myInDetGlobalPrimaryVertexMonAlg, **kwargsInDetGlobalPrimaryVertexMonAlg) + +topSequence += helper.result() diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/CMakeLists.txt b/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/CMakeLists.txt new file mode 100644 index 000000000000..d61850233029 --- /dev/null +++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/CMakeLists.txt @@ -0,0 +1,56 @@ +################################################################################ +# Package: InDetGlobalMonitoringRun3Test +################################################################################ + +# Declare the package name: +atlas_subdir( InDetGlobalMonitoringRun3Test ) + +# Declare the package's dependencies: +atlas_depends_on_subdirs( + PUBLIC + Control/AthenaMonitoring + DetectorDescription/AtlasDetDescr + GaudiKernel + InnerDetector/InDetDetDescr/PixelGeoModel + InnerDetector/InDetRawEvent/InDetRawData + InnerDetector/InDetRecEvent/InDetPrepRawData + Tracking/TrkEvent/TrkTrack + PRIVATE + Database/AthenaPOOL/AthenaPoolUtilities + DetectorDescription/GeoPrimitives + Event/xAOD/xAODEventInfo + Event/xAOD/xAODTracking + Event/EventPrimitives + InnerDetector/InDetConditions/InDetConditionsSummaryService + InnerDetector/InDetConditions/InDetByteStreamErrors + InnerDetector/InDetConditions/PixelConditionsTools + InnerDetector/InDetDetDescr/InDetIdentifier + InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelCabling + InnerDetector/InDetRecEvent/InDetRIO_OnTrack + InnerDetector/InDetRecTools/InDetTrackSelectionTool + InnerDetector/InDetConditions/BeamSpotConditionsData + Tools/LWHists + Tools/PathResolver + Tracking/TrkEvent/TrkParameters + Tracking/TrkEvent/TrkSpacePoint + Tracking/TrkEvent/TrkTrackSummary + Tracking/TrkEvent/VxVertex + Tracking/TrkVertexFitter/TrkVertexFitterInterfaces + Tracking/TrkTools/TrkToolInterfaces ) + +# External dependencies: +find_package( ROOT COMPONENTS Core MathCore Hist ) + +# Component(s) in the package: +atlas_add_component( InDetGlobalMonitoringRun3Test + InDetGlobalMonitoringRun3Test/*.h src/*.cxx src/components/*.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaMonitoringLib AtlasDetDescr + GaudiKernel InDetRawData InDetPrepRawData TrkTrack InDetByteStreamErrors + AthenaPoolUtilities GeoPrimitives xAODEventInfo EventPrimitives InDetIdentifier + InDetReadoutGeometry InDetRIO_OnTrack LWHists TrkParameters TrkSpacePoint VxVertex TrkVertexFitterInterfaces xAODTracking + TrkTrackSummary TrkToolInterfaces PixelCablingLib PixelGeoModelLib PathResolver BeamSpotConditionsData + InDetTrackSelectionToolLib ) + +atlas_install_python_modules( python/*.py ) diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/InDetGlobalMonitoringRun3Test/InDetGlobalBeamSpotMonAlg.h b/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/InDetGlobalMonitoringRun3Test/InDetGlobalBeamSpotMonAlg.h new file mode 100644 index 000000000000..a5bb7240fa65 --- /dev/null +++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/InDetGlobalMonitoringRun3Test/InDetGlobalBeamSpotMonAlg.h @@ -0,0 +1,90 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// ******************************************************************************** +// $Id:$ +// +// InDetGlobalBeamSpotMonAlg is a module to monitor primary vertices and the beam spot in +// the context of package InnerDetector/InDetMonitoring/InDetGlobalMonitoring. A +// scaled-down version doing only primary vertex monitoring is available as module +// InDetGlobalPrimaryVertexMonTool (the reason for having two tools is that in +// InDetGlobalBeamSpotMonAlg monitoring is done wrt beam spot, while InDetGlobalPrimaryVertexMonAlg +// does not use the beam spot). Originally, this module was developed in package +// InDetAlignmentMonitoring under the name InDetAlignMonBeamSpot. +// +// Written in March 2008 by Juerg Beringer (LBNL) +// Adapted to AthenaMT 2019 by Per Johansson (Sheffield University) +// +// ******************************************************************************** + +#ifndef InDetGlobalBeamSpotMonAlg_H +#define InDetGlobalBeamSpotMonAlg_H + +#include "AthenaMonitoring/AthMonitorAlgorithm.h" +#include "AthenaMonitoringKernel/Monitored.h" + +#include "StoreGate/ReadHandleKey.h" +#include <algorithm> + +// tracking +#include "TrkToolInterfaces/ITrackHoleSearchTool.h" +#include "InDetTrackSelectionTool/IInDetTrackSelectionTool.h" +#include "TrkTrack/TrackCollection.h" +#include "TrkTrackSummary/TrackSummary.h" +#include "TrkMeasurementBase/MeasurementBase.h" +#include "TrkRIO_OnTrack/RIO_OnTrack.h" +#include "InDetReadoutGeometry/SiDetectorElement.h" +#include "InDetRIO_OnTrack/SiClusterOnTrack.h" +#include "TrkToolInterfaces/ITrackSummaryTool.h" + +// xAOD +#include "xAODTracking/TrackParticleContainer.h" +#include "xAODTracking/VertexContainer.h" +#include "xAODTracking/Vertex.h" + +//for Amg::error helper function: +#include "EventPrimitives/EventPrimitives.h" +#include "EventPrimitives/EventPrimitivesHelpers.h" + +#include "InDetConditionsSummaryService/IInDetConditionsTool.h" + +// Beam condition include(s): +#include "BeamSpotConditionsData/BeamSpotData.h" + +//#include <vector> +#include <string> + +//namespace Trk { +// class ITrackHoleSearchTool;/ +//} + + +class InDetGlobalBeamSpotMonAlg : public AthMonitorAlgorithm { + + public: + + InDetGlobalBeamSpotMonAlg( const std::string & name, ISvcLocator* pSvcLocator); + virtual ~InDetGlobalBeamSpotMonAlg(); + virtual StatusCode initialize() override; + virtual StatusCode fillHistograms(const EventContext& ctx) const override; + std::string findComponentString(int bec, int ld) const; + + private: + + SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; + std::string m_stream; + + bool m_useBeamspot; + SG::ReadHandleKey<xAOD::VertexContainer> m_vxContainerName{this,"vxContainerName","PrimaryVertices","Vertex Container for Global Beamspot Monitoring"}; + bool m_vxContainerWithBeamConstraint; + + SG::ReadHandleKey<xAOD::TrackParticleContainer> m_trackContainerName{this,"trackContainerName","InDetTrackParticles","TrackParticle container for Global Beamspot Monitoring"}; + + std::string m_histFolder; + std::string m_triggerChainName; + unsigned int m_minTracksPerVtx; + float m_minTrackPt; +}; + +#endif diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/InDetGlobalMonitoringRun3Test/InDetGlobalPrimaryVertexMonAlg.h b/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/InDetGlobalMonitoringRun3Test/InDetGlobalPrimaryVertexMonAlg.h new file mode 100644 index 000000000000..f8744ca046fc --- /dev/null +++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/InDetGlobalMonitoringRun3Test/InDetGlobalPrimaryVertexMonAlg.h @@ -0,0 +1,88 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + + +/** @file InDetGlobalPrimaryVertexMonAlg.h + * Implementation of inner detector global primary vertex monitoring tool + * + *@author + * Leonid Serkin <lserkin@cern.ch> @n + * + * based on InDetGlobalPrimaryVertexMonTool.h + * + ****************************************************************************/ + +#ifndef InDetGlobalPrimaryVertexMonAlg_H +#define InDetGlobalPrimaryVertexMonAlg_H + +#include "AthenaMonitoring/AthMonitorAlgorithm.h" +#include "AthenaMonitoringKernel/Monitored.h" + +// tracking vertex +#include "StoreGate/ReadHandleKey.h" +#include "xAODTracking/VertexContainer.h" +#include "xAODTracking/Vertex.h" + +#include <string> +#include <algorithm> + +//for Amg::error helper function: +#include "EventPrimitives/EventPrimitivesHelpers.h" + +//Standard c++ +#include <string> +#include <map> +#include <vector> + + + +//------------------------------ + +namespace Trk { + class VxCandidate; +} + + + +class InDetGlobalPrimaryVertexMonAlg : public AthMonitorAlgorithm { + + public: + + InDetGlobalPrimaryVertexMonAlg( const std::string & name, ISvcLocator* pSvcLocator ); + virtual ~InDetGlobalPrimaryVertexMonAlg(); + virtual StatusCode initialize() override; + virtual StatusCode fillHistograms( const EventContext& ctx ) const override; + std::string findComponentString(int bec, int ld) const; + + + + private: + + SG::ReadHandleKey<xAOD::VertexContainer> m_vxContainerName{this,"vxContainerName","PrimaryVertices","Primary Vertices for Global Monitoring"}; + SG::ReadHandleKey<xAOD::VertexContainer> m_vxContainerNameWithoutBeamConstraint{this,"vxContainerNameWithOutBeamConstraint","VxPrimaryCandidateWithBeamConstraint","Vertices without beam constraint for Global Monitoring"}; + SG::ReadHandleKey<xAOD::VertexContainer> m_vxContainerNameSplit{this,"vxContainerNameSplit","VxPrimaryCandidateSplitStream","Split Vertices for Global Monitoring"}; + + int m_splitVertexTrkInvFraction; ///< store inverse of the fraction of input tracks used for probe vertex (1:N) + float m_distanceSplitVxMatch; ///< store maximum distance for matching split vertices to original non-BC vertex + /** store metric to be used for split vertex matching in selection efficiency + * Values currently implemented: + * 0: dummy metric; returns zero distance + * 1: simple delta-z metric + * 2: 3-D distance divided by the error (dominated by Delta z) + * 3: quadratic sum of distances divided by their errors in the 3 directions. Expected RMS = 1. Default. + */ + + int m_splitMatchingMetric; + bool m_doEnhancedMonitoring; // trigger the enhanced monitoring (to be activated by InDetFlags.doMonitoringPrimaryVertexingEnhanced because split vertexing and vertexing with no beam constraint need to be run as well) + +// Helper functions + /** Returns matching distance between split and original vertex. + * @param splitVx pointer to split vertex + * @param originalVx pointer to original non-BC vertex + * @return distance for matching split to original Vertex + */ + double GetSplitMatchDistance(const xAOD::Vertex* splitVx, const xAOD::Vertex* originalVx); + +}; +#endif diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/InDetGlobalMonitoringRun3Test/InDetGlobalTrackMonAlg.h b/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/InDetGlobalMonitoringRun3Test/InDetGlobalTrackMonAlg.h new file mode 100644 index 000000000000..93a09d6cec85 --- /dev/null +++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/InDetGlobalMonitoringRun3Test/InDetGlobalTrackMonAlg.h @@ -0,0 +1,147 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + + +/** @file InDetGlobalTrackMonAlg.h + * Implementation of inner detector global track monitoring tool + * + *@author + * Leonid Serkin <lserkin@cern.ch> @n + * + * based on InDetGlobalTrackMonTool.h + * + ****************************************************************************/ + +#ifndef InDetGlobalTrackMonAlg_H +#define InDetGlobalTrackMonAlg_H + +#include "AthenaMonitoring/AthMonitorAlgorithm.h" +#include "AthenaMonitoringKernel/Monitored.h" + +#include "PixelGeoModel/IBLParameterSvc.h" + + + +//Detector Managers +#include "AtlasDetDescr/AtlasDetectorID.h" +#include "InDetIdentifier/PixelID.h" +#include "InDetIdentifier/SCT_ID.h" +#include "InDetIdentifier/TRT_ID.h" + +#include "InDetConditionsSummaryService/IInDetConditionsTool.h" +#include "StoreGate/ReadHandleKey.h" + +#include "InDetPrepRawData/PixelClusterContainer.h" + +//------------TrackMon------------ +#include <algorithm> +#include "TrkToolInterfaces/ITrackHoleSearchTool.h" +#include "InDetTrackSelectionTool/IInDetTrackSelectionTool.h" +#include "TrkTrack/TrackCollection.h" +#include "TrkTrackSummary/TrackSummary.h" +#include "TrkMeasurementBase/MeasurementBase.h" +#include "TrkRIO_OnTrack/RIO_OnTrack.h" +#include "InDetReadoutGeometry/SiDetectorElement.h" +#include "InDetRIO_OnTrack/SiClusterOnTrack.h" +#include "TrkToolInterfaces/ITrackSummaryTool.h" + + + +//for Amg::error helper function: +#include "EventPrimitives/EventPrimitivesHelpers.h" + +//Standard c++ +#include <string> +#include <map> +#include <vector> + + + +//------------------------------ + +class PixelID; +class SCT_ID; +class TRT_ID; + +namespace InDet { + class IInDetTrackSelectionTool; +} + + +class InDetGlobalTrackMonAlg : public AthMonitorAlgorithm { + + public: + + InDetGlobalTrackMonAlg( const std::string& name, ISvcLocator* pSvcLocator ); + virtual ~InDetGlobalTrackMonAlg(); + virtual StatusCode initialize() override; + virtual StatusCode fillHistograms( const EventContext& ctx ) const override; + std::string findComponentString(int bec, int ld) const; + + + // Functions to fill individual sets of histograms + void FillForwardTracks( const Trk::Track *track, const std::unique_ptr<const Trk::TrackSummary> & summary ); + void FillEtaPhi( const Trk::Track *track, const std::unique_ptr<const Trk::TrackSummary> & summary ); + void FillHits( const Trk::Track *track, const std::unique_ptr<const Trk::TrackSummary> & summary ); + void FillTIDE(); + void FillHoles( const Trk::Track *track, const std::unique_ptr<const Trk::TrackSummary> & summary ); + void FillHitMaps( const Trk::Track *track ); + void FillHoleMaps( const Trk::Track *track ); + + private: + + ToolHandle <Trk::ITrackHoleSearchTool> m_holes_search_tool; // new + + ToolHandle<InDet::IInDetTrackSelectionTool> m_trackSelTool; // baseline + ToolHandle< InDet::IInDetTrackSelectionTool > m_tight_trackSelTool; //tightw + + + + ToolHandle<IInDetConditionsTool> m_pixelCondSummaryTool{this, "PixelConditionsSummaryTool", "PixelConditionsSummaryTool", "Tool to retrieve Pixel Conditions summary"}; + + PublicToolHandle <Trk::ITrackSummaryTool> m_trkSummaryTool + {this,"TrackSummaryTool","Trk::TrackSummaryTool/InDetTrackSummaryTool",""}; + + + + + const AtlasDetectorID* m_atlasid; //tracks only + + // the TRT ID helper + const TRT_ID *m_trtID; + + // the SCT ID helper + const SCT_ID *m_sctID; + + // the Pixel ID helper + const PixelID *m_pixelID; + + + SG::ReadHandleKey<InDet::PixelClusterContainer> m_clustersKey{this, "ClusterName", "PixelClusters", "pixel cluster data key" }; + SG::ReadHandleKey<TrackCollection> m_tracksKey {this,"TrackName", "CombinedInDetTracks", "track data key"}; + SG::ReadHandleKey<TrackCollection> m_CombinedTracksName{this,"TrackName2","CombinedInDetTracks", "track data key"}; + SG::ReadHandleKey<TrackCollection> m_ForwardTracksName {this,"TrackName3","CombinedInDetTracks", "track data key"}; + + + ServiceHandle <IBLParameterSvc> m_IBLParameterSvc; + + + + //Switch if LB accounting should be done + bool m_doLumiblock; + + // Switch for hole searching + bool m_doHolePlots; + bool m_DoHoles_Search; + + // Switch for hitmaps + bool m_doHitMaps; + + bool m_doTide; + bool m_doTideResiduals; + bool m_doForwardTracks; + bool m_doIBL; + +}; +#endif diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/python/InDetGlobalBeamSpotMonAlgCfg.py b/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/python/InDetGlobalBeamSpotMonAlgCfg.py new file mode 100644 index 000000000000..f608e93b87d1 --- /dev/null +++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/python/InDetGlobalBeamSpotMonAlgCfg.py @@ -0,0 +1,97 @@ +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# + +'''@file InDetGlobalBeamSpotMonAlgCfg.py +@author PerJohansson +@date November 2019 +@brief Configuration for Run 3 based on InDetGlobalBeamSpotMonTool.cxx +''' + +def InDetGlobalBeamSpotMonAlgCfg(helper, alg, **kwargs): + '''Function to configures some algorithms in the monitoring system.''' + + #Values + m_useBeamspot = True + expert = True + m_vxContainerWithBeamConstraint = False + + # this creates a "trackGroup" called "alg" which will put its histograms into the subdirectory "BeamSpot" + bsGroup = helper.addGroup(alg, 'BeamSpot') + pathbs = '/InDetGlobal/BeamSpot' + + # Histograms for track-based beam spot monitoring: + varName = 'm_trkD0,m_trkD0Phi;trkDPhi' + bsGroup.defineHistogram(varName,type="TH2F",title="DCA vs Phi; #varphi (rad);d_{0} (#mum)", path=pathbs, xbins=100, xmin=-3.5, xmax=3.5, ybins=100, ymin=-1000, ymax=1000) + + if (expert): + varName = 'm_trkPt;trkPt' + bsGroup.defineHistogram(varName, type="TH1F", title="Track Pt;p_{T} (GeV)",path=pathbs,xbins=100,xmin=0,xmax=20) + varName = 'm_trkNPt;trkNPt' + bsGroup.defineHistogram(varName, type="TH1F", title="Number of Tracks per event (after p_{T} cut);Number of tracks", path=pathbs, xbins=100, xmin=0, xmax=1000) + + #Histograms of assumed beam spot position + if (m_useBeamspot): + varName = 'm_trkD0Corr,m_trkD0PhiCorr;trkDPhiCorr' + bsGroup.defineHistogram(varName,type="TH2F",title="DCA vs Phi wrt Beamspot;#varphi (rad);d_{0} (#mum)",path=pathbs,xbins=100, xmin=-3.5,xmax=3.5, ybins=100, ymin=-500,ymax=500) + varName = 'm_bsX;bsX' + bsGroup.defineHistogram(varName, type="TH1F", title="Beam spot position: x;x (mm)",path=pathbs,xbins=100,xmin=-10,xmax=10) + varName = 'm_bsY;bsY' + bsGroup.defineHistogram(varName, type="TH1F", title="Beam spot position: y;y (mm)",path=pathbs,xbins=100,xmin=-10,xmax=10) + varName = 'm_bsZ;bsZ' + bsGroup.defineHistogram(varName, type="TH1F", title="Beam spot position: z;z (mm)",path=pathbs,xbins=100,xmin=-500,xmax=500) + varName = 'm_bsTiltX;bsTiltX' + bsGroup.defineHistogram(varName, type="TH1F", title="Beam spot tile angle: x-z plane; Tilt angle (#murad)",path=pathbs,xbins=100,xmin=-1e3,xmax=1e3) + varName = 'm_bsTiltY;bsTiltY' + bsGroup.defineHistogram(varName, type="TH1F", title="Beam spot tile angle: y-z plane; Tilt angle (#murad)",path=pathbs,xbins=100,xmin=-1e3,xmax=1e3) + + # Histograms for vertex-based beam spot monitoring + if (not m_vxContainerWithBeamConstraint): + # The following histograms are made either relative to the current beamspot (from BeamCondSvc), or relative to the nomial beamspot at (0,0,0) without any tilt. + if (m_useBeamspot): + varName = 'm_pvXbeam;pvX' + bsGroup.defineHistogram(varName, type="TH1F", title="Primary vertex: x - x_{beam};x-x_{beam} (#mum)",path=pathbs,xbins=100,xmin=-500,xmax=500) + varName = 'm_pvYbeam;pvY' + bsGroup.defineHistogram(varName, type="TH1F", title="Primary vertex: y - y_{beam};y-y_{beam} (#mum)",path=pathbs,xbins=100,xmin=-500,xmax=500) + varName = 'm_pvZbeam;pvZ' + bsGroup.defineHistogram(varName, type="TH1F", title="Primary vertex: z - z_{beam};z-z_{beam} (#mum)",path=pathbs,xbins=100,xmin=-500,xmax=500) + else: + varName = 'm_pvXbeam;pvX' + bsGroup.defineHistogram(varName, type="TH1F", title="Primary vertex: x;x (mm)",path=pathbs,xbins=100,xmin=-10,xmax=10) + varName = 'm_pvXbeam;pvX' + bsGroup.defineHistogram(varName, type="TH1F", title="Primary vertex: y;y (mm)",path=pathbs,xbins=100,xmin=-10,xmax=10) + varName = 'm_pvXbeam;pvX' + bsGroup.defineHistogram(varName, type="TH1F", title="Primary vertex: z;z (mm)",path=pathbs,xbins=100,xmin=-500,xmax=500) + + + #Histograms that are independent of the useBeamSpot parameters + varName = 'm_pvX,m_pvZ;pvXZ' + bsGroup.defineHistogram(varName, type="TH2F", title="Primary vertex: x vs z;z (mm);x (mm)", path=pathbs, xbins=100, xmin=-500, xmax=500, ybins=100, ymin=-10, ymax=10) + varName = 'm_pvY,m_pvZ;pvYZ' + bsGroup.defineHistogram(varName, type="TH2F", title="Primary vertex: y vs z;z (mm);y (mm)", path=pathbs, xbins=100, xmin=-500, xmax=500, ybins=100, ymin=-10,ymax=10) + varName = 'm_pvY,m_pvX;pvYX' + bsGroup.defineHistogram(varName, type="TH2F", title="Primary vertex: y vs x;x (mm);y (mm)", path=pathbs, xbins=100, xmin=-10, xmax=10, ybins=100, ymin=-10, ymax=10) + varName = 'm_pvChiSqDof;pvChiSqDof' + bsGroup.defineHistogram(varName, type="TH1F", title="",path=pathbs,xbins=100,xmin=0,xmax=20) + + if (expert): + varName = 'm_pvN;pvN' + bsGroup.defineHistogram(varName, type="TH1F", title="Number of primary vertices;Number of vertices", path=pathbs, xbins=100,xmin=0,xmax=100) + varName = 'm_pvNPriVtx;pvNPriVtx' + bsGroup.defineHistogram(varName, type="TH1F", title="Number of primary vertices;Number of vertices", path=pathbs, xbins=3,xmin=0,xmax=3) + varName = 'm_pvNPileupVtx;pvNPileupVtx' + bsGroup.defineHistogram(varName, type="TH1F", title="Number of pileup vertices;Number of vertices", path=pathbs, xbins=100,xmin=0,xmax=100) + varName = 'm_pvErrX;pvErrX' + bsGroup.defineHistogram(varName, type="TH1F", title="Primary vertex: #sigma_{x}; #sigma_{x} (mm)",path=pathbs,xbins=100,xmin=0,xmax=0.5) + varName = 'm_pvErrY;pvErrY' + bsGroup.defineHistogram(varName, type="TH1F", title="Primary vertex: #sigma_{y}; #sigma_{y} (mm)",path=pathbs,xbins=100,xmin=0,xmax=0.5) + varName = 'm_pvErrZ;pvErrZ' + bsGroup.defineHistogram(varName, type="TH1F", title="Primary vertex: #sigma_{z}; #sigma_{z} (mm)",path=pathbs,xbins=100,xmin=0,xmax=0.5) + varName = 'm_pvNTracks;pvNTracks' + bsGroup.defineHistogram(varName, type="TH1F", title="Number of tracks in primary vertex;Number of tracks",path=pathbs,xbins=100,xmin=0,xmax=500) + varName = 'm_pvTrackPt;pvTrackPt' + bsGroup.defineHistogram(varName, type="TH1F", title="Primary vertex: original track p_{t};p_{t} (GeV)",path=pathbs,xbins=100,xmin=0,xmax=20) + varName = 'm_pvTrackEta;pvTrackEta' + bsGroup.defineHistogram(varName, type="TH1F", title="Primary vertex: original track #eta; #eta",path=pathbs,xbins=100,xmin=-3,xmax=3) + +# end histograms diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/python/InDetGlobalMonitoringRun3TestConfig.py b/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/python/InDetGlobalMonitoringRun3TestConfig.py new file mode 100644 index 000000000000..4a6e10e4d162 --- /dev/null +++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/python/InDetGlobalMonitoringRun3TestConfig.py @@ -0,0 +1,108 @@ +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# + + + +#################################################### +# # +# InDetGlobalManager top algorithm # +# # +#################################################### + +def InDetGlobalMonitoringRun3TestConfig(flags): + from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator + acc = ComponentAccumulator() + + # run on RAW only + if flags.DQ.Environment in ('online', 'tier0', 'tier0Raw'): +## from InDetRecExample.InDetKeys import InDetKeys ## not sure it works now + + ########### here begins InDetGlobalTrackMonAlg ########### + kwargsInDetGlobalTrackMonAlg = { + 'DoIBL' : True, #InDetFlags.doIBL(), #Turn on/off IBL histograms + 'TrackName' : 'CombinedInDetTracks', #Until new config ready + 'TrackName2' : 'CombinedInDetTracks', #Until new config ready + 'TrackName3' : 'CombinedInDetTracks', #Until new config ready + } + + + from AthenaMonitoring import AthMonitorCfgHelper + helper = AthMonitorCfgHelper(flags, "InDetGlobalMonitoringRun3Test") + + from AthenaConfiguration.ComponentFactory import CompFactory +# from InDetGlobalMonitoringRun3Test.InDetGlobalMonitoringRun3TestConf import InDetGlobalTrackMonAlg + from InDetGlobalMonitoringRun3Test.InDetGlobalTrackMonAlgCfg import InDetGlobalTrackMonAlgCfg + + inDetGlobalTrackMonAlg = helper.addAlgorithm(CompFactory.InDetGlobalTrackMonAlg, 'InDetGlobalTrackMonAlg') + for k, v in kwargsInDetGlobalTrackMonAlg.items(): + setattr(inDetGlobalTrackMonAlg, k, v) + inDetGlobalTrackMonAlg.TrackSelectionTool.UseTrkTrackTools = True + inDetGlobalTrackMonAlg.TrackSelectionTool.CutLevel = "TightPrimary" + inDetGlobalTrackMonAlg.TrackSelectionTool.maxNPixelHoles = 1 + inDetGlobalTrackMonAlg.TrackSelectionTool.minPt = 5000 +# InDetGlobalTrackMonAlg.Baseline_TrackSelectionTool.TrackSummaryTool = InDetTrackSummaryTool +# InDetGlobalTrackMonAlg.Baseline_TrackSelectionTool.Extrapolator = InDetExtrapolator +# + inDetGlobalTrackMonAlg.Tight_TrackSelectionTool.UseTrkTrackTools = True + inDetGlobalTrackMonAlg.Tight_TrackSelectionTool.CutLevel = "TightPrimary" + inDetGlobalTrackMonAlg.Tight_TrackSelectionTool.minPt = 5000 +# InDetGlobalTrackMonAlg.Tight_TrackSelectionTool.TrackSummaryTool = InDetTrackSummaryTool +# InDetGlobalTrackMonAlg.Tight_TrackSelectionTool.Extrapolator = InDetExtrapolator + + + # Run 3 configs - stolen from SCT + from SCT_Monitoring.TrackSummaryToolWorkaround import TrackSummaryToolWorkaround + inDetGlobalTrackMonAlg.TrackSelectionTool.TrackSummaryTool = acc.popToolsAndMerge(TrackSummaryToolWorkaround(flags)) + inDetGlobalTrackMonAlg.TrackSelectionTool.Extrapolator = acc.getPublicTool("InDetExtrapolator") + inDetGlobalTrackMonAlg.Tight_TrackSelectionTool.TrackSummaryTool = acc.popToolsAndMerge(TrackSummaryToolWorkaround(flags)) + inDetGlobalTrackMonAlg.Tight_TrackSelectionTool.Extrapolator = acc.getPublicTool("InDetExtrapolator") + + InDetGlobalTrackMonAlgCfg(helper, inDetGlobalTrackMonAlg, **kwargsInDetGlobalTrackMonAlg) + ########### here ends InDetGlobalTrackMonAlg ########### + + + ########### here begins InDetGlobalPrimaryVertexMonAlg ########### + from InDetGlobalMonitoringRun3Test.InDetGlobalMonitoringRun3TestConf import InDetGlobalPrimaryVertexMonAlg + from InDetGlobalMonitoringRun3Test.InDetGlobalPrimaryVertexMonAlgCfg import InDetGlobalPrimaryVertexMonAlgCfg + + myInDetGlobalPrimaryVertexMonAlg = helper.addAlgorithm(InDetGlobalPrimaryVertexMonAlg, 'InDetGlobalPrimaryVertexMonAlg') + + kwargsInDetGlobalPrimaryVertexMonAlg = { + 'vxContainerName' : 'PrimaryVertices', #InDetKeys.xAODVertexContainer(), + 'vxContainerNameWithOutBeamConstraint' : 'VxPrimaryCandidateWithBeamConstraint', #InDetKeys.PrimaryVerticesWithoutBeamConstraint(), + 'vxContainerNameSplit' : 'VxPrimaryCandidateSplitStream', #InDetKeys.PrimaryVerticesSplitStream(), + 'doEnhancedMonitoring' : True # InDetFlags.doMonitoringPrimaryVertexingEnhanced() + } + + for k, v in kwargsInDetGlobalPrimaryVertexMonAlg.items(): + setattr(kwargsInDetGlobalPrimaryVertexMonAlg, k, v) + + InDetGlobalPrimaryVertexMonAlgCfg(helper, myInDetGlobalPrimaryVertexMonAlg, **kwargsInDetGlobalPrimaryVertexMonAlg) + + ########### here ends InDetGlobalPrimaryVertexMonAlg ########### + + ########### here begins InDetGlobalBeamSpotMonAlg ########### + + from InDetGlobalMonitoringRun3Test.InDetGlobalMonitoringRun3TestConf import InDetGlobalBeamSpotMonAlg + from InDetGlobalMonitoringRun3Test.InDetGlobalBeamSpotMonAlgCfg import InDetGlobalBeamSpotMonAlgCfg + + myInDetGlobalBeamSpotMonAlg = helper.addAlgorithm(InDetGlobalBeamSpotMonAlg, 'InDetGlobalBeamSpotMonAlg') + + kwargsInDetGlobalBeamSpotMonAlg = { + 'BeamSpotKey' : 'BeamSpotData', #InDetKeys.BeamSpotData(), + 'vxContainerName' : 'PrimaryVertices', #InDetKeys.xAODVertexContainer(), + 'trackContainerName' : 'InDetTrackParticles', #InDetKeys.xAODTrackParticleContainer(), + 'useBeamspot' : True, # InDetFlags.useBeamConstraint() + 'vxContainerWithBeamConstraint' : False # InDetFlags.useBeamConstraint() + } + + for k, v in kwargsInDetGlobalBeamSpotMonAlg.items(): + setattr(kwargsInDetGlobalBeamSpotMonAlg, k, v) + + InDetGlobalBeamSpotMonAlgCfg(helper, myInDetGlobalBeamSpotMonAlg, **kwargsInDetGlobalBeamSpotMonAlg) + + ########### here ends InDetGlobalBeamSpotMonAlg ########### + + return acc + diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/python/InDetGlobalPrimaryVertexMonAlgCfg.py b/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/python/InDetGlobalPrimaryVertexMonAlgCfg.py new file mode 100644 index 000000000000..c09aa92136a1 --- /dev/null +++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/python/InDetGlobalPrimaryVertexMonAlgCfg.py @@ -0,0 +1,74 @@ +""" +@file InDetGlobalPrimaryVertexMonAlgCfg.py +@author Leonid Serkin +@date November 2019 +@brief Configuration for Run 3 based on InDetGlobalPrimaryVertexMonTool.cxx +""" + +def InDetGlobalPrimaryVertexMonAlgCfg(helper, alg, **kwargs): + + # values + M_PI = 3.141592 + + # this creates a "pvGroup" called "alg" which will put its histograms into the subdirectory "PrimaryVertex" + pvGroup = helper.addGroup(alg, 'PrimaryVertex') + pathpv = '/InDetGlobal/PrimaryVertex' + + # begin histogram definitions + varName = 'm_PvX;pvX' #done + title = 'Primary vertex: x;x (mm);Events' + pvGroup.defineHistogram(varName, type='TH1F', path=pathpv, title=title, xbins=500, xmin=-1.0, xmax=1.0) + + varName = 'm_PvY;pvY' #done + title = 'Primary vertex: y;y (mm);Events' + pvGroup.defineHistogram(varName, type='TH1F', path=pathpv, title=title, xbins=500, xmin=-1.0, xmax=1.0) + + varName = 'm_PvZ;pvZ' #done + title = 'Primary vertex: z;z (mm);Events' + pvGroup.defineHistogram(varName, type='TH1F', path=pathpv, title=title, xbins=100, xmin=-200., xmax=200.) + + varName = 'm_PvN;pvN' #done + title = 'Total number of vertices (primary and pile up);Total number of vertices;Events' + pvGroup.defineHistogram(varName, type='TH1F', path=pathpv, title=title, xbins=50, xmin=-0.5, xmax=49.5) + + varName = 'm_nPriVtx;pvNPriVtx' #done + title = 'Number of primary vertices;Number of primary vertices;Events' + pvGroup.defineHistogram(varName, type='TH1F', path=pathpv, title=title, xbins=3, xmin=-0.5, xmax=2.5) + + varName = 'm_nPileupVtx;pvNPileupVtx' #done + title = 'Number of pileup vertices;Number of pile up vertices;Events' + pvGroup.defineHistogram(varName, type='TH1F', path=pathpv, title=title, xbins=40, xmin=-0.5, xmax=39.5) + + varName = 'm_PvErrX;pvErrX' #done + title = 'Primary vertex: #sigma_{x}; #sigma_{x} (mm);Events' + pvGroup.defineHistogram(varName, type='TH1F', path=pathpv, title=title, xbins=100, xmin=0., xmax=0.015) + + varName = 'm_PvErrY;pvErrY' #done + title = 'Primary vertex: #sigma_{x}; #sigma_{y} (mm);Events' + pvGroup.defineHistogram(varName, type='TH1F', path=pathpv, title=title, xbins=100, xmin=0., xmax=0.015) + + varName = 'm_PvErrZ;pvErrZ' #done + title = 'Primary vertex: #sigma_{z}; #sigma_{y} (mm);Events' + pvGroup.defineHistogram(varName, type='TH1F', path=pathpv, title=title, xbins=100, xmin=0., xmax=0.1) + + varName = 'm_PvChiSqDoF;pvChiSqDof' #done + title = 'Primary vertex: #Chi^{2}/DoF of vertex fit;#Chi^{2}/DoF;Events' + pvGroup.defineHistogram(varName, type='TH1F', path=pathpv, title=title, xbins=100, xmin=0., xmax=5.) + + varName = 'm_PvN;pvNTracks' #done + title = 'Number of tracks in primary vertex;Number of tracks;Events' + pvGroup.defineHistogram(varName, type='TH1F', path=pathpv, title=title, xbins=300, xmin=0., xmax=300.) + + varName = 'm_PvTrackPt;pvTrackPt' #done + title = 'Primary vertex: original track p_{t};p_{t} (GeV);Events' + pvGroup.defineHistogram(varName, type='TH1F', path=pathpv, title=title, xbins=100, xmin=0., xmax=20.) + + varName = 'm_PvTrackEta;pvTrackEta' #done + title = 'Primary vertex: original track #eta; #eta;Events' + pvGroup.defineHistogram(varName, type='TH1F', path=pathpv, title=title, xbins=100, xmin=-3, xmax=3) + + + +# end histograms + + diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/python/InDetGlobalTrackMonAlgCfg.py b/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/python/InDetGlobalTrackMonAlgCfg.py new file mode 100644 index 000000000000..4feb27f33253 --- /dev/null +++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/python/InDetGlobalTrackMonAlgCfg.py @@ -0,0 +1,152 @@ +""" +@file InDetGlobalTrackMonAlgCfg.py +@author Leonid Serkin +@date November 2019 +@brief Configuration for Run 3 based on InDetGlobalTrackMonTool.cxx +""" + +def InDetGlobalTrackMonAlgCfg(helper, alg, **kwargs): + + # values + m_doIBL = True + m_nBinsEta = 50 + m_nBinsPhi = 50 + m_trackBin = 100 + m_c_etaRange = 2.5 + m_c_etaTrackletsMin = 2.4 + m_c_etaTrackletsMax = 2.7 + m_c_etaRangeTRT = 2.0 + m_c_range_LB = 3000 + m_trackMax = 75 + M_PI = 3.141592 + + # this creates a "trackGroup" called "alg" which will put its histograms into the subdirectory "Track" + trackGroup = helper.addGroup(alg, 'Track') + pathtrack = '/InDetGlobal/Track' + pathhits = '/InDetGlobal/Hits' + + + varName = 'm_nBase;nCOMBtrks' #done + title = 'Track multiplicity (baseline tracks);Track multiplicity;Events' + trackGroup.defineHistogram(varName, type='TH1F', path=pathtrack, title=title, xbins=m_trackBin, xmin=0.5, xmax=m_trackMax + 0.5) + + # Eta-phi maps + varName = 'm_eta_perigee,m_phi_perigee;Trk_Base_eta_phi' #done + title = 'Distribution of eta vs phi for combined tracks passing Loose Primary selection;#eta,#phi_{0}' + trackGroup.defineHistogram(varName, type='TH2F', path=pathtrack, title=title, xbins=m_nBinsEta, xmin=-m_c_etaRange, xmax=m_c_etaRange, ybins=m_nBinsPhi, ymin=-M_PI, ymax=M_PI) + + varName = 'm_eta_perigee,m_phi_perigee,m_track_pass_tight;Trk_Tight_eta_phi_ratio' #done + title = 'Distribution of eta vs phi for combined tracks passing Tight selection;#eta;#phi_{0}' + trackGroup.defineHistogram(varName, type='TProfile2D', path=pathtrack, title=title, xbins=m_nBinsEta, xmin=-m_c_etaRange, xmax=m_c_etaRange, ybins=m_nBinsPhi, ymin=-M_PI, ymax=M_PI) + + varName = 'm_eta_perigee,m_phi_perigee,m_noTRTHits;Trk_noTRText_eta_phi_ratio' #done + title = 'Distribution of eta vs phi for combined tracks passing with no TRT extension;#eta;#phi_{0}' + trackGroup.defineHistogram(varName, type='TProfile2D', path=pathtrack, title=title, xbins=20, xmin=-m_c_etaRangeTRT, xmax=m_c_etaRangeTRT, ybins=m_nBinsPhi, ymin=-M_PI, ymax=M_PI) + + varName = 'm_eta_perigee,m_phi_perigee,m_NextToInnermostPixelLayerHit;Trk_noBLhit_eta_phi_ratio' #done + title = 'Eta-phi of tracks with no b-layer hit but a hit is expected, ratio to total tracks;#eta;#phi_{0}' + trackGroup.defineHistogram(varName, type='TProfile2D', path=pathtrack, title=title, xbins=m_nBinsEta, xmin=-m_c_etaRange, xmax=m_c_etaRange, ybins=m_nBinsPhi, ymin=-M_PI, ymax=M_PI) + + varName = 'm_eta_perigee,m_phi_perigee,m_InnermostPixelLayerHit;Trk_noIBLhit_eta_phi_ratio' #done + title = 'Eta-phi of tracks with no IBL hit but a hit is expected, ratio to total tracks;#eta;#phi_{0}' + trackGroup.defineHistogram(varName, type='TProfile2D', path=pathtrack, title=title, xbins=m_nBinsEta, xmin=-m_c_etaRange, xmax=m_c_etaRange, ybins=m_nBinsPhi, ymin=-M_PI, ymax=M_PI) + + varName = 'm_eta_perigee,m_phi_perigee,m_numberOfInnermostPixelLayerHits;Trk_nIBLhits_eta_phi' # done + title = 'Number of IBL hits per track, eta-phi profile;#eta;#phi' + trackGroup.defineHistogram(varName, type='TProfile2D', path=pathhits, title=title, xbins=m_nBinsEta, xmin=-m_c_etaRange, xmax=m_c_etaRange, ybins=m_nBinsPhi, ymin=-M_PI, ymax=M_PI) + + varName = 'm_eta_perigee,m_phi_perigee,m_pixHits;Trk_nPIXhits_eta_phi' #done + title = 'Number of PIX hits per track, eta-phi profile;#eta;#phi' + trackGroup.defineHistogram(varName, type='TProfile2D', path=pathhits, title=title, xbins=m_nBinsEta, xmin=-m_c_etaRange, xmax=m_c_etaRange, ybins=m_nBinsPhi, ymin=-M_PI, ymax=M_PI) + + varName = 'm_eta_perigee,m_phi_perigee,m_sctHits;Trk_nSCThits_eta_phi' #done + title = 'Number of SCT hits per track, eta-phi profile;#eta;#phi' + trackGroup.defineHistogram(varName, type='TProfile2D', path=pathhits, title=title, xbins=m_nBinsEta, xmin=-m_c_etaRange, xmax=m_c_etaRange, ybins=m_nBinsPhi, ymin=-M_PI, ymax=M_PI) + + varName = 'm_eta_perigee,m_phi_perigee,m_trtHits;Trk_nTRThits_eta_phi' #done + title = 'Number of TRT hits per track, eta-phi profile;#eta;#phi' + trackGroup.defineHistogram(varName, type='TProfile2D', path=pathhits, title=title, xbins=m_nBinsEta, xmin=-m_c_etaRange, xmax=m_c_etaRange, ybins=m_nBinsPhi, ymin=-M_PI, ymax=M_PI) + + varName = 'm_lb,m_numberOfInnermostPixelLayerHits;trk_nIBLhits_LB' #done + title = 'Average number of IBL hits by LB;LB;Average number of hits in LB' + trackGroup.defineHistogram(varName, type='TProfile', path=pathtrack, title=title, xbins=m_c_range_LB, xmin=0, xmax=m_c_range_LB) + + varName = 'm_lb,m_pixHits;trk_nPIXhits_LB' #done + title = 'Average number of PIX hits by LB;LB;Average number of hits in LB' + trackGroup.defineHistogram(varName, type='TProfile', path=pathtrack, title=title, xbins=m_c_range_LB, xmin=0, xmax=m_c_range_LB) + + varName = 'm_lb,m_sctHits;trk_nSCThits_LB' #done + title = 'Average number of SCT hits by LB;LB;Average number of hits in LB' + trackGroup.defineHistogram(varName, type='TProfile', path=pathtrack, title=title, xbins=m_c_range_LB, xmin=0, xmax=m_c_range_LB) + + varName = 'm_lb,m_trtHits;trk_nTRThits_LB' #done + title = 'Average number of TRT hits by LB;LB;Average number of hits in LB' + trackGroup.defineHistogram(varName, type='TProfile', path=pathtrack, title=title, xbins=m_c_range_LB, xmin=0, xmax=m_c_range_LB) + + varName = 'm_eta_perigee,m_phi_perigee,m_numberOfPixelDeadSensors;Trk_nPIXdisabled_eta_phi' # done + title = 'Number of PIX disabled detector elements per track, eta-phi profile;#eta;#phi' + trackGroup.defineHistogram(varName, type='TProfile2D', path=pathhits, title=title, xbins=m_nBinsEta, xmin=-m_c_etaRange, xmax=m_c_etaRange, ybins=m_nBinsPhi, ymin=-M_PI, ymax=M_PI) + + varName = 'm_eta_perigee,m_phi_perigee,m_numberOfSCTDeadSensors;Trk_nSCTdisabled_eta_phi' #done + title = 'Number of SCT disabled detector elements per track, eta-phi profile;#eta;#phi' + trackGroup.defineHistogram(varName, type='TProfile2D', path=pathhits, title=title, xbins=m_nBinsEta, xmin=-m_c_etaRange, xmax=m_c_etaRange, ybins=m_nBinsPhi, ymin=-M_PI, ymax=M_PI) + + varName = 'm_eta_perigee,m_phi_perigee,m_numberOfTRTDeadStraws;Trk_nTRTdisabled_eta_phi' #done + title = 'Number of TRT disabled detector elements per track, eta-phi profile;#eta;#phi' + trackGroup.defineHistogram(varName, type='TProfile2D', path=pathhits, title=title, xbins=m_nBinsEta, xmin=-m_c_etaRange, xmax=m_c_etaRange, ybins=m_nBinsPhi, ymin=-M_PI, ymax=M_PI) + + varName = 'm_eta_perigee,m_phi_perigee,m_numberOfPixelSharedHits;Trk_nPixShared_eta_phi' #done + title = 'Number of Pixel shared hits per track, eta-phi profile;#eta;#phi' + trackGroup.defineHistogram(varName, type='TProfile2D', path=pathhits, title=title, xbins=m_nBinsEta, xmin=-m_c_etaRange, xmax=m_c_etaRange, ybins=m_nBinsPhi, ymin=-M_PI, ymax=M_PI) + + varName = 'm_eta_perigee,m_phi_perigee,m_numberOfPixelSplitHits;Trk_nPixSplit_eta_phi' #done + title = 'Number of Pixel split hits per track, eta-phi profile;#eta;#phi' + trackGroup.defineHistogram(varName, type='TProfile2D', path=pathhits, title=title, xbins=m_nBinsEta, xmin=-m_c_etaRange, xmax=m_c_etaRange, ybins=m_nBinsPhi, ymin=-M_PI, ymax=M_PI) + + varName = 'm_eta_perigee,m_phi_perigee,m_numberOfSCTSharedHits;Trk_nSCTShared_eta_phi' #done + title = 'Number of SCT shared hits per track, eta-phi profile;#eta;#phi' + trackGroup.defineHistogram(varName, type='TProfile2D', path=pathhits, title=title, xbins=m_nBinsEta, xmin=-m_c_etaRange, xmax=m_c_etaRange, ybins=m_nBinsPhi, ymin=-M_PI, ymax=M_PI) + + varName = 'm_eta_perigee,m_phi_perigee,m_numberOfPixelHoles;Trk_nPixHoles_eta_phi' #done + title = 'Number of Pixel holes per track, eta-phi profile;#eta;#phi' + trackGroup.defineHistogram(varName, type='TProfile2D', path=pathhits, title=title, xbins=m_nBinsEta, xmin=-m_c_etaRange, xmax=m_c_etaRange, ybins=m_nBinsPhi, ymin=-M_PI, ymax=M_PI) + + varName = 'm_eta_perigee,m_phi_perigee,m_numberOfSCTHoles;Trk_nSCTHoles_eta_phi' #done + title = 'Number of SCT holes per track, eta-phi profile;#eta;#phi' + trackGroup.defineHistogram(varName, type='TProfile2D', path=pathhits, title=title, xbins=m_nBinsEta, xmin=-m_c_etaRange, xmax=m_c_etaRange, ybins=m_nBinsPhi, ymin=-M_PI, ymax=M_PI) + + varName = 'm_lb,m_nBase_LB;Trk_nBase_LB' #done + title = 'Average number of baseline tracks per event in LB;LB number;Average number of loose primary tracks per event in LB' + trackGroup.defineHistogram(varName, type='TProfile', path=pathtrack, title=title, xbins=m_c_range_LB, xmin=0, xmax=m_c_range_LB) + + varName = 'm_lb,m_nTight_LB;Trk_nTight_LB' #done + title = 'Average number of tight tracks per event in LB;LB number;Average number of tight tracks per event in LB' + trackGroup.defineHistogram(varName, type='TProfile', path=pathtrack, title=title, xbins=m_c_range_LB, xmin=0, xmax=m_c_range_LB) + + varName = 'm_lb,m_nNoIBL_LB;Trk_noIBLhits_LB' #done + title = 'Average number of tracks with missing IBL hit per event in LB;LB number;Average number of tracks with missing IBL hit per event in LB' + trackGroup.defineHistogram(varName, type='TProfile', path=pathtrack, title=title, xbins=m_c_range_LB, xmin=0, xmax=m_c_range_LB) + + varName = 'm_lb,m_NoIBL_LB;Trk_noIBLhits_frac_LB' #done + title = 'Fraction of tracks with missing IBL hit per event in LB;LB number;Fraction of tracks with missing IBL hit per event in LB' + trackGroup.defineHistogram(varName, type='TProfile', path=pathtrack, title=title, xbins=m_c_range_LB, xmin=0, xmax=m_c_range_LB) + + varName = 'm_lb,m_nNoBL_LB;Trk_noBLhits_LB' #done + title = 'Average number of tracks with missing b-layer hit per event in LB;LB number;Average number of tracks with missing b-layer hit per event in LB' + trackGroup.defineHistogram(varName, type='TProfile', path=pathtrack, title=title, xbins=m_c_range_LB, xmin=0, xmax=m_c_range_LB) + + varName = 'm_lb,m_NoBL_LB;Trk_noBLhits_frac_LB' #done + title = 'Fraction of tracks with missing b-layer hit per event in LB;LB number;Fraction of tracks with missing b-layer hit per event in LB' + trackGroup.defineHistogram(varName, type='TProfile', path=pathtrack, title=title, xbins=m_c_range_LB, xmin=0, xmax=m_c_range_LB) + + varName = 'm_lb,m_nNoTRText_LB;Trk_noTRText_LB' #done + title = 'Average number of tracks without TRT extension per event in LB;LB number;Average number of tracks with without TRT extension per event in LB' + trackGroup.defineHistogram(varName, type='TProfile', path=pathtrack, title=title, xbins=m_c_range_LB, xmin=0, xmax=m_c_range_LB) + + varName = 'm_lb,m_NoTRText_LB;Trk_noTRText_frac_LB' #done + title = 'Fraction of tracks without TRT extension per event in LB;LB number;Fraction of tracks with without TRT extension per event in LB' + trackGroup.defineHistogram(varName, type='TProfile', path=pathtrack, title=title, xbins=m_c_range_LB, xmin=0, xmax=m_c_range_LB) + +# end histograms + + diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/src/InDetGlobalBeamSpotMonAlg.cxx b/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/src/InDetGlobalBeamSpotMonAlg.cxx new file mode 100644 index 000000000000..8cac7bb503b8 --- /dev/null +++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/src/InDetGlobalBeamSpotMonAlg.cxx @@ -0,0 +1,286 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** @file InDetGlobalBeamSpotMonAlg.cxx + * Implementation of inner detector global beamspot monitoring tool + * + *@authors + * Per Johansson <Per.Johansson@cern.ch> @n + * Leonid Serkin <lserkin@cern.ch> @n + * + * based on InDetGlobalBeamSpotMonTool.cxx + * + ****************************************************************************/ + +//main header +#include "InDetGlobalMonitoringRun3Test/InDetGlobalBeamSpotMonAlg.h" + +#include "TrkEventPrimitives/ParamDefs.h" + +#include "xAODTracking/TrackParticleContainer.h" +#include "EventPrimitives/EventPrimitivesHelpers.h" + +#include "xAODTracking/TrackParticle.h" +#include "xAODTracking/TrackParticleAuxContainer.h" + +#include <sstream> + + +InDetGlobalBeamSpotMonAlg::InDetGlobalBeamSpotMonAlg( const std::string & name, ISvcLocator* pSvcLocator) : + AthMonitorAlgorithm( name, pSvcLocator ), + m_useBeamspot(true), + m_vxContainerWithBeamConstraint(false), + m_minTracksPerVtx(4), + m_minTrackPt(500) +{ + declareProperty("useBeamspot", m_useBeamspot, "turn on histograms for assumed beam spot position"); + declareProperty("vxContainerWithBeamConstraint", m_vxContainerWithBeamConstraint, "turn on histograms for vertex-based beam spot monitoring" ); + declareProperty("minTracksPerVtx", m_minTracksPerVtx, "minimum number of tracks per vertex" ); + declareProperty("minTrackPt", m_minTrackPt, "minimum track pT (MeV)"); +} + +InDetGlobalBeamSpotMonAlg::~InDetGlobalBeamSpotMonAlg() {} + + +StatusCode InDetGlobalBeamSpotMonAlg::initialize() { + ATH_CHECK(m_beamSpotKey.initialize()); + ATH_CHECK(m_vxContainerName.initialize()); + ATH_CHECK(m_trackContainerName.initialize()); + + return AthMonitorAlgorithm::initialize(); +} + + +StatusCode InDetGlobalBeamSpotMonAlg::fillHistograms( const EventContext& ctx ) const { + using namespace Monitored; + + //******************************************************************************* + //************************** Begin of filling Beam spot Histograms ****************** + //******************************************************************************* + ATH_MSG_DEBUG("Filling InDetGlobalBeamSpotMonAlg"); + + // For histogram naming + auto bsGroup = getGroup("BeamSpot"); + + // Get beamspot information, if available + float beamSpotX = 0.; + float beamSpotY = 0.; + float beamSpotZ = 0.; + float beamTiltX = 0.; + float beamTiltY = 0.; + float scaleFactor = 1.; + if (m_useBeamspot) { + + + auto beamSpotHandle = SG::ReadCondHandle(m_beamSpotKey, ctx); + + // check for tracks + if ( !(beamSpotHandle.isValid()) ) { + ATH_MSG_ERROR("InDetGlobalBeamSpotMonAlg: BeamSpot container "<< beamSpotHandle.key() << " could not be found."); + return StatusCode::RECOVERABLE; + } else { + ATH_MSG_DEBUG("InDetGlobalBeamSpotMonAlg: BeamSpot container "<< beamSpotHandle.fullKey() <<" is found."); + } + + + + const Amg::Vector3D &bpos = beamSpotHandle->beamPos(); + + auto beamSpotX_m = Monitored::Scalar<float>("m_bsX", bpos.x() ); + auto beamSpotY_m = Monitored::Scalar<float>("m_bsY", bpos.y() ); + auto beamSpotZ_m = Monitored::Scalar<float>("m_bsZ", bpos.z() ); + auto beamTiltX_m = Monitored::Scalar<float>("m_bsTiltX", 1e6*beamSpotHandle->beamTilt(0) ); + auto beamTiltY_m = Monitored::Scalar<float>("m_bsTiltY", 1e6*beamSpotHandle->beamTilt(1) ); + scaleFactor = 1000.; // Use microns for some histograms when showing distance relative to beamspot PJ not used here?! + + fill(bsGroup,beamSpotX_m); + fill(bsGroup,beamSpotY_m); + fill(bsGroup,beamSpotZ_m); + fill(bsGroup,beamTiltX_m); + fill(bsGroup,beamTiltY_m); + + ATH_MSG_DEBUG("InDetGlobalBeamSpotMonAlg: Beamspot x0 = " << beamSpotX_m << ", y0 = " << beamSpotY_m << ", z0 = " << beamSpotZ_m << ", tiltX = " << beamTiltX_m << ", tiltY = " << beamTiltY_m); + } // m_useBeamspot + + + auto trackCollection = SG::makeHandle(m_trackContainerName, ctx); + + if(!(trackCollection.isValid())){ + ATH_MSG_DEBUG ("InDetGlobalBeamSpotMonAlg: Could not retrieve TrackParticleContainer container with key "+m_trackContainerName.key()); + return StatusCode::SUCCESS; + } + + + // Track monitoring + int nTracks = 0; + + xAOD::TrackParticleContainer::const_iterator itrack = trackCollection->begin(); + xAOD::TrackParticleContainer::const_iterator itrack_end = trackCollection->end(); + + for ( ; itrack!= itrack_end; ++itrack) + { + + const xAOD::TrackParticle* tpb = (*itrack); + + if ( !tpb ) + { + ATH_MSG_DEBUG( "InDetGlobalBeamSpotMonAlg: NULL track pointer in collection" ); + continue; + } + + + const Trk::Perigee* perigee = &(tpb->perigeeParameters()); + + if ( !perigee ) + { + ATH_MSG_DEBUG( "InDetGlobalBeamSpotMonAlg: NULL track->perigeeParameters pointer " ); + continue; + } + + + + float theta = perigee->parameters()[Trk::theta]; + float qOverPt = perigee->parameters()[Trk::qOverP]/sin(theta); + float charge = perigee->charge(); + float z0 = perigee->parameters()[Trk::z0]; + float phi0 = perigee->parameters()[Trk::phi0]; + float d0 = perigee->parameters()[Trk::d0]; + float pT = 0; + + if ( qOverPt != 0 ){ + pT = (1/qOverPt)*(charge); + // For all tracks + auto pT_m = Monitored::Scalar<float>("m_trkPt", pT/1000); + fill(bsGroup, pT_m); + + // Select tracks to use for remaining histograms + if (pT<m_minTrackPt) continue; + } + + nTracks++; + + auto trkDPhi_m = Monitored::Scalar<float>("m_trkD0Phi", phi0); + auto trkD_m = Monitored::Scalar<float>("m_trkD0", d0*1e3); + fill(bsGroup, trkD_m, trkDPhi_m); + + // Currently we do the direct calculation of d0corr. We could + // also use an extrapolator to calculate d0 wrt a + // Trk::StraightLineSurface constructed along the beam line. + if(m_useBeamspot){ + + float trkbeamlineTiltX=tpb->beamlineTiltX(); + float trkbeamlineTiltY=tpb->beamlineTiltY(); + float trkbeamspotx=tpb->vx(); + float trkbeamspoty=tpb->vy(); + float trkbeamspotz=tpb->vz(); + + float beamX = (beamSpotX-trkbeamspotx) + tan(beamTiltX-trkbeamlineTiltX) * (z0-beamSpotZ+trkbeamspotz); + float beamY = (beamSpotY-trkbeamspoty) + tan(beamTiltY-trkbeamlineTiltY) * (z0-beamSpotZ+trkbeamspotz); + float d0corr = d0 - ( -sin(phi0)*beamX + cos(phi0)*beamY ); + + + auto trkDPhiCorr_m = Monitored::Scalar<float>("m_trkD0PhiCorr", phi0); + auto trkDCorr_m = Monitored::Scalar<float>("m_trkD0Corr", d0corr*1e3); + fill(bsGroup, trkDPhiCorr_m, trkDCorr_m); + } + } // track iterator + + auto trkNPt_m = Monitored::Scalar<float>("m_trkNPt", nTracks); + fill(bsGroup,trkNPt_m); + + // Primary vertex monitoring - only if we have a primary vertex collection determined + // without beam constraint + if (! m_vxContainerWithBeamConstraint) { + ATH_MSG_DEBUG( "InDetGlobalBeamSpotMonAlg: vxContainerWithBeamConstraint is " << m_vxContainerWithBeamConstraint ); + + // Basic primary vertex monitoring + auto vxContainer = SG::makeHandle(m_vxContainerName, ctx); + + if (!vxContainer.isValid()) { + ATH_MSG_DEBUG ("InDetGlobalBeamSpotMonAlg: Could not retrieve primary vertex container with key "+ m_vxContainerName.key()); + return StatusCode::SUCCESS; + } + + auto pvN_m = Monitored::Scalar<float>("m_pvN", vxContainer->size()-1); // exclude dummy vertex + fill(bsGroup, pvN_m); + + int nPriVtx = 0; + int nPileupVtx = 0; + + for (xAOD::VertexContainer::const_iterator vxIter = vxContainer->begin(); vxIter != vxContainer->end(); ++vxIter) { + if ( !(*vxIter) ) continue; + + // Count different types of vertices + if ((*vxIter)->vertexType() == xAOD::VxType::PriVtx) nPriVtx++; + if ((*vxIter)->vertexType() == xAOD::VxType::PileUp) nPileupVtx++; + + // Select primary vertex + if ((*vxIter)->vertexType() != xAOD::VxType::PriVtx) continue; + if ((*vxIter)->numberDoF() <= 0) continue; + + if ((*vxIter)->nTrackParticles() < m_minTracksPerVtx) continue; + + // Found good VxCandidate to monitor - now fill histograms + float x = (*vxIter)->position().x(); + float y = (*vxIter)->position().y(); + float z = (*vxIter)->position().z(); + float beamX = beamSpotX + tan(beamTiltX) * (z-beamSpotZ); + float beamY = beamSpotY + tan(beamTiltY) * (z-beamSpotZ); + float beamZ = beamSpotZ; + + auto pvXbeam_m = Monitored::Scalar<float>("m_pvXbeam", (x-beamX)*scaleFactor); + fill(bsGroup, pvXbeam_m); + + auto pvYbeam_m = Monitored::Scalar<float>("m_pvYbeam", (y-beamY)*scaleFactor); + fill(bsGroup, pvYbeam_m); + + auto pvZbeam_m = Monitored::Scalar<float>("m_pvZbeam", z-beamZ); + fill(bsGroup, pvZbeam_m); + + auto pvErrX_m = Monitored::Scalar<float>("m_pvErrX", Amg::error( (*vxIter)->covariancePosition(), Trk::x)); + fill(bsGroup, pvErrX_m); + + auto pvErrY_m = Monitored::Scalar<float>("m_pvErrY", Amg::error( (*vxIter)->covariancePosition(), Trk::y)); + fill(bsGroup, pvErrY_m); + + auto pvErrZ_m = Monitored::Scalar<float>("m_pvErrZ", Amg::error( (*vxIter)->covariancePosition(), Trk::z)); + fill(bsGroup, pvErrZ_m); + + auto pvNTracks_m = Monitored::Scalar<float>("m_pvNTracks", (*vxIter)->nTrackParticles()); + fill(bsGroup, pvNTracks_m); + + auto pvChiSqDof_m = Monitored::Scalar<float>("m_pvChiSqDof", (*vxIter)->chiSquared() / (*vxIter)->numberDoF()); + fill(bsGroup, pvChiSqDof_m); + + auto pvX_m = Monitored::Scalar<float>("m_pvX", x); + auto pvY_m = Monitored::Scalar<float>("m_pvY", y); + auto pvZ_m = Monitored::Scalar<float>("m_pvZ", z); + fill(bsGroup, pvX_m, pvZ_m); + fill(bsGroup, pvY_m, pvZ_m); + fill(bsGroup, pvY_m, pvX_m); + + // Histograms on original tracks used for primary vertex + for (unsigned int trkIter=0; trkIter!=(*vxIter)->nTrackParticles(); ++trkIter) { + const xAOD::TrackParticle* tp = (*vxIter)->trackParticle(trkIter); + if(!tp){ + ATH_MSG_DEBUG ("InDetGlobalBeamSpotMonAlg: Could not retrieve track particle."); + continue; + } + const Trk::Perigee measuredPerigee = tp->perigeeParameters(); + auto pvTrackPt_m = Monitored::Scalar<float>("m_pvTrackPt", measuredPerigee.pT()/1000.); + auto pvTrackEta_m = Monitored::Scalar<float>("m_pvTrackEta", measuredPerigee.eta()); + fill(bsGroup, pvTrackPt_m); + fill(bsGroup, pvTrackEta_m); + } + } // vertex iterator + + auto pvNPriVtx_m = Monitored::Scalar<float>("m_pvNPriVtx", nPriVtx); + auto pvNPileupVtx_m = Monitored::Scalar<float>("m_pvNPileupVtx", nPileupVtx); + fill(bsGroup, pvNPriVtx_m); + fill(bsGroup, pvNPileupVtx_m); + } + + return StatusCode::SUCCESS; +} + diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/src/InDetGlobalPrimaryVertexMonAlg.cxx b/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/src/InDetGlobalPrimaryVertexMonAlg.cxx new file mode 100644 index 000000000000..4ebfe6a1a13b --- /dev/null +++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/src/InDetGlobalPrimaryVertexMonAlg.cxx @@ -0,0 +1,177 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + + +/** @file InDetGlobalPrimaryVertexMonAlg.h + * Implementation of inner detector global Primary Vertex monitoring tool + * + *@author + * Leonid Serkin <lserkin@cern.ch> @n + * + * based on InDetGlobalPrimaryVertexMonTool.cxx + * + ****************************************************************************/ + +//main header +#include "InDetGlobalMonitoringRun3Test/InDetGlobalPrimaryVertexMonAlg.h" + +#include "TrkEventPrimitives/ParamDefs.h" +#include "xAODTracking/TrackParticleContainer.h" +#include "EventPrimitives/EventPrimitivesHelpers.h" + + +//Root +#include "TMath.h" + +//Standard c++ +#include <algorithm> +#include <vector> +#include <string> +#include <cmath> +#include <functional> + + +InDetGlobalPrimaryVertexMonAlg::InDetGlobalPrimaryVertexMonAlg( const std::string& name, ISvcLocator* pSvcLocator ) : + AthMonitorAlgorithm(name, pSvcLocator), + m_splitVertexTrkInvFraction(2), + m_distanceSplitVxMatch(5.0), + m_splitMatchingMetric(3), + m_doEnhancedMonitoring(false) +{ + declareProperty("splitVertexTrkInvFraction", m_splitVertexTrkInvFraction, "inverse fraction to split tracks (1:N)"); + declareProperty("distanceSplitVertexMatch", m_distanceSplitVxMatch, "Distance for matching split-original Vertex in selection efficiency"); + declareProperty("splitMatchingMetric", m_splitMatchingMetric, "Determines which function to use to calculate matching between split vertices and original input vertex -- used in selection efficiency"); + declareProperty("doEnhancedMonitoring" , m_doEnhancedMonitoring, "turn on the enhanced vertex monitoring, it is triggered by the same InDetFlag that also triggers the creation of no beam constraint and split vertices"); +} + + +InDetGlobalPrimaryVertexMonAlg::~InDetGlobalPrimaryVertexMonAlg() {} + + +StatusCode InDetGlobalPrimaryVertexMonAlg::initialize() { + + + ATH_CHECK( m_vxContainerName.initialize() ); + ATH_CHECK( m_vxContainerNameWithoutBeamConstraint.initialize() ); + ATH_CHECK( m_vxContainerNameSplit.initialize() ); + + + return AthMonitorAlgorithm::initialize(); +} + + +StatusCode InDetGlobalPrimaryVertexMonAlg::fillHistograms( const EventContext& ctx ) const { + using namespace Monitored; + + //******************************************************************************* + //************************** Begin of filling Track Histograms ****************** + //******************************************************************************* + ATH_MSG_DEBUG("Filling InDetGlobalPrimaryVertexMonAlg"); + + // For histogram naming + auto pvGroup = getGroup("PrimaryVertex"); + + // retrieving vertices + auto vxContainer = SG::makeHandle(m_vxContainerName, ctx); // another way to access ?? + + if (!vxContainer.isPresent()) { + ATH_MSG_DEBUG ("InDetGlobalPrimaryVertexMonAlg: StoreGate doesn't contain primary vertex container with key "+m_vxContainerName.key()); + return StatusCode::SUCCESS; + } + if (!vxContainer.isValid()) { + ATH_MSG_ERROR ("InDetGlobalPrimaryVertexMonAlg: Could not retrieve primary vertex container with key "+m_vxContainerName.key()); + return StatusCode::RECOVERABLE; + } + + + // Total number of vertices (primary and pile up) + int PvN = vxContainer->size()-1; // exclude dummy vertex + auto PvN_m = Monitored::Scalar<int>( "m_PvN", PvN); + fill(pvGroup, PvN_m); + + int nPriVtx = 0; + int nPileupVtx = 0; + + for (xAOD::VertexContainer::const_iterator vxIter = vxContainer->begin(); vxIter != vxContainer->end(); ++vxIter) + { + + // Count different types of vertices + if ((*vxIter)->vertexType() == xAOD::VxType::PriVtx) nPriVtx++; + if ((*vxIter)->vertexType() == xAOD::VxType::PileUp) nPileupVtx++; + + + // Select primary vertex + if ((*vxIter)->vertexType() != xAOD::VxType::PriVtx) continue; + if ((*vxIter)->numberDoF() <= 0) continue; + + float PvX = (*vxIter)->position().x(); + auto PvX_m = Monitored::Scalar<float>( "m_PvX", PvX); + fill(pvGroup, PvX_m); + + float PvY = (*vxIter)->position().y(); + auto PvY_m = Monitored::Scalar<float>( "m_PvY", PvY); + fill(pvGroup, PvY_m); + + float PvZ = (*vxIter)->position().z(); + auto PvZ_m = Monitored::Scalar<float>( "m_PvZ", PvZ); + fill(pvGroup, PvZ_m); + + float PvErrX = Amg::error( (*vxIter)->covariancePosition(), Trk::x); + auto PvErrX_m = Monitored::Scalar<float>( "m_PvErrX", PvErrX); + fill(pvGroup, PvErrX_m); + + float PvErrY = Amg::error( (*vxIter)->covariancePosition(), Trk::y); + auto PvErrY_m = Monitored::Scalar<float>( "m_PvErrY", PvErrY); + fill(pvGroup, PvErrY_m); + + float PvErrZ = Amg::error( (*vxIter)->covariancePosition(), Trk::z); + auto PvErrZ_m = Monitored::Scalar<float>( "m_PvErrZ", PvErrZ); + fill(pvGroup, PvErrZ_m); + + float PvChiSqDoF = (*vxIter)->chiSquared() / (*vxIter)->numberDoF() ; + auto PvChiSqDoF_m = Monitored::Scalar<float>( "m_PvChiSqDoF", PvChiSqDoF); + fill(pvGroup, PvChiSqDoF_m); + + + auto & trackparticles = (*vxIter)->trackParticleLinks(); + + int PvNTracks = trackparticles.size() ; + auto PvNTracks_m = Monitored::Scalar<int>( "m_PvNTracks", PvNTracks); + fill(pvGroup, PvNTracks_m); + + + // original tracks used for primary vertex + for (auto trackparticle : trackparticles ) + { + const Trk::Perigee & measuredPerigee = (*trackparticle)->perigeeParameters(); + + float PvTrackEta = measuredPerigee.eta() ; + auto PvTrackEta_m = Monitored::Scalar<float>( "m_PvTrackEta", PvTrackEta); + fill(pvGroup, PvTrackEta_m); + + float PvTrackPt = measuredPerigee.pT()/1000. ; // Histo is in GeV + auto PvTrackPt_m = Monitored::Scalar<float>( "m_PvTrackPt", PvTrackPt); + fill(pvGroup, PvTrackPt_m); + + } + + } // vxContainer + + + auto nPriVtx_m = Monitored::Scalar<int>( "m_nPriVtx", nPriVtx); + fill(pvGroup, nPriVtx_m); + + auto nPileupVtx_m = Monitored::Scalar<int>( "m_nPileupVtx", nPileupVtx); + fill(pvGroup, nPileupVtx_m); + + + // EnhancedMonitoring is OFF + + + //******************************************************************************* + //**************************** End of filling Track Histograms ****************** + //******************************************************************************* + + return StatusCode::SUCCESS; +} diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/src/InDetGlobalTrackMonAlg.cxx b/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/src/InDetGlobalTrackMonAlg.cxx new file mode 100644 index 000000000000..cd736cee87e2 --- /dev/null +++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/src/InDetGlobalTrackMonAlg.cxx @@ -0,0 +1,378 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + + +/** @file InDetGlobalTrackMonAlg.h + * Implementation of inner detector global track monitoring tool + * + *@author + * Leonid Serkin <lserkin@cern.ch> @n + * + * based on InDetGlobalTrackMonTool.cxx + * + ****************************************************************************/ + +//main header +#include "InDetGlobalMonitoringRun3Test/InDetGlobalTrackMonAlg.h" + +//Root +#include "TMath.h" + +//Standard c++ +#include <algorithm> +#include <vector> +#include <string> +#include <cmath> +#include <functional> + + + + +InDetGlobalTrackMonAlg::InDetGlobalTrackMonAlg( const std::string& name, ISvcLocator* pSvcLocator ) : + AthMonitorAlgorithm(name, pSvcLocator), + m_holes_search_tool("InDet::InDetTrackHoleSearchTool/InDetHoleSearchTool", this), + m_trackSelTool ( "InDet::InDetTrackSelectionTool/TrackSelectionTool", this), + m_tight_trackSelTool( "InDet::InDetTrackSelectionTool/TrackSelectionTool", this ), + m_atlasid(nullptr), + m_trtID(nullptr), + m_sctID(nullptr), + m_pixelID(nullptr), + m_IBLParameterSvc("IBLParameterSvc",name), + m_doLumiblock(true), + m_doHolePlots(false), + m_DoHoles_Search(false), + m_doHitMaps(false), + m_doTide(false), + m_doTideResiduals(false), + m_doForwardTracks(false), + m_doIBL(true) +{ + //jo flags go here, keys and some tools -> in class + declareProperty("DoHoleSearch",m_DoHoles_Search,"Write hole data?"); + declareProperty("DoTide",m_doTide,"Make TIDE plots?"); + declareProperty("DoTideResiduals",m_doTideResiduals,"Make TIDE residual plots?"); + declareProperty("HoleSearchTool", m_holes_search_tool,"Tool to search for holes on track"); + // declareProperty("UpdatorTool" , m_iUpdator); + declareProperty("DoHitMaps", m_doHitMaps,"Produce hit maps?"); + declareProperty("DoForwardTracks", m_doForwardTracks,"Run over forward tracks?"); + declareProperty("DoIBL", m_doIBL,"IBL present?"); + // declareProperty("ResidualPullCalculatorTool", m_residualPullCalculator); + declareProperty( "TrackSelectionTool", m_trackSelTool); + declareProperty( "Tight_TrackSelectionTool", m_tight_trackSelTool ); +} + + +InDetGlobalTrackMonAlg::~InDetGlobalTrackMonAlg() {} + + +StatusCode InDetGlobalTrackMonAlg::initialize() { + + ATH_CHECK( detStore()->retrieve(m_atlasid, "AtlasID") ); + + m_pixelID = 0; + if (detStore()->retrieve(m_pixelID, "PixelID").isFailure()) { + ATH_MSG_DEBUG("InDetGlobalMonitoringRun3Test: Could not get Pixel ID helper"); + m_doHitMaps = false; + } + + m_sctID = 0; + if (detStore()->retrieve(m_sctID, "SCT_ID").isFailure()) { + ATH_MSG_DEBUG("InDetGlobalMonitoringRun3Test: Could not get SCT ID helper"); + m_doHitMaps = false; + } + + m_trtID = 0; + if (detStore()->retrieve(m_trtID, "TRT_ID").isFailure()) { + ATH_MSG_DEBUG("InDetGlobalMonitoringRun3Test: Could not get TRT ID helper"); + m_doHitMaps = false; + } + + + ATH_CHECK( m_pixelCondSummaryTool.retrieve() ); // maybe not needed + + + if (m_IBLParameterSvc.retrieve().isFailure()) { + if(msgLvl(MSG::FATAL)) msg(MSG::FATAL) << "Could not retrieve " << m_IBLParameterSvc << endmsg; + return StatusCode::FAILURE; + } else { + if(msgLvl(MSG::INFO)) msg(MSG::INFO) << "Retrieved tool " << m_IBLParameterSvc << endmsg; + } + + m_doIBL = m_IBLParameterSvc->containsIBL(); + + if (!m_trackSelTool.empty() ) ATH_CHECK( m_trackSelTool.retrieve() ); + if (!m_tight_trackSelTool.empty()) ATH_CHECK( m_tight_trackSelTool.retrieve() ); + + if (!m_holes_search_tool.empty()) ATH_CHECK( m_holes_search_tool.retrieve()); + + ATH_CHECK( m_CombinedTracksName.initialize() ); + ATH_CHECK( m_ForwardTracksName.initialize() ); + + ATH_CHECK( m_clustersKey.initialize() ); // maybe not needed + + return AthMonitorAlgorithm::initialize(); +} + + +StatusCode InDetGlobalTrackMonAlg::fillHistograms( const EventContext& ctx ) const { + using namespace Monitored; + + //******************************************************************************* + //************************** Begin of filling Track Histograms ****************** + //******************************************************************************* + ATH_MSG_DEBUG("Filling InDetGlobalTrackMonAlg"); + + // For histogram naming + auto trackGroup = getGroup("Track"); + + // m_manager->lumiBlockNumber() // not used anymore, now use + int lb = GetEventInfo(ctx)->lumiBlock(); + auto lb_m = Monitored::Scalar<int>( "m_lb", lb ); + + // retrieving tracks + auto combined_tracks = SG::makeHandle(m_CombinedTracksName, ctx); + + // check for tracks + if ( !(combined_tracks.isValid()) ) { + ATH_MSG_ERROR("InDetGlobalMonitoringRun3Test: Track container "<< m_CombinedTracksName.key() << " could not be found."); + return StatusCode::RECOVERABLE; + } else { + ATH_MSG_DEBUG("InDetGlobalMonitoringRun3Test: Track container "<< combined_tracks.name() <<" is found."); + } + + // counters + int nBase = 0; + int nTight = 0; + int nNoIBL = 0; + int nNoBL = 0; + int nNoTRText = 0; + + + TrackCollection::const_iterator itrack = combined_tracks->begin(); + TrackCollection::const_iterator itrack_end = combined_tracks->end(); + + for ( ; itrack!= itrack_end; ++itrack) + { + + const Trk::Track * track = (*itrack); + if ( !track || track->perigeeParameters() == 0 ) + { + ATH_MSG_DEBUG( "InDetGlobalMonitoringRun3Test: NULL track pointer in collection" ); + continue; + } + + // not sure it works now.... + // Skip tracks that are not inside out + //if ( ( m_dataType == AthenaMonManager::collisions || m_dataType == AthenaMonManager::userDefined ) + // && ! track->info().patternRecoInfo( Trk::TrackInfo::SiSPSeededFinder ) ) + // continue; + + + // Loose primary tracks + if ( !m_trackSelTool->accept(*track) ) + continue; + + // Create a new summary or get copy of the cached one + std::unique_ptr<const Trk::TrackSummary> summary(m_trkSummaryTool->createSummary( * track ) ); + + if ( !summary ) + { + ATH_MSG_DEBUG( "InDetGlobalMonitoringRun3Test: NULL pointer to track summary" ); + continue; + } + + nBase++; + + + // =================================== // + // Fill hits BEGINS + int numberOfPixelHits = ( summary->get(Trk::numberOfPixelHits) >= 0 ) ? summary->get(Trk::numberOfPixelHits) : 0 ; + int numberOfPixelDeadSensors = ( summary->get(Trk::numberOfPixelDeadSensors) >= 0 ) ? summary->get(Trk::numberOfPixelDeadSensors ) : 0 ; + int pixHits = numberOfPixelHits + numberOfPixelDeadSensors; + + int numberOfSCTHits = ( summary->get(Trk::numberOfSCTHits) >= 0 ) ? summary->get(Trk::numberOfSCTHits) : 0 ; + int numberOfSCTDeadSensors = ( summary->get(Trk::numberOfSCTDeadSensors) >= 0 ) ? summary->get(Trk::numberOfSCTDeadSensors) : 0 ; + int sctHits = numberOfSCTHits + numberOfSCTDeadSensors; + + int trtHits = summary->get(Trk::numberOfTRTHits) + summary->get(Trk::numberOfTRTDeadStraws); + + + const Trk::Perigee *perigee = track->perigeeParameters(); + if ( !perigee ) + { + ATH_MSG_DEBUG( "InDetGlobalMonitoringRun3Test: NULL track->perigeeParameters pointer " ); + continue; + } + + float eta_perigee = perigee->eta(); + float phi_perigee = perigee->parameters()[Trk::phi0]; + + auto eta_perigee_m = Monitored::Scalar<float>( "m_eta_perigee", eta_perigee); + auto phi_perigee_m = Monitored::Scalar<float>( "m_phi_perigee", phi_perigee); + fill(trackGroup, eta_perigee_m, phi_perigee_m); // Trk_Base_eta_phi + + + if ( m_doIBL ) + { + int numberOfInnermostPixelLayerHits = summary->get( Trk::numberOfInnermostPixelLayerHits ); + auto numberOfInnermostPixelLayerHits_m = Monitored::Scalar<int>( "m_numberOfInnermostPixelLayerHits", numberOfInnermostPixelLayerHits); + fill(trackGroup, eta_perigee_m, phi_perigee_m, numberOfInnermostPixelLayerHits_m); + + fill(trackGroup, lb_m, numberOfInnermostPixelLayerHits_m); + } + + auto pixHits_m = Monitored::Scalar<int>( "m_pixHits", pixHits ); + fill(trackGroup, eta_perigee_m, phi_perigee_m, pixHits_m); + fill(trackGroup, lb_m, pixHits_m); + + auto numberOfPixelDeadSensors_m = Monitored::Scalar<int>( "m_numberOfPixelDeadSensors", numberOfPixelDeadSensors ); + fill(trackGroup, eta_perigee_m, phi_perigee_m, numberOfPixelDeadSensors_m); + + int numberOfPixelSharedHits = ( summary->get(Trk::numberOfPixelSharedHits) >= 0 ) ? summary->get(Trk::numberOfPixelSharedHits) : 0 ; + auto numberOfPixelSharedHits_m = Monitored::Scalar<int>( "m_numberOfPixelSharedHits", numberOfPixelSharedHits); + fill(trackGroup, eta_perigee_m, phi_perigee_m, numberOfPixelSharedHits_m); + + int numberOfPixelHoles = summary->get(Trk::numberOfPixelHoles) >= 0 ? summary->get(Trk::numberOfPixelHoles) : 0; + auto numberOfPixelHoles_m = Monitored::Scalar<int>( "m_numberOfPixelHoles", numberOfPixelHoles); + fill(trackGroup, eta_perigee_m, phi_perigee_m, numberOfPixelHoles_m); + + int numberOfPixelSplitHits = ( summary->get(Trk::numberOfPixelSplitHits) >= 0 ) ? summary->get(Trk::numberOfPixelSplitHits) : 0 ; + auto numberOfPixelSplitHits_m = Monitored::Scalar<int>( "m_numberOfPixelSplitHits", numberOfPixelSplitHits); + fill(trackGroup, eta_perigee_m, phi_perigee_m, numberOfPixelSplitHits_m); + + auto sctHits_m = Monitored::Scalar<int>( "m_sctHits", sctHits ); + fill(trackGroup, eta_perigee_m, phi_perigee_m, sctHits_m); + fill(trackGroup, lb_m, sctHits_m); + + auto numberOfSCTDeadSensors_m = Monitored::Scalar<int>( "m_numberOfSCTDeadSensors", numberOfSCTDeadSensors ); + fill(trackGroup, eta_perigee_m, phi_perigee_m, numberOfSCTDeadSensors_m); + + int numberOfSCTSharedHits = ( summary->get(Trk::numberOfSCTSharedHits) >= 0 ) ? summary->get(Trk::numberOfSCTSharedHits) : 0 ; + auto numberOfSCTSharedHits_m = Monitored::Scalar<int>( "m_numberOfSCTSharedHits", numberOfSCTSharedHits); + fill(trackGroup, eta_perigee_m, phi_perigee_m, numberOfSCTSharedHits_m); + + int numberOfSCTHoles = summary->get(Trk::numberOfSCTHoles) >= 0 ? summary->get(Trk::numberOfSCTHoles) : 0; + auto numberOfSCTHoles_m = Monitored::Scalar<int>( "m_numberOfSCTHoles", numberOfSCTHoles); + fill(trackGroup, eta_perigee_m, phi_perigee_m, numberOfSCTHoles_m); + + auto trtHits_m = Monitored::Scalar<int>( "m_trtHits", trtHits ); + fill(trackGroup, eta_perigee_m, phi_perigee_m, trtHits_m); + fill(trackGroup, lb_m, trtHits_m); + + int numberOfTRTDeadStraws = ( summary->get(Trk::numberOfTRTDeadStraws) >= 0 ) ? summary->get(Trk::numberOfTRTDeadStraws) : 0 ; + auto numberOfTRTDeadStraws_m = Monitored::Scalar<int>( "m_numberOfTRTDeadStraws", numberOfTRTDeadStraws); + fill(trackGroup, eta_perigee_m, phi_perigee_m, numberOfTRTDeadStraws_m); + + // Fill hits ENDS + // =================================== // + + // =================================== // + // FillEtaPhi BEGINS + + int InnermostPixelLayerHit = 0; + int NextToInnermostPixelLayerHit = 0; + if ( m_doIBL ) + { + // no IBL hit but a hit is expected + if ( summary->get( Trk::expectInnermostPixelLayerHit ) && !summary->get( Trk::numberOfInnermostPixelLayerHits ) ) InnermostPixelLayerHit = 1; + auto InnermostPixelLayerHit_m = Monitored::Scalar<int>( "m_InnermostPixelLayerHit", InnermostPixelLayerHit); + fill(trackGroup, eta_perigee_m, phi_perigee_m, InnermostPixelLayerHit_m); + + + // no b-layer hit but a hit is expected + if ( summary->get( Trk::expectNextToInnermostPixelLayerHit ) && !summary->get( Trk::numberOfNextToInnermostPixelLayerHits ) ) NextToInnermostPixelLayerHit = 1 ; + auto NextToInnermostPixelLayerHit_m = Monitored::Scalar<int>( "m_NextToInnermostPixelLayerHit", NextToInnermostPixelLayerHit); + fill(trackGroup, eta_perigee_m, phi_perigee_m, NextToInnermostPixelLayerHit_m); + + } + else + { + if ( summary->get( Trk::expectInnermostPixelLayerHit ) && !summary->get( Trk::numberOfInnermostPixelLayerHits ) ) InnermostPixelLayerHit = 1; + NextToInnermostPixelLayerHit = InnermostPixelLayerHit; + auto NextToInnermostPixelLayerHit_m = Monitored::Scalar<int>( "m_NextToInnermostPixelLayerHit", NextToInnermostPixelLayerHit); + fill(trackGroup, eta_perigee_m, phi_perigee_m, NextToInnermostPixelLayerHit_m); + + } + + // No TRT extension + int noTRTHits = 0; + if ( summary->get(Trk::numberOfTRTHits) == 0 ) noTRTHits = 1; + auto noTRTHits_m = Monitored::Scalar<int>( "m_noTRTHits", noTRTHits); + fill(trackGroup, eta_perigee_m, phi_perigee_m, noTRTHits_m); + + + // Tight track selection + int track_pass_tight = 0; + if ( m_tight_trackSelTool -> accept(*track) ) track_pass_tight = 1; // tight selection + auto track_pass_tight_m = Monitored::Scalar<int>( "m_track_pass_tight", track_pass_tight); + fill(trackGroup, eta_perigee_m, phi_perigee_m, track_pass_tight_m); + + // =================================== // + // FillEtaPhi ENDS + + int NoIBL = 0; + if ( m_doIBL ) + { + // no IBL hit but a hit is expected + if ( summary->get( Trk::expectInnermostPixelLayerHit ) && !summary->get( Trk::numberOfInnermostPixelLayerHits ) ) NoIBL = 1; + if (NoIBL == 1) nNoIBL++; + auto NoIBL_m = Monitored::Scalar<int>( "m_NoIBL_LB", NoIBL); + fill(trackGroup, lb_m, NoIBL_m); + } + + int NoBL = 0; + if ( summary->get( ( m_doIBL ) ? Trk::expectNextToInnermostPixelLayerHit : Trk::expectInnermostPixelLayerHit ) && !summary->get( ( m_doIBL ) ? Trk::numberOfNextToInnermostPixelLayerHits : Trk::numberOfInnermostPixelLayerHits ) ) NoBL = 1; + if (NoBL == 1) nNoBL++; + auto NoBL_m = Monitored::Scalar<int>( "m_NoBL_LB", NoBL); + fill(trackGroup, lb_m, NoBL_m); + + int NoTRText = 0; + if ( summary->get(Trk::numberOfTRTHits) + summary->get(Trk::numberOfTRTOutliers) == 0 ) NoTRText = 1; + if (NoTRText == 1) nNoTRText++; + auto NoTRText_m = Monitored::Scalar<int>( "m_NoTRText_LB", NoTRText); + fill(trackGroup, lb_m, NoTRText_m); + + + if ( m_tight_trackSelTool -> accept(*track) ) + { + nTight++; + } + + + // FillHitMaps is false for now + // FillHoles is false for now + + + } // end of track loop + + // Filling per-event histograms + auto nBase_m = Monitored::Scalar<int>( "m_nBase", nBase); + fill(trackGroup, nBase_m); + + auto nBaseLB_m = Monitored::Scalar<int>( "m_nBase_LB", nBase); + fill(trackGroup, lb_m, nBaseLB_m); + + auto nTight_m = Monitored::Scalar<int>( "m_nTight_LB", nTight); + fill(trackGroup, lb_m, nTight_m); + + if ( m_doIBL ) { + auto nNoIBL_m = Monitored::Scalar<int>( "m_nNoIBL_LB", nNoIBL); + fill(trackGroup, lb_m, nNoIBL_m); + } + + auto nNoBL_m = Monitored::Scalar<int>( "m_nNoBL_LB", nNoBL); + fill(trackGroup, lb_m, nNoBL_m); + + auto nNoTRText_m = Monitored::Scalar<int>( "m_nNoTRText_LB", nNoTRText); + fill(trackGroup, lb_m, nNoTRText_m); + + + + + //******************************************************************************* + //**************************** End of filling Track Histograms ****************** + //******************************************************************************* + + return StatusCode::SUCCESS; +} diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/src/components/InDetGlobalMonitoringRun3Test_entries.cxx b/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/src/components/InDetGlobalMonitoringRun3Test_entries.cxx new file mode 100644 index 000000000000..b778c8ca79d5 --- /dev/null +++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/src/components/InDetGlobalMonitoringRun3Test_entries.cxx @@ -0,0 +1,7 @@ +#include "InDetGlobalMonitoringRun3Test/InDetGlobalTrackMonAlg.h" +#include "InDetGlobalMonitoringRun3Test/InDetGlobalPrimaryVertexMonAlg.h" +#include "InDetGlobalMonitoringRun3Test/InDetGlobalBeamSpotMonAlg.h" + +DECLARE_COMPONENT( InDetGlobalTrackMonAlg ) +DECLARE_COMPONENT( InDetGlobalPrimaryVertexMonAlg ) +DECLARE_COMPONENT( InDetGlobalBeamSpotMonAlg ) -- GitLab