diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastSteering.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastSteering.h index 8144f4f332313227dba745130a039085152a028e..5dc507b393d75d885df96003d94cb249345502ee 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastSteering.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MuFastSteering.h @@ -25,6 +25,13 @@ #include "TrigL2MuonSA/CscSegmentMaker.h" #include "TrigL2MuonSA/CscRegUtils.h" +//adding a part of DataHandle for AthenaMT +#include "AthenaBaseComps/AthReentrantAlgorithm.h" +#include "StoreGate/ReadHandleKey.h" +#include "StoreGate/WriteHandleKey.h" +#include "TrigMuonEvent/MuonFeature.h" +#include "TrigMuonEvent/MuonFeatureDetails.h" + #include "xAODTrigMuon/L2StandAloneMuonContainer.h" #include "xAODTrigger/TrigCompositeAuxContainer.h" #include "xAODTrigger/TrigCompositeContainer.h" @@ -69,7 +76,11 @@ class MuFastSteering : public HLT::FexAlgo, /** hltExecute(), main code of the algorithm */ HLT::ErrorCode hltExecute(const HLT::TriggerElement* inputTE, HLT::TriggerElement* outputTE); - + + //adding a part of DataHandle for AthenaMT + /** execute(), main code of the algorithm for AthenaMT*/ + StatusCode execute(); + int L2MuonAlgoMap(const std::string& name); /** A function which clears internal data for a new event */ @@ -178,7 +189,23 @@ class MuFastSteering : public HLT::FexAlgo, DoubleProperty m_rWidth_TGC_Failed; DoubleProperty m_winPt; - + + //adding a part of DataHandle for AthenaMT + //ReadHandle L1MURoIs + SG::ReadHandleKey<TrigRoiDescriptorCollection> m_roiCollectionKey; + SG::ReadHandle<TrigRoiDescriptorCollection> m_roiCollection; + + //WriteHandle MuonFeature + SG::WriteHandleKey<MuonFeature> m_muFeContainerKey; + SG::WriteHandle<MuonFeature> m_muFeContainer; + + //WriteHandle MuonFeatureDetails + SG::WriteHandleKey<MuonFeatureDetails> m_muFeDeContainerKey; + SG::WriteHandle<MuonFeatureDetails> m_muFeDeContainer; + + //Test Value to confirm to record with WriteHandle + MuonFeatureDetails muFeDeTestValue; + //Monitored variables float m_inner_mdt_hits; float m_middle_mdt_hits; diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcDataPreparator.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcDataPreparator.h index 71c2f03e5a35d99d73c8c79464f3633f4b9e3e3e..a1b584d2addbe43a09106d5a11dca75e10f3386c 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcDataPreparator.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcDataPreparator.h @@ -33,6 +33,7 @@ #include "TrigSteeringEvent/TrigRoiDescriptor.h" + class StoreGateSvc; class ActiveStoreSvc; class RpcIdHelper; @@ -77,7 +78,7 @@ class RpcDataPreparator: public AthAlgTool bool isFakeRoi() { return m_isFakeRoi; } void setRoIBasedDataAccess(bool use_RoIBasedDataAccess); - + private: // Reference to StoreGateSvc; @@ -97,9 +98,11 @@ class RpcDataPreparator: public AthAlgTool // handles to the RoI driven data access ToolHandle<Muon::IMuonRdoToPrepDataTool> m_rpcPrepDataProvider; - + ToolHandle <Muon::MuonIdHelperTool> m_idHelperTool; //!< Pointer to concrete tool + // Declare the keys used to access the data: one for reading and one + // for writing. bool m_use_RoIBasedDataAccess; bool m_isFakeRoi; }; diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcDataPreparator.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcDataPreparator.h index 421da05d59b2ae65e54eab2e2caeff7a336a6ddb..8e4b5b0c08f668eb6cc0fdf5d2bc1d92bdba59aa 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcDataPreparator.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcDataPreparator.h @@ -89,6 +89,7 @@ class TgcDataPreparator: public AthAlgTool const MuonGM::TgcReadoutElement* m_tgcReadout; const TgcIdHelper* m_tgcIdHelper; ActiveStoreSvc* m_activeStore; + // vector of the TGC hash ID list std::vector<IdentifierHash> m_tgcHashList; diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAConfig.py b/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAConfig.py index 01d52a9de5da199c65e771f0f060995fc7851e74..daf2518846395996e141e1130d26fe44b660c2c2 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAConfig.py +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAConfig.py @@ -31,7 +31,6 @@ ToolSvc += MuonBackExtrapolatorForData() ToolSvc += TrigL2MuonSA__CscSegmentMaker() ToolSvc += TrigL2MuonSA__CscRegDict() - class PtBarrelLUTSvc(TrigL2MuonSA__PtBarrelLUTSvc): def __init__(self,name = 'PtBarrelLUTSvc'): super(PtBarrelLUTSvc ,self).__init__(name) diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx index 02a9928d08e55c66f6656f897b17a431ac5285f4..db59ae23d81de853006028283df4c433a06174bf 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastSteering.cxx @@ -24,6 +24,7 @@ #include "AthenaBaseComps/AthMsgStreamMacros.h" +using namespace SG; // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -46,7 +47,12 @@ MuFastSteering::MuFastSteering(const std::string& name, ISvcLocator* svc) m_rpcFitResult(), m_tgcFitResult(), m_mdtHits_normal(), m_mdtHits_overlap(), m_cscHits(), - m_jobOptionsSvc(0), m_trigCompositeContainer(0) + m_jobOptionsSvc(0), m_trigCompositeContainer(0), + + //adding a part of DataHandle for AthenaMT + m_roiCollection("L1MURoIs"), //ReadHandle L1MuRoIs to read in + m_muFeContainer("MuonFeature"), //WriteHandle MuonFeature to record + m_muFeDeContainer("MuonFeatureDetails") //WriteHandle MuonFeatureDetails to record { declareProperty("DataPreparator", m_dataPreparator, "data preparator"); declareProperty("PatternFinder", m_patternFinder, "pattern finder"); @@ -110,6 +116,12 @@ MuFastSteering::MuFastSteering(const std::string& name, ISvcLocator* svc) declareMonitoredStdContainer("TrackPhi", m_track_phi); declareMonitoredStdContainer("FailedRoIEta", m_failed_eta); declareMonitoredStdContainer("FailedRoIPhi", m_failed_phi); + + //adding a part of DataHandle for AthenaMT + declareProperty("MuRoIs", m_roiCollectionKey = std::string("L1MURoIs"), "L1MuRoIs to read in"); + declareProperty("MuonFeature",m_muFeContainerKey = std::string("MuonFeature"),"MuonFeature to record"); + declareProperty("MuonFeatureDetails",m_muFeDeContainerKey = std::string("MuonFeatureDetails"),"MuonFeatureDetails to record"); + } // -------------------------------------------------------------------------------- @@ -166,7 +178,8 @@ HLT::ErrorCode MuFastSteering::hltInitialize() // if (m_patternFinder.retrieve().isFailure()) { - ATH_MSG_ERROR("Cannot retrieve Tool DataPreparator"); + +ATH_MSG_ERROR("Cannot retrieve Tool DataPreparator"); return HLT::BAD_JOB_SETUP; } @@ -199,8 +212,6 @@ HLT::ErrorCode MuFastSteering::hltInitialize() ATH_MSG_ERROR("Could not retrieve " << m_cscsegmaker); return HLT::BAD_JOB_SETUP; } - - // Set service tools m_trackExtrapolator->setExtrapolatorTool(&m_backExtrapolatorTool); m_dataPreparator->setExtrapolatorTool(&m_backExtrapolatorTool); @@ -276,15 +287,23 @@ HLT::ErrorCode MuFastSteering::hltInitialize() p_incidentSvc->addListener(this,"UpdateAfterFork",pri); p_incidentSvc.release().ignore(); } - } - - - - + } + //adding a part of DataHandle for AThenaMT + if (m_roiCollectionKey.initialize().isFailure() ) { + ATH_MSG_ERROR("ReadHandleKey for L1MURoIs initialize Failure!"); + return HLT::BAD_JOB_SETUP; + } + if (m_muFeContainerKey.initialize().isFailure() ) { + ATH_MSG_ERROR("WriteHandleKey for MuonFeature initialize Failure!"); + return HLT::BAD_JOB_SETUP; + } + if (m_muFeDeContainerKey.initialize().isFailure() ) { + ATH_MSG_ERROR("WriteHandleKey for MuonFeatureDetails initialize Failure!"); + return HLT::BAD_JOB_SETUP; + } ATH_MSG_DEBUG("initialize success"); - return HLT::OK; } @@ -311,6 +330,61 @@ HLT::ErrorCode MuFastSteering::hltEndRun() { return HLT::OK; } +//adding a part of DataHandel for AthenaMT +StatusCode MuFastSteering::execute() { + + ATH_MSG_DEBUG("StatusCode MuFastSteering::execute() start"); + + //ReadHandle:L1MURoIs to read in + auto roiCollectionHandle = SG::makeHandle( m_roiCollectionKey ); + const TrigRoiDescriptorCollection *roiCollection = roiCollectionHandle.cptr(); + if (!roiCollectionHandle.isValid()){ + ATH_MSG_ERROR("ReadHandle for L1MURoIs isn't Valid"); + return StatusCode::FAILURE; + } + const TrigRoiDescriptor* roiDescriptor = 0; + TrigRoiDescriptorCollection::const_iterator roiIn = roiCollection->begin(); + TrigRoiDescriptorCollection::const_iterator roiEn = roiCollection->end(); + for(; roiIn != roiEn; ++roiIn){ + roiDescriptor = *roiIn; + float roieta = roiDescriptor->eta(); + float roiphi = roiDescriptor->phi(); + ATH_MSG_DEBUG("L1MURoIs eta/phi = " << roieta << "/" << roiphi); + } + ATH_MSG_DEBUG("ReadHandle for L1MURoIs success"); + + //WriteHandle:MuonFeature to record + SG::WriteHandle<MuonFeature> muFeContainerHandle(m_muFeContainerKey); + muFeContainerHandle = std::make_unique<MuonFeature>(); + if(!muFeContainerHandle.isValid()){ + ATH_MSG_ERROR("ReadHandle for MuonFeature isn't Valid"); + return StatusCode::FAILURE; + } +// ATH_MSG_DEBUG("muFeContainer Pt/Alpha/Beta= " << muFeContainerHandle->Pt() << "/" << muFeContainerHandle->Alpha() << "/" << muFeContainerHandle->Beta()); + ATH_MSG_DEBUG("WriteHandle for MuonFeature success"); + + //Test Value defined + float muFeDePt = 1.52; + float muFeDeAlpha = 1.23; + float muFeDeBeta = -1.15; + muFeDeTestValue.setPt(muFeDePt); + muFeDeTestValue.setAlpha(muFeDeAlpha); + muFeDeTestValue.setBeta(muFeDeBeta); + + //WriteHandle:MuonFeatureDetails to record + SG::WriteHandle<MuonFeatureDetails> muFeDeContainerHandle(m_muFeDeContainerKey); + muFeDeContainerHandle = std::make_unique<MuonFeatureDetails>(muFeDeTestValue); + if(!muFeDeContainerHandle.isValid()){ + ATH_MSG_ERROR("ReadHandle for MuonFeatureDetails isn't Valid"); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG("muFeDeContainer Pt/Alpha/Beta= " << muFeDeContainerHandle->Pt() << "/" << muFeDeContainerHandle->Alpha() << "/" << muFeDeContainerHandle->Beta()); + ATH_MSG_DEBUG("WriteHandle for MuonFeatureDetails success"); + + ATH_MSG_DEBUG("StatusCode MuFastSteering::execute() success"); + return StatusCode::SUCCESS; +} + HLT::ErrorCode MuFastSteering::hltFinalize() { ATH_MSG_DEBUG("hltFinalize()"); return HLT::OK; @@ -352,7 +426,7 @@ HLT::ErrorCode MuFastSteering::hltExecute(const HLT::TriggerElement* inputTE, } } clearEvent(); - + if (m_timerSvc) m_timers[ITIMER_TOTAL_PROCESSING]->resume(); if (m_timerSvc) m_timers[ITIMER_DATA_PREPARATOR]->resume(); @@ -395,7 +469,7 @@ HLT::ErrorCode MuFastSteering::hltExecute(const HLT::TriggerElement* inputTE, if ( m_recMuonRoIUtils.isBarrel(*p_roi) ) { // Barrel ATH_MSG_DEBUG("Barrel"); - + m_muonRoad.setScales(m_scaleRoadBarrelInner, m_scaleRoadBarrelMiddle, m_scaleRoadBarrelOuter); diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx index 1d91362e76ac60c33ce4a875f4c1682136f7e53b..ce4a94e90a055a9cad2b79f64e0f8156f01b2830 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcDataPreparator.cxx @@ -26,6 +26,7 @@ using namespace Muon; using namespace MuonGM; +using namespace SG; // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -49,6 +50,7 @@ TrigL2MuonSA::RpcDataPreparator::RpcDataPreparator(const std::string& type, { declareInterface<TrigL2MuonSA::RpcDataPreparator>(this); declareProperty("RpcPrepDataProvider", m_rpcPrepDataProvider); + } // -------------------------------------------------------------------------------- @@ -236,8 +238,8 @@ StatusCode TrigL2MuonSA::RpcDataPreparator::prepareData(const TrigRoiDescriptor* const RpcPrepDataContainer* rpcPrds = 0; std::string rpcKey = "RPC_Measurements"; - if (m_activeStore) { - StatusCode sc = (*m_activeStore)->retrieve(rpcPrds, rpcKey); + if (m_activeStore) { //m_activeStore->m_storeGateSvc + StatusCode sc = (*m_activeStore)->retrieve(rpcPrds, rpcKey); //m_activeStore->m_storeGateSvc if ( sc.isFailure() ) { ATH_MSG_ERROR(" Cannot retrieve RPC PRD Container " << rpcKey); return StatusCode::FAILURE;; diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparator.cxx index 37d862be4b756e2e1c05c528d11d9882be1572a3..72c3485f6a196e80b413e49c66eb7acb7a522955 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparator.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcDataPreparator.cxx @@ -53,6 +53,7 @@ TrigL2MuonSA::TgcDataPreparator::TgcDataPreparator(const std::string& type, declareProperty("TGC_RawDataProvider", m_tgcRawDataProvider); } + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -177,7 +178,7 @@ StatusCode TrigL2MuonSA::TgcDataPreparator::prepareData(const LVL1::RecMuonRoI* int channel; bool isLowPt = m_recMuonRoIUtils.isLowPt(p_roi); - + // Select the eta cut based on ROI Pt. double mid_eta_test = (isLowPt) ? m_options.roadParameters().deltaEtaAtMiddleForLowPt() : m_options.roadParameters().deltaEtaAtMiddleForHighPt();