diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPreProcessingSilicon.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPreProcessingSilicon.py index dc87370d4287157801b2c7d6991901a25ba15f59..3839e4aec8e5e1b02f723ba38b2d614806127cf6 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPreProcessingSilicon.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPreProcessingSilicon.py @@ -275,6 +275,13 @@ if InDetFlags.doSpacePointFormation(): ProcessSCTs = DetFlags.haveRIO.SCT_on(), ProcessOverlaps = DetFlags.haveRIO.SCT_on()) + # Condition algorithm for SiTrackerSpacePointFinder + from AthenaCommon.AlgSequence import AthSequencer + condSeq = AthSequencer("AthCondSeq") + if not hasattr(condSeq, "InDetSiElementPropertiesTableCondAlg"): + from SiSpacePointFormation.SiSpacePointFormationConf import InDet__SiElementPropertiesTableCondAlg + condSeq += InDet__SiElementPropertiesTableCondAlg(name = "InDetSiElementPropertiesTableCondAlg") + # if InDetFlags.doDBM(): # InDetSiTrackerSpacePointFinderDBM = InDet__SiTrackerSpacePointFinder(name = "InDetSiTrackerSpacePointFinderDBM", # SiSpacePointMakerTool = InDetSiSpacePointMakerTool, diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecPreProcessing.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecPreProcessing.py index db1de369d68f9c026aade29460698d06bdf3a83b..12a7a637b3b4071b35414cd063bb02ebea3556f1 100755 --- a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecPreProcessing.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecPreProcessing.py @@ -273,6 +273,12 @@ class SiTrigSpacePointFinder_EF( InDet__SiTrigSpacePointFinder ): print SCT_TrigSpacePointTool ToolSvc += SCT_TrigSpacePointTool + # Condition algorithm for SiTrigSpacePointFinder + from AthenaCommon.AlgSequence import AthSequencer + condSeq = AthSequencer("AthCondSeq") + if not hasattr(condSeq, "InDetSiElementPropertiesTableCondAlg"): + from SiSpacePointFormation.SiSpacePointFormationConf import InDet__SiElementPropertiesTableCondAlg + condSeq += InDet__SiElementPropertiesTableCondAlg(name = "InDetSiElementPropertiesTableCondAlg") self.SiSpacePointMakerTool = InDetTrigSiSpacePointMakerTool self.SCTSpacePointTrigHelperTool = SCT_TrigSpacePointTool diff --git a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/SiSpacePointFormation/SiElementPropertiesTable.h b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/SiSpacePointFormation/SiElementPropertiesTable.h index cb6c9d2ef5676a002f665a14d3dfb94d083f0d0c..18d4d21ca29638fbe30142217bb7ba2b4d4cdd04 100755 --- a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/SiSpacePointFormation/SiElementPropertiesTable.h +++ b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/SiSpacePointFormation/SiElementPropertiesTable.h @@ -13,12 +13,12 @@ #ifndef SISPACEPOINTFORMATION_SIELEMENTPROPERTIESTABLE_H #define SISPACEPOINTFORMATION_SIELEMENTPROPERTIESTABLE_H -#include <vector> -#include "Identifier/IdentifierHash.h" -#include "InDetReadoutGeometry/SCT_DetectorManager.h" #include "SiSpacePointFormation/SiElementProperties.h" -class SiDetectorElementCollection; +#include "Identifier/IdentifierHash.h" +#include "InDetReadoutGeometry/SiDetectorElementCollection.h" + +#include <vector> namespace InDet { @@ -53,4 +53,10 @@ SiElementPropertiesTable::halfWidth(IdentifierHash waferID) const } } + +#include "AthenaKernel/CLASS_DEF.h" +CLASS_DEF( InDet::SiElementPropertiesTable , 713446 , 1 ) +#include "AthenaKernel/CondCont.h" +CONDCONT_DEF( InDet::SiElementPropertiesTable , 92686144 ); + #endif // SISPACEPOINTFORMATION_SIELEMENTPROPERTIESTABLE_H diff --git a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/SiSpacePointFormation/SiTrackerSpacePointFinder.h b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/SiSpacePointFormation/SiTrackerSpacePointFinder.h index 7313827e5a3f2969be645f1294340e961172b751..0232444ed295235f90fdbbd77106f46a66435dfa 100755 --- a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/SiSpacePointFormation/SiTrackerSpacePointFinder.h +++ b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/SiSpacePointFormation/SiTrackerSpacePointFinder.h @@ -63,6 +63,9 @@ #include "TrkSpacePoint/SpacePointContainer.h" #include "GeoPrimitives/GeoPrimitives.h" +#include "StoreGate/ReadCondHandleKey.h" +#include "SiSpacePointFormation/SiElementPropertiesTable.h" + class Event; class SpacePointCollection; class SpacePointOverlapCollection; @@ -80,8 +83,6 @@ namespace InDetDD { namespace InDet { - class SiElementPropertiesTable; - class SiTrackerSpacePointFinder:public AthReentrantAlgorithm { struct SPFCache{//This is a temporary object to aid reentrant coding @@ -113,7 +114,8 @@ namespace InDet { void addSCT_SpacePoints - (const SCT_ClusterCollection* next, + (const SCT_ClusterCollection* next, + const SiElementPropertiesTable* properties, SpacePointCollection* spacepointCollection, SpacePointOverlapCollection* spacepointOverlapCollection, SPFCache&) const; void checkForSCT_Points @@ -144,7 +146,6 @@ namespace InDet { float m_overlapLimitPhi; // overlap limit for phi-neighbours. float m_overlapLimitEtaMin; // low overlap limit for eta-neighbours. float m_overlapLimitEtaMax; // high overlap limit for eta-neighbours. - float m_epsWidth; // safety margin for half-width. bool m_overrideBS; float m_xVertex; @@ -162,7 +163,6 @@ namespace InDet { // const InDetDD::PixelDetectorManager* m_managerPixel; // unused const SCT_ID* m_idHelper; const PixelID* m_idHelperPixel; - static const SiElementPropertiesTable* s_properties; SG::WriteHandleKey<SpacePointContainer> m_SpacePointContainer_SCTKey; SG::WriteHandleKey<SpacePointContainer> m_SpacePointContainerPixelKey; @@ -170,6 +170,8 @@ namespace InDet { SG::UpdateHandleKey<SpacePointCache> m_SpacePointCache_SCTKey; SG::UpdateHandleKey<SpacePointCache> m_SpacePointCache_PixKey; ToolHandle< SiSpacePointMakerTool > m_SiSpacePointMakerTool; + + SG::ReadCondHandleKey<InDet::SiElementPropertiesTable> m_SCTPropertiesKey{this, "SCTPropertiesKey", "SCT_ElementPropertiesTable", "Key of input SiElementPropertiesTable for SCT"}; }; } diff --git a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiElementPropertiesTable.cxx b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiElementPropertiesTable.cxx index 54c4223afeb1798e70d44177a3fb7524b73ea0e1..55c5cfc43de9192d8a33ccb5827ab814ec6de18a 100755 --- a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiElementPropertiesTable.cxx +++ b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiElementPropertiesTable.cxx @@ -8,11 +8,11 @@ ATLAS Collaboration ***************************************************************************/ +#include "SiSpacePointFormation/SiElementPropertiesTable.h" + #include "InDetIdentifier/SCT_ID.h" #include "InDetReadoutGeometry/SiDetectorDesign.h" -#include "InDetReadoutGeometry/SiDetectorElementCollection.h" #include "InDetReadoutGeometry/SiLocalPosition.h" -#include "SiSpacePointFormation/SiElementPropertiesTable.h" namespace InDet{ diff --git a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiElementPropertiesTableCondAlg.cxx b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiElementPropertiesTableCondAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..68d0b8533082de62015abf2b11597cdd6d1bb8c5 --- /dev/null +++ b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiElementPropertiesTableCondAlg.cxx @@ -0,0 +1,101 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +#include "SiElementPropertiesTableCondAlg.h" + +#include "InDetIdentifier/SCT_ID.h" +#include "InDetReadoutGeometry/SCT_DetectorManager.h" +#include "InDetReadoutGeometry/SiDetectorElement.h" + +#include <memory> + +namespace InDet { + + SiElementPropertiesTableCondAlg::SiElementPropertiesTableCondAlg(const std::string& name, ISvcLocator* pSvcLocator) + : ::AthAlgorithm(name, pSvcLocator) + , m_condSvc{"CondSvc", name} + , m_idHelper{nullptr} + , m_detManager{nullptr} +{ +} + + StatusCode SiElementPropertiesTableCondAlg::initialize() + { + ATH_MSG_DEBUG("initialize " << name()); + + // Read Handle + ATH_CHECK(m_readKey.initialize()); + + // Write Handle + ATH_CHECK(m_writeKey.initialize()); + // CondSvc + ATH_CHECK(m_condSvc.retrieve()); + // Register write handle + ATH_CHECK(m_condSvc->regHandle(this, m_writeKey)); + + ATH_CHECK(detStore()->retrieve(m_detManager, "SCT")); + ATH_CHECK(detStore()->retrieve(m_idHelper, "SCT_ID")); + + return StatusCode::SUCCESS; + } + + StatusCode SiElementPropertiesTableCondAlg::execute() + { + ATH_MSG_DEBUG("execute " << name()); + + // ____________ Construct Write Cond Handle and check its validity ____________ + SG::WriteCondHandle<InDet::SiElementPropertiesTable> writeHandle{m_writeKey}; + + // Do we have a valid Write Cond Handle for current time? + if (writeHandle.isValid()) { + ATH_MSG_DEBUG("CondHandle " << writeHandle.fullKey() << " is already valid." + << ". In theory this should not be called, but may happen" + << " if multiple concurrent events are being processed out of order."); + return StatusCode::SUCCESS; + } + + // ____________ Get Read Cond Object ____________ + SG::ReadCondHandle<InDetDD::SiDetectorElementCollection> readHandle{m_readKey}; + const InDetDD::SiDetectorElementCollection* readCdo{*readHandle}; + if (readCdo==nullptr) { + ATH_MSG_FATAL("Null pointer to the read conditions object of " << m_readKey.key()); + return StatusCode::FAILURE; + } + + // Define validity of the output cond object and record it + EventIDRange rangeW; + if (not readHandle.range(rangeW)) { + ATH_MSG_FATAL("Failed to retrieve validity range for " << readHandle.key()); + return StatusCode::FAILURE; + } + + if (m_useDetectorManager) { // For debugging: use SiDetectorElementCollection from SCT_DetectorManager + readCdo = m_detManager->getDetectorElementCollection(); + } + + // ____________ Construct new Write Cond Object ____________ + std::unique_ptr<InDet::SiElementPropertiesTable> writeCdo{std::make_unique<InDet::SiElementPropertiesTable>(*m_idHelper, *readCdo, m_epsWidth)}; + + // ____________ Fill writeCdo using readCdo ____________ + + // Record WriteCondHandle + if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) { + ATH_MSG_ERROR("Could not record " << writeHandle.key() + << " with EventRange " << rangeW + << " into Conditions Store"); + return StatusCode::FAILURE; + } + ATH_MSG_INFO("recorded new CDO " << writeHandle.key() << " with range " << rangeW << " into ConditionStore"); + + return StatusCode::SUCCESS; + } + + StatusCode SiElementPropertiesTableCondAlg::finalize() + { + ATH_MSG_DEBUG("finalize " << name()); + + return StatusCode::SUCCESS; + } + +} diff --git a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiElementPropertiesTableCondAlg.h b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiElementPropertiesTableCondAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..fa25dec5df461873044ef8fd0fc3854753d7e763 --- /dev/null +++ b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiElementPropertiesTableCondAlg.h @@ -0,0 +1,48 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef SiElementPropertiesTableCondAlg_h +#define SiElementPropertiesTableCondAlg_h + +#include "AthenaBaseComps/AthAlgorithm.h" +#include "StoreGate/ReadCondHandleKey.h" +#include "StoreGate/WriteCondHandleKey.h" + +#include "InDetReadoutGeometry/SiDetectorElementCollection.h" +#include "SiSpacePointFormation/SiElementPropertiesTable.h" + +#include "GaudiKernel/ICondSvc.h" + +class SCT_ID; + +namespace InDetDD { + class SCT_DetectorManager; +} + +namespace InDet { + + class SiElementPropertiesTableCondAlg : public AthAlgorithm { + public: + SiElementPropertiesTableCondAlg(const std::string& name, ISvcLocator* pSvcLocator); + virtual ~SiElementPropertiesTableCondAlg() override = default; + + virtual StatusCode initialize() override; + virtual StatusCode execute() override; + virtual StatusCode finalize() override; + + private: + SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_readKey{this, "ReadKey", "SCT_DetectorElementCollection", "Key of input SiDetectorElementCollection for SCT"}; + SG::WriteCondHandleKey<InDet::SiElementPropertiesTable> m_writeKey{this, "WriteKey", "SCT_ElementPropertiesTable", "Key of output SiElementPropertiesTable for SCT"}; + + FloatProperty m_epsWidth{this, "EpsWidth", 0.02, "Safety margin for half-widths, in cm"}; + BooleanProperty m_useDetectorManager{this, "UseDetectorManager", true/*false*/, "Switch to use SiDetectorElementCollection from SCT_DetectorManager for debugging"}; + + ServiceHandle<ICondSvc> m_condSvc; + const SCT_ID* m_idHelper; + const InDetDD::SCT_DetectorManager* m_detManager; + }; + +} + +#endif // SiElementPropertiesTableCondAlg_h diff --git a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiTrackerSpacePointFinder.cxx b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiTrackerSpacePointFinder.cxx index 7c855cb211c635895d40eaca4bb3f384d9c6f7f5..c7e9a9519901eda46d1e04444e7f40e91053c2df 100755 --- a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiTrackerSpacePointFinder.cxx +++ b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiTrackerSpacePointFinder.cxx @@ -11,9 +11,9 @@ ATLAS Collaboration #include "SiSpacePointFormation/SiTrackerSpacePointFinder.h" -#include "SiSpacePointFormation/SiElementPropertiesTable.h" // For processing clusters +#include "InDetReadoutGeometry/SCT_DetectorManager.h" #include "InDetReadoutGeometry/SiLocalPosition.h" #include "InDetReadoutGeometry/SiDetectorDesign.h" #include "InDetReadoutGeometry/SiDetectorElement.h" @@ -35,9 +35,6 @@ ATLAS Collaboration namespace InDet { -const SiElementPropertiesTable* SiTrackerSpacePointFinder::s_properties = nullptr; - - //------------------------------------------------------------------------ SiTrackerSpacePointFinder::SiTrackerSpacePointFinder(const std::string& name, ISvcLocator* pSvcLocator) @@ -52,7 +49,6 @@ const SiElementPropertiesTable* SiTrackerSpacePointFinder::s_properties = nullpt m_overlapLimitPhi(5.64), // overlap limit for phi-neighbours. m_overlapLimitEtaMin(1.68), // low overlap limit for eta-neighbours. m_overlapLimitEtaMax(3.0), // high overlap limit for eta-neighbours. - m_epsWidth(0.02), // safety margin for half-widths, in cm. m_overrideBS(false), m_xVertex(0.), m_yVertex(0.), @@ -153,13 +149,8 @@ StatusCode SiTrackerSpacePointFinder::initialize() // also need the SCT Manager to get the detectorElementCollection ATH_CHECK(detStore()->retrieve(m_manager,"SCT")); - // Make a table of neighbours and widths of side 1 SCT wafers - //ADAM - removed const cast to test without - //Using const static to save memory in cases of multiple instances of this algorithm. - if(s_properties==nullptr){ - const InDetDD::SiDetectorElementCollection* elements =(m_manager->getDetectorElementCollection()); - s_properties = new SiElementPropertiesTable(*m_idHelper, *elements, m_epsWidth); - } + // Initialize the key of input SiElementPropertiesTable for SCT + ATH_CHECK(m_SCTPropertiesKey.initialize()); } ATH_CHECK(m_SiSpacePointMakerTool.retrieve()); @@ -187,6 +178,15 @@ StatusCode SiTrackerSpacePointFinder::execute_r (const EventContext& ctx) const ++m_numberOfEvents; + const SiElementPropertiesTable* properties = nullptr; + if (m_selectSCTs) { + SG::ReadCondHandle<SiElementPropertiesTable> sctProperties(m_SCTPropertiesKey, ctx); + properties = sctProperties.retrieve(); + if (properties==nullptr) { + ATH_MSG_FATAL("Pointer of SiElementPropertiesTable (" << m_SCTPropertiesKey.fullKey() << ") could not be retrieved"); + return StatusCode::SUCCESS; + } + } SPFCache r_cache(ctx); if (! m_overrideBS){ r_cache.vertex = m_iBeamCondSvc->beamVtx().position(); @@ -266,7 +266,8 @@ StatusCode SiTrackerSpacePointFinder::execute_r (const EventContext& ctx) const spacepointCollection->setIdentifier(elementID); if ( colNext->size() != 0){ - addSCT_SpacePoints(colNext,spacepointCollection.get(),spacepointoverlapCollection.ptr(), r_cache); + addSCT_SpacePoints(colNext, properties, + spacepointCollection.get(), spacepointoverlapCollection.ptr(), r_cache); } else { ATH_MSG_DEBUG( "Empty SCT cluster collection" ); } @@ -380,9 +381,6 @@ StatusCode SiTrackerSpacePointFinder::finalize() ATH_MSG_DEBUG( m_sctCacheHits << " sct cache hits" ); ATH_MSG_DEBUG( m_pixCacheHits << " pix cache hits" ); } - if(s_properties){ - delete s_properties; s_properties = nullptr; - } return StatusCode::SUCCESS; } @@ -390,6 +388,7 @@ StatusCode SiTrackerSpacePointFinder::finalize() void SiTrackerSpacePointFinder:: addSCT_SpacePoints(const SCT_ClusterCollection* next, + const SiElementPropertiesTable* properties, SpacePointCollection* spacepointCollection, SpacePointOverlapCollection* spacepointOverlapCollection, SPFCache &r_cache) const { @@ -409,7 +408,7 @@ addSCT_SpacePoints(const SCT_ClusterCollection* next, // check2 for phi overlaps const std::vector<IdentifierHash>* - others(s_properties->neighbours(thisHash)); + others(properties->neighbours(thisHash)); if (others==0 || others->empty() ) return; std::vector<IdentifierHash>::const_iterator otherHash = others->begin(); @@ -425,7 +424,7 @@ addSCT_SpacePoints(const SCT_ClusterCollection* next, overlapColl = true; ++otherHash; if (otherHash == others->end() ) return; - float hwidth(s_properties->halfWidth(thisHash)); + float hwidth(properties->halfWidth(thisHash)); // half-width of wafer checkForSCT_Points(next, *otherHash, diff --git a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/components/SiSpacePointFormation_entries.cxx b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/components/SiSpacePointFormation_entries.cxx index 28674a38214faa678d3607fb067a15ab599075ee..0dd4498e2e69fd04a48d9b315e5542efe7442888 100644 --- a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/components/SiSpacePointFormation_entries.cxx +++ b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/components/SiSpacePointFormation_entries.cxx @@ -1,4 +1,6 @@ +#include "../SiElementPropertiesTableCondAlg.h" #include "SiSpacePointFormation/SiTrackerSpacePointFinder.h" +DECLARE_COMPONENT( InDet::SiElementPropertiesTableCondAlg ) DECLARE_COMPONENT( InDet::SiTrackerSpacePointFinder ) diff --git a/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/SiTrigSpacePointFormation/SiTrigSpacePointFinder.h b/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/SiTrigSpacePointFormation/SiTrigSpacePointFinder.h index 57d5e429eba52899d77a6ad7133c896252f72ed8..ca4c3ef7a5ec941058456bd638b5c24d5c001fc0 100755 --- a/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/SiTrigSpacePointFormation/SiTrigSpacePointFinder.h +++ b/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/SiTrigSpacePointFormation/SiTrigSpacePointFinder.h @@ -36,6 +36,9 @@ #include "InDetPrepRawData/PixelClusterContainer.h" #include "InDetPrepRawData/SCT_ClusterContainer.h" +#include "StoreGate/ReadCondHandleKey.h" +#include "SiSpacePointFormation/SiElementPropertiesTable.h" + //!< Trigger includes #include "TrigInterfaces/FexAlgo.h" @@ -54,7 +57,6 @@ class TrigTimer; namespace InDet{ - class SiElementPropertiesTable; class SiSpacePointMakerTool; class ITrigSCT_SpacePointTool; @@ -97,6 +99,9 @@ namespace InDet{ SpacePointOverlapCollection* m_spOverlapColl; + SG::ReadCondHandleKey<InDet::SiElementPropertiesTable> m_SCTPropertiesKey{this, "SCTPropertiesKey", + "SCT_ElementPropertiesTable", "Key of input SiElementPropertiesTable for SCT"}; + ToolHandle< ITrigSCT_SpacePointTool > m_trigSpacePointTool; ToolHandle< SiSpacePointMakerTool > m_SiSpacePointMakerTool; diff --git a/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SCT_TrigSpacePointTool.cxx b/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SCT_TrigSpacePointTool.cxx index c19950f49478a6cc90be7be2b710b37ca3a093d0..b29a97ca5763bf4cc3a9ffac2b44615ded3651d7 100755 --- a/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SCT_TrigSpacePointTool.cxx +++ b/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SCT_TrigSpacePointTool.cxx @@ -34,12 +34,10 @@ SCT_TrigSpacePointTool::SCT_TrigSpacePointTool(const std::string &type, m_overlapLimitPhi(5.64), // overlap limit for phi-neighbours. m_overlapLimitEtaMin(1.68), // low overlap limit for eta-neighbours. m_overlapLimitEtaMax(3.0), // high overlap limit for eta-neighbours. - m_epsWidth(0.02), // safety margin for half-widths, in cm. m_spacePointsOverlapName("OverlapSpacePoints"), m_SiSpacePointMakerToolName("InDet::SiSpacePointMakerTool"), m_manager(0), m_idHelper(0), - m_properties{nullptr}, m_Sct_clcontainer{nullptr}, m_SiSpacePointMakerTool(0), m_allClusters(false), // process all clusters without limits. @@ -60,7 +58,6 @@ SCT_TrigSpacePointTool::SCT_TrigSpacePointTool(const std::string &type, // eta-neighbours. declareProperty("OverlapLimitEtaMax", m_overlapLimitEtaMax);// high overlap limit for // eta-neighbours. - declareProperty("EpsWidth",m_epsWidth); // safety margin for half-widths, in cm declareProperty("SpacePointsOverlapName", m_spacePointsOverlapName); declareProperty("SiSpacePointMakerToolName", m_SiSpacePointMakerToolName); @@ -96,10 +93,6 @@ StatusCode SCT_TrigSpacePointTool::initialize() { return StatusCode::FAILURE; } - m_properties = new InDet::SiElementPropertiesTable(*m_idHelper, - *elements, - m_epsWidth); - ATH_CHECK( toolSvc()->retrieveTool(m_SiSpacePointMakerToolName, m_SiSpacePointMakerTool, this) ); @@ -113,7 +106,6 @@ StatusCode SCT_TrigSpacePointTool::initialize() { //-------------------------------------------------------------------------- StatusCode SCT_TrigSpacePointTool::finalize() { StatusCode sc = AthAlgTool::finalize(); - delete m_properties; m_properties=0; return sc; } @@ -121,19 +113,21 @@ StatusCode SCT_TrigSpacePointTool::finalize() { //-------------------------------------------------------------------------- void SCT_TrigSpacePointTool:: addSCT_SpacePoints(const SCT_ClusterCollection* clusCollection, - const SCT_ClusterContainer* clusterContainer, - SpacePointCollection* spacepointCollection) { + const SCT_ClusterContainer* clusterContainer, + const SiElementPropertiesTable* properties, + SpacePointCollection* spacepointCollection) { - addSCT_SpacePoints(clusCollection, clusterContainer, spacepointCollection, 0); + addSCT_SpacePoints(clusCollection, clusterContainer, properties, spacepointCollection, 0); } //-------------------------------------------------------------------------- void SCT_TrigSpacePointTool:: addSCT_SpacePoints(const SCT_ClusterCollection* clusCollection, - const SCT_ClusterContainer* clusterContainer, - SpacePointCollection* spacepointCollection, - SpacePointOverlapCollection* overlapColl) { + const SCT_ClusterContainer* clusterContainer, + const SiElementPropertiesTable* properties, + SpacePointCollection* spacepointCollection, + SpacePointOverlapCollection* overlapColl) { m_Sct_clcontainer = clusterContainer; m_spacepointoverlapCollection = overlapColl; @@ -174,7 +168,7 @@ addSCT_SpacePoints(const SCT_ClusterCollection* clusCollection, IdentifierHash thisHash = m_idHelper->wafer_hash(thisID); const std::vector<IdentifierHash>* - others(m_properties->neighbours(thisHash)); + others(properties->neighbours(thisHash)); if (others==0 || others->empty() ) return; std::vector<IdentifierHash>::const_iterator otherHash = others->begin(); @@ -195,7 +189,7 @@ addSCT_SpacePoints(const SCT_ClusterCollection* clusCollection, doOverlapColl = true; ++otherHash; if (otherHash == others->end() ) return; - float hwidth(m_properties->halfWidth(thisHash)); + float hwidth(properties->halfWidth(thisHash)); // half-width of wafer checkForSCT_Points(clusCollection, *otherHash, diff --git a/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SCT_TrigSpacePointTool.h b/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SCT_TrigSpacePointTool.h index 103546aac18a3ca145eb78dddb6926d79e376baa..a4711fa7304be3137369ace6695ac822a3317203 100755 --- a/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SCT_TrigSpacePointTool.h +++ b/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SCT_TrigSpacePointTool.h @@ -40,7 +40,7 @@ #include "InDetPrepRawData/PixelClusterContainer.h" #include "InDetPrepRawData/PixelClusterCollection.h" #include "InDetPrepRawData/SCT_ClusterCollection.h" - + #include <string> class SCT_ID; @@ -82,13 +82,15 @@ namespace InDet { // Convert clusters to space points void addSCT_SpacePoints (const SCT_ClusterCollection* clusCollection, - const SCT_ClusterContainer* clusterContainer, - SpacePointCollection* spacepointCollection, - SpacePointOverlapCollection* overlapColl); + const SCT_ClusterContainer* clusterContainer, + const SiElementPropertiesTable* properties, + SpacePointCollection* spacepointCollection, + SpacePointOverlapCollection* overlapColl); void addSCT_SpacePoints (const SCT_ClusterCollection* clusCollection, - const SCT_ClusterContainer* clusterContainer, - SpacePointCollection* spacepointCollection); + const SCT_ClusterContainer* clusterContainer, + const SiElementPropertiesTable* properties, + SpacePointCollection* spacepointCollection); void checkForSCT_Points (const SCT_ClusterCollection* clusters1, @@ -114,7 +116,6 @@ namespace InDet { float m_overlapLimitPhi; //!< overlap limit for phi-neighbours. float m_overlapLimitEtaMin; //!< low overlap limit for eta-neighbours. float m_overlapLimitEtaMax; //!< high overlap limit for eta-neighbours. - float m_epsWidth; //!< safety margin for half-width. std::string m_spacePointsOverlapName; std::string m_SiSpacePointMakerToolName; @@ -122,7 +123,6 @@ namespace InDet { const InDetDD::SCT_DetectorManager *m_manager; const SCT_ID* m_idHelper; - InDet::SiElementPropertiesTable* m_properties; const SCT_ClusterContainer* m_Sct_clcontainer; InDet::SiSpacePointMakerTool* m_SiSpacePointMakerTool; diff --git a/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SiTrigSpacePointFinder.cxx b/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SiTrigSpacePointFinder.cxx index 5365644b9f0a20ec1339e3b30d50afb74f701388..3d890832e31eabd533f8cd17e0f1569e8d902757 100755 --- a/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SiTrigSpacePointFinder.cxx +++ b/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SiTrigSpacePointFinder.cxx @@ -271,6 +271,14 @@ namespace InDet{ // m_spOverlapColl->addRef(); } + if (m_selectSCTs) { + // ReadCondHandleKey for SCT alignment conditions + if (m_SCTPropertiesKey.initialize().isFailure()) { + ATH_MSG_FATAL( "Failed to initialize " << m_SCTPropertiesKey.fullKey() ); + return HLT::ErrorCode(HLT::Action::ABORT_JOB, HLT::Reason::BAD_JOB_SETUP); + } + } + // initializing the IdentifiableContainers for clusters: m_pixelClusterContainer=0; m_sctClusterContainer=0; @@ -430,6 +438,13 @@ namespace InDet{ if (m_selectSCTs && doSCT ){ + SG::ReadCondHandle<SiElementPropertiesTable> sctProperties(m_SCTPropertiesKey); + const SiElementPropertiesTable* properties(sctProperties.retrieve()); + if (properties==nullptr) { + ATH_MSG_FATAL("Pointer of SiElementPropertiesTable (" << m_SCTPropertiesKey.fullKey() << ") could not be retrieved"); + return HLT::ErrorCode(HLT::Action::ABORT_JOB, HLT::Reason::BAD_JOB_SETUP); + } + if(!m_doFullScan){ // Get the SCT RDO's: if(doTiming()) m_timerRegSel->resume(); @@ -479,6 +494,7 @@ namespace InDet{ m_trigSpacePointTool->addSCT_SpacePoints(SCTClusterCollection, m_sctClusterContainer, + properties, spacepointCollection, m_spOverlapColl); } @@ -529,6 +545,7 @@ namespace InDet{ m_trigSpacePointTool->addSCT_SpacePoints(colNext, m_sctClusterContainer, + properties, spacepointCollection, m_spOverlapColl); } diff --git a/InnerDetector/InDetTrigRecTools/InDetTrigToolInterfaces/InDetTrigToolInterfaces/ITrigSCT_SpacePointTool.h b/InnerDetector/InDetTrigRecTools/InDetTrigToolInterfaces/InDetTrigToolInterfaces/ITrigSCT_SpacePointTool.h index 9ac2f31af2159c8f7976a07474bc617ad80a4ce8..34996a91770d0a70841e195fb7a0b7bba32d7c90 100644 --- a/InnerDetector/InDetTrigRecTools/InDetTrigToolInterfaces/InDetTrigToolInterfaces/ITrigSCT_SpacePointTool.h +++ b/InnerDetector/InDetTrigRecTools/InDetTrigToolInterfaces/InDetTrigToolInterfaces/ITrigSCT_SpacePointTool.h @@ -29,6 +29,7 @@ class SpacePointCollection; class SpacePointOverlapCollection; namespace InDet { + class SiElementPropertiesTable; static const InterfaceID IID_ITrigSCT_SpacePointTool("InDet::ITrigSCT_SpacePointTool",1,0); @@ -42,23 +43,27 @@ namespace InDet { * Convert clusters to SpacePoints * @param[in] clusCollection Cluster collection * @param[in] clusterContainer Cluster container + * @param[in] properties SiElementPropertiesTable * @param[out] spacepointCollection SpacePoint collection */ virtual void addSCT_SpacePoints (const SCT_ClusterCollection* clusCollection, - const SCT_ClusterContainer* clusterContainer, - SpacePointCollection* spacepointCollection)=0; + const SCT_ClusterContainer* clusterContainer, + const SiElementPropertiesTable* properties, + SpacePointCollection* spacepointCollection)=0; /** * Convert clusters to SpacePoints * @param[in] clusCollection Cluster collection * @param[in] clusterContainer Cluster container + * @param[in] properties SiElementPropertiesTable * @param[out] spacepointCollection SpacePoint collection * @param overlapColl collection of SP with overlaps */ virtual void addSCT_SpacePoints (const SCT_ClusterCollection* clusCollection, - const SCT_ClusterContainer* clusterContainer, - SpacePointCollection* spacepointCollection, - SpacePointOverlapCollection* overlapColl)=0; + const SCT_ClusterContainer* clusterContainer, + const SiElementPropertiesTable* properties, + SpacePointCollection* spacepointCollection, + SpacePointOverlapCollection* overlapColl)=0; virtual void checkForSCT_Points (const SCT_ClusterCollection* clusters1, const IdentifierHash& id2, double minDiff, diff --git a/LArCalorimeter/LArCafJobs/share/LArNoiseBursts_prodJO.py b/LArCalorimeter/LArCafJobs/share/LArNoiseBursts_prodJO.py index 1e4a9996ea2a2fd0371be973929c5d7fb548fce9..30ce4218559b0f48ce37bb39a4f30130f25595ad 100644 --- a/LArCalorimeter/LArCafJobs/share/LArNoiseBursts_prodJO.py +++ b/LArCalorimeter/LArCafJobs/share/LArNoiseBursts_prodJO.py @@ -114,6 +114,12 @@ from SiSpacePointFormation.SiSpacePointFormationConf import InDet__SiTrackerSpac InDetSiTrackerSpacePointFinder = InDet__SiTrackerSpacePointFinder(name = "InDetSiTrackerSpacePointFinder") topSequence += InDetSiTrackerSpacePointFinder +# Condition algorithm for SiTrackerSpacePointFinder +from AthenaCommon.AlgSequence import AthSequencer +condSeq = AthSequencer("AthCondSeq") +if not hasattr(condSeq, "InDetSiElementPropertiesTableCondAlg"): + from SiSpacePointFormation.SiSpacePointFormationConf import InDet__SiElementPropertiesTableCondAlg + condSeq += InDet__SiElementPropertiesTableCondAlg(name = "InDetSiElementPropertiesTableCondAlg") from LArCafJobs.LArCafJobsConf import LArNoiseBursts topSequence += LArNoiseBursts( "LArNoiseBursts" ) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/InDetSetup.py b/Trigger/TrigValidation/TrigUpgradeTest/python/InDetSetup.py index 547c47b6c54533bb568c7c3c90197f96f2f5e84e..446fe7d6abc2b270f68a5648e4eb85010905a1ee 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/InDetSetup.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/InDetSetup.py @@ -235,8 +235,17 @@ def makeInDetAlgs(): #OutputLevel=INFO) viewAlgs.append(InDetSiTrackerSpacePointFinder) - - + + # Condition algorithm for SiTrackerSpacePointFinder + if InDetSiTrackerSpacePointFinder.ProcessSCTs: + from AthenaCommon.AlgSequence import AthSequencer + condSeq = AthSequencer("AthCondSeq") + if not hasattr(condSeq, "InDetSiElementPropertiesTableCondAlg"): + # Setup alignment folders and conditions algorithms + from InDetCondFolders import InDetAlignFolders + from SiSpacePointFormation.SiSpacePointFormationConf import InDet__SiElementPropertiesTableCondAlg + condSeq += InDet__SiElementPropertiesTableCondAlg(name = "InDetSiElementPropertiesTableCondAlg") + from TrigInDetConf.TrigInDetRecCommonTools import InDetTrigFastTrackSummaryTool from TrigInDetConf.TrigInDetPostTools import InDetTrigParticleCreatorToolFTF