From 22f8f2a1da98c3c955613b6cee09f31ba9cc55eb Mon Sep 17 00:00:00 2001 From: Susumu Oda <Susumu.Oda@cern.ch> Date: Thu, 13 Apr 2017 14:25:54 +0200 Subject: [PATCH] Fix conflict --- .../InDetTrackHoleSearch/CMakeLists.txt | 2 + .../InDetTrackHoleSearchTool.h | 12 ++ .../src/InDetTrackHoleSearchTool.cxx | 124 +++++++++++++++++- 3 files changed, 136 insertions(+), 2 deletions(-) diff --git a/InnerDetector/InDetRecTools/InDetTrackHoleSearch/CMakeLists.txt b/InnerDetector/InDetRecTools/InDetTrackHoleSearch/CMakeLists.txt index 8663ec5a1fe5..425c71b027ba 100644 --- a/InnerDetector/InDetRecTools/InDetTrackHoleSearch/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/InDetTrackHoleSearch/CMakeLists.txt @@ -16,6 +16,8 @@ atlas_depends_on_subdirs( PUBLIC DetectorDescription/AtlasDetDescr DetectorDescription/Identifier InnerDetector/InDetConditions/InDetConditionsSummaryService + InnerDetector/InDetConditions/SCT_ConditionsServices + InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry InnerDetector/InDetRecTools/InDetRecToolInterfaces Tracking/TrkDetDescr/TrkDetDescrUtils diff --git a/InnerDetector/InDetRecTools/InDetTrackHoleSearch/InDetTrackHoleSearch/InDetTrackHoleSearchTool.h b/InnerDetector/InDetRecTools/InDetTrackHoleSearch/InDetTrackHoleSearch/InDetTrackHoleSearchTool.h index 7a6fffaf016f..6f51556c64da 100644 --- a/InnerDetector/InDetRecTools/InDetTrackHoleSearch/InDetTrackHoleSearch/InDetTrackHoleSearchTool.h +++ b/InnerDetector/InDetRecTools/InDetTrackHoleSearch/InDetTrackHoleSearch/InDetTrackHoleSearchTool.h @@ -19,14 +19,18 @@ #include <map> class AtlasDetectorID; +class SCT_ID; class Identifier; class AtlasID; class IInDetConditionsSvc; +class ISCT_ConfigurationConditionsSvc; namespace InDet {class IInDetTestPixelLayerTool; } namespace Trk { class RIO_OnTrack; class TrackStateOnSurface; class Track;} namespace Trk { class IExtrapolator;} +namespace InDetDD { class SiDetectorElement; } + namespace InDet { @@ -111,6 +115,9 @@ namespace InDet /** Handles to IConditionsSummaryServices for Pixels and SCT*/ ServiceHandle <IInDetConditionsSvc> m_pixelCondSummarySvc, m_sctCondSummarySvc; ToolHandle< IInDetTestPixelLayerTool > m_pixelLayerTool; + ServiceHandle <ISCT_ConfigurationConditionsSvc> m_sctConfCondSvc; + + const SCT_ID* m_sct_id; /** Configure outwards hole search */ bool m_extendedListOfHoles,m_cosmic; @@ -118,6 +125,9 @@ namespace InDet /** Control usage of pixel, SCT and TRT info */ bool m_usepix, m_usesct; + /** Control check of bad SCT chip (should be false for ITk Strip) */ + bool m_checkBadSCTChip; + /** Min number of hits **/ int m_minSiHits; @@ -169,6 +179,8 @@ namespace InDet const Trk::Track* addHolesToTrack(const Trk::Track& oldTrack, std::vector<const Trk::TrackStateOnSurface*>* listOfHoles) const; + /** This method checks the SCT ABCD chip where the track passes through is bad or not */ + bool isBadSCTChip(const Identifier& waferId, const Trk::TrackParameters* parameters, const InDetDD::SiDetectorElement* siElement) const; }; } // end of namespace diff --git a/InnerDetector/InDetRecTools/InDetTrackHoleSearch/src/InDetTrackHoleSearchTool.cxx b/InnerDetector/InDetRecTools/InDetTrackHoleSearch/src/InDetTrackHoleSearchTool.cxx index 26390e08f75d..56fe3b25fde8 100644 --- a/InnerDetector/InDetRecTools/InDetTrackHoleSearch/src/InDetTrackHoleSearchTool.cxx +++ b/InnerDetector/InDetRecTools/InDetTrackHoleSearch/src/InDetTrackHoleSearchTool.cxx @@ -21,8 +21,10 @@ #include "TrkDetDescrUtils/SharedObject.h" #include "TrkGeometry/TrackingVolume.h" #include "Identifier/Identifier.h" +#include "InDetIdentifier/SCT_ID.h" #include "AtlasDetDescr/AtlasDetectorID.h" #include "InDetConditionsSummaryService/IInDetConditionsSvc.h" +#include "SCT_ConditionsServices/ISCT_ConfigurationConditionsSvc.h" #include "InDetReadoutGeometry/SiDetectorElement.h" #include "InDetRecToolInterfaces/IInDetTestPixelLayerTool.h" #include "TrkVolumes/Volume.h" @@ -38,21 +40,26 @@ InDet::InDetTrackHoleSearchTool::InDetTrackHoleSearchTool(const std::string& t, m_pixelCondSummarySvc("PixelConditionsSummarySvc",n), m_sctCondSummarySvc ("SCT_ConditionsSummarySvc",n), m_pixelLayerTool("InDet::InDetTestPixelLayerTool"), + m_sctConfCondSvc("SCT_ConfigurationConditionsSvc", n), + m_sct_id(nullptr), m_extendedListOfHoles(false), m_cosmic(false), m_usepix(true), m_usesct(true), + m_checkBadSCTChip(true), m_warning(0) { declareInterface<ITrackHoleSearchTool>(this); declareProperty("Extrapolator" , m_extrapolator); declareProperty("PixelSummarySvc" , m_pixelCondSummarySvc); declareProperty("SctSummarySvc" , m_sctCondSummarySvc); + declareProperty("SctConfCondSvc" , m_sctConfCondSvc); declareProperty("PixelLayerTool" , m_pixelLayerTool); declareProperty("ExtendedListOfHoles" , m_extendedListOfHoles = false); declareProperty("Cosmics" , m_cosmic); declareProperty("usePixel" , m_usepix); declareProperty("useSCT" , m_usesct); + declareProperty("checkBadSCTChip" , m_checkBadSCTChip); declareProperty("minSiHits" , m_minSiHits = 3); declareProperty("CountDeadModulesAfterLastHit", m_countDeadModulesAfterLastHit = true); declareProperty("phitol" , m_phitol = 3.); @@ -105,10 +112,21 @@ StatusCode InDet::InDetTrackHoleSearchTool::initialize() if (m_usesct) { // Get SctConditionsSummarySvc if ( m_sctCondSummarySvc.retrieve().isFailure() ) { - msg(MSG::FATAL) << "Failed to retrieve tool " << m_sctCondSummarySvc << endmsg; + msg(MSG::FATAL) << "Failed to retrieve service " << m_sctCondSummarySvc << endmsg; return StatusCode::FAILURE; } else { - msg(MSG::INFO) << "Retrieved tool " << m_sctCondSummarySvc << endmsg; + msg(MSG::INFO) << "Retrieved service " << m_sctCondSummarySvc << endmsg; + } + // Get SctConditionsSummarySvc + if ( m_sctConfCondSvc.retrieve().isFailure() ) { + msg(MSG::FATAL) << "Failed to retrieve service " << m_sctConfCondSvc << endmsg; + return StatusCode::FAILURE; + } else { + msg(MSG::INFO) << "Retrieved service " << m_sctConfCondSvc << endmsg; + } + if( detStore()->retrieve(m_sct_id, "SCT_ID").isFailure() ) { + msg(MSG::FATAL) << "Cannot retrieve SCT ID helper!" << endmsg; + return StatusCode::FAILURE; } } @@ -915,6 +933,12 @@ bool InDet::InDetTrackHoleSearchTool::isSensitive(const Trk::TrackParameters* pa // this detElement is only cosidered as hole if the extrapolation of // the track plus its error hits the active material if (isActiveElement) { + + if(m_checkBadSCTChip and isBadSCTChip(id, parameters, siElement)) { + ATH_MSG_VERBOSE ("Track is hiting a bad SCT chip, this is not a hole candidate!"); + return false; + } + ATH_MSG_VERBOSE ("SCT module is good, this is a hole candidate !"); return true; } @@ -1003,3 +1027,99 @@ const Trk::Track* InDet::InDetTrackHoleSearchTool::addHolesToTrack(const Trk::T return newTrack; } +// ==================================================================================================================== +bool InDet::InDetTrackHoleSearchTool::isBadSCTChip(const Identifier& waferId, + const Trk::TrackParameters* parameters, + const InDetDD::SiDetectorElement* siElement) const { + // Check if the track passes through a bad SCT ABCD chip + // A chip is determined by the extraporated position. + // Algorithm is based on InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonTool.cxx + + // Check the inputs + if(!parameters) { + ATH_MSG_WARNING("Trk::TrackParameters* parameters is null."); + return true; + } + if(!siElement) { + ATH_MSG_WARNING("InDetDD::SiDetectorElement* siElement is null."); + return true; + } + if(not m_atlasId->is_sct(waferId)) { + ATH_MSG_WARNING(waferId << " is not an SCT Identifier"); + return true; + } + + // wafer id -> module id + const Identifier moduleId(m_sct_id->module_id(waferId)); + // badChips word for the module from SCT_ConfigurationConditionsSvc + // tempMaskedChips word for the module from SCT_ByteStreamErrorSvc should also be added. + // https://its.cern.ch/jira/browse/ATLASRECTS-4011 + const unsigned int badChips(m_sctConfCondSvc->badChips(moduleId)); + // badChips holds 12 bits. + // bit 0 (LSB) is chip 0 for side 0. + // bit 5 is chip 5 for side 0. + // bit 6 is chip 6 for side 1. + // bit 11 is chip 11 for side 1. + + // If there is no bad chip, this check is done. + if(badChips==0) return false; + + const int side(m_sct_id->side(waferId)); + // Check the six chips on the side + // 0x3F = 0000 0011 1111 + // 0xFC0 = 1111 1100 0000 + // If there is no bad chip on the side, this check is done. + if((side==0 and (badChips & 0x3F)==0) or (side==1 and (badChips & 0xFC0)==0)) return false; + + // There is at least one bad chip on the side. + // Get strip id from local position + const Amg::Vector2D localPos(parameters->localPosition()); + const Identifier stripIdentifier(siElement->identifierOfPosition(localPos)); + if(not m_atlasId->is_sct(stripIdentifier)) { + ATH_MSG_WARNING(stripIdentifier << " is not an SCT Identifier"); + return true; + } + + // Get strip number from strip id + const int strip(m_sct_id->strip(stripIdentifier)); + if(strip<0 or strip>=768) { + ATH_MSG_WARNING("strip number is invalid: " << strip); + return true; + } + + // Conversion from strip to chip: specific for present SCT + int chip(strip/128); // One ABCD chip reads 128 strips + // Relation between chip and offline strip is determined by the swapPhiReadoutDirection method. + // If swap is false + // offline strip: 0 767 + // chip on side 0: 0 1 2 3 4 5 + // chip on side 1: 11 10 9 8 7 6 + // If swap is true + // offline strip: 0 767 + // chip on side 0: 5 4 3 2 1 0 + // chip on side 1: 6 7 8 9 10 11 + const bool swap(siElement->swapPhiReadoutDirection()); + if(side==0) { + chip = swap ? 5 - chip : chip; + } else { + chip = swap ? 11 - chip : 6 + chip; + } + + // Veto if either of closest two chips is dead + const bool badChip(badChips & (1<<chip)); + + std::cout << "susumu" + << " waferId " << waferId + << " side " << side + << " moduleId " << moduleId + << " strip " << strip + << " chip " << chip + << " badChip " << badChip + << " badChips "; + for(unsigned int i=0; i<12; i++) { + std::cout << ((badChips>>i) & 0x1); + } + std::cout << std::endl; + + return badChip; +} -- GitLab