From aa5ea6c52466e17cc4df30ac3722e04da937bd4d Mon Sep 17 00:00:00 2001 From: Goetz Gaycken <goetz.gaycken@cern.ch> Date: Fri, 21 Aug 2020 10:01:07 +0200 Subject: [PATCH] Remove unused pixel covariance correction for collimated tracks. - remove the pixel covariance correction, - remove dRmap based identification of collimated tracks, - remove creation of dRmap. All of the above is unused and was not properly migrated to athenaMT. --- .../InDetConfig/python/InDetConfigFlags.py | 1 - .../python/InDetJobProperties.py | 16 -- .../InDetRecExample/python/TrackingCommon.py | 2 - .../share/ConfiguredNewTrackingSiPattern.py | 2 - .../share/InDetRecLoadTools.py | 9 - .../python/InDetTrigConfigRecLoadTools.py | 5 - .../SiClusterOnTrackTool/CMakeLists.txt | 3 +- .../PixelClusterOnTrackTool.h | 53 +---- .../src/PixelClusterOnTrackTool.cxx | 217 ------------------ .../TrkAmbiguityProcessor/CMakeLists.txt | 19 +- .../TrkAmbiguityProcessor/dRMap.h | 30 --- ...enseEnvironmentsAmbiguityProcessorTool.cxx | 105 --------- .../DenseEnvironmentsAmbiguityProcessorTool.h | 3 - 13 files changed, 20 insertions(+), 445 deletions(-) delete mode 100644 Tracking/TrkTools/TrkAmbiguityProcessor/TrkAmbiguityProcessor/dRMap.h diff --git a/InnerDetector/InDetConfig/python/InDetConfigFlags.py b/InnerDetector/InDetConfig/python/InDetConfigFlags.py index fc36ba07c72..35fa2e606eb 100644 --- a/InnerDetector/InDetConfig/python/InDetConfigFlags.py +++ b/InnerDetector/InDetConfig/python/InDetConfigFlags.py @@ -165,7 +165,6 @@ def createInDetConfigFlags(): icf.addFlag("InDet.doTIDE_Ambi", True) # Switch for running TIDE Ambi icf.addFlag("InDet.doRefitInvalidCov", False) # Try Kalman fitter if the track fit in the ambiguity processor produces non positive definitematrices. icf.addFlag("InDet.doRejectInvalidCov", False) # Reject all tracks which have a non positive definite covariance matrix after the refit. - icf.addFlag("InDet.doTIDE_RescalePixelCovariances", False) # Switch for running TIDE pixel cluster covariance rescaling icf.addFlag("InDet.doSSSfilter", True) # Switch for running SSS filter icf.addFlag("InDet.pT_SSScut", -1) # Pt cut for SSS filter [GeV] icf.addFlag("InDet.ForceCoraCool", False) # Use old (non CoolVectorPayload) SCT Conditions diff --git a/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py b/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py index ecd768873b2..160c7f3fcfe 100644 --- a/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py +++ b/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py @@ -1085,12 +1085,6 @@ class doTIDE_Ambi(InDetFlagsJobProperty): allowedTypes = ['bool'] StoredValue = True -class doTIDE_RescalePixelCovariances(InDetFlagsJobProperty): - """ Switch for running TIDE pixel cluster covariance rescaling """ - statusOn = True - allowedTypes = ['bool'] - StoredValue = False - class doRefitInvalidCov(InDetFlagsJobProperty): """ Try Kalman fitter if the track fit in the ambiguity processor produces non positive definitematrices.""" statusOn = True @@ -1357,7 +1351,6 @@ class InDetJobProperties(JobPropertyContainer): self.checkThenSet(self.doTrackSegmentsTRT , False) self.checkThenSet(self.doSlimming , False) self.checkThenSet(self.doSGDeletion , True ) - self.checkThenSet(self.doTIDE_RescalePixelCovariances, False) # TEMPORARY FIX TO STOP SEG FAULT self.checkThenSet(self.doPixelClusterSplitting, False) self.checkThenSet(self.doTIDE_Ambi, False) @@ -1654,7 +1647,6 @@ class InDetJobProperties(JobPropertyContainer): self.checkThenSet(self.doTrackSegmentsTRT , True ) self.checkThenSet(self.doPixelClusterSplitting, False) self.checkThenSet(self.doTIDE_Ambi, False) - self.checkThenSet(self.doTIDE_RescalePixelCovariances, False) self.checkThenSet(self.doTrackSegmentsDisappearing, False) if rec.doExpressProcessing() : @@ -1715,11 +1707,6 @@ class InDetJobProperties(JobPropertyContainer): self.doSpacePointFormation = self.preProcessing() and self.doSpacePointFormation() and (DetFlags.haveRIO.pixel_on() or DetFlags.haveRIO.SCT_on()) self.doPRDFormation = self.preProcessing() and self.doPRDFormation() and (DetFlags.makeRIO.pixel_on() or DetFlags.makeRIO.SCT_on() or DetFlags.makeRIO.TRT_on()) - # -------------------------------------------------------------------- - # ---- TIDE Pixel cluster covariance rescaling - # -------------------------------------------------------------------- - self.doTIDE_RescalePixelCovariances = self.doTIDE_RescalePixelCovariances() and self.doPixelClusterSplitting() and self.pixelClusterSplittingType() == 'NeuralNet' and self.doTIDE_Ambi() - # -------------------------------------------------------------------- # --- 1st iteration, inside out tracking # -------------------------------------------------------------------- @@ -2231,8 +2218,6 @@ class InDetJobProperties(JobPropertyContainer): print('* split prob1 cut: ', self.pixelClusterSplitProb1()) print('* split prob2 cut: ', self.pixelClusterSplitProb2()) print('* Min split pt: [MeV] ', self.pixelClusterSplitMinPt()) - if self.doTIDE_RescalePixelCovariances(): - print('* rescaling pixel cluster covariances: ', self.doTIDE_RescalePixelCovariances()) else: print('* - run new Pixel clustering with splitting using analog information') print('* splitting technique: ', self.pixelClusterSplittingType()) @@ -2764,7 +2749,6 @@ _list_InDetJobProperties = [Enabled, doTIDE_Ambi, doRefitInvalidCov, doRejectInvalidCov, - doTIDE_RescalePixelCovariances, doSSSfilter, pT_SSScut, ForceCoraCool, diff --git a/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py b/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py index 84f5ebc4b79..088720d6326 100644 --- a/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py +++ b/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py @@ -353,8 +353,6 @@ def getInDetPixelClusterOnTrackToolNNSplitting(name='InDetPixelClusterOnTrackToo if 'NnClusterizationFactory' not in kwargs : kwargs = setDefaults(kwargs, NnClusterizationFactory = getNnClusterizationFactory()) - if InDetFlags.doTIDE_RescalePixelCovariances() : - kwargs = setDefaults(kwargs, applydRcorrection = True) return getInDetPixelClusterOnTrackToolBase(name=name, **kwargs) def getInDetPixelClusterOnTrackTool(name='InDetPixelClusterOnTrackTool', **kwargs) : diff --git a/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredNewTrackingSiPattern.py b/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredNewTrackingSiPattern.py index 74d387eb180..1efc7806b04 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredNewTrackingSiPattern.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredNewTrackingSiPattern.py @@ -553,8 +553,6 @@ class ConfiguredNewTrackingSiPattern: elif NewTrackingCuts.extension() == "Disappearing": InDetAmbiguityScoreProcessor.SplitClusterMap_old = InDetKeys.SplitClusterAmbiguityMap() InDetAmbiguityScoreProcessor.SplitClusterMap_new = InDetKeys.SplitClusterAmbiguityMap()+NewTrackingCuts.extension() - if InDetFlags.doTIDE_RescalePixelCovariances() : - InDetAmbiguityProcessor.applydRcorrection = True if NewTrackingCuts.mode() == "Pixel" or NewTrackingCuts.mode() == "DBM": InDetAmbiguityProcessor.SuppressHoleSearch = True diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py index 5b6012e177a..800bf2d703a 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py @@ -82,15 +82,6 @@ if InDetFlags.doPixelClusterSplitting() and not InDetFlags.doSLHC(): ToolSvc += NnClusterizationFactory - # special setup for DVRetracking mode - # if InDetFlags.doDVRetracking() : - # COOL binding - from IOVDbSvc.CondDB import conddb - if InDetFlags.doTIDE_RescalePixelCovariances() : - if not conddb.folderRequested('/PIXEL/PixelClustering/PixelCovCorr'): - # COOL binding - conddb.addFolder("PIXEL_OFL","/PIXEL/PixelClustering/PixelCovCorr") - if (InDetFlags.doPrintConfigurables()): printfunc (NnClusterizationFactory) elif InDetFlags.doPixelClusterSplitting(): diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecLoadTools.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecLoadTools.py index cedfd5bd811..8cdd29a1ce7 100755 --- a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecLoadTools.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecLoadTools.py @@ -112,11 +112,6 @@ if InDetTrigFlags.loadRotCreator(): NnCollectionWithTrackReadKey = 'PixelClusterNNWithTrack') ToolSvc += TrigNnClusterizationFactory - - from IOVDbSvc.CondDB import conddb - if InDetTrigFlags.doTIDE_RescalePixelCovariances() : - if not conddb.folderRequested('/PIXEL/PixelClustering/PixelCovCorr'): - conddb.addFolder("PIXEL_OFL","/PIXEL/PixelClustering/PixelCovCorr") else: TrigNnClusterizationFactory = None diff --git a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/CMakeLists.txt b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/CMakeLists.txt index c8ff0c79709..961ff0106c7 100644 --- a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/CMakeLists.txt @@ -17,7 +17,6 @@ atlas_depends_on_subdirs( PUBLIC InnerDetector/InDetRecEvent/InDetRIO_OnTrack Tracking/TrkEvent/TrkParameters Tracking/TrkTools/TrkToolInterfaces - Tracking/TrkTools/TrkAmbiguityProcessor Tracking/TrkEvent/TrkRIO_OnTrack Tracking/TrkUtilityPackages/TrkNeuralNetworkUtils Control/StoreGate @@ -40,7 +39,7 @@ atlas_add_component( SiClusterOnTrackTool src/*.cxx src/components/*.cxx INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps AthenaPoolUtilities GeoPrimitives GaudiKernel InDetPrepRawData InDetRIO_OnTrack TrkParameters TrkToolInterfaces TrkAmbiguityProcessorLib StoreGateLib SGtests EventPrimitives InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry SiClusterizationToolLib TrkSurfaces TrkRIO_OnTrack PixelConditionsData TrkNeuralNetworkUtilsLib ) + LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps AthenaPoolUtilities GeoPrimitives GaudiKernel InDetPrepRawData InDetRIO_OnTrack TrkParameters TrkToolInterfaces StoreGateLib SGtests EventPrimitives InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry SiClusterizationToolLib TrkSurfaces TrkRIO_OnTrack PixelConditionsData TrkNeuralNetworkUtilsLib TrkEventUtils) # Install files from the package: atlas_install_headers( SiClusterOnTrackTool ) diff --git a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/SiClusterOnTrackTool/PixelClusterOnTrackTool.h b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/SiClusterOnTrackTool/PixelClusterOnTrackTool.h index e60bd26b65c..b583ff3dea5 100755 --- a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/SiClusterOnTrackTool/PixelClusterOnTrackTool.h +++ b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/SiClusterOnTrackTool/PixelClusterOnTrackTool.h @@ -15,7 +15,6 @@ #include "InDetPrepRawData/PixelGangedClusterAmbiguities.h" #include "TrkParameters/TrackParameters.h" #include "GeoPrimitives/GeoPrimitives.h" -#include "TrkAmbiguityProcessor/dRMap.h" #include "Identifier/Identifier.h" #include "InDetIdentifier/PixelID.h" @@ -73,12 +72,6 @@ public: virtual StatusCode initialize() override; //! AlgTool termination virtual StatusCode finalize () override; - - - - void correctBow(const Identifier&, Amg::Vector2D& locpos, const double tanphi, const double taneta) const; - - double splineIBLPullX(float x, int layer) const; /** @brief produces a PixelClusterOnTrack (object factory!). @@ -89,8 +82,15 @@ public: virtual const InDet::PixelClusterOnTrack* correct(const Trk::PrepRawData&, const Trk::TrackParameters&) const override; - virtual const InDet::PixelClusterOnTrack* correctDefault(const Trk::PrepRawData&, - const Trk::TrackParameters&) const; + /////////////////////////////////////////////////////////////////// + // Private methods: + /////////////////////////////////////////////////////////////////// + +protected: + void correctBow(const Identifier&, Amg::Vector2D& locpos, const double tanphi, const double taneta) const; + + const InDet::PixelClusterOnTrack* correctDefault(const Trk::PrepRawData&, + const Trk::TrackParameters&) const; virtual const InDet::PixelClusterOnTrack* correctNN(const Trk::PrepRawData&, const Trk::TrackParameters&) const; virtual bool getErrorsDefaultAmbi( const InDet::PixelCluster*, const Trk::TrackParameters&, @@ -110,15 +110,6 @@ public: private: - /** @brief parametrizes the pixel cluster position error as a function of - the track angle alpha and the cluster width (number of rows) deltax */ - // double getBarrelPhiError(double& alpha, int& deltax) const; - // double getBarrelEtaError(double eta, int deltax, int deltay) const; - // double getEndcapPhiError(int etasize, int phisize) const; - // double getEndcapEtaError(int etasize, int phisize) const; - - void FillFromDataBase() const; - /////////////////////////////////////////////////////////////////// // Private data: /////////////////////////////////////////////////////////////////// @@ -134,17 +125,6 @@ public: SG::ReadCondHandleKey<RIO_OnTrackErrorScaling> m_pixelErrorScalingKey {this,"PixelErrorScalingKey", "/Indet/TrkErrorScalingPixel", "Key for pixel error scaling conditions data."}; - /* ME: Test histos have nothing to do with production code, use a flag - IHistogram1D* m_h_Resx; - IHistogram1D* m_h_Resy; - IHistogram1D* m_h_Locx; - IHistogram1D* m_h_Locy; - IHistogram1D* m_h_PhiTrack; - IHistogram1D* m_h_ThetaTrack; - IHistogram1D* m_h_Rad; - IHistogram1D* m_h_Slope; - */ - //! toolhandle for central error scaling //! flag storing if errors need scaling or should be kept nominal bool m_disableDistortions; @@ -172,7 +152,6 @@ public: /** Enable NN based calibration (do only if NN calibration is applied) **/ bool m_applyNNcorrection{false}; BooleanProperty m_applyNNcorrectionProperty{this, "applyNNcorrection", false}; - bool m_applydRcorrection; bool m_NNIBLcorrection; bool m_IBLAbsent; @@ -180,22 +159,12 @@ public: ToolHandle<NnClusterizationFactory> m_NnClusterizationFactory; ServiceHandle<IIBLParameterSvc> m_IBLParameterSvc; - - SG::ReadHandleKey<InDet::DRMap> m_dRMap; //!< the actual dR map - std::string m_dRMapName; - bool m_doNotRecalibrateNN; bool m_noNNandBroadErrors; /** Enable different treatment of cluster errors based on NN information (do only if TIDE ambi is run) **/ bool m_usingTIDE_Ambi; - SG::ReadHandleKey<InDet::PixelGangedClusterAmbiguities> m_splitClusterMapKey; - mutable std::vector< std::vector<float> > m_fX ATLAS_THREAD_SAFE; // Guarded by m_mutex - mutable std::vector< std::vector<float> > m_fY ATLAS_THREAD_SAFE; // Guarded by m_mutex - mutable std::vector< std::vector<float> > m_fB ATLAS_THREAD_SAFE; // Guarded by m_mutex - mutable std::vector< std::vector<float> > m_fC ATLAS_THREAD_SAFE; // Guarded by m_mutex - mutable std::vector< std::vector<float> > m_fD ATLAS_THREAD_SAFE; // Guarded by m_mutex - mutable std::mutex m_mutex; - + SG::ReadHandleKey<InDet::PixelGangedClusterAmbiguities> m_splitClusterMapKey; + //moved from static to member variable static constexpr int s_nbinphi=9; static constexpr int s_nbineta=6; diff --git a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/PixelClusterOnTrackTool.cxx b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/PixelClusterOnTrackTool.cxx index 3d830b65b6e..1339a792da2 100755 --- a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/PixelClusterOnTrackTool.cxx +++ b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/PixelClusterOnTrackTool.cxx @@ -60,13 +60,10 @@ InDet::PixelClusterOnTrackTool::PixelClusterOnTrackTool m_disableDistortions(false), m_rel13like(false), m_pixelid(nullptr), - m_applydRcorrection(false), m_NNIBLcorrection(false), m_IBLAbsent(true), m_NnClusterizationFactory("InDet::NnClusterizationFactory/NnClusterizationFactory", this), m_IBLParameterSvc("IBLParameterSvc", n), - m_dRMap(""), - m_dRMapName("dRMap"), m_doNotRecalibrateNN(false), m_noNNandBroadErrors(false), m_usingTIDE_Ambi(false), @@ -76,11 +73,9 @@ InDet::PixelClusterOnTrackTool::PixelClusterOnTrackTool declareProperty("PositionStrategy", m_positionStrategy = 1, "Which calibration of cluster positions"); declareProperty("DisableDistortions", m_disableDistortions, "Disable simulation of module distortions"); declareProperty("Release13like", m_rel13like, "Activate release-13 like settigs"); - declareProperty("applydRcorrection", m_applydRcorrection); declareProperty("NNIBLcorrection", m_NNIBLcorrection); declareProperty("NnClusterizationFactory", m_NnClusterizationFactory); declareProperty("SplitClusterAmbiguityMap", m_splitClusterMapKey);//Remove Later - declareProperty("dRMapName", m_dRMapName); //This is a string to prevent the scheduler seeing trkAmbSolver as both creating and requiring the map declareProperty("doNotRecalibrateNN", m_doNotRecalibrateNN); declareProperty("m_noNNandBroadErrors", m_noNNandBroadErrors); declareProperty("RunningTIDE_Ambi", m_usingTIDE_Ambi); @@ -133,9 +128,6 @@ InDet::PixelClusterOnTrackTool::initialize() { ATH_CHECK (detStore()->retrieve(m_pixelid, "PixelID")); - m_dRMap = SG::ReadHandleKey<InDet::DRMap>(m_dRMapName); - ATH_CHECK( m_dRMap.initialize() ); - m_applyNNcorrection &= !m_splitClusterMapKey.key().empty(); ATH_CHECK(m_splitClusterMapKey.initialize(m_applyNNcorrection)); ATH_CHECK(m_NnClusterizationFactory.retrieve( DisableTool{!m_applyNNcorrection} )); @@ -169,70 +161,6 @@ InDet::PixelClusterOnTrackTool::finalize() { return StatusCode::SUCCESS; } -void -InDet::PixelClusterOnTrackTool::FillFromDataBase() const{ - if (m_fX.empty()) { - const CondAttrListCollection *atrlistcol = nullptr; - if (StatusCode::SUCCESS == detStore()->retrieve(atrlistcol, "/PIXEL/PixelClustering/PixelCovCorr")) { - // loop over objects in collection - for (CondAttrListCollection::const_iterator citr = atrlistcol->begin(); citr != atrlistcol->end(); ++citr) { - std::vector<float> fx, fy, fb, fc, fd; - const coral::AttributeList &atrlist = citr->second; - - fx.push_back(atrlist["fX1"].data<float>()); - fx.push_back(atrlist["fX2"].data<float>()); - fx.push_back(atrlist["fX3"].data<float>()); - fx.push_back(atrlist["fX4"].data<float>()); - fx.push_back(atrlist["fX5"].data<float>()); - fx.push_back(atrlist["fX6"].data<float>()); - fx.push_back(atrlist["fX7"].data<float>()); - m_fX.emplace_back(std::move(fx)); - - fy.push_back(atrlist["fY1"].data<float>()); - fy.push_back(atrlist["fY2"].data<float>()); - fy.push_back(atrlist["fY3"].data<float>()); - fy.push_back(atrlist["fY4"].data<float>()); - fy.push_back(atrlist["fY5"].data<float>()); - fy.push_back(atrlist["fY6"].data<float>()); - fy.push_back(atrlist["fY7"].data<float>()); - m_fY.emplace_back(std::move(fy)); - - fb.push_back(atrlist["fB1"].data<float>()); - fb.push_back(atrlist["fB2"].data<float>()); - fb.push_back(atrlist["fB3"].data<float>()); - fb.push_back(atrlist["fB4"].data<float>()); - fb.push_back(atrlist["fB5"].data<float>()); - fb.push_back(atrlist["fB6"].data<float>()); - fb.push_back(atrlist["fB7"].data<float>()); - m_fB.emplace_back(std::move(fb)); - - fc.push_back(atrlist["fC1"].data<float>()); - fc.push_back(atrlist["fC2"].data<float>()); - fc.push_back(atrlist["fC3"].data<float>()); - fc.push_back(atrlist["fC4"].data<float>()); - fc.push_back(atrlist["fC5"].data<float>()); - fc.push_back(atrlist["fC6"].data<float>()); - fc.push_back(atrlist["fC7"].data<float>()); - m_fC.emplace_back(std::move(fc)); - - fd.push_back(atrlist["fD1"].data<float>()); - fd.push_back(atrlist["fD2"].data<float>()); - fd.push_back(atrlist["fD3"].data<float>()); - fd.push_back(atrlist["fD4"].data<float>()); - fd.push_back(atrlist["fD5"].data<float>()); - fd.push_back(atrlist["fD6"].data<float>()); - fd.push_back(atrlist["fD7"].data<float>()); - m_fD.emplace_back(std::move(fd)); - } - }else { - ATH_MSG_ERROR( "Cannot find covariance corrections for key " - << "/PIXEL/PixelClustering/PixelCovCorr" << " - no correction " ); - - } - } -} - - /////////////////////////////////////////////////////////////////// // Trk::SiClusterOnTrack production /////////////////////////////////////////////////////////////////// @@ -954,102 +882,11 @@ InDet::PixelClusterOnTrackTool::getErrorsTIDE_Ambi(const InDet::PixelCluster *pi return false; } - bool correctdR = false; - - std::array<float, 3> correctiondR = {{0., 0., 0.}}; - - if(m_applydRcorrection){ - SG::ReadHandle<InDet::DRMap> mapHandle(m_dRMap); - if(!mapHandle.isValid()){ - ATH_MSG_ERROR("Error retreving " << m_dRMap.key()); - return false; - } - - if(!mapHandle->empty() && pixelPrepCluster->isSplit() ){ - - const InDetDD::SiDetectorElement *det = pixelPrepCluster->detectorElement(); - - if (det->isBarrel()) { - int pixelLayer = m_pixelid->layer_disk(det->identify()); - - float correctiondRX = 1.0; // correction factor to be applied to covariance(!) - float correctiondRZ = 1.0; // correction factor to be applied to covariance(!) - - const InDetDD::PixelModuleDesign *design(dynamic_cast<const InDetDD::PixelModuleDesign *>(&det->design())); - if (! design){ - ATH_MSG_WARNING("Design cannot be cast to a pixel design"); - return false; - } - const float pitchX = design->phiPitch(); - const float pitchZ = design->etaPitch(); - - ATH_MSG_DEBUG("PixelClusterOnTrackTool: Trying to apply dR correction for pixelLayer " << pixelLayer); - - InDet::DRMap::const_iterator it = mapHandle->find(pixelPrepCluster); - if (it != mapHandle->end()) { - correctdR = true; - float mindX = it->second.first; - float mindZ = it->second.second; - float mindXOverPitch = mindX / pitchX; - float mindZOverPitch = mindZ / pitchZ; - - float dR = std::sqrt(mindX * mindX + mindZ * mindZ); - - ATH_MSG_DEBUG(" ---- Min dX ---- " << mindX << " mindZ " << mindZ); - - if (dR > 0. && dR < 2.0) { - correctiondRX = splineIBLPullX(mindXOverPitch, pixelLayer); - correctiondRZ = splineIBLPullX(mindZOverPitch, pixelLayer); - - if (correctiondRX > 3.75) { - correctiondRX = 3.75; - } - if (correctiondRZ > 3.75) { - correctiondRZ = 3.75; - } - }else { - correctiondRX = 2.35; - correctiondRZ = 1.70; - } - - ATH_MSG_DEBUG( - "PixelClusterOnTrackTool: Correction factor calculation for distX/pitch= " << mindXOverPitch << " -> " << correctiondRX << " distZ/pitch= " << mindZOverPitch << " -> " << - correctiondRZ); - }else { - ATH_MSG_WARNING("Split Pixel cluster not found in dRmap! " << pixelPrepCluster); - } - - ATH_MSG_DEBUG( - " ++++ Hit Error ++++ Layer " << pixelLayer << " Correction Flag " << m_applydRcorrection << " Split " << pixelPrepCluster->isSplit() << " Scaling " << correctiondRX << " " << - correctiondRZ); - - correctiondRX *= correctiondRX; - correctiondRZ *= correctiondRZ; - - correctiondR[0] = correctiondRX * correctiondRX; - correctiondR[1] = correctiondRZ * correctiondRZ; - correctiondR[2] = correctiondRX * correctiondRZ; - } - } - } // AKM: now the not so nice part find the best match position option // Takes the error into account to scale the importance of the measurement if (numberOfSubclusters == 1) { finalposition = allLocalPositions[0]; - - if (correctdR) { - allErrorMatrix[0](0, 0) *= correctiondR[0]; - allErrorMatrix[0](1, 1) *= correctiondR[1]; - allErrorMatrix[0](0, 1) *= correctiondR[2]; - allErrorMatrix[0](1, 0) *= correctiondR[2]; - ATH_MSG_DEBUG( - " ++++ Hit Error ++++ " << numberOfSubclusters << " Split " << pixelPrepCluster->isSplit() << " Scaling " << - std::sqrt(correctiondR[0]) << " " << std::sqrt(correctiondR[1]) << " Rescaled ErrX " << std::sqrt(allErrorMatrix[0](0, - 0)) << " Rescaled ErrZ " << - std::sqrt(allErrorMatrix[0](1, 1))); - } - finalerrormatrix = allErrorMatrix[0]; return true; } @@ -1077,60 +914,6 @@ InDet::PixelClusterOnTrackTool::getErrorsTIDE_Ambi(const InDet::PixelCluster *pi } finalposition = allLocalPositions[index]; - - if (correctdR) { - allErrorMatrix[index](0, 0) *= correctiondR[0]; - allErrorMatrix[index](1, 1) *= correctiondR[1]; - allErrorMatrix[index](0, 1) *= correctiondR[2]; - allErrorMatrix[index](1, 0) *= correctiondR[2]; - ATH_MSG_DEBUG( - " ++++ Hit Error ++++ " << numberOfSubclusters << " Split " << pixelPrepCluster->isSplit() << " Scaling " << - std::sqrt(correctiondR[0]) << " " << std::sqrt(correctiondR[1]) << " Rescaled ErrX " << std::sqrt(allErrorMatrix[index](0, - 0)) << " Rescaled ErrZ " << - std::sqrt(allErrorMatrix[index](1, 1))); - } - finalerrormatrix = allErrorMatrix[index]; return true; } - -double -InDet::PixelClusterOnTrackTool::splineIBLPullX(float x, int layer) const { - std::lock_guard<std::mutex> lock(m_mutex); - FillFromDataBase(); - const int fNp = m_fY[layer].size(); - const int fKstep = 0; - const double fDelta = -1; - const auto result = std::minmax_element(std::begin(m_fX[layer]), std::end(m_fX[layer])); - const double fXmin = *(result.first); - const double fXmax = *(result.second); - - int klow = 0; - - if (x <= fXmin) { - klow = 0; - } else if (x >= fXmax) { - klow = fNp - 1; - } else { - if (fKstep) { - // Equidistant knots, use histogramming - klow = int((x - fXmin) / fDelta); - if (klow < fNp - 1) { - klow = fNp - 1; - } - } else { - int khig = fNp - 1, khalf; - // Non equidistant knots, binary search - while (khig - klow > 1) { - if (x > m_fX[layer][khalf = (klow + khig) / 2]) { - klow = khalf; - } else { - khig = khalf; - } - } - } - } - // Evaluate now - double dx = x - m_fX[layer][klow]; - return(m_fY[layer][klow] + dx * (m_fB[layer][klow] + dx * (m_fC[layer][klow] + dx * m_fD[layer][klow]))); -} diff --git a/Tracking/TrkTools/TrkAmbiguityProcessor/CMakeLists.txt b/Tracking/TrkTools/TrkAmbiguityProcessor/CMakeLists.txt index 5e9256a66bd..90334e12e5b 100644 --- a/Tracking/TrkTools/TrkAmbiguityProcessor/CMakeLists.txt +++ b/Tracking/TrkTools/TrkAmbiguityProcessor/CMakeLists.txt @@ -27,23 +27,20 @@ atlas_depends_on_subdirs( PRIVATE Tracking/TrkExtrapolation/TrkExInterfaces ) # External dependencies: -find_package( CLHEP ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) -find_package( HepPDT ) # Component(s) in the package: -atlas_add_library( TrkAmbiguityProcessorLib +atlas_add_component( TrkAmbiguityProcessor src/DenseEnvironmentsAmbiguityProcessorTool.cxx src/DenseEnvironmentsAmbiguityScoreProcessorTool.cxx src/AmbiguityProcessorUtility.cxx src/AmbiguityProcessorBase.cxx - PUBLIC_HEADERS TrkAmbiguityProcessor + src/SimpleAmbiguityProcessorTool.cxx + src/TrackScoringTool.cxx + src/TrackSelectionProcessorTool.cxx + src/ToolVisitor.cxx + src/RenounceToolInputsVisitor.cxx + src/components/*.cxx PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaKernel AthenaBaseComps AtlasDetDescr GaudiKernel InDetPrepRawData InDetRecToolInterfaces TrkDetElementBase TrkEventPrimitives TrkParameters TrkRIO_OnTrack TrkTrack TrkTrackSummary TrkTruthData TrkFitterInterfaces TrkToolInterfaces TrkValInterfaces TrkExInterfaces TrkCaloClusterROI) - -atlas_add_component( TrkAmbiguityProcessor - src/SimpleAmbiguityProcessorTool.cxx src/TrackScoringTool.cxx src/TrackSelectionProcessorTool.cxx src/AmbiguityProcessorUtility.cxx src/AmbiguityProcessorBase.cxx - src/components/*.cxx - INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPPDT_LIBRARIES} TrkAmbiguityProcessorLib ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaKernel AthenaBaseComps AtlasDetDescr GaudiKernel InDetPrepRawData InDetRecToolInterfaces TrkDetElementBase TrkEventPrimitives TrkParameters TrkRIO_OnTrack TrkTrack TrkTrackSummary TrkTruthData TrkFitterInterfaces TrkToolInterfaces TrkValInterfaces TrkExInterfaces TrkCaloClusterROI) diff --git a/Tracking/TrkTools/TrkAmbiguityProcessor/TrkAmbiguityProcessor/dRMap.h b/Tracking/TrkTools/TrkAmbiguityProcessor/TrkAmbiguityProcessor/dRMap.h deleted file mode 100644 index 42a39dcd859..00000000000 --- a/Tracking/TrkTools/TrkAmbiguityProcessor/TrkAmbiguityProcessor/dRMap.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -/*************************************************************************** - CLASS_DEF for InDet dR map - ------------------------------ - ATLAS Collaboration - ***************************************************************************/ - -#ifndef DRMAP_H -#define DRMAP_H 1 - -//<<<<<< INCLUDES >>>>>> -#include "AthenaKernel/CLASS_DEF.h" -#include <map> -#include "InDetPrepRawData/PixelCluster.h" - - -namespace InDet{ - - typedef std::map<const InDet::PixelCluster*, std::pair<float,float> > - DRMap; -} - -CLASS_DEF( InDet::DRMap , 193676466 , 1 ) - - - -#endif // DRMAP_H diff --git a/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityProcessorTool.cxx b/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityProcessorTool.cxx index e6224bce632..b132c2a2b68 100644 --- a/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityProcessorTool.cxx +++ b/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityProcessorTool.cxx @@ -115,10 +115,6 @@ Trk::DenseEnvironmentsAmbiguityProcessorTool::initialize(){ //Initialise the ROI tool ATH_CHECK(m_inputHadClusterContainerName.initialize(m_useHClusSeed)); - if(!m_dRMap.key().empty()){ - ATH_CHECK(m_dRMap.initialize() ); - } - if (m_etaBounds.size() != Counter::nRegions) { ATH_MSG_FATAL("There must be exactly " << (Counter::nRegions) << " eta bounds but " << m_etaBounds.size() << " are set." ); @@ -334,107 +330,6 @@ Trk::DenseEnvironmentsAmbiguityProcessorTool::refitPrds( const Trk::Track* track } -//================================================================================================== - -void -Trk::DenseEnvironmentsAmbiguityProcessorTool::storeTrkDistanceMapdR( TrackCollection& tracks, - std::vector<Trk::Track*> &refittedTracks ){ - ATH_MSG_VERBOSE ("Creating track Distance dR map"); - SG::WriteHandle<InDet::DRMap> dRMapHandle (m_dRMap); - dRMapHandle = std::make_unique<InDet::DRMap>(); - if ( !dRMapHandle.isValid() ){ - ATH_MSG_WARNING("Could not record Distance dR map."); - } else { - ATH_MSG_VERBOSE("Distance dR map recorded as '" << m_dRMap.key() <<"'."); - } - constexpr double twoPi = 2.*M_PI; - for (const auto & track : tracks){ - bool refit = false; - const DataVector<const TrackStateOnSurface>* tsosVec = track->trackStateOnSurfaces(); - if(!tsosVec){ - ATH_MSG_WARNING("TSOS vector does not exist"); - continue; - } - ATH_MSG_VERBOSE("---> Looping over TSOS's to allow for cluster updates: "<< tsosVec->size() ); - for(const auto & tsos : *tsosVec){ - const MeasurementBase* measurement = tsos->measurementOnTrack(); - if(!measurement || ! tsos->trackParameters()){ - ATH_MSG_VERBOSE("---- TSOS has either no measurement or parameters: "<< measurement << " " << tsos->trackParameters() ); - continue; - } - if(!tsos->type(Trk::TrackStateOnSurface::Measurement)) {continue;} - auto globalPosition = measurement->globalPosition(); - const double radius = std::sqrt(globalPosition[0]*globalPosition[0]+globalPosition[1]*globalPosition[1]); - const double invRadius{1./radius}; - // get the associated prd - const Trk::RIO_OnTrack* rio = dynamic_cast<const Trk::RIO_OnTrack*> ( measurement ); - if(!rio){ - continue; - } - const InDet::PixelCluster* pixel = dynamic_cast<const InDet::PixelCluster*> ( rio->prepRawData() ); - // not pixel or not split - if (!pixel || !pixel->isSplit() ) {continue ;} - - CylinderSurface iblSurface(radius,3000.0); - - const TrackParameters * trackParams = m_extrapolatorTool->extrapolate(*track,iblSurface); - - double yOnPix = trackParams->position().y(); - double zOnPix = trackParams->position().z(); - - // now, find closest track - double mindR = 99999999.; - double mindX = 99999999.; - double mindZ = 99999999.; - // - const double eta1{track->perigeeParameters()->momentum().eta()}; - const double phi1{track->perigeeParameters()->momentum().phi()}; - for (const auto & track2 : tracks){ - if(track==track2) continue; - float dEta = eta1 - track2->perigeeParameters()->momentum().eta(); - float dPhi2 = phi1 - track2->perigeeParameters()->momentum().phi(); - double dr = std::sqrt(dEta*dEta + dPhi2*dPhi2); - if(dr>0.4) continue; - - //extrapolation to pixel hit radius - const TrackParameters * track2Params = m_extrapolatorTool->extrapolate(*track2,iblSurface); - - const double y2OnPix = track2Params->position().y(); - const double z2OnPix = track2Params->position().z(); - - float dPhi = std::asin(yOnPix*invRadius) - std::asin(y2OnPix*invRadius); - if (dPhi >= M_PI) dPhi -= twoPi; - if (dPhi < -M_PI) dPhi += twoPi; - - const double dx = std::abs(radius*dPhi); - const double dz = std::abs(zOnPix - z2OnPix); - if(dx>mindX && dz>mindZ) continue; - dr = std::sqrt(dx*dx + dz*dz); - - if(dr<mindR && dr > 1.e-4){ - mindR = dr; - mindX = dx; - mindZ = dz; - } - } - refit = true; - std::pair<InDet::DRMap::iterator,bool> ret; - std::pair<float,float> min (mindX, mindZ); - ret = dRMapHandle->insert ( std::pair<const InDet::PixelCluster*,std::pair<float,float> >(pixel,min)); - // if we already have a dR for this prd, we update it, if current value is smaller - if (!ret.second) { - InDet::DRMap::iterator it{dRMapHandle->find(pixel)}; - auto &[x, z] = it->second; - if(std::sqrt(x * x + z * z) > (float)mindR) { - x = (float) mindX; - z = (float) mindZ; - } - } - } - if(refit) refittedTracks.push_back(track); - } - } - //============================================================================================================ bool Trk::DenseEnvironmentsAmbiguityProcessorTool::decideIfInHighPtBROI(const Trk::Track* ptrTrack) const{ diff --git a/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityProcessorTool.h b/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityProcessorTool.h index 2acd36c3019..dfafe963ba9 100644 --- a/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityProcessorTool.h +++ b/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityProcessorTool.h @@ -9,7 +9,6 @@ #include "TrkFitterInterfaces/ITrackFitter.h" #include "TrkToolInterfaces/IAmbiTrackSelectionTool.h" #include "InDetPrepRawData/PixelGangedClusterAmbiguities.h" -#include "TrkAmbiguityProcessor/dRMap.h" #include "TrkCaloClusterROI/CaloClusterROI_Collection.h" #include "TrkToolInterfaces/IPRDtoTrackMapTool.h" @@ -158,8 +157,6 @@ namespace Trk { const PixelID* m_pixelId; const AtlasDetectorID* m_idHelper; - SG::WriteHandleKey<InDet::DRMap> m_dRMap; //!< the actual dR map - bool m_rejectInvalidTracks; }; -- GitLab