Skip to content
Snippets Groups Projects
Commit 55e0371e authored by Goetz Gaycken's avatar Goetz Gaycken
Browse files

Replace deprectated tool by PRDtoTrackMapTool and actually configure used tools.

parent 63f03970
No related branches found
No related tags found
No related merge requests found
#
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
#
'''@file SCTLorentzMonAlg.py
......@@ -7,6 +7,7 @@
@date 2019-04-02
@brief Based on AthenaMonitoring/ExampleMonitorAlgorithm.py
'''
from InDetConfig import TrackingCommonConfig
def SCTLorentzMonAlgConfig(inputFlags):
......@@ -29,7 +30,9 @@ def SCTLorentzMonAlgConfig(inputFlags):
# base class configuration following the inputFlags. The returned object
# is the algorithm.
from AthenaConfiguration.ComponentFactory import CompFactory
myMonAlg = helper.addAlgorithm(CompFactory.SCTLorentzMonAlg, 'SCTLorentzMonAlg')
myMonAlg = helper.addAlgorithm(CompFactory.SCTLorentzMonAlg,
'SCTLorentzMonAlg',
AssociationTool = result.popToolsAndMerge(TrackingCommonConfig.InDetPRDtoTrackMapToolGangedPixelsCfg(inputFlags)) )
# # If for some really obscure reason you need to instantiate an algorithm
# # yourself, the AddAlgorithm method will still configure the base
......
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#include "SCTLorentzMonAlg.h"
......@@ -10,6 +10,7 @@
#include "InDetPrepRawData/SiCluster.h"
#include "InDetRIO_OnTrack/SiClusterOnTrack.h"
#include "TrkTrackSummary/TrackSummary.h"
#include "TrkEventUtils/PRDtoTrackMap.h"
#include <cmath>
#include <memory>
......@@ -24,12 +25,7 @@ StatusCode SCTLorentzMonAlg::initialize() {
ATH_CHECK(m_trackSummaryTool.retrieve());
ATH_CHECK(m_tracksName.initialize());
ATH_CHECK(m_SCTDetEleCollKey.initialize());
if (m_rejectSharedHits) {
ATH_CHECK(m_assoTool.retrieve());
} else {
m_assoTool.disable();
}
ATH_CHECK(m_assoTool.retrieve(DisableTool{!m_rejectSharedHits} ));
return AthMonitorAlgorithm::initialize();
}
......@@ -72,9 +68,12 @@ StatusCode SCTLorentzMonAlg::fillHistograms(const EventContext& ctx) const {
}
// Prepare AssociationTool
Trk::IPRD_AssociationTool::Maps maps;
for (const Trk::Track* track : *tracks) {
ATH_CHECK(m_assoTool->addPRDs(maps, *track));
std::unique_ptr<Trk::PRDtoTrackMap> prd_to_track_map;
if (m_rejectSharedHits) {
prd_to_track_map = m_assoTool->createPRDtoTrackMap();
for (const Trk::Track* track : *tracks) {
ATH_CHECK( m_assoTool->addPRDs(*prd_to_track_map,*track) );
}
}
for (const Trk::Track* track: *tracks) {
......@@ -106,7 +105,7 @@ StatusCode SCTLorentzMonAlg::fillHistograms(const EventContext& ctx) const {
const InDet::SiClusterOnTrack* clus{dynamic_cast<const InDet::SiClusterOnTrack*>(tsos->measurementOnTrack())};
if (clus) { // Is it a SiCluster? If yes...
// Reject shared hits if you want
if (m_rejectSharedHits and m_assoTool->isShared(maps, *(clus->prepRawData()))) {
if (prd_to_track_map and prd_to_track_map->isShared(*(clus->prepRawData())) ) {
continue;
}
......
// -*- C++ -*-
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef SCTLORENTZMONALG_H
......@@ -14,7 +14,8 @@
#include "StoreGate/ReadHandleKey.h"
#include "TrkTrack/TrackCollection.h"
#include "TrkToolInterfaces/ITrackSummaryTool.h"
#include "TrkToolInterfaces/IPRD_AssociationTool.h"
#include "TrkToolInterfaces/IPRDtoTrackMapTool.h"
class SCT_ID;
......@@ -32,7 +33,7 @@ class SCTLorentzMonAlg : public AthMonitorAlgorithm {
const SCT_ID* m_pSCTHelper{nullptr};
ToolHandle<Trk::ITrackSummaryTool> m_trackSummaryTool{this, "TrackSummaryTool", "InDetTrackSummaryTool"};
ToolHandle<Trk::IPRD_AssociationTool> m_assoTool{this, "AssociationTool", "InDet::InDetPRD_AssociationToolGangedPixels"};
ToolHandle<Trk::IPRDtoTrackMapTool> m_assoTool{this, "AssociationTool", "InDet::InDetPRDtoTrackMapToolGangedPixels" };
/// Name of the Track collection to use
SG::ReadHandleKey<TrackCollection> m_tracksName{this, "tracksName", "CombinedInDetTracks"};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment