diff --git a/AtlasTest/TestTools/share/post.sh b/AtlasTest/TestTools/share/post.sh index ff17daa68d9d26a2303c90f1e41cf73815f36944..c3071681f29eca1742401ef1bfd0cc24abbeba0a 100755 --- a/AtlasTest/TestTools/share/post.sh +++ b/AtlasTest/TestTools/share/post.sh @@ -159,6 +159,8 @@ PP="$PP"'|bits/regex.h:1545' # More StoreGate changes. PP="$PP"'|DEBUG trying to create store' +# Differences in MT build. +PP="$PP"'|^IncidentProcAlg.* INFO|^Ath.*Seq +INFO' if [ "$extrapatterns" != "" ]; then diff --git a/Control/AthViews/AthViews/ViewHelper.h b/Control/AthViews/AthViews/ViewHelper.h index 723d48022b4845c6ed5ad00bcb7fcad21116e5c3..8d0d9ac6da2c7877a8c1982cb0bd41a87e4924a4 100644 --- a/Control/AthViews/AthViews/ViewHelper.h +++ b/Control/AthViews/AthViews/ViewHelper.h @@ -138,6 +138,63 @@ namespace ViewHelper return StatusCode::SUCCESS; } -} + /** + * @arg unique_index - gets appended to the view name if >= 0 + */ + inline SG::View* makeView( const std::string& common_name, int unique_index=-1) { + return (( unique_index == -1 ) ? + new SG::View( common_name ) : + new SG::View( common_name+ " "+std::to_string(unique_index) ) ); + + } + + /** + * @brief - records object in a view + */ + template< typename T > + StatusCode addToView( SG::View* view, const std::string& key, T* ptr ) { + + SG::WriteHandle< T > handle( key ); + + if( handle.setProxyDict( view ).isFailure() ) { + return StatusCode::FAILURE; + } + + if ( handle.record( std::unique_ptr<T>( ptr ) ).isFailure() ) { + return StatusCode::FAILURE; + } + + return StatusCode::SUCCESS; + } + + template< typename T > + StatusCode addViewCollectionToView(SG::View* view, const std::string& key, const T* src ) { + auto * viewColl = new ConstDataVector<T>(); + viewColl->clear( SG::VIEW_ELEMENTS ); //make it a view + viewColl->insert( viewColl->end(), src->begin(), src->end() ); // copy content + + return addToView( view, key, viewColl ); + } + + + /** + * @return nullptr if object of type T is missing in the view + */ + template< typename T > + const T* getFromView( SG::View* view, const std::string& key) { + + SG::ReadHandle<T> handle(key); + + if ( handle.setProxyDict(view).isFailure() ) { + return nullptr; + } + + return handle.cptr(); + } + + + + +} // EOF namspace ViewHelper #endif diff --git a/Control/AthViews/share/GraphViews.py b/Control/AthViews/share/GraphViews.py index 455058ff6e62c6e3dc4cfdb4240921aaa8539fed..f6a245bc792ab2a6133cd11e6001124dd6b8b8a6 100644 --- a/Control/AthViews/share/GraphViews.py +++ b/Control/AthViews/share/GraphViews.py @@ -10,43 +10,57 @@ # ATLAS default Application Configuration options #-------------------------------------------------------------- +# Configure the scheduler from GaudiHive.GaudiHiveConf import ForwardSchedulerSvc svcMgr += ForwardSchedulerSvc() svcMgr.ForwardSchedulerSvc.CheckDependencies = True # Make a separate alg pool for the view algs -# We don't actually need to do this if we attach the algs to job -# I'm hoping we can keep the mechanism for later, alternatively do the lazy init from GaudiHive.GaudiHiveConf import AlgResourcePool viewAlgPoolName = "ViewAlgPool" svcMgr += AlgResourcePool( viewAlgPoolName ) -#svcMgr.ViewAlgPool.TopAlg = [ "AthViews::DFlowAlg1/dflow_alg1", "AthViews::DFlowAlg2/dflow_alg2", "AthViews::DFlowAlg3/dflow_alg3" ] #algs will be instantiated with default config -svcMgr.ViewAlgPool.TopAlg = [ "dflow_alg1", "dflow_alg2", "dflow_alg3" ] #use existing instances -# Full job is a list of algorithms +# Set of view algs +from AthenaCommon.AlgSequence import AthSequencer +allViewAlgorithms = AthSequencer( "allViewAlgorithms" ) + +# Filter to stop view algs from running on whole event +allViewAlgorithms += CfgMgr.AthPrescaler( "alwaysFail" ) +allViewAlgorithms.alwaysFail.PercentPass = 0.0 + +# Method to set up a view algorithm +def DeclareViewAlgorithm( viewAlg ): + global svcMgr, allViewAlgorithms + svcMgr.ViewAlgPool.TopAlg += [ viewAlg.name() ] + allViewAlgorithms += viewAlg + +# Event-level algorithm sequence from AthenaCommon.AlgSequence import AlgSequence job = AlgSequence() + # Make views job += CfgMgr.AthViews__ViewSubgraphAlg("make_alg") job.make_alg.ViewBaseName = "view" job.make_alg.ViewNumber = 5 job.make_alg.AlgPoolName = viewAlgPoolName -job.make_alg.AlgorithmNameSequence = [ "dflow_alg1", "dflow_alg2", "dflow_alg3" ] +job.make_alg.AlgorithmNameSequence = [ "dflow_alg1", "dflow_alg2", "dflow_alg3" ] #Eventually scheduler will do this -# Algorithms for one view -job += CfgMgr.AthViews__DFlowAlg1("dflow_alg1") -job.dflow_alg1.RequireView = True +# View algorithms +dflow_alg1 = CfgMgr.AthViews__DFlowAlg1("dflow_alg1") +DeclareViewAlgorithm( dflow_alg1 ) # -job += CfgMgr.AthViews__DFlowAlg2("dflow_alg2") -job.dflow_alg2.RequireView = True +dflow_alg2 = CfgMgr.AthViews__DFlowAlg2("dflow_alg2") +DeclareViewAlgorithm( dflow_alg2 ) # -job += CfgMgr.AthViews__DFlowAlg3("dflow_alg3") -job.dflow_alg3.RequireView = True +dflow_alg3 = CfgMgr.AthViews__DFlowAlg3("dflow_alg3") +DeclareViewAlgorithm( dflow_alg3 ) # Merge views job += CfgMgr.AthViews__ViewMergeAlg("merge_alg") -job.merge_alg.ExtraInputs += [ ( 'int', 'all_views_done_dflow' ) ] + +# Add the view algorithms to the job +job += allViewAlgorithms #-------------------------------------------------------------- # Event related parameters diff --git a/Control/AthViews/src/AthViewAlgorithm.cxx b/Control/AthViews/src/AthViewAlgorithm.cxx index 35bb880ee8044d61fedef39a2b0fdc0b8df9f221..16f0c0918a4e4508e14114226cd872b59f51eef0 100755 --- a/Control/AthViews/src/AthViewAlgorithm.cxx +++ b/Control/AthViews/src/AthViewAlgorithm.cxx @@ -67,7 +67,7 @@ StatusCode AthViewAlgorithm::sysExecute(const EventContext& ctx) { StatusCode AthViewAlgorithm::sysExecute() { const EventContext& ctx = *getContext(); #endif - ATH_MSG_DEBUG( "AthViewAlgorithm sysExecute for " << name() ); + ATH_MSG_WARNING( "AthViewAlgorithm is now OBSOLETE, please migrate your code" ); //Skip the algorithm if views are required or avoided SG::View * myView = eventView(ctx); @@ -104,7 +104,6 @@ StatusCode AthViewAlgorithm::sysExecute() { //Retrieve the EventView pointer from the context if it exists SG::View * AthViewAlgorithm::eventView(const EventContext& ctx) { - //Try to get the view from context if ( ! ctx.valid() ) return 0; //but why no context? SG::View * myView = dynamic_cast< SG::View * >( ctx.proxy() ); diff --git a/Control/AthViews/src/GraphExecutionTask.cxx b/Control/AthViews/src/GraphExecutionTask.cxx index 305b3e7cfcc14538e189c70b895794f2cb493cbe..ec8abfb226e9aa81b3b3059e7e09430a8bb5486e 100644 --- a/Control/AthViews/src/GraphExecutionTask.cxx +++ b/Control/AthViews/src/GraphExecutionTask.cxx @@ -8,6 +8,7 @@ #include "GaudiKernel/Algorithm.h" #include "GaudiKernel/IAlgResourcePool.h" #include "GaudiKernel/IAlgorithm.h" +#include "GaudiKernel/ThreadLocalContext.h" //The method for scheduling a subgraph @@ -43,7 +44,9 @@ tbb::task* GraphExecutionTask::execute() { return nullptr; } -#ifdef GAUDI_SYSEXECUTE_WITHCONTEXT +#ifdef GAUDI_SYSEXECUTE_WITHCONTEXT + Gaudi::Hive::setCurrentContext( *m_eventContext ); + algoPtr->whiteboard()->selectStore( m_eventContext->slot() ).ignore(); algoPtr->sysExecute( *m_eventContext ); #else algoPtr->setContext( m_eventContext ); diff --git a/Control/AthViews/src_dflow/DFlowAlg1.cxx b/Control/AthViews/src_dflow/DFlowAlg1.cxx index d9763c99d6fae46302abddf82bffa05a9ec0ee1a..3131a12ad055aa18e82cfa88e4bbfd530c24b0f6 100644 --- a/Control/AthViews/src_dflow/DFlowAlg1.cxx +++ b/Control/AthViews/src_dflow/DFlowAlg1.cxx @@ -17,11 +17,10 @@ // FrameWork includes #include "GaudiKernel/Property.h" - +#include "StoreGate/ReadHandle.h" +#include "StoreGate/WriteHandle.h" #include "CxxUtils/make_unique.h" -#include "AthViews/View.h" - namespace AthViews { /////////////////////////////////////////////////////////////////// @@ -32,7 +31,7 @@ namespace AthViews { //////////////// DFlowAlg1::DFlowAlg1( const std::string& name, ISvcLocator* pSvcLocator ) : - ::AthViewAlgorithm( name, pSvcLocator ), + ::AthAlgorithm( name, pSvcLocator ), m_r_int( "view_start" ), m_w_int( "dflow_int" ) { @@ -57,6 +56,9 @@ StatusCode DFlowAlg1::initialize() { ATH_MSG_INFO ("Initializing " << name() << "..."); + CHECK( m_r_int.initialize() ); + CHECK( m_w_int.initialize() ); + return StatusCode::SUCCESS; } @@ -71,26 +73,38 @@ StatusCode DFlowAlg1::execute() { ATH_MSG_DEBUG ("Executing " << name() << "..."); - if ( !m_r_int.isValid() ) return StatusCode::FAILURE; - int seedData = *m_r_int; +#ifdef GAUDI_SYSEXECUTE_WITHCONTEXT + const EventContext& ctx = getContext(); +#else + const EventContext& ctx = *getContext(); +#endif + + SG::ReadHandle< int > inputData( m_r_int, ctx ); + if ( !inputData.isValid() ) + { + ATH_MSG_ERROR( "Failed to retrieve initial view data from store " << inputData.store() ); + return StatusCode::FAILURE; + } + int seedData = *inputData; + SG::WriteHandle< int > outputData( m_w_int, ctx ); ATH_MSG_INFO("myint handle..."); - ATH_MSG_INFO("name: [" << m_w_int.name() << "]"); - ATH_MSG_INFO("store [" << m_w_int.store() << "]"); - ATH_MSG_INFO("clid: [" << m_w_int.clid() << "]"); + ATH_MSG_INFO("name: [" << outputData.name() << "]"); + ATH_MSG_INFO("store [" << outputData.store() << "]"); + ATH_MSG_INFO("clid: [" << outputData.clid() << "]"); - m_w_int.record( CxxUtils::make_unique< int >( seedData ) ); + outputData.record( CxxUtils::make_unique< int >( seedData ) ); - //redundant check as op = would throw if m_w_int was not valid (e.g. because if clid/key combo was duplicated) - if (m_w_int.isValid()) + //redundant check as op = would throw if outputData was not valid (e.g. because if clid/key combo was duplicated) + if ( outputData.isValid() ) { - ATH_MSG_INFO("ptr: " << m_w_int.cptr()); - ATH_MSG_INFO("val: " << *m_w_int); + ATH_MSG_INFO("ptr: " << outputData.cptr()); + ATH_MSG_INFO("val: " << *outputData); ATH_MSG_INFO("modify myint by value..."); - ATH_MSG_INFO("ptr: " << m_w_int.cptr()); - ATH_MSG_INFO("val: " << *m_w_int); + ATH_MSG_INFO("ptr: " << outputData.cptr()); + ATH_MSG_INFO("val: " << *outputData); } return StatusCode::SUCCESS; diff --git a/Control/AthViews/src_dflow/DFlowAlg1.h b/Control/AthViews/src_dflow/DFlowAlg1.h index f8d3c264842f82290e316483cc5425c608f76d8c..ed30f53f5becbf63b82209e4d977283c4222aa09 100644 --- a/Control/AthViews/src_dflow/DFlowAlg1.h +++ b/Control/AthViews/src_dflow/DFlowAlg1.h @@ -15,16 +15,14 @@ #include <string> // FrameWork includes -#include "AthViews/AthViewAlgorithm.h" -#include "SGTools/BuiltinsClids.h" -#include "StoreGate/ReadHandle.h" -#include "StoreGate/WriteHandle.h" -#include "AthViews/View.h" +#include "AthenaBaseComps/AthAlgorithm.h" +#include "StoreGate/ReadHandleKey.h" +#include "StoreGate/WriteHandleKey.h" namespace AthViews { class DFlowAlg1 - : public ::AthViewAlgorithm + : public ::AthAlgorithm { /////////////////////////////////////////////////////////////////// @@ -67,8 +65,8 @@ class DFlowAlg1 /// Containers // vars - SG::ReadHandle<int> m_r_int; - SG::WriteHandle<int> m_w_int; + SG::ReadHandleKey<int> m_r_int; + SG::WriteHandleKey<int> m_w_int; }; diff --git a/Control/AthViews/src_dflow/DFlowAlg2.cxx b/Control/AthViews/src_dflow/DFlowAlg2.cxx index de203fe09ce6e103a6fd04d67194fd52b13f041c..c90c9214798612df756de86fd47119c0dd2aec9f 100644 --- a/Control/AthViews/src_dflow/DFlowAlg2.cxx +++ b/Control/AthViews/src_dflow/DFlowAlg2.cxx @@ -17,7 +17,8 @@ // FrameWork includes #include "GaudiKernel/Property.h" #include "CxxUtils/make_unique.h" -#include "AthViews/View.h" +#include "StoreGate/ReadHandle.h" +#include "StoreGate/WriteHandle.h" namespace AthViews { @@ -29,9 +30,8 @@ namespace AthViews { //////////////// DFlowAlg2::DFlowAlg2( const std::string& name, ISvcLocator* pSvcLocator ) : - ::AthViewAlgorithm( name, pSvcLocator ), + ::AthAlgorithm( name, pSvcLocator ), m_r_int( "dflow_int" ), - //m_rw_int( "dflow_int" ), m_ints( "dflow_ints" ) { // @@ -41,8 +41,6 @@ DFlowAlg2::DFlowAlg2( const std::string& name, declareProperty( "RIntFlow", m_r_int, "Data flow of int" ); - /*declareProperty( "RWIntFlow", m_rw_int, "Data flow of int" );*/ - declareProperty( "IntsFlow", m_ints, "Data flow of integers" ); } @@ -57,6 +55,9 @@ StatusCode DFlowAlg2::initialize() { ATH_MSG_INFO ("Initializing " << name() << "..."); + CHECK( m_r_int.initialize() ); + CHECK( m_ints.initialize() ); + return StatusCode::SUCCESS; } @@ -71,41 +72,39 @@ StatusCode DFlowAlg2::execute() { ATH_MSG_DEBUG ("Executing " << name() << "..."); +#ifdef GAUDI_SYSEXECUTE_WITHCONTEXT + const EventContext& ctx = getContext(); +#else + const EventContext& ctx = *getContext(); +#endif + + SG::ReadHandle< int > inputHandle( m_r_int, ctx ); ATH_MSG_INFO("================================"); ATH_MSG_INFO("myint r-handle..."); - ATH_MSG_INFO("name: [" << m_r_int.name() << "]"); - ATH_MSG_INFO("store [" << m_r_int.store() << "]"); - ATH_MSG_INFO("clid: [" << m_r_int.clid() << "]"); + ATH_MSG_INFO("name: [" << inputHandle.name() << "]"); + ATH_MSG_INFO("store [" << inputHandle.store() << "]"); + ATH_MSG_INFO("clid: [" << inputHandle.clid() << "]"); - ATH_MSG_INFO("ptr: " << m_r_int.cptr()); - if (m_r_int.isValid()) { - ATH_MSG_INFO("val: " << *(m_r_int.cptr())); + ATH_MSG_INFO("ptr: " << inputHandle.cptr()); + if ( inputHandle.isValid() ) + { + ATH_MSG_INFO("val: " << *( inputHandle.cptr() ) ); } - //UpdateHandles have changed - /*ATH_MSG_INFO("myint rw-handle..."); - ATH_MSG_INFO("name: [" << m_rw_int.name() << "]"); - ATH_MSG_INFO("store [" << m_rw_int.store() << "]"); - ATH_MSG_INFO("clid: [" << m_rw_int.clid() << "]"); - ATH_MSG_INFO("ptr: " << m_rw_int.ptr()); - if (m_rw_int.isValid()) - { - ATH_MSG_INFO("val: " << *(m_rw_int.cptr())); - *m_rw_int += 100; + SG::WriteHandle< std::vector< int > > outputHandle( m_ints, ctx ); + ATH_MSG_INFO("ints w-handle..."); + outputHandle.record( CxxUtils::make_unique< std::vector< int > >() ); + outputHandle->push_back( 10 ); - ATH_MSG_INFO("val: " << *m_rw_int); + if ( inputHandle.isValid() ) + { + outputHandle->push_back( *inputHandle ); } - ATH_MSG_INFO("cptr: " << m_rw_int.cptr());*/ - ATH_MSG_INFO("ints w-handle..."); - m_ints.record( CxxUtils::make_unique< std::vector< int > >() ); - m_ints->push_back( 10 ); - //would be nice if it worked... if (0 != m_r_int) m_ints->push_back(*m_r_int); - if ( m_r_int.isValid() ) m_ints->push_back( *m_r_int ); - ATH_MSG_INFO( "size:" << m_ints->size() ); - for ( int i = 0, imax = m_ints->size(); i != imax; ++i ) + ATH_MSG_INFO( "size:" << outputHandle->size() ); + for ( int i = 0, imax = outputHandle->size(); i != imax; ++i ) { - ATH_MSG_INFO( "val[" << i << "]= " << m_ints->at( i ) ); + ATH_MSG_INFO( "val[" << i << "]= " << outputHandle->at( i ) ); } return StatusCode::SUCCESS; diff --git a/Control/AthViews/src_dflow/DFlowAlg2.h b/Control/AthViews/src_dflow/DFlowAlg2.h index f54939b6216a1689cf254ee063236ad48600f066..941270c35451006e5fb857fdc052a771138c9d55 100644 --- a/Control/AthViews/src_dflow/DFlowAlg2.h +++ b/Control/AthViews/src_dflow/DFlowAlg2.h @@ -15,16 +15,14 @@ #include <string> // FrameWork includes -#include "AthViews/AthViewAlgorithm.h" -#include "StoreGate/ReadHandle.h" -#include "StoreGate/WriteHandle.h" -#include "StoreGate/UpdateHandle.h" -#include "AthViews/View.h" +#include "AthenaBaseComps/AthAlgorithm.h" +#include "StoreGate/ReadHandleKey.h" +#include "StoreGate/WriteHandleKey.h" namespace AthViews { class DFlowAlg2 - : public ::AthViewAlgorithm + : public ::AthAlgorithm { /////////////////////////////////////////////////////////////////// @@ -67,9 +65,8 @@ class DFlowAlg2 /// Containers // vars - SG::ReadHandle<int> m_r_int; - //SG::UpdateHandle<int> m_rw_int; - SG::WriteHandle<std::vector<int> > m_ints; + SG::ReadHandleKey<int> m_r_int; + SG::WriteHandleKey<std::vector<int> > m_ints; }; diff --git a/Control/AthViews/src_dflow/DFlowAlg3.cxx b/Control/AthViews/src_dflow/DFlowAlg3.cxx index dbce9eb7701a3dc5e80988fea90747d5d393e31d..899547cf97721983cb8bfd717c5afa8bec6262a8 100644 --- a/Control/AthViews/src_dflow/DFlowAlg3.cxx +++ b/Control/AthViews/src_dflow/DFlowAlg3.cxx @@ -16,9 +16,9 @@ // FrameWork includes #include "GaudiKernel/Property.h" -#include "AthViews/View.h" - #include "CxxUtils/make_unique.h" +#include "StoreGate/ReadHandleKey.h" +#include "StoreGate/WriteHandleKey.h" namespace AthViews { @@ -30,10 +30,9 @@ namespace AthViews { //////////////// DFlowAlg3::DFlowAlg3( const std::string& name, ISvcLocator* pSvcLocator ) : - ::AthViewAlgorithm( name, pSvcLocator ), + ::AthAlgorithm( name, pSvcLocator ), m_r_int( "dflow_int" ), m_r_ints( "dflow_ints" ), - //m_rw_ints( "dflow_ints" ), m_w_dflowDummy( "dflow_dummy" ) { // @@ -46,8 +45,6 @@ DFlowAlg3::DFlowAlg3( const std::string& name, declareProperty( "RIntsFlow", m_r_ints, "Data flow of integers (read)" ); - /*declareProperty( "RWIntsFlow", m_rw_ints, "Data flow of integers (r/w)" );*/ - declareProperty( "DFlowDummy", m_w_dflowDummy, "Dummy object to fix dependencies" ); } @@ -63,6 +60,10 @@ StatusCode DFlowAlg3::initialize() { ATH_MSG_INFO ("Initializing " << name() << "..."); + CHECK( m_r_int.initialize() ); + CHECK( m_r_ints.initialize() ); + CHECK( m_w_dflowDummy.initialize() ); + return StatusCode::SUCCESS; } @@ -83,68 +84,37 @@ StatusCode DFlowAlg3::execute() const EventContext& ctx = *getContext(); #endif + SG::ReadHandle< int > inputScalarHandle( m_r_int, ctx ); ATH_MSG_INFO("================================"); ATH_MSG_INFO("myint r-handle..."); - ATH_MSG_INFO("name: [" << m_r_int.name() << "]"); - ATH_MSG_INFO("store [" << m_r_int.store() << "]"); - ATH_MSG_INFO("clid: [" << m_r_int.clid() << "]"); + ATH_MSG_INFO("name: [" << inputScalarHandle.name() << "]"); + ATH_MSG_INFO("store [" << inputScalarHandle.store() << "]"); + ATH_MSG_INFO("clid: [" << inputScalarHandle.clid() << "]"); - ATH_MSG_INFO("ptr: " << m_r_int.cptr()); - if (m_r_int.isValid()) { - ATH_MSG_INFO("val: " << *(m_r_int.cptr())); + ATH_MSG_INFO("ptr: " << inputScalarHandle.cptr()); + if ( inputScalarHandle.isValid() ) + { + ATH_MSG_INFO( "val: " << *( inputScalarHandle.cptr() ) ); } + SG::ReadHandle< std::vector< int > > inputVectorHandle( m_r_ints, ctx ); ATH_MSG_INFO("ints r-handle..."); - ATH_MSG_INFO("name: [" << m_r_ints.name() << "]"); - ATH_MSG_INFO("store [" << m_r_ints.store() << "]"); - ATH_MSG_INFO("clid: [" << m_r_ints.clid() << "]"); - - ATH_MSG_INFO( "cptr: " << m_r_ints.cptr() ); - - //UpdateHandles have changed - /*ATH_MSG_INFO("ints rw-handle..."); - m_rw_ints->push_back(10); - if (m_r_int.isValid()) - { - m_rw_ints->push_back(*m_r_int); - } - ATH_MSG_INFO("size:" << m_rw_ints->size()); - for ( int i = 0, imax = m_rw_ints->size(); i != imax; ++i ) - { - ATH_MSG_INFO( "val[" << i << "]= " << m_rw_ints->at( i ) ); - }*/ + ATH_MSG_INFO("name: [" << inputVectorHandle.name() << "]"); + ATH_MSG_INFO("store [" << inputVectorHandle.store() << "]"); + ATH_MSG_INFO("clid: [" << inputVectorHandle.clid() << "]"); + ATH_MSG_INFO("cptr: " << inputVectorHandle.cptr()); - // try to modify 'ints' via ReadHadnle<> + // try to modify 'ints' via ReadHandle<> // shouldn't compile #ifdef TRY_COMPILATION_ERRORS - m_r_ints->push_back(666); + inputVectorHandle->push_back(666); #endif // create a temporary r-handle - SG::ReadHandle<std::vector<int> > ints(m_r_ints.name()); - StatusCode sc = ints.setProxyDict( eventView(ctx) ); + SG::ReadHandle< std::vector<int> > ints( inputVectorHandle.name() ); + StatusCode sc = ints.setProxyDict( ctx.proxy() ); if ( !sc.isSuccess() ) ATH_MSG_INFO( "Failed to load view " ); - ATH_MSG_INFO("temporary r-handle[ints] - size: " << ints->size()); - /*ATH_MSG_INFO("compare pointers: ok=" << (ints.ptr() == m_r_ints.ptr())); - ATH_MSG_INFO("compare pointers: ok=" << (ints.ptr() == m_rw_ints.ptr())); - - // test that modification thru one handle is seen thru the other one - std::vector<int> save = *m_rw_ints; - m_rw_ints = std::vector<int>(); - ATH_MSG_INFO("temporary r-handle[ints] - size: " << ints->size()); - if (m_r_int.isValid()) { - ATH_MSG_INFO("data mbr r-handle[ints] - size: " << m_r_ints->size()); - } - ATH_MSG_INFO("data mbr rw-handle[ints] - size: " << m_rw_ints->size()); - - ATH_MSG_INFO("--restore--"); - m_rw_ints = save; - ATH_MSG_INFO("temporary r-handle[ints] - size: " << ints->size()); - if (m_r_int.isValid()) { - ATH_MSG_INFO("data mbr r-handle[ints] - size: " << m_r_ints->size()); - } - ATH_MSG_INFO("data mbr rw-handle[ints] - size: " << m_rw_ints->size());*/ - + ATH_MSG_INFO( "temporary r-handle[ints] - size: " << ints->size() ); // test that inexistant proxies are correctly detected ATH_MSG_INFO("-- testing inexistant proxies --"); @@ -166,66 +136,11 @@ StatusCode DFlowAlg3::execute() return StatusCode::FAILURE; } } - { - SG::UpdateHandle<int> o("--rw-not-there--"); - ATH_MSG_INFO("name: " << o.name()); - ATH_MSG_INFO("valid:" << o.isValid()); - if (o.isValid()) { - ATH_MSG_ERROR("should NOT be valid ! [line " << __LINE__ << "]" ); - return StatusCode::FAILURE; - } - } - - // - if (m_r_int.isValid()) { - SG::UpdateHandle<int> rw_int(m_r_int.name()); - if (rw_int.isValid()) { - ATH_MSG_INFO("temporary r/w-int: " << *rw_int); - } - m_r_int.setConst(); - if (!m_r_int.isConst()) { - ATH_MSG_ERROR("ReadHandle<int>@[" << m_r_int.name() << "] should be CONST !"); - return StatusCode::FAILURE; - } - //now we can't put it into an update handle anymore - SG::UpdateHandle<int> rw_const_int(m_r_int.name()); - if (rw_const_int.isValid()) { - ATH_MSG_ERROR("UpdateHandle<int>@[" << m_r_int.name() << "] should not be allowed to refer to a const value !"); - return StatusCode::FAILURE; - } - - } // test WVar<T> semantics ATH_MSG_INFO("-- testing WVar<T> semantics..."); { - SG::WriteHandle<int> o(m_r_int.name()); - ATH_MSG_INFO("name: " << o.name()); - ATH_MSG_INFO("valid:" << o.isValid()); - if (o.isValid()) { - ATH_MSG_ERROR("should NOT be valid ! [line " << __LINE__ << "]" ); - return StatusCode::FAILURE; - } - try { - *o = 42; - if (o.isValid()) { - ATH_MSG_ERROR("should NOT be valid ! [line " << __LINE__ << "]" ); - return StatusCode::FAILURE; - } - } catch (std::exception &err) { - ATH_MSG_INFO("good, caught: [" << err.what() << "]"); - } - ATH_MSG_INFO("valid:" << o.isValid()); - if (o.isValid()) { - ATH_MSG_ERROR("should NOT be valid ! [line " << __LINE__ << "]" ); - return StatusCode::FAILURE; - } - } - - // test RWVar<T> semantics - ATH_MSG_INFO("-- testing RWVar<T> semantics..."); - { - SG::UpdateHandle<int> o(m_r_int.name()); + SG::WriteHandle<int> o( inputScalarHandle.name() ); ATH_MSG_INFO("name: " << o.name()); ATH_MSG_INFO("valid:" << o.isValid()); if (o.isValid()) { @@ -249,7 +164,8 @@ StatusCode DFlowAlg3::execute() } //Dummy object to fix the data flow - m_w_dflowDummy.record( CxxUtils::make_unique<int>(1) ); + SG::WriteHandle< int > outputHandle( m_w_dflowDummy, ctx ); + outputHandle.record( CxxUtils::make_unique<int>(1) ); return StatusCode::SUCCESS; } diff --git a/Control/AthViews/src_dflow/DFlowAlg3.h b/Control/AthViews/src_dflow/DFlowAlg3.h index 33d4e92427dc38a1984672f816dbb5af6a592534..a5841cbd5784ae35840f8cea9e587d348a3ec760 100644 --- a/Control/AthViews/src_dflow/DFlowAlg3.h +++ b/Control/AthViews/src_dflow/DFlowAlg3.h @@ -15,15 +15,14 @@ #include <string> // FrameWork includes -#include "AthViews/AthViewAlgorithm.h" -#include "StoreGate/ReadHandle.h" -#include "StoreGate/UpdateHandle.h" -#include "AthViews/View.h" +#include "AthenaBaseComps/AthAlgorithm.h" +#include "StoreGate/ReadHandleKey.h" +#include "StoreGate/WriteHandleKey.h" namespace AthViews { class DFlowAlg3 - : public ::AthViewAlgorithm + : public ::AthAlgorithm { /////////////////////////////////////////////////////////////////// @@ -66,10 +65,9 @@ class DFlowAlg3 /// Containers // vars - SG::ReadHandle<int> m_r_int; - SG::ReadHandle<std::vector<int> > m_r_ints; - //SG::UpdateHandle<std::vector<int> > m_rw_ints; - SG::WriteHandle<int> m_w_dflowDummy; + SG::ReadHandleKey<int> m_r_int; + SG::ReadHandleKey<std::vector<int> > m_r_ints; + SG::WriteHandleKey<int> m_w_dflowDummy; }; diff --git a/Control/AthViews/src_dflow/ViewMergeAlg.cxx b/Control/AthViews/src_dflow/ViewMergeAlg.cxx index f363ecb8daf95282cd0af1f91ef7ce1ebffb1abe..4d347b16361439903b826e672bbf880e464151c0 100644 --- a/Control/AthViews/src_dflow/ViewMergeAlg.cxx +++ b/Control/AthViews/src_dflow/ViewMergeAlg.cxx @@ -10,7 +10,8 @@ // FrameWork includes #include "GaudiKernel/Property.h" - +#include "StoreGate/ReadHandle.h" +#include "StoreGate/WriteHandle.h" #include "CxxUtils/make_unique.h" namespace AthViews { @@ -24,7 +25,7 @@ namespace AthViews { ViewMergeAlg::ViewMergeAlg( const std::string& name, ISvcLocator* pSvcLocator ) : ::AthAlgorithm( name, pSvcLocator ), - m_w_ints( "dflow_ints" ), + m_w_ints( "mergedOutput" ), m_r_ints( "dflow_ints" ), m_r_views( "all_views" ) { @@ -43,11 +44,7 @@ ViewMergeAlg::ViewMergeAlg( const std::string& name, // Destructor /////////////// ViewMergeAlg::~ViewMergeAlg() -{ - //m_r_ints.reset(); - //m_w_ints.reset(); - //m_r_views.reset(); -} +{} // Athena Algorithm's Hooks //////////////////////////// @@ -55,6 +52,10 @@ StatusCode ViewMergeAlg::initialize() { ATH_MSG_INFO ("Initializing " << name() << "..."); + CHECK( m_r_ints.initialize() ); + CHECK( m_w_ints.initialize() ); + CHECK( m_r_views.initialize() ); + return StatusCode::SUCCESS; } @@ -69,18 +70,28 @@ StatusCode ViewMergeAlg::execute() { ATH_MSG_DEBUG ("Executing " << name() << "..."); +#ifdef GAUDI_SYSEXECUTE_WITHCONTEXT + const EventContext& ctx = getContext(); +#else + const EventContext& ctx = *getContext(); +#endif + //Merge results std::vector< int > outputVector; - CHECK( ViewHelper::MergeViewCollection( *m_r_views, //Vector of views (inside ReadHandle) - m_r_ints, //ReadHandle to access the views (the handle itself) + SG::ReadHandle< std::vector< int > > inputHandle( m_r_ints, ctx ); + SG::ReadHandle< std::vector< SG::View* > > inputViews( m_r_views, ctx ); + CHECK( ViewHelper::MergeViewCollection( *inputViews, //Vector of views (inside ReadHandle) + inputHandle, //ReadHandle to access the views (the handle itself) outputVector ) ); //Container to merge results into //Output the merged data - if ( !m_w_ints.setProxyDict( 0 ).isSuccess() ) + SG::WriteHandle< std::vector< int > > outputHandle( m_w_ints, ctx ); + outputHandle.record( CxxUtils::make_unique< std::vector< int > >( outputVector ) ); + if ( !outputHandle.isValid() ) { - ATH_MSG_INFO( "Unable to load main event store" ); + ATH_MSG_INFO( "Unable to load main event store for output" ); } - m_w_ints = CxxUtils::make_unique< std::vector< int > >( outputVector ); + for ( int const test : outputVector ) { ATH_MSG_INFO( test ); diff --git a/Control/AthViews/src_dflow/ViewMergeAlg.h b/Control/AthViews/src_dflow/ViewMergeAlg.h index 0d435de09a89fbadedb69be3b9647652c2e25a0f..03981d45cc8c356e85b7c87eec2788e197312d2e 100644 --- a/Control/AthViews/src_dflow/ViewMergeAlg.h +++ b/Control/AthViews/src_dflow/ViewMergeAlg.h @@ -7,12 +7,12 @@ // STL includes #include <string> +#include <vector> // FrameWork includes -#include "AthViews/AthViewAlgorithm.h" -#include "SGTools/BuiltinsClids.h" -#include "StoreGate/ReadHandle.h" -#include "StoreGate/WriteHandle.h" +#include "AthenaBaseComps/AthAlgorithm.h" +#include "StoreGate/ReadHandleKey.h" +#include "StoreGate/WriteHandleKey.h" #include "AthViews/View.h" namespace AthViews { @@ -58,9 +58,9 @@ class ViewMergeAlg /// Containers // vars - SG::WriteHandle< std::vector<int> > m_w_ints; - SG::ReadHandle< std::vector<int> > m_r_ints; - SG::ReadHandle< std::vector< SG::View* > > m_r_views; + SG::WriteHandleKey< std::vector<int> > m_w_ints; + SG::ReadHandleKey< std::vector<int> > m_r_ints; + SG::ReadHandleKey< std::vector< SG::View* > > m_r_views; }; // I/O operators diff --git a/Control/AthViews/src_dflow/ViewSubgraphAlg.cxx b/Control/AthViews/src_dflow/ViewSubgraphAlg.cxx index 31cceb019900f2793925d45a0848ce6a63336162..3a1fdc8cb6ede656307626794fec6492a752b0fa 100644 --- a/Control/AthViews/src_dflow/ViewSubgraphAlg.cxx +++ b/Control/AthViews/src_dflow/ViewSubgraphAlg.cxx @@ -8,8 +8,8 @@ // STL includes // FrameWork includes -//#include "GaudiKernel/Property.h" - +#include "GaudiKernel/Property.h" +#include "StoreGate/WriteHandle.h" #include "CxxUtils/make_unique.h" namespace AthViews { @@ -25,7 +25,6 @@ ViewSubgraphAlg::ViewSubgraphAlg( const std::string& name, ::AthAlgorithm( name, pSvcLocator ), m_w_views( "all_views" ), m_w_int( "view_start" ), - m_w_allViewsDone( "all_views_done_dflow" ), m_algorithmNameSequence( std::vector< std::string >() ), m_algPoolName( "" ), m_viewBaseName( "" ), @@ -37,8 +36,6 @@ ViewSubgraphAlg::ViewSubgraphAlg( const std::string& name, declareProperty( "ViewStart", m_w_int, "A number to start off the view" ); - declareProperty( "AllViewsDone", m_w_allViewsDone, "Data flow to indicate that all views have been completed" ); - declareProperty( "AllViews", m_w_views, "All views" ); declareProperty( "ViewBaseName", m_viewBaseName, "Name to use for all views - number will be appended" ); @@ -62,6 +59,9 @@ StatusCode ViewSubgraphAlg::initialize() { ATH_MSG_INFO ("Initializing " << name() << "..."); + CHECK( m_w_int.initialize() ); + CHECK( m_w_views.initialize() ); + return StatusCode::SUCCESS; } @@ -76,9 +76,6 @@ StatusCode ViewSubgraphAlg::execute() { ATH_MSG_DEBUG ("Executing " << name() << "..."); - //Create the container of views - m_w_views.record( CxxUtils::make_unique< std::vector< SG::View* > >() ); - #ifdef GAUDI_SYSEXECUTE_WITHCONTEXT const EventContext& ctx = getContext(); #else @@ -87,27 +84,28 @@ StatusCode ViewSubgraphAlg::execute() //Make a vector of dummy data to initialise the views std::vector<int> viewData; + std::vector< SG::View* > viewVector; for ( int viewIndex = 0; viewIndex < m_viewNumber; ++viewIndex ) { viewData.push_back( ( viewIndex * 10 ) + 10 + ctx.evt() ); } //Create the views and populate them + SG::WriteHandle< int > viewStartHandle( m_w_int, ctx ); CHECK( ViewHelper::MakeAndPopulate( m_viewBaseName, //Base name for all views to use - *m_w_views, //Vector to store views (within writehandle) - m_w_int, //A writehandle to use to access the views (the handle itself, not the contents) + viewVector, //Vector to store views + viewStartHandle,//A writehandle to use to access the views (the handle itself, not the contents) viewData ) ); //Data to initialise each view - one view will be made per entry - //Specify algorithms to run in views (data flow info not available yet) - //std::vector< std::string > algorithmNameSequence = { "dflow_alg1", "dflow_alg2", "dflow_alg3" }; - - CHECK( ViewHelper::RunViews( *m_w_views, //View vector + //Run the algorithms in views + CHECK( ViewHelper::RunViews( viewVector, //View vector m_algorithmNameSequence, //Algorithms to run in each view - ctx, //Context to attach the views to + ctx, //Context to attach the views to serviceLocator()->service( m_algPoolName ) ) ); //Service to retrieve algorithms by name - //Make a dummy output to organise data flow - m_w_allViewsDone.record( CxxUtils::make_unique<int>( 1 ) ); + //Store the collection of views + SG::WriteHandle< std::vector< SG::View* > > outputViewHandle( m_w_views, ctx ); + outputViewHandle.record( CxxUtils::make_unique< std::vector< SG::View* > >( viewVector ) ); return StatusCode::SUCCESS; } diff --git a/Control/AthViews/src_dflow/ViewSubgraphAlg.h b/Control/AthViews/src_dflow/ViewSubgraphAlg.h index 15b06e92d2c124d1910a5cad4c04e75f448747f4..d860b098c68c09719194b14a9718bbc49f0d4804 100644 --- a/Control/AthViews/src_dflow/ViewSubgraphAlg.h +++ b/Control/AthViews/src_dflow/ViewSubgraphAlg.h @@ -11,9 +11,8 @@ // FrameWork includes #include "AthenaBaseComps/AthAlgorithm.h" -#include "SGTools/BuiltinsClids.h" #include "AthViews/View.h" -#include "StoreGate/WriteHandle.h" +#include "StoreGate/WriteHandleKey.h" namespace AthViews { @@ -58,9 +57,8 @@ class ViewSubgraphAlg /// Containers // vars - SG::WriteHandle< std::vector< SG::View* > > m_w_views; - SG::WriteHandle<int> m_w_int; - SG::WriteHandle<int> m_w_allViewsDone; + SG::WriteHandleKey< std::vector< SG::View* > > m_w_views; + SG::WriteHandleKey<int> m_w_int; std::vector< std::string > m_algorithmNameSequence; std::string m_algPoolName; std::string m_viewBaseName; diff --git a/Control/AthenaServices/src/AthenaHiveEventLoopMgr.cxx b/Control/AthenaServices/src/AthenaHiveEventLoopMgr.cxx index 01d0ea4ad8a0293919ebd9d4e399763ea428dcb5..fe70994e5dfb9f78071d9ac0ce6686e0f2823aa7 100644 --- a/Control/AthenaServices/src/AthenaHiveEventLoopMgr.cxx +++ b/Control/AthenaServices/src/AthenaHiveEventLoopMgr.cxx @@ -729,9 +729,9 @@ StatusCode AthenaHiveEventLoopMgr::executeEvent(void* createdEvts_IntPtr ) // Now add event to the scheduler - info() << "Adding event " << evtContext->evt() - << ", slot " << evtContext->slot() - << " to the scheduler" << endmsg; + debug() << "Adding event " << evtContext->evt() + << ", slot " << evtContext->slot() + << " to the scheduler" << endmsg; m_incidentSvc->fireIncident(Incident(name(), IncidentType::BeginProcessing, *evtContext)); @@ -1253,9 +1253,9 @@ AthenaHiveEventLoopMgr::drainScheduler(int& finishedEvts){ // *thisFinishedEvtContext )); - info() << "Clearing slot " << thisFinishedEvtContext->slot() - << " (event " << thisFinishedEvtContext->evt() - << ") of the whiteboard" << endmsg; + debug() << "Clearing slot " << thisFinishedEvtContext->slot() + << " (event " << thisFinishedEvtContext->evt() + << ") of the whiteboard" << endmsg; StatusCode sc = clearWBSlot(thisFinishedEvtContext->slot()); if (!sc.isSuccess()) { diff --git a/Control/CxxUtils/CxxUtils/checker_macros.h b/Control/CxxUtils/CxxUtils/checker_macros.h index 03db1db6660e3b8d2ed612975928be262e68d69f..63e2c52933766e1e1f22b2680c66aa7142095304 100644 --- a/Control/CxxUtils/CxxUtils/checker_macros.h +++ b/Control/CxxUtils/CxxUtils/checker_macros.h @@ -53,6 +53,33 @@ #ifdef ATLAS_GCC_CHECKERS +/** + * @brief Include this at the start of a file to enable thread-safety + * checking for everything in a file: + * + *@code + * ATLAS_CHECK_FILE_THREAD_SAFETY; + @endcode +*/ +#define ATLAS_CHECK_FILE_THREAD_SAFETY _Pragma ("ATLAS check_thread_safety") \ + class ATLAS_CHECK_FILE_THREAD_SAFETY_SWALLOW_SEMICOLON + + +/** + * @brief Include this at the start of a file to disable thread-safety + * checking for everything in a file: + * + *@code + * ATLAS_NO_CHECK_FILE_THREAD_SAFETY; + @endcode + * + * This can be used to disable checking for specific files when checking + * has been enabled on a per-package basis. + */ +#define ATLAS_NO_CHECK_FILE_THREAD_SAFETY _Pragma ("ATLAS no_check_thread_safety") \ + class ATLAS_CHECK_FILE_THREAD_SAFETY_SWALLOW_SEMICOLON + + /** * @brief Request thread-safety checking of a function/class. * @@ -162,6 +189,8 @@ #else // not ATLAS_GCC_CHECKERS +#define ATLAS_CHECK_FILE_THREAD_SAFETY class ATLAS_CHECK_FILE_THREAD_SAFETY_SWALLOW_SEMICOLON +#define ATLAS_NO_CHECK_FILE_THREAD_SAFETY class ATLAS_CHECK_FILE_THREAD_SAFETY_SWALLOW_SEMICOLON #define ATLAS_CHECK_THREAD_SAFETY #define ATLAS_THREAD_SAFE #define ATLAS_NOT_THREAD_SAFE diff --git a/Control/StoreGate/StoreGate/tools/SGImplSvc.h b/Control/StoreGate/StoreGate/tools/SGImplSvc.h index f00d41797082e6157a781726f7c0fbac44f82bba..2a865512dcfae7fa0644515127f5740d2ee020fe 100644 --- a/Control/StoreGate/StoreGate/tools/SGImplSvc.h +++ b/Control/StoreGate/StoreGate/tools/SGImplSvc.h @@ -1106,6 +1106,7 @@ private: typedef std::recursive_mutex mutex_t; typedef std::lock_guard<mutex_t> lock_t; mutable mutex_t m_mutex; + mutable mutex_t m_remapMutex; public: diff --git a/Control/StoreGate/src/SGImplSvc.cxx b/Control/StoreGate/src/SGImplSvc.cxx index 400784d87bd3f17ed90d4f89cfd5c6c817a43d37..9e40f13ff1cf4d9d206aa2c058223f8cdf9b7f33 100644 --- a/Control/StoreGate/src/SGImplSvc.cxx +++ b/Control/StoreGate/src/SGImplSvc.cxx @@ -382,19 +382,24 @@ string SGImplSvc::createKey(const CLID& id) // clear store StatusCode SGImplSvc::clearStore(bool forceRemove) { - lock_t lock (m_mutex); - emptyTrash(); - for (auto& p : m_newBoundHandles) - p.second.clear(); - assert(m_pStore); - MsgStream* pmlog( msgLvl(MSG::VERBOSE) ? &msg() : 0); - msg() << MSG::DEBUG << "Clearing store with forceRemove=" - << forceRemove << endmsg; - bool hard_reset = (m_numSlots > 1); - m_pStore->clearStore(forceRemove, hard_reset, pmlog); - m_storeLoaded=false; //FIXME hack needed by loadEventProxies - m_remap_impl->m_remaps.clear(); - m_arena.reset(); + { + lock_t lock (m_mutex); + emptyTrash(); + for (auto& p : m_newBoundHandles) + p.second.clear(); + assert(m_pStore); + MsgStream* pmlog( msgLvl(MSG::VERBOSE) ? &msg() : 0); + msg() << MSG::DEBUG << "Clearing store with forceRemove=" + << forceRemove << endmsg; + bool hard_reset = (m_numSlots > 1); + m_pStore->clearStore(forceRemove, hard_reset, pmlog); + m_storeLoaded=false; //FIXME hack needed by loadEventProxies + } + { + lock_t remap_lock (m_remapMutex); + m_remap_impl->m_remaps.clear(); + m_arena.reset(); + } return StatusCode::SUCCESS; } @@ -1462,7 +1467,7 @@ void SGImplSvc::remap_impl (sgkey_t source, sgkey_t target, off_t index_offset) { - lock_t lock (m_mutex); + lock_t lock (m_remapMutex); SG::RemapImpl::remap_t payload; payload.target = target; payload.index_offset = index_offset; @@ -1481,7 +1486,7 @@ void SGImplSvc::remap_impl (sgkey_t source, bool SGImplSvc::tryELRemap (sgkey_t sgkey_in, size_t index_in, sgkey_t& sgkey_out, size_t& index_out) { - lock_t lock (m_mutex); + lock_t lock (m_remapMutex); SG::RemapImpl::remap_map_t::iterator i = m_remap_impl->m_remaps.find (sgkey_in); if (i == m_remap_impl->m_remaps.end()) diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/MuonTGC_CnvTools/ITGC_RDO_Decoder.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/MuonTGC_CnvTools/ITGC_RDO_Decoder.h old mode 100755 new mode 100644 diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/MuonTGC_CnvTools/ITGC_RDOtoByteStreamTool.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/MuonTGC_CnvTools/ITGC_RDOtoByteStreamTool.h old mode 100755 new mode 100644 diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/MuonTGC_CnvTools/ITgcPrepDataReplicationTool.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/MuonTGC_CnvTools/ITgcPrepDataReplicationTool.h old mode 100755 new mode 100644 diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_Hid2RESrcID.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_Hid2RESrcID.cxx old mode 100755 new mode 100644 diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_Hid2RESrcID.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_Hid2RESrcID.h old mode 100755 new mode 100644 diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RodDecoderRawdata.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RodDecoderRawdata.cxx old mode 100755 new mode 100644 diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RodDecoderRawdata.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TGC_RodDecoderRawdata.h old mode 100755 new mode 100644 diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcByteStream.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcByteStream.cxx old mode 100755 new mode 100644 diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcByteStream.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcByteStream.h old mode 100755 new mode 100644 diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcByteStreamData.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcByteStreamData.h old mode 100755 new mode 100644 diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.cxx index c10de4789c8eaff5e261e30b7a7d2075e9c2337f..69c7b35132af54bc101c5e2176c7f2398c0c7798 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.cxx @@ -253,7 +253,7 @@ Muon::TgcPrepDataReplicationTool::makeTgcPrepData(Muon::TgcPrepDataCollection::c { Identifier channelId = (*itr)->identify(); IdentifierHash tgcHashId = (*itr)->collectionHash(); - std::vector<Identifier> identifierList = (*itr)->rdoList(); + const std::vector<Identifier> &identifierList = (*itr)->rdoList(); const Amg::MatrixX* errHitPos = &(*itr)->localCovariance(); const MuonGM::TgcReadoutElement* descriptor = (*itr)->detectorElement(); diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool.h old mode 100755 new mode 100644 diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ba6b7f97982fbaf1835b32e0cf2dad20544e3b50 --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.cxx @@ -0,0 +1,150 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +//////////////////////////////////////////////////////////////////////////////// +// TgcPrepDataReplicationTool.cxx, (c) ATLAS Detector software +//////////////////////////////////////////////////////////////////////////////// + +#include "TgcPrepDataReplicationTool3BCtoAllBC.h" +#include "TgcPrepDataReplicationToolAllBCto3BC.h" +#include "MuonReadoutGeometry/MuonDetectorManager.h" +#include "MuonCnvToolInterfaces/IDC_Helper.h" + +#include "MuonDigitContainer/TgcDigit.h" +#include "EventPrimitives/EventPrimitives.h" + +//================ Constructor ================================================= +Muon::TgcPrepDataReplicationTool3BCtoAllBC::TgcPrepDataReplicationTool3BCtoAllBC + (const std::string& t, const std::string& n, const IInterface* p) + : AthAlgTool(t, n, p), + m_muonMgr(0), + m_tgcHelper(0), + m_3BCKeys{"dummy", "dummy", "dummy"}, + m_AllBCKey("TGC_MeasurementsAllBCs") +{ + declareProperty("BC3Keys", m_3BCKeys); + declareProperty("AllBCKey", m_AllBCKey); +} + + +//================ Destructor ================================================== +Muon::TgcPrepDataReplicationTool3BCtoAllBC::~TgcPrepDataReplicationTool3BCtoAllBC() +{} + +//================ Initialization ============================================== +StatusCode Muon::TgcPrepDataReplicationTool3BCtoAllBC::initialize() +{ + StatusCode sc = AthAlgTool::initialize(); + if(sc.isFailure()) return sc; + + sc = detStore()->retrieve(m_muonMgr); + if(sc.isFailure()) { + ATH_MSG_FATAL("Cannot retrieve MuonDetectorManager"); + return sc; + } + + /// get tgcIdHelper from muonMgr + m_tgcHelper = m_muonMgr->tgcIdHelper(); + + for(int ibc = 0; ibc < BC_ALL; ibc++) { + std::ostringstream location; + location << "TGC_Measurements" + << (ibc == BC_PREVIOUS ? "PriorBC" : "") + << (ibc == BC_NEXT ? "NextBC" : ""); + m_3BCKeys.at(ibc) = location.str(); + } + + ATH_CHECK(m_3BCKeys.initialize()); + + + return StatusCode::SUCCESS; +} + +StatusCode Muon::TgcPrepDataReplicationTool3BCtoAllBC::replicate() +{ + return convert3BCtoAllBC(); +} + +StatusCode Muon::TgcPrepDataReplicationTool3BCtoAllBC::finalize() +{ + + return AthAlgTool::finalize(); +} + + +StatusCode Muon::TgcPrepDataReplicationTool3BCtoAllBC::convert3BCtoAllBC() +{ + + SG::WriteHandle<TgcPrepDataContainer> m_tgcPrepDataContainerAll(m_AllBCKey); + m_tgcPrepDataContainerAll = std::unique_ptr<TgcPrepDataContainer>( new TgcPrepDataContainer(m_tgcHelper->module_hash_max()) ); + + auto tgc3BCs = m_3BCKeys.makeHandles(); + + // convert + + for (int ibc = 0; ibc < BC_ALL; ibc++) { + uint16_t bcBitMap = 0; + if (ibc == BC_PREVIOUS) bcBitMap = TgcPrepData::BCBIT_PREVIOUS; + else if (ibc == BC_CURRENT) bcBitMap = TgcPrepData::BCBIT_CURRENT; + else if (ibc == BC_NEXT) bcBitMap = TgcPrepData::BCBIT_NEXT; + + + if(tgc3BCs.at(ibc).isValid()==false) { + ATH_MSG_FATAL("Cannot retrieve " << tgc3BCs.at(ibc).key()); + return StatusCode::FAILURE; + } + + Muon::TgcPrepDataContainer::const_iterator tgcItr = tgc3BCs[ibc]->begin(); + Muon::TgcPrepDataContainer::const_iterator tgcItrE = tgc3BCs[ibc]->end(); + + for (; tgcItr != tgcItrE; ++tgcItr) { + Muon::TgcPrepDataCollection::const_iterator tgcColItr = (*tgcItr)->begin(); + Muon::TgcPrepDataCollection::const_iterator tgcColItrE = (*tgcItr)->end(); + + for (; tgcColItr != tgcColItrE; ++tgcColItr) { + Identifier channelId = (*tgcColItr)->identify(); + Identifier elementId = m_tgcHelper->elementID(channelId); + + Muon::TgcPrepDataCollection* collection = Muon::IDC_Helper::getCollection<TgcPrepDataContainer, TgcIdHelper> + (elementId, m_tgcPrepDataContainerAll.ptr(), m_tgcHelper, msg()); + + bool duplicateInAllBCs = false; + TgcPrepDataCollection::iterator tgcAllItr = collection->begin(); + TgcPrepDataCollection::iterator tgcAllItrE = collection->end(); + for(; tgcAllItr != tgcAllItrE; tgcAllItr++) { + if(channelId == (*tgcAllItr)->identify()) { + duplicateInAllBCs = true; + break; + } + } + + if(duplicateInAllBCs) { + TgcPrepData *prd = *tgcAllItr; + uint16_t bcBitMap_tmp = prd->getBcBitMap(); + prd->setBcBitMap(bcBitMap_tmp | bcBitMap); + } else { + Muon::TgcPrepData* newPrepData = TgcPrepDataReplicationToolAllBCto3BC::makeTgcPrepData(tgcColItr, bcBitMap); + newPrepData->setHashAndIndex(collection->identifyHash(), collection->size()); + collection->push_back(newPrepData); + } + } + } + } + + return StatusCode::SUCCESS; +} + +StatusCode Muon::TgcPrepDataReplicationTool3BCtoAllBC::queryInterface(const InterfaceID& riid, void** ppvIf) { + ATH_MSG_DEBUG("queryInterface()"); + if(ITgcPrepDataReplicationTool::interfaceID().versionMatch(riid)) { + *ppvIf = dynamic_cast<ITgcPrepDataReplicationTool*>(this); + addRef(); + ATH_MSG_DEBUG("InterfaceID successfully matched with ITgcPrepDataReplicationTool one."); + return StatusCode::SUCCESS; + } + + return AthAlgTool::queryInterface(riid, ppvIf); +} + + diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.h new file mode 100644 index 0000000000000000000000000000000000000000..ebc24379d192c0b1fcf648b5c74796ddddc79ce7 --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationTool3BCtoAllBC.h @@ -0,0 +1,60 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// TgcPrepDataReplicationTool.h, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// +#ifndef MUONTGC_CNVTOOLS_TGCPREPDATAREPLICATIONTOOL3BCtoALLBC_H +#define MUONTGC_CNVTOOLS_TGCPREPDATAREPLICATIONTOOL3BCtoALLBC_H + +#include "AthenaBaseComps/AthAlgTool.h" +#include "MuonTGC_CnvTools/ITgcPrepDataReplicationTool.h" +#include "MuonPrepRawData/TgcPrepDataContainer.h" + +class TgcIdHelper; + +namespace MuonGM +{ + class MuonDetectorManager; +} + +namespace Muon +{ + class TgcPrepDataReplicationTool3BCtoAllBC + : virtual public ITgcPrepDataReplicationTool, virtual public AthAlgTool + { + public: + /** Constructor */ + TgcPrepDataReplicationTool3BCtoAllBC(const std::string& t, const std::string& n, const IInterface* p); + + /** Destructor */ + virtual ~TgcPrepDataReplicationTool3BCtoAllBC(); + + /** Provide InterfaceID */ + static const InterfaceID& interfaceID() { return ITgcPrepDataReplicationTool::interfaceID(); }; + + /** Query interface */ + virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvIF); + + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + virtual StatusCode replicate() override; + StatusCode convert3BCtoAllBC(); + + + private: + enum {BC_PREVIOUS=0, BC_CURRENT, BC_NEXT, BC_ALL, BC_NUM}; + + /** muon detector manager */ + const MuonGM::MuonDetectorManager * m_muonMgr; + + /** TGC identifier helper */ + const TgcIdHelper* m_tgcHelper; + + SG::ReadHandleKeyArray<TgcPrepDataContainer> m_3BCKeys; + SG::WriteHandleKey<TgcPrepDataContainer> m_AllBCKey; + }; +} // end of namespace + +#endif // MUONTGC_CNVTOOLS_TGCPREPDATAREPLICATIONTOOL3BCtoALLBC_H diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.cxx new file mode 100644 index 0000000000000000000000000000000000000000..05ca1fac8bfd9af3cf5a2bfb13fc70cd7882804d --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.cxx @@ -0,0 +1,166 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +//////////////////////////////////////////////////////////////////////////////// +// TgcPrepDataReplicationTool.cxx, (c) ATLAS Detector software +//////////////////////////////////////////////////////////////////////////////// + +#include "TgcPrepDataReplicationToolAllBCto3BC.h" + +#include "MuonReadoutGeometry/MuonDetectorManager.h" +#include "MuonCnvToolInterfaces/IDC_Helper.h" + +#include "MuonDigitContainer/TgcDigit.h" +#include "EventPrimitives/EventPrimitives.h" + + +//================ Constructor ================================================= +Muon::TgcPrepDataReplicationToolAllBCto3BC::TgcPrepDataReplicationToolAllBCto3BC + (const std::string& t, const std::string& n, const IInterface* p) + : AthAlgTool(t, n, p), + m_muonMgr(0), + m_tgcHelper(0), + m_3BCKeys{"dummy", "dummy", "dummy"}, + m_AllBCKey("TGC_MeasurementsAllBCs") +{ + declareProperty("BC3Keys", m_3BCKeys); + declareProperty("AllBCKey", m_AllBCKey); +} + + +//================ Destructor ================================================== +Muon::TgcPrepDataReplicationToolAllBCto3BC::~TgcPrepDataReplicationToolAllBCto3BC() +{} + +//================ Finalization ================================================ +StatusCode Muon::TgcPrepDataReplicationToolAllBCto3BC::finalize() +{ + + return AthAlgTool::finalize(); +} + + +//================ Initialization ============================================== +StatusCode Muon::TgcPrepDataReplicationToolAllBCto3BC::initialize() +{ + StatusCode sc = AthAlgTool::initialize(); + if(sc.isFailure()) return sc; + + sc = detStore()->retrieve(m_muonMgr); + if(sc.isFailure()) { + ATH_MSG_FATAL("Cannot retrieve MuonDetectorManager"); + return sc; + } + + /// get tgcIdHelper from muonMgr + m_tgcHelper = m_muonMgr->tgcIdHelper(); + + for(int ibc = 0; ibc < BC_ALL; ibc++) { + std::ostringstream location; + location << "TGC_Measurements" + << (ibc == BC_PREVIOUS ? "PriorBC" : "") + << (ibc == BC_NEXT ? "NextBC" : ""); + m_3BCKeys.at(ibc) = location.str(); + } + + ATH_CHECK(m_3BCKeys.initialize()); + + + return StatusCode::SUCCESS; +} + +StatusCode Muon::TgcPrepDataReplicationToolAllBCto3BC::replicate() +{ + return convertAllBCto3BC(); +} + +StatusCode Muon::TgcPrepDataReplicationToolAllBCto3BC::convertAllBCto3BC() +{ + + SG::ReadHandle<TgcPrepDataContainer> tgcAll(m_AllBCKey); + + if(!tgcAll.isValid()) { + ATH_MSG_FATAL("Cannot retrieve TGC_MeasurementsAllBCs"); + return StatusCode::FAILURE; + } + + + // convert + auto m_3BCHandles = m_3BCKeys.makeHandles(); + for (int ibc = 0; ibc < BC_ALL; ibc++){ + m_3BCHandles.at(ibc) = std::unique_ptr<TgcPrepDataContainer>( new TgcPrepDataContainer(m_tgcHelper->module_hash_max()) ); + } + + Muon::TgcPrepDataContainer::const_iterator tgcAllItr = tgcAll->begin(); + Muon::TgcPrepDataContainer::const_iterator tgcAllItrE = tgcAll->end(); + + for (; tgcAllItr != tgcAllItrE; ++tgcAllItr) { + Muon::TgcPrepDataCollection::const_iterator tgcAllColItr = (*tgcAllItr)->begin(); + Muon::TgcPrepDataCollection::const_iterator tgcAllColItrE = (*tgcAllItr)->end(); + + for (; tgcAllColItr != tgcAllColItrE; ++tgcAllColItr) { + + uint16_t bcBitMap = (*tgcAllColItr)->getBcBitMap(); + uint16_t hasBC[BC_NUM] = {0}; + if (bcBitMap & TgcPrepData::BCBIT_PREVIOUS) + hasBC[BC_PREVIOUS] = TgcPrepData::BCBIT_PREVIOUS; + if (bcBitMap & TgcPrepData::BCBIT_CURRENT) + hasBC[BC_CURRENT] = TgcPrepData::BCBIT_CURRENT; + if (bcBitMap & TgcPrepData::BCBIT_NEXT) + hasBC[BC_NEXT] = TgcPrepData::BCBIT_NEXT; + + Identifier channelId = (*tgcAllColItr)->identify(); + Identifier elementId = m_tgcHelper->elementID(channelId); + std::array<Muon::TgcPrepDataCollection*, BC_ALL> collections; + for (int ibc = 0; ibc < BC_ALL; ibc++) { + collections[ibc] = Muon::IDC_Helper::getCollection<TgcPrepDataContainer, TgcIdHelper> + (elementId, m_3BCHandles[ibc].ptr(), m_tgcHelper, msg()); + + if (!hasBC[ibc]) continue; + Muon::TgcPrepData* newPrepData = makeTgcPrepData(tgcAllColItr, hasBC[ibc]); + newPrepData->setHashAndIndex(collections[ibc]->identifyHash(), collections[ibc]->size()); + collections[ibc]->push_back(newPrepData); + } + } + } + + + return StatusCode::SUCCESS; +} + + +Muon::TgcPrepData* +Muon::TgcPrepDataReplicationToolAllBCto3BC::makeTgcPrepData(Muon::TgcPrepDataCollection::const_iterator itr, uint16_t bcBitMap) +{ + Identifier channelId = (*itr)->identify(); + IdentifierHash tgcHashId = (*itr)->collectionHash(); + const std::vector<Identifier> &identifierList = (*itr)->rdoList(); + const Amg::MatrixX* errHitPos = &(*itr)->localCovariance(); + const MuonGM::TgcReadoutElement* descriptor = (*itr)->detectorElement(); + + const Amg::MatrixX* newErrHitPos = new Amg::MatrixX(*errHitPos); + + Muon::TgcPrepData* newPrepData = new TgcPrepData(channelId, tgcHashId, (*itr)->localPosition(), + identifierList, newErrHitPos, descriptor); + newPrepData->setBcBitMap(bcBitMap); + + return newPrepData; +} + + + + +StatusCode Muon::TgcPrepDataReplicationToolAllBCto3BC::queryInterface(const InterfaceID& riid, void** ppvIf) { + ATH_MSG_DEBUG("queryInterface()"); + if(ITgcPrepDataReplicationTool::interfaceID().versionMatch(riid)) { + *ppvIf = dynamic_cast<ITgcPrepDataReplicationTool*>(this); + addRef(); + ATH_MSG_DEBUG("InterfaceID successfully matched with ITgcPrepDataReplicationTool one."); + return StatusCode::SUCCESS; + } + + return AthAlgTool::queryInterface(riid, ppvIf); +} + + diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.h new file mode 100644 index 0000000000000000000000000000000000000000..8082e8079ea19230fc849986f1f426b33f73e0dc --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcPrepDataReplicationToolAllBCto3BC.h @@ -0,0 +1,66 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// TgcPrepDataReplicationTool.h, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// +#ifndef MUONTGC_CNVTOOLS_TGCPREPDATAREPLICATIONTOOLAllBCto3BC_H +#define MUONTGC_CNVTOOLS_TGCPREPDATAREPLICATIONTOOLAllBCto3BC_H + +#include "AthenaBaseComps/AthAlgTool.h" +#include "MuonTGC_CnvTools/ITgcPrepDataReplicationTool.h" +#include "MuonPrepRawData/TgcPrepDataContainer.h" + +class TgcIdHelper; + +namespace MuonGM +{ + class MuonDetectorManager; +} + +namespace Muon +{ + class TgcPrepDataReplicationToolAllBCto3BC + : virtual public ITgcPrepDataReplicationTool, virtual public AthAlgTool + { + public: + /** Constructor */ + TgcPrepDataReplicationToolAllBCto3BC(const std::string& t, const std::string& n, const IInterface* p); + + /** Destructor */ + virtual ~TgcPrepDataReplicationToolAllBCto3BC(); + + /** Provide InterfaceID */ + static const InterfaceID& interfaceID() { return ITgcPrepDataReplicationTool::interfaceID(); }; + + /** Query interface */ + virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvIF); + + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + virtual StatusCode replicate() override; + StatusCode convertAllBCto3BC(); + +/** Make new TgcPrepData */ //Static to avoid code duplication with sister class + static TgcPrepData* makeTgcPrepData(TgcPrepDataCollection::const_iterator itr, uint16_t bcBitMap); + + private: + enum {BC_PREVIOUS=0, BC_CURRENT, BC_NEXT, BC_ALL, BC_NUM}; + + /** muon detector manager */ + const MuonGM::MuonDetectorManager * m_muonMgr; + + /** TGC identifier helper */ + const TgcIdHelper* m_tgcHelper; + + SG::WriteHandleKeyArray<TgcPrepDataContainer> m_3BCKeys; + SG::ReadHandleKey<TgcPrepDataContainer> m_AllBCKey; + + + + + }; +} // end of namespace + +#endif // MUONTGC_CNVTOOLS_TGCPREPDATAREPLICATIONTOOLAllBCto3BC_H diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRDO_Decoder.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRDO_Decoder.cxx old mode 100755 new mode 100644 diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRDO_Decoder.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRDO_Decoder.h old mode 100755 new mode 100644 diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRODReadOut.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRODReadOut.cxx old mode 100755 new mode 100644 diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRODReadOut.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRODReadOut.h old mode 100755 new mode 100644 diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcROD_Encoder.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcROD_Encoder.cxx old mode 100755 new mode 100644 diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcROD_Encoder.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcROD_Encoder.h old mode 100755 new mode 100644 diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoContByteStreamTool.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoContByteStreamTool.cxx old mode 100755 new mode 100644 diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoContByteStreamTool.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoContByteStreamTool.h old mode 100755 new mode 100644 diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.cxx index 24d99c607ec29c585746e9a5f5403ff0dfd11110..73b0603f541f0a31a01a15dbdb26346f2090c920 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.cxx @@ -9,7 +9,6 @@ #include "TgcRdoToPrepDataTool.h" #include "GaudiKernel/ISvcLocator.h" -#include "GaudiKernel/PropertyMgr.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/TgcReadoutElement.h" @@ -19,7 +18,6 @@ #include "TGCcablingInterface/ITGCcablingServerSvc.h" #include "TGCcablingInterface/TGCIdBase.h" -#include "MuonRDO/TgcRdoContainer.h" #include "MuonDigitContainer/TgcDigit.h" #include "MuonTrigCoinData/TgcCoinData.h" @@ -44,7 +42,6 @@ Muon::TgcRdoToPrepDataTool::TgcRdoToPrepDataTool(const std::string& t, const std m_tgcCabling(0), m_useBStoRdoTool(false), // true if running trigger (EF) on BS input m_rawDataProviderTool("Muon::TGC_RawDataProviderTool/TGC_RawDataProviderTool"), - m_decodedRdoCollVec(0), m_nHitRDOs(0), m_nHitPRDs(0), m_nTrackletRDOs(0), @@ -55,7 +52,10 @@ Muon::TgcRdoToPrepDataTool::TgcRdoToPrepDataTool(const std::string& t, const std m_nHiPtPRDs(0), m_nSLRDOs(0), m_nSLPRDs(0), - m_is12fold(true) + m_is12fold(true), + m_rdoContainer("TGCRDO"), + m_outputCoinKeys{"dummy", "dummy", "dummy" }, + m_outputprepdataKeys{"dummy", "dummy", "dummy", "dummy"} { // tools declareProperty("RawDataProviderTool", m_rawDataProviderTool); @@ -68,7 +68,9 @@ Muon::TgcRdoToPrepDataTool::TgcRdoToPrepDataTool(const std::string& t, const std declareProperty("useBStoRdoTool", m_useBStoRdoTool = false); declareProperty("show_warning_level_invalid_A09_SSW6_hit", m_show_warning_level_invalid_A09_SSW6_hit = false); declareProperty("dropPrdsWithZeroWidth", m_dropPrdsWithZeroWidth = true); - + declareProperty("RDOContainer", m_rdoContainer); + declareProperty("outputCoinKey", m_outputCoinKeys); + declareProperty("prepDataKeys", m_outputprepdataKeys); for(int ibc=0; ibc<NBC+1; ibc++) m_tgcPrepDataContainer[ibc]=0; for(int ibc=0; ibc<NBC ; ibc++) m_tgcCoinDataContainer[ibc]=0; for(int ibc=0; ibc<NBC+1; ibc++) m_fullEventDone[ibc]=false; @@ -108,19 +110,26 @@ StatusCode Muon::TgcRdoToPrepDataTool::initialize() /// get tgcIdHelper from muonMgr m_tgcHelper = m_muonMgr->tgcIdHelper(); - - /// create an empty TGC container for filling - for(int ibc=0; ibc<NBC+1; ibc++) { - try { - m_tgcPrepDataContainer[ibc] = new TgcPrepDataContainer(m_tgcHelper->module_hash_max()); - } catch(std::bad_alloc) { - ATH_MSG_FATAL("Could not create a new TGC PrepRawData container!"); - return StatusCode::FAILURE; - } - m_tgcPrepDataContainer[ibc]->addRef(); + + for(int ibc=0; ibc<NBC+1; ibc++) { + int bcTag=ibc+1; + std::ostringstream location; + location << m_outputCollectionLocation << (bcTag==TgcDigit::BC_PREVIOUS ? "PriorBC" : "") + << (bcTag==TgcDigit::BC_NEXT ? "NextBC" : "") << (bcTag==(NBC+1) ? "AllBCs" : ""); + m_outputprepdataKeys.at(ibc) = location.str(); } + for(int ibc=0; ibc<NBC; ibc++) { + int bcTag=ibc+1; + std::ostringstream location; + location << m_outputCoinCollectionLocation << (bcTag==TgcDigit::BC_PREVIOUS ? "PriorBC" : "") + << (bcTag==TgcDigit::BC_NEXT ? "NextBC" : ""); + m_outputCoinKeys.at(ibc) = location.str(); + } + ATH_CHECK(m_outputCoinKeys.initialize()); + ATH_CHECK(m_outputprepdataKeys.initialize()); + // Get TgcRawDataProviderTool sc = m_rawDataProviderTool.retrieve(); if(sc.isFailure()) { @@ -130,20 +139,7 @@ StatusCode Muon::TgcRdoToPrepDataTool::initialize() ATH_MSG_INFO("Retrieved Tool " << m_rawDataProviderTool); } - - /// create an empty TgcCoinData container for filling - for(int ibc=0; ibc<NBC; ibc++) { - try { - m_tgcCoinDataContainer[ibc] = new TgcCoinDataContainer(m_tgcHelper->module_hash_max()); - } catch(std::bad_alloc) { - ATH_MSG_FATAL("Could not create a new TGC TrigCoinData container!"); - return StatusCode::FAILURE; - } - m_tgcCoinDataContainer[ibc]->addRef(); - } - // create vector of RDO collections already decoded in the event - m_decodedRdoCollVec = new std::vector<const TgcRdo*>; //try to configure the cabling service sc = getCabling(); @@ -159,15 +155,9 @@ StatusCode Muon::TgcRdoToPrepDataTool::initialize() StatusCode Muon::TgcRdoToPrepDataTool::finalize() { - for(int ibc=0; ibc<NBC+1; ibc++) { - m_tgcPrepDataContainer[ibc]->release(); - } - for(int ibc=0; ibc<NBC; ibc++) { - m_tgcCoinDataContainer[ibc]->release(); - } - delete m_decodedRdoCollVec; - m_decodedRdoCollVec = 0; + m_decodedRdoCollVec.clear(); + m_decodedRdoCollVec.shrink_to_fit(); ATH_MSG_INFO("finalize(): input RDOs->output PRDs [" << "Hit: " << m_nHitRDOs << "->" << m_nHitPRDs << ", " << @@ -201,34 +191,30 @@ StatusCode Muon::TgcRdoToPrepDataTool::decode(std::vector<IdentifierHash>& reque /// clean up containers for Hits for(int ibc=0; ibc<NBC+1; ibc++) { int bcTag=ibc+1; - std::ostringstream location; - location << m_outputCollectionLocation << (bcTag==TgcDigit::BC_PREVIOUS ? "PriorBC" : "") - << (bcTag==TgcDigit::BC_NEXT ? "NextBC" : "") << (bcTag==(NBC+1) ? "AllBCs" : ""); - if(!evtStore()->contains<Muon::TgcPrepDataContainer>(location.str())) { - // this happens the first time in the event ! - m_tgcPrepDataContainer[ibc]->cleanup(); // clean up the PrepRawData container + + if(!evtStore()->contains<Muon::TgcPrepDataContainer>(m_outputprepdataKeys.at(ibc).key())) { + // initialize with false - for(uint16_t onlineId=0; onlineId<m_decodedOnlineId.size(); onlineId++) { - m_decodedOnlineId.at(onlineId) = false; - } - + std::fill(m_decodedOnlineId.begin(), m_decodedOnlineId.end(), false); + SG::WriteHandle<TgcPrepDataContainer> handle(m_outputprepdataKeys[ibc]); + // record the container in storeGate - StatusCode status = evtStore()->record(m_tgcPrepDataContainer[ibc],location.str()); - if(status.isFailure()) { - ATH_MSG_FATAL("Could not record container of TGC PrepRawData at " << location.str()); - return status; + handle = std::unique_ptr<TgcPrepDataContainer> (new TgcPrepDataContainer(m_tgcHelper->module_hash_max())); + // cache the pointer, storegate retains ownership + m_tgcPrepDataContainer[ibc] = handle.ptr(); + if(!handle.isValid()) { + ATH_MSG_FATAL("Could not record container of TGC PrepRawData at " << m_outputprepdataKeys[ibc].key()); + return StatusCode::FAILURE; } else { - ATH_MSG_DEBUG("TGC PrepData Container recorded in StoreGate with key " << location.str()); + ATH_MSG_DEBUG("TGC PrepData Container recorded in StoreGate with key " << m_outputprepdataKeys[ibc].key()); } - if(sizeVectorRequested==0) { // un-seeded mode (no need to decode this event after this execution) - m_fullEventDone[ibc] = true; - } else { // seeded mode (still need to decode this event even after this execution) - m_fullEventDone[ibc] = false; - } - - m_decodedRdoCollVec->clear(); // The information of decoded RDO in the previous event is cleared. + //true: un-seeded mode (no need to decode this event after this execution) + //false: seeded mode (still need to decode this event even after this execution) + m_fullEventDone[ibc] = sizeVectorRequested==0; + + m_decodedRdoCollVec.clear(); // The information of decoded RDO in the previous event is cleared. } else { // If you come here, this event is partially or fully decoded. ATH_MSG_DEBUG("TGC PrepData Container at " << @@ -268,21 +254,22 @@ StatusCode Muon::TgcRdoToPrepDataTool::decode(std::vector<IdentifierHash>& reque if(!nothingToDoForAllBC) { // If still need to do something /// clean up containers for Coincidence for(int ibc=0; ibc<NBC; ibc++) { - int bcTag=ibc+1; - std::ostringstream location; - location << m_outputCoinCollectionLocation << (bcTag==TgcDigit::BC_PREVIOUS ? "PriorBC" : "") - << (bcTag==TgcDigit::BC_NEXT ? "NextBC" : ""); - if(!evtStore()->contains<Muon::TgcCoinDataContainer>(location.str())) { + + if(!evtStore()->contains<Muon::TgcCoinDataContainer>(m_outputCoinKeys.at(ibc).key())) { // this happens the first time in the event ! - m_tgcCoinDataContainer[ibc]->cleanup();// clean up the CoinData container + SG::WriteHandle<TgcCoinDataContainer> handle(m_outputCoinKeys[ibc]); - // record the container in storeGate - StatusCode status = evtStore()->record(m_tgcCoinDataContainer[ibc],location.str()); - if(status.isFailure()) { - ATH_MSG_FATAL("Could not record container of TGC CoinData at " << location.str()); - return status; + // record the container in storeGate + handle = std::unique_ptr<TgcCoinDataContainer> (new TgcCoinDataContainer(m_tgcHelper->module_hash_max())); + + // cache the pointer, storegate retains ownership + m_tgcCoinDataContainer[ibc] = handle.ptr(); + + if(!handle.isValid()) { + ATH_MSG_FATAL("Could not record container of TGC CoinData at " << m_outputCoinKeys[ibc].key()); + return StatusCode::FAILURE; } else { - ATH_MSG_DEBUG("TGC CoinData Container recorded in StoreGate with key " << location.str()); + ATH_MSG_DEBUG("TGC CoinData Container recorded in StoreGate with key " << m_outputCoinKeys[ibc].key()); } } else { ATH_MSG_DEBUG("TGC CoinData Container is already in StoreGate"); @@ -304,7 +291,6 @@ StatusCode Muon::TgcRdoToPrepDataTool::decode(std::vector<IdentifierHash>& reque } // retrieve the collection of RDO - const TgcRdoContainer* rdoContainer = 0; if(m_useBStoRdoTool) { // we come here if the entire rdo container is not yet in SG (i.e. in EF with BS input) // ask TgcRawDataProviderTool to decode the list of robs and to fill the rdo IDC @@ -326,21 +312,20 @@ StatusCode Muon::TgcRdoToPrepDataTool::decode(std::vector<IdentifierHash>& reque } ATH_MSG_DEBUG("Retriving TGC RDO container from the store"); - StatusCode status = evtStore()->retrieve(rdoContainer, "TGCRDO"); - if(status.isFailure()) { + if(!m_rdoContainer.isValid()) { ATH_MSG_WARNING("No TGC RDO container in StoreGate!"); return StatusCode::SUCCESS; } ///////////// here the RDO container is retrieved and filled -whatever input type we start with- => check the size - if(rdoContainer->size()==0) { + if(m_rdoContainer->size()==0) { // empty csm container - no tgc rdo in this event ATH_MSG_DEBUG("Empty rdo container - no tgc rdo in this event"); return StatusCode::SUCCESS; } ATH_MSG_DEBUG("Not empty rdo container in this event, the container size is " << - rdoContainer->size()); + m_rdoContainer->size()); // select RDOs to be decoded when seeded mode is used std::vector<const TgcRdo*> rdoCollVec; @@ -361,8 +346,8 @@ StatusCode Muon::TgcRdoToPrepDataTool::decode(std::vector<IdentifierHash>& reque m_decodedOnlineId.at(onlineId) = true; // The ROB with this onlineId will be decoded only once - TgcRdoContainer::const_iterator rdo_container_it = rdoContainer->begin(); - TgcRdoContainer::const_iterator rdo_container_it_e = rdoContainer->end(); + TgcRdoContainer::const_iterator rdo_container_it = m_rdoContainer->begin(); + TgcRdoContainer::const_iterator rdo_container_it_e = m_rdoContainer->end(); for(; rdo_container_it!=rdo_container_it_e; rdo_container_it++) { const TgcRdo* rdoColl = *rdo_container_it; if(rdoColl->identify()==onlineId) { @@ -389,15 +374,15 @@ StatusCode Muon::TgcRdoToPrepDataTool::decode(std::vector<IdentifierHash>& reque for(; itD!=itD_e; itD++) { selectDecoder(itD, (*iRdo)); } - m_decodedRdoCollVec->push_back(*iRdo); + m_decodedRdoCollVec.push_back(*iRdo); } // show the vector of IdentifierHash which contains the data within requested range showIdentifierHashVector(selectedIdHashVect); } else { ATH_MSG_DEBUG("Start loop over rdos - unseeded mode"); - TgcRdoContainer::const_iterator rdoColli = rdoContainer->begin(); - TgcRdoContainer::const_iterator rdoColli_e = rdoContainer->end(); + TgcRdoContainer::const_iterator rdoColli = m_rdoContainer->begin(); + TgcRdoContainer::const_iterator rdoColli_e = m_rdoContainer->end(); for(; rdoColli!=rdoColli_e; rdoColli++) { // loop over all elements of the rdo container const TgcRdo* rdoColl = *rdoColli; @@ -409,7 +394,7 @@ StatusCode Muon::TgcRdoToPrepDataTool::decode(std::vector<IdentifierHash>& reque for(; itD!=itD_e; itD++) { selectDecoder(itD, rdoColl); } - m_decodedRdoCollVec->push_back(rdoColl); + m_decodedRdoCollVec.push_back(rdoColl); } } // show the vector of IdentifierHash which contains the data @@ -448,14 +433,12 @@ void Muon::TgcRdoToPrepDataTool::printInputRdo() IdContext tgcContext = m_tgcHelper->module_context(); /// TGC RDO container --- assuming it is available - const TgcRdoContainer* rdoContainer; - StatusCode status = evtStore()->retrieve(rdoContainer, "TGCRDO"); - if(status.isFailure()) { + if(!m_rdoContainer.isValid()) { ATH_MSG_WARNING("*** Retrieval of TGC RDO container for debugging purposes failed !"); return; } - if(rdoContainer->size()<=0) { + if(m_rdoContainer->size()==0) { ATH_MSG_INFO("*** No TgcRdo collections were found"); return; } @@ -469,8 +452,8 @@ void Muon::TgcRdoToPrepDataTool::printInputRdo() int nOthers = 0; int nTgcRawData = 0; - TgcRdoContainer::const_iterator rdo_container_it = rdoContainer->begin(); - TgcRdoContainer::const_iterator rdo_container_it_e = rdoContainer->end(); + TgcRdoContainer::const_iterator rdo_container_it = m_rdoContainer->begin(); + TgcRdoContainer::const_iterator rdo_container_it_e = m_rdoContainer->end(); for(; rdo_container_it!=rdo_container_it_e; rdo_container_it++) { // loop over all elements of the rdo container const TgcRdo* rdoColl = *rdo_container_it; @@ -595,7 +578,7 @@ void Muon::TgcRdoToPrepDataTool::printPrepData() const TgcPrepDataCollection* tgcColl; for(int ibc=0; ibc<NBC; ibc++) { - if(m_tgcPrepDataContainer[ibc]->size() <= 0) ATH_MSG_INFO("No TgcPrepRawData collections found"); + if(m_tgcPrepDataContainer[ibc]->size()==0) ATH_MSG_INFO("No TgcPrepRawData collections found"); ATH_MSG_INFO("--------------------------------------------------------------------------------------------"); IdentifiableContainer<Muon::TgcPrepDataCollection>::const_iterator tgcColli = m_tgcPrepDataContainer[ibc]->begin(); @@ -622,7 +605,7 @@ void Muon::TgcRdoToPrepDataTool::printPrepData() const TgcCoinDataCollection* tgcCoinColl; for(int ibc=0; ibc<NBC; ibc++) { - if(m_tgcCoinDataContainer[ibc]->size() <= 0) ATH_MSG_INFO("No TgcCoinData collections found"); + if(m_tgcCoinDataContainer[ibc]->size()==0) ATH_MSG_INFO("No TgcCoinData collections found"); ATH_MSG_INFO("--------------------------------------------------------------------------------------------"); @@ -1806,16 +1789,14 @@ StatusCode Muon::TgcRdoToPrepDataTool::decodeSL(const TgcRdo::const_iterator& it Amg::Vector3D tmp_gp(tmp_r*cos(tmp_phi), tmp_r*sin(tmp_phi), tmp_wire_z); Amg::Vector2D tmp_hitPos; bool onSurface = descriptor_w2->surface(channelId_wire[2]).globalToLocal(tmp_gp,tmp_gp,tmp_hitPos); - const Amg::Vector2D* hitPos = new Amg::Vector2D(tmp_hitPos); - if(!onSurface) { // If TGC A-lines with rotations are used, the z-coordinate of a chamber depends on position. // In this case, the global to local conversion fails. // Obtain the local position in a different way. - hitPos = getSLLocalPosition(descriptor_w2, channelId_wire[2], tmp_eta, tmp_phi); - } - if(!hitPos) { - ATH_MSG_WARNING("Muon::TgcRdoToPrepDataTool::decodeSL Amg::Vector2D* hitPos is null."); - } + const Amg::Vector2D* hitPos = !onSurface ? new Amg::Vector2D(tmp_hitPos) : getSLLocalPosition(descriptor_w2, channelId_wire[2], tmp_eta, tmp_phi); + +// if(!hitPos) { //No need to check should not be possible to fail +// ATH_MSG_WARNING("Muon::TgcRdoToPrepDataTool::decodeSL Amg::Vector2D* hitPos is null."); +// } Amg::MatrixX mat(2,2); mat.setIdentity(); @@ -1956,9 +1937,9 @@ bool Muon::TgcRdoToPrepDataTool::isAlreadyConverted(std::vector<const TgcRdo*>& } } - if(!m_decodedRdoCollVec->empty()) { - std::vector<const TgcRdo*>::const_iterator jt = m_decodedRdoCollVec->begin(); - std::vector<const TgcRdo*>::const_iterator jt_e = m_decodedRdoCollVec->end(); + if(!m_decodedRdoCollVec.empty()) { + std::vector<const TgcRdo*>::const_iterator jt = m_decodedRdoCollVec.begin(); + std::vector<const TgcRdo*>::const_iterator jt_e = m_decodedRdoCollVec.end(); for(; jt!=jt_e; jt++) { if(*jt==rdoColl) return true; } @@ -3380,17 +3361,17 @@ bool Muon::TgcRdoToPrepDataTool::getSbLocOfEndcapStripBoundaryFromTracklet(const void Muon::TgcRdoToPrepDataTool::getEndcapStripCandidateTrackletIds(const int roi, int &trackletIdStripFirst, int &trackletIdStripSecond, int &trackletIdStripThird) const { - static const int T9SscMax = 2; // SSC 0 to SSC 2 - static const int T8SscMax = 4; // SSC 3 to SSC 4 - static const int T7SscMax = 6; // SSC 5 to SSC 6 - static const int T6SscMax = 12; // SSC 7 to SSC12 - static const int T5SscMax = 18; // SSC13 to SSC18 - - static const int T9Offset = 32 + 0; - static const int T8Offset = 32 + 2; - static const int T7Offset = 32 + 4; - static const int T6Offset = 32 + 6; - static const int T5Offset = 32 + 8; + constexpr int T9SscMax = 2; // SSC 0 to SSC 2 + constexpr int T8SscMax = 4; // SSC 3 to SSC 4 + constexpr int T7SscMax = 6; // SSC 5 to SSC 6 + constexpr int T6SscMax = 12; // SSC 7 to SSC12 + constexpr int T5SscMax = 18; // SSC13 to SSC18 + + constexpr int T9Offset = 32 + 0; + constexpr int T8Offset = 32 + 2; + constexpr int T7Offset = 32 + 4; + constexpr int T6Offset = 32 + 6; + constexpr int T5Offset = 32 + 8; // ROI : 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ... // SSC : 0 0 0 0 1 1 1 1 1 1 1 1 2 2 2 2 2 2 ... @@ -3508,10 +3489,10 @@ const Amg::Vector2D* Muon::TgcRdoToPrepDataTool::getSLLocalPosition(const MuonGM if(!readout) return 0; // Obtain the local coordinate by the secant method - const double length = 100.; // 100 mm - const unsigned int nRep = 10; // 10 repetitions - const double dRAccuracy = 1.0E-20; // recuqired dR accuracy - const double maxLocR = 10000.; // 10 m + constexpr double length = 100.; // 100 mm + constexpr unsigned int nRep = 10; // 10 repetitions + constexpr double dRAccuracy = 1.0E-20; // recuqired dR accuracy + constexpr double maxLocR = 10000.; // 10 m double locX = 0.; double locY = 0.; @@ -3519,65 +3500,56 @@ const Amg::Vector2D* Muon::TgcRdoToPrepDataTool::getSLLocalPosition(const MuonGM Amg::Vector2D loc_hitPos_c(locX, locY); // center or current position Amg::Vector3D tmp_glob_hitPos_c; readout->surface(identify).localToGlobal(loc_hitPos_c,tmp_glob_hitPos_c,tmp_glob_hitPos_c); - const Amg::Vector3D* glob_hitPos_c = new Amg::Vector3D(tmp_glob_hitPos_c); - if(glob_hitPos_c) { - double glob_eta_c = glob_hitPos_c->eta(); - double glob_phi_c = glob_hitPos_c->phi(); - - Amg::MatrixX vector(2, 1); - vector(0,0) = eta - glob_eta_c; - vector(1,0) = phi - glob_phi_c; - while(vector(1,0)>+M_PI) vector(1,0) -= 2.*M_PI; - while(vector(1,0)<-M_PI) vector(1,0) += 2.*M_PI; + const Amg::Vector3D &glob_hitPos_c = tmp_glob_hitPos_c; + + double glob_eta_c = glob_hitPos_c.eta(); + double glob_phi_c = glob_hitPos_c.phi(); + + Amg::MatrixX vector(2, 1); + vector(0,0) = eta - glob_eta_c; + vector(1,0) = phi - glob_phi_c; + while(vector(1,0)>+M_PI) vector(1,0) -= 2.*M_PI; + while(vector(1,0)<-M_PI) vector(1,0) += 2.*M_PI; - double dR = sqrt(vector(0,0)*vector(0,0) + vector(1,0)*vector(1,0)); - if(dR<dRAccuracy) { - delete glob_hitPos_c; glob_hitPos_c = 0; + double dR = sqrt(vector(0,0)*vector(0,0) + vector(1,0)*vector(1,0)); + if(dR<dRAccuracy) { break; - } + } - Amg::Vector2D loc_hitPos_w(locX+length, locY ); // slightly shifted position in the wire direction - Amg::Vector2D loc_hitPos_s(locX, locY+length); // slightly shifted position in the strip direction - Amg::Vector3D tmp_glob_hitPos_w; - readout->surface(identify).localToGlobal(loc_hitPos_w,tmp_glob_hitPos_w,tmp_glob_hitPos_w); - const Amg::Vector3D* glob_hitPos_w = new Amg::Vector3D(tmp_glob_hitPos_w); - Amg::Vector3D tmp_glob_hitPos_s; - readout->surface(identify).localToGlobal(loc_hitPos_s,tmp_glob_hitPos_s,tmp_glob_hitPos_s); - const Amg::Vector3D* glob_hitPos_s = new Amg::Vector3D(tmp_glob_hitPos_s); + Amg::Vector2D loc_hitPos_w(locX+length, locY ); // slightly shifted position in the wire direction + Amg::Vector2D loc_hitPos_s(locX, locY+length); // slightly shifted position in the strip direction + Amg::Vector3D tmp_glob_hitPos_w; + readout->surface(identify).localToGlobal(loc_hitPos_w,tmp_glob_hitPos_w,tmp_glob_hitPos_w); + const Amg::Vector3D &glob_hitPos_w = tmp_glob_hitPos_w; + Amg::Vector3D tmp_glob_hitPos_s; + readout->surface(identify).localToGlobal(loc_hitPos_s,tmp_glob_hitPos_s,tmp_glob_hitPos_s); + const Amg::Vector3D &glob_hitPos_s = tmp_glob_hitPos_s; - if(glob_hitPos_w && glob_hitPos_s) { - Amg::MatrixX matrix(2, 2); - matrix(0,0) = glob_hitPos_w->eta() - glob_eta_c; - matrix(1,0) = glob_hitPos_w->phi() - glob_phi_c; - while(matrix(1,0)>+M_PI) matrix(1,0) -= 2.*M_PI; - while(matrix(1,0)<-M_PI) matrix(1,0) += 2.*M_PI; - - matrix(0,1) = glob_hitPos_s->eta() - glob_eta_c; - matrix(1,1) = glob_hitPos_s->phi() - glob_phi_c; - while(matrix(1,1)>+M_PI) matrix(1,1) -= 2.*M_PI; - while(matrix(1,1)<-M_PI) matrix(1,1) += 2.*M_PI; + Amg::MatrixX matrix(2, 2); + matrix(0,0) = glob_hitPos_w.eta() - glob_eta_c; + matrix(1,0) = glob_hitPos_w.phi() - glob_phi_c; + while(matrix(1,0)>+M_PI) matrix(1,0) -= 2.*M_PI; + while(matrix(1,0)<-M_PI) matrix(1,0) += 2.*M_PI; - bool invertible(false); - if( matrix.determinant() ) invertible = true; - if(invertible) { - Amg::MatrixX invertedMatrix = matrix.inverse(); - Amg::MatrixX solution = invertedMatrix * vector; - locX += length * solution(0,0); - locY += length * solution(1,0); + matrix(0,1) = glob_hitPos_s.eta() - glob_eta_c; + matrix(1,1) = glob_hitPos_s.phi() - glob_phi_c; + while(matrix(1,1)>+M_PI) matrix(1,1) -= 2.*M_PI; + while(matrix(1,1)<-M_PI) matrix(1,1) += 2.*M_PI; + + bool invertible = matrix.determinant(); + if(invertible) { + Amg::MatrixX invertedMatrix = matrix.inverse(); + Amg::MatrixX solution = invertedMatrix * vector; + locX += length * solution(0,0); + locY += length * solution(1,0); - double locR = sqrt(locX*locX + locY*locY); - if(locR>maxLocR) { - locX *= maxLocR/locR; - locY *= maxLocR/locR; - } - } + double locR = sqrt(locX*locX + locY*locY); + if(locR>maxLocR) { + locX *= maxLocR/locR; + locY *= maxLocR/locR; } - - delete glob_hitPos_c; glob_hitPos_c = 0; - delete glob_hitPos_w; glob_hitPos_w = 0; - delete glob_hitPos_s; glob_hitPos_s = 0; } - } + } return new Amg::Vector2D(locX, locY); } diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.h old mode 100755 new mode 100644 index 5eea933447898add780594b2f7f8864152a07261..7691e02e6cd905ea3000b017b7477ce457427eb0 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.h +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataTool.h @@ -19,6 +19,8 @@ #include "MuonRDO/TgcRdo.h" #include "MuonTrigCoinData/TgcCoinDataContainer.h" +#include "MuonRDO/TgcRdoContainer.h" + class AtlasDetectorID; class Identifier; @@ -55,19 +57,19 @@ namespace Muon virtual ~TgcRdoToPrepDataTool(); /** Query the IMuonRdoToPrepDataTool interface */ - StatusCode queryInterface(const InterfaceID& riid, void** ppvIf); + StatusCode queryInterface(const InterfaceID& riid, void** ppvIf) override; /** Standard AthAlgTool initialize method */ - virtual StatusCode initialize(); + virtual StatusCode initialize() override; /** Standard AthAlgTool finalize method */ - virtual StatusCode finalize(); + virtual StatusCode finalize() override; /** Decode RDO to PRD * A vector of IdentifierHash are passed in, and the data corresponding to this list (i.e. in a Region of Interest) are converted. * @param requestedIdHashVect Vector of hashes to convert i.e. the hashes of ROD collections in a 'Region of Interest' * @return selectedIdHashVect This is the subset of requestedIdVect which were actually found to contain data * (i.e. if you want you can use this vector of hashes to optimise the retrieval of data in subsequent steps.) */ - StatusCode decode(std::vector<IdentifierHash>& idVect, std::vector<IdentifierHash>& idWithDataVect); + StatusCode decode(std::vector<IdentifierHash>& idVect, std::vector<IdentifierHash>& idWithDataVect) override; /** Print Input RDO for debugging */ void printInputRdo(); @@ -352,7 +354,7 @@ namespace Muon std::vector<uint16_t> m_hashToOnlineId; /** Vector of RDO collections already decoded in the event */ - std::vector<const TgcRdo*> *m_decodedRdoCollVec; + std::vector<const TgcRdo*> m_decodedRdoCollVec; /** Switch for error message disabling on one invalid channel in sector A09 seen in 2008 data, at least run 79772 - 91800. @@ -364,7 +366,7 @@ namespace Muon /** Flag for dropping PRD's with zero widths */ bool m_dropPrdsWithZeroWidth; /** Cut value for zero widths */ - static const double s_cutDropPrdsWithZeroWidth; + const static double s_cutDropPrdsWithZeroWidth; // 0.1 mm /** long to count the numbers of RDOs and PRDs */ long m_nHitRDOs; @@ -381,6 +383,11 @@ namespace Muon /** Flag to distinguish 12-fold cabling and 8-fold cabling */ bool m_is12fold; + + SG::ReadHandle<TgcRdoContainer> m_rdoContainer;//"TGCRDO" + SG::WriteHandleKeyArray<Muon::TgcCoinDataContainer> m_outputCoinKeys; + SG::WriteHandleKeyArray<TgcPrepDataContainer> m_outputprepdataKeys; + /** Aboid compiler warning **/ virtual StatusCode decode( const std::vector<uint32_t>& /*robIds*/ ) {return StatusCode::FAILURE;} }; diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcSlbData.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcSlbData.h old mode 100755 new mode 100644 diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcSlbDataHelper.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcSlbDataHelper.cxx old mode 100755 new mode 100644 diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcSlbDataHelper.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcSlbDataHelper.h old mode 100755 new mode 100644 diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/components/MuonTGC_CnvTools_entries.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/components/MuonTGC_CnvTools_entries.cxx index 9c57c653340ed73376c87c35d2cbfdf530e0c7ac..2ea0d878e90ae4e7c4aa41bf12aa83cd5fdbb1fa 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/components/MuonTGC_CnvTools_entries.cxx +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/components/MuonTGC_CnvTools_entries.cxx @@ -7,10 +7,15 @@ #include "../TGC_RawDataProviderTool.h" #include "../TgcRDO_Decoder.h" #include "../TgcPrepDataReplicationAlg.h" +#include "../TgcPrepDataReplicationTool3BCtoAllBC.h" +#include "../TgcPrepDataReplicationToolAllBCto3BC.h" + DECLARE_NAMESPACE_TOOL_FACTORY( Muon, TgcRdoToPrepDataTool ) DECLARE_NAMESPACE_TOOL_FACTORY( Muon, TgcRdoContByteStreamTool ) DECLARE_NAMESPACE_TOOL_FACTORY( Muon, TgcPrepDataReplicationTool ) +DECLARE_NAMESPACE_TOOL_FACTORY( Muon, TgcPrepDataReplicationTool3BCtoAllBC ) +DECLARE_NAMESPACE_TOOL_FACTORY( Muon, TgcPrepDataReplicationToolAllBCto3BC ) DECLARE_NAMESPACE_TOOL_FACTORY( Muon, TGC_RodDecoderReadout ) DECLARE_NAMESPACE_TOOL_FACTORY( Muon, TGC_RodDecoderRawdata ) DECLARE_NAMESPACE_TOOL_FACTORY( Muon, TGC_RawDataProviderTool ) @@ -26,5 +31,7 @@ DECLARE_FACTORY_ENTRIES( MuonTGC_CnvTools ) DECLARE_NAMESPACE_TOOL( Muon, TGC_RodDecoderRawdata ) DECLARE_NAMESPACE_TOOL( Muon, TGC_RawDataProviderTool ) DECLARE_NAMESPACE_TOOL( Muon, TgcRDO_Decoder ) + DECLARE_NAMESPACE_TOOL( Muon, TgcPrepDataReplicationTool3BCtoAllBC ) + DECLARE_NAMESPACE_TOOL( Muon, TgcPrepDataReplicationToolAllBCto3BC ) DECLARE_NAMESPACE_ALGORITHM( Muon, TgcPrepDataReplicationAlg ) } diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentFinderAlg.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentFinderAlg.cxx index 5f84b40b9247c9371fb769f0d987ebeee7110954..f8d4d32711eee85e050f39da175b73f2fa700348 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentFinderAlg.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentFinderAlg.cxx @@ -82,21 +82,21 @@ StatusCode MooSegmentFinderAlg::initialize() return StatusCode::FAILURE; } - if(!m_useMdt) m_keyMdt = "";//Nullify key from scheduler if not needed - if(!m_useCsc) m_keyCsc = ""; - if(!m_useRpc) m_keyRpc = ""; - if(!m_useTgcPriorBC) m_keyTgcPriorBC = ""; - if(!m_useTgcNextBC) m_keyTgcNextBC = ""; - if(!m_useTgc) m_keyTgc = ""; - - - ATH_CHECK( m_keyCsc.initialize() ); - ATH_CHECK( m_keyMdt.initialize() ); - ATH_CHECK( m_keyRpc.initialize() ); - ATH_CHECK( m_keyTgc.initialize() ); - ATH_CHECK( m_keyTgcPriorBC.initialize() ); - ATH_CHECK( m_keyTgcNextBC.initialize() ); - + //Nullify key from scheduler if not needed + if (!m_useMdt) m_keyMdt = ""; + if (!m_useCsc) m_keyCsc = ""; + if (!m_useRpc) m_keyRpc = ""; + if (!m_useTgcPriorBC) m_keyTgcPriorBC = ""; + if (!m_useTgcNextBC) m_keyTgcNextBC = ""; + if (!m_useTgc) m_keyTgc = ""; + + // Only initialise the keys we need. + if (m_useCsc) ATH_CHECK( m_keyCsc.initialize() ); + if (m_useMdt) ATH_CHECK( m_keyMdt.initialize() ); + if (m_useRpc) ATH_CHECK( m_keyRpc.initialize() ); + if (m_useTgc) ATH_CHECK( m_keyTgc.initialize() ); + if (m_useTgcPriorBC) ATH_CHECK( m_keyTgcPriorBC.initialize() ); + if (m_useTgcNextBC) ATH_CHECK( m_keyTgcNextBC.initialize() ); ATH_CHECK( m_patternCombiLocation.initialize() ); ATH_CHECK( m_segmentLocation.initialize() ); diff --git a/Projects/Athena/externals.txt b/Projects/Athena/externals.txt index 9414a65412969ea2402d637e293f5615014f3f04..feeb06a392e6fd1a75a03ee56769d2bbf5a7f3dd 100644 --- a/Projects/Athena/externals.txt +++ b/Projects/Athena/externals.txt @@ -6,4 +6,4 @@ # forbidden. AthenaExternalsVersion = 1.0.4 -GaudiVersion = v28r1.conditions.006 +GaudiVersion = v28r1.conditions.007 diff --git a/Trigger/TrigSteer/ViewAlgsTest/CMakeLists.txt b/Trigger/TrigSteer/ViewAlgsTest/CMakeLists.txt index dd6c0a37cc61f7adf1cb0e59d5c555ac6e4ae971..d72dfd72502092d5de562ac63afe4097a55096e6 100644 --- a/Trigger/TrigSteer/ViewAlgsTest/CMakeLists.txt +++ b/Trigger/TrigSteer/ViewAlgsTest/CMakeLists.txt @@ -33,4 +33,5 @@ atlas_install_joboptions( share/*.py ) atlas_install_runtime( share/caloRoIData.dat share/menuData.dat share/muonRoIData.dat ) atlas_install_python_modules( python/*.py ) +atlas_install_xmls( data/*.xml ) diff --git a/Trigger/TrigSteer/ViewAlgsTest/share/HLTTestMenu.xml b/Trigger/TrigSteer/ViewAlgsTest/data/HLTTestMenu.xml similarity index 100% rename from Trigger/TrigSteer/ViewAlgsTest/share/HLTTestMenu.xml rename to Trigger/TrigSteer/ViewAlgsTest/data/HLTTestMenu.xml diff --git a/Trigger/TrigSteer/ViewAlgsTest/share/BasicMTTrackingTrigger.py b/Trigger/TrigSteer/ViewAlgsTest/share/BasicMTTrackingTrigger.py index fd5e90ef5823395aa1984d360e9c828a03bb27c8..0d56fea97936f7e77e66832c1d34000e95e849ba 100644 --- a/Trigger/TrigSteer/ViewAlgsTest/share/BasicMTTrackingTrigger.py +++ b/Trigger/TrigSteer/ViewAlgsTest/share/BasicMTTrackingTrigger.py @@ -34,7 +34,7 @@ topSequence.SGInputLoader.Load = [ ('PixelRDO_Container','PixelRDOs'), from TrigConfigSvc.TrigConfigSvcConf import TrigConf__LVL1ConfigSvc l1svc = TrigConf__LVL1ConfigSvc("LVL1ConfigSvc") -l1svc.XMLMenuFile = "LVL1config_Physics_pp_v5.xml" +l1svc.XMLMenuFile = "LVL1config_Physics_pp_v7.xml" svcMgr += l1svc diff --git a/Trigger/TrigSteer/ViewAlgsTest/python/ID_RawDataMT_Trigger.py b/Trigger/TrigSteer/ViewAlgsTest/share/ID_RawDataMT_Trigger.py similarity index 98% rename from Trigger/TrigSteer/ViewAlgsTest/python/ID_RawDataMT_Trigger.py rename to Trigger/TrigSteer/ViewAlgsTest/share/ID_RawDataMT_Trigger.py index 824648faccff4c8106d261cd9429f3344a007ac2..7df074a9b002d58f9aa58fbe562b0dcdecaf6603 100644 --- a/Trigger/TrigSteer/ViewAlgsTest/python/ID_RawDataMT_Trigger.py +++ b/Trigger/TrigSteer/ViewAlgsTest/share/ID_RawDataMT_Trigger.py @@ -50,14 +50,14 @@ from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() include( "ByteStreamCnvSvc/BSEventStorageEventSelector_jobOptions.py" ) -inputfile="/afs/cern.ch/user/s/smh/public/data16_13TeV.00311563.physics_Main.daq.RAW._lb0177._SFO-1._0001.data" +inputfile="root://eosatlas//eos/atlas/atlascerngroupdisk/trig-daq/validation/test_data/data16_13TeV.00309640.physics_EnhancedBias.merge.RAW/data16_13TeV.00309640.physics_EnhancedBias.merge.RAW._lb0628._SFO-1._0001.1" svcMgr.ByteStreamInputSvc.FullFileName=[inputfile,] from AthenaCommon.AthenaCommonFlags import athenaCommonFlags athenaCommonFlags.FilesInput=[inputfile,] from TrigConfigSvc.TrigConfigSvcConf import TrigConf__LVL1ConfigSvc l1svc = TrigConf__LVL1ConfigSvc("LVL1ConfigSvc") -l1svc.XMLMenuFile = "LVL1config_Physics_pp_v6.xml" +l1svc.XMLMenuFile = "LVL1config_Physics_pp_v7.xml" svcMgr += l1svc if not hasattr( svcMgr, "ByteStreamAddressProviderSvc" ): diff --git a/Trigger/TrigSteer/ViewAlgsTest/share/menuRun.py b/Trigger/TrigSteer/ViewAlgsTest/share/menuRun.py index e022b46816180d2f175f571612208ed38e987c63..a41f6524bb6349f6d6d1d2e71ed2c44067cc112e 100755 --- a/Trigger/TrigSteer/ViewAlgsTest/share/menuRun.py +++ b/Trigger/TrigSteer/ViewAlgsTest/share/menuRun.py @@ -45,7 +45,7 @@ else: from TrigConfigSvc.TrigConfigSvcConf import TrigConf__LVL1ConfigSvc l1svc = TrigConf__LVL1ConfigSvc("LVL1ConfigSvc") -l1svc.XMLMenuFile = "LVL1config_Physics_pp_v5.xml" +l1svc.XMLMenuFile = "LVL1config_Physics_pp_v7.xml" svcMgr += l1svc @@ -89,12 +89,18 @@ topSequence += caloFakeRoI testViewAlgorithm = True if ( testViewAlgorithm ): + # A sequence to hide view algorithms from the event context + from AthenaCommon.AlgSequence import AthSequencer + allViewAlgorithms = AthSequencer( "allViewAlgorithms" ) + allViewAlgorithms += CfgMgr.AthPrescaler( "alwaysFail" ) + allViewAlgorithms.alwaysFail.PercentPass = 0.0 + # The algorithm to run inside the views from ViewAlgsTest.ViewAlgsTestConf import SchedulerProxyAlg viewAlgName = "algInView" viewAlg = SchedulerProxyAlg( viewAlgName ) - viewAlg.RequireView = True - topSequence += viewAlg + viewAlg.RoIsContainer = "InViewRoI" + allViewAlgorithms += viewAlg # The pool to retrieve the view algorithm from from GaudiHive.GaudiHiveConf import AlgResourcePool @@ -109,6 +115,7 @@ if ( testViewAlgorithm ): runInViews.OutputLevel = DEBUG runInViews.ViewAlgorithmNames = [ viewAlgName ] topSequence += runInViews + topSequence += allViewAlgorithms muonFakeRoI = FakeRoI("muonFakeRoI") @@ -470,4 +477,4 @@ print "topSequence dump:", topSequence # ############################################################### -graph_generator.saveGraph('menuRun dependencies graph', 'graph.dot') +graph_generator.saveGraph('menuRun dependencies graph', 'graph.dot') \ No newline at end of file diff --git a/Trigger/TrigSteer/ViewAlgsTest/src/SchedulerProxyAlg.cxx b/Trigger/TrigSteer/ViewAlgsTest/src/SchedulerProxyAlg.cxx index 87d7d5a1950616754645acb96624c82e1fc45704..ea196b8e330ef6fe3e365522fb688fb3c3885a45 100644 --- a/Trigger/TrigSteer/ViewAlgsTest/src/SchedulerProxyAlg.cxx +++ b/Trigger/TrigSteer/ViewAlgsTest/src/SchedulerProxyAlg.cxx @@ -8,7 +8,7 @@ #include "./SchedulerProxyAlg.h" SchedulerProxyAlg::SchedulerProxyAlg(const std::string& name, ISvcLocator* pSvcLocator) - : AthViewAlgorithm(name, pSvcLocator), + : AthAlgorithm(name, pSvcLocator), m_roisContainer("RegionOfReco"), m_outputClusterContainer("Clusters"), m_outputClusterContainerAux("ClustersAux.") @@ -18,29 +18,44 @@ SchedulerProxyAlg::SchedulerProxyAlg(const std::string& name, ISvcLocator* pSvcL declareProperty("OutputClusterContainerAux", m_outputClusterContainerAux, "ClustersAux."); } -StatusCode SchedulerProxyAlg::initialize() { +StatusCode SchedulerProxyAlg::initialize() +{ + CHECK( m_roisContainer.initialize() ); + CHECK( m_outputClusterContainer.initialize() ); + CHECK( m_outputClusterContainerAux.initialize() ); return StatusCode::SUCCESS; } -StatusCode SchedulerProxyAlg::execute() { +StatusCode SchedulerProxyAlg::execute() +{ +#ifdef GAUDI_SYSEXECUTE_WITHCONTEXT + const EventContext& ctx = getContext(); +#else + const EventContext& ctx = *getContext(); +#endif - if ( not m_roisContainer.isValid() ) { - ATH_MSG_ERROR("No decisions object prom previous stage"); + SG::ReadHandle< ConstDataVector< TrigRoiDescriptorCollection > > inputHandle( m_roisContainer, ctx ); + if ( not inputHandle.isValid() ) + { + ATH_MSG_ERROR("No decisions object from previous stage"); return StatusCode::FAILURE; } - m_outputClusterContainer = CxxUtils::make_unique<TestClusterContainer >(); - ATH_CHECK(m_outputClusterContainer.commit()); + SG::WriteHandle< TestClusterContainer > outputHandle( m_outputClusterContainer, ctx ); + outputHandle = CxxUtils::make_unique<TestClusterContainer >(); + ATH_CHECK( outputHandle.commit() ); - m_outputClusterContainerAux = CxxUtils::make_unique<TestClusterAuxContainer>(); - ATH_CHECK(m_outputClusterContainerAux.commit()); - m_outputClusterContainer->setStore(m_outputClusterContainerAux.ptr()); + SG::WriteHandle< TestClusterAuxContainer > outputHandleAux( m_outputClusterContainerAux, ctx ); + outputHandleAux = CxxUtils::make_unique<TestClusterAuxContainer>(); + ATH_CHECK( outputHandleAux.commit() ); + outputHandle->setStore( outputHandleAux.ptr() ); ATH_MSG_INFO( "Launching processing for View with RoIs" ); - for ( const auto roi: *m_roisContainer.cptr() ) { + for ( const auto roi: *inputHandle.cptr() ) + { ATH_MSG_INFO( " ... " << *roi ); TestCluster * cl = new TestCluster(); - m_outputClusterContainer->push_back(cl); + outputHandle->push_back(cl); TestEDM::setClusterEt (cl, roi->eta()*10.0); // whatever values TestEDM::setClusterEta(cl, roi->eta()+0.01); TestEDM::setClusterPhi(cl, roi->phi()-0.05); diff --git a/Trigger/TrigSteer/ViewAlgsTest/src/SchedulerProxyAlg.h b/Trigger/TrigSteer/ViewAlgsTest/src/SchedulerProxyAlg.h index 5db7cdd57530acbfb68d3a4baa981060dc97b5fa..8dd2f6baa16bd55f5b9a494cf7d52dbdd27be7d1 100644 --- a/Trigger/TrigSteer/ViewAlgsTest/src/SchedulerProxyAlg.h +++ b/Trigger/TrigSteer/ViewAlgsTest/src/SchedulerProxyAlg.h @@ -8,24 +8,23 @@ #define ViewAlgs_SchedulerProxyAlg_h #include <string> -#include "AthViews/AthViewAlgorithm.h" +#include "AthenaBaseComps/AthAlgorithm.h" #include "TrigSteeringEvent/TrigRoiDescriptorCollection.h" #include "AthContainers/ConstDataVector.h" #include "./TestEDM.h" -class SchedulerProxyAlg : public AthViewAlgorithm { +class SchedulerProxyAlg : public AthAlgorithm { public: SchedulerProxyAlg(const std::string& name, ISvcLocator* pSvcLocator); StatusCode initialize(); StatusCode execute(); private: - SG::ReadHandle<ConstDataVector<TrigRoiDescriptorCollection> > m_roisContainer; - //SG::ReadHandle<TrigRoiDescriptorCollection> m_roisContainer; - SG::WriteHandle< TestClusterContainer > m_outputClusterContainer; - SG::WriteHandle< TestClusterAuxContainer > m_outputClusterContainerAux; + SG::ReadHandleKey<ConstDataVector<TrigRoiDescriptorCollection> > m_roisContainer; + SG::WriteHandleKey< TestClusterContainer > m_outputClusterContainer; + SG::WriteHandleKey< TestClusterAuxContainer > m_outputClusterContainerAux; }; diff --git a/Trigger/TrigSteer/ViewAlgsTest/src/TestViewDriver.cxx b/Trigger/TrigSteer/ViewAlgsTest/src/TestViewDriver.cxx index ca1c5cd812d7ca365bbe7ddb5557ab1ff98b3cc9..6571db36be29dca2375bedd04b5bc32d96b3d7f1 100644 --- a/Trigger/TrigSteer/ViewAlgsTest/src/TestViewDriver.cxx +++ b/Trigger/TrigSteer/ViewAlgsTest/src/TestViewDriver.cxx @@ -13,7 +13,7 @@ #include "./SchedulerProxy.h" #include "./TestViewDriver.h" - +enum RoIsInView { BareRoIDescriptor = 0, CollectionWithOneElement = 1, CollectionWithAllElements = 2, SuperRoI=3 }; TestViewDriver::TestViewDriver(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), @@ -29,7 +29,8 @@ TestViewDriver::TestViewDriver(const std::string& name, ISvcLocator* pSvcLocator declareProperty("RoIsContainer", m_roisContainer, "Input RoIs"); declareProperty("Views", m_views, "Name of the generated view" ); - + declareProperty("RoITypeInViews", m_roITypeInViews = 1, "0 - place TrigRoiDesciptor in views, 1 - place Collections wiht single RoI, 2 - place entrie collection in the view, 3 - place SuperRoI in single view "); + declareProperty("RoIKeyInViews", m_roIKeyInViews="ANewBeginning", "A key under which the roi descriptors appear in the view"); declareProperty("OutputClusterContainer", m_outputClusterContainer, "Output collection for clusters"); declareProperty("OutputClusterContainerAux", m_outputClusterContainerAux, ""); // declareProperty("OutputProxyContainer", m_outputProxyContainer, "Output proxies - this is returned by each fex and can be used to access actual objects"); @@ -45,29 +46,38 @@ StatusCode TestViewDriver::initialize() { StatusCode TestViewDriver::execute() { if ( not m_roisContainer.isValid() ) { - ATH_MSG_ERROR("No decisions object from previous stage"); + ATH_MSG_ERROR("No RoIs previous stage"); return StatusCode::FAILURE; } ATH_MSG_DEBUG("Running on " << m_roisContainer->size() << " RoIs"); - // Create a temporary WriteHandle to populate the views (this should maybe be done with a configurable handle instead) - SG::WriteHandle< ConstDataVector<TrigRoiDescriptorCollection> > roisForTheView("RegionOfReco"); - - // Divide the RoIs into a vector of single-element collections, one for each view - std::vector< ConstDataVector<TrigRoiDescriptorCollection> > roiCollections; + + // + std::vector<SG::View*> viewVector; + unsigned int viewCounter = 0; for ( const auto roi: *m_roisContainer.cptr() ) { - ConstDataVector<TrigRoiDescriptorCollection> oneRoI; - oneRoI.clear(SG::VIEW_ELEMENTS); //Don't delete the RoIs - oneRoI.push_back( roi ); - roiCollections.push_back( oneRoI ); + viewVector.push_back( ViewHelper::makeView(name()+"_view", viewCounter++) ); + + // Divide the RoIs into a vector of single-element collections, one for each view + if ( m_roITypeInViews == CollectionWithOneElement ) { + + auto oneRoIColl = new ConstDataVector<TrigRoiDescriptorCollection>; + oneRoIColl->clear(SG::VIEW_ELEMENTS); //Don't delete the RoIs + oneRoIColl->push_back( roi ); + CHECK( ViewHelper::addToView(viewVector.back(), m_roIKeyInViews, oneRoIColl ) ); + ATH_MSG_DEBUG("Placed RoICollection with a single RoI in the view"); + // just an RoI descriptor in the view + } else if ( m_roITypeInViews == BareRoIDescriptor ) { + + CHECK( ViewHelper::addToView(viewVector.back(), m_roIKeyInViews, new TrigRoiDescriptor(*roi) ) ); + + } } - - // Create the views and populate them - std::vector<SG::View*> viewVector; - CHECK( ViewHelper::MakeAndPopulate( name()+"_view", // Base name for all views to use - viewVector, // Vector to store views - roisForTheView, // A writehandle to use to access the views (the handle itself, not the contents) - roiCollections ) ); // Data to initialise each view - one view will be made per entry + if ( m_roITypeInViews == CollectionWithAllElements ) { + viewVector.push_back( ViewHelper::makeView(name()+"_view") ); + CHECK( ViewHelper::addViewCollectionToView( viewVector.back(), m_roIKeyInViews, m_roisContainer.cptr() ) ); + } + // missing is super RoI, and not covering the case when this alg can actually comsume more than on RoIs input collections // Run the views CHECK( ViewHelper::RunViews( viewVector, // Vector to store views @@ -75,9 +85,6 @@ StatusCode TestViewDriver::execute() { Gaudi::Hive::currentContext(), // Context to attach the views to serviceLocator()->service( "ViewAlgPool" ) ) ); // Service to retrieve algorithms by name (should make the service name configurable) - // Create a temporary ReadHandle to access the views (this should maybe be done with a configurable handle instead) - SG::ReadHandle< TestClusterContainer > viewClusters("Clusters"); - // Harvest the results into a merged collection - currently impossible due to issue with TrigComposite m_outputClusterContainer = CxxUtils::make_unique< TestClusterContainer >(); m_outputClusterContainerAux = CxxUtils::make_unique< TestClusterAuxContainer>(); @@ -86,11 +93,10 @@ StatusCode TestViewDriver::execute() { viewClusters, *m_outputClusterContainer ) );*/ - for ( auto view : viewVector ) { - CHECK(viewClusters.setProxyDict(view)); - - for ( auto cl: *viewClusters.cptr() ) { + const TestClusterContainer* viewClusters = ViewHelper::getFromView<TestClusterContainer>(view, "Clusters"); + + for ( auto cl: *viewClusters ) { ATH_MSG_DEBUG("Pulling cluster from the view of Et " << TestEDM::getClusterEt(cl) ); } diff --git a/Trigger/TrigSteer/ViewAlgsTest/src/TestViewDriver.h b/Trigger/TrigSteer/ViewAlgsTest/src/TestViewDriver.h index e88e91a47bd71deca003072594606d7f727db3f6..bc3737c7f7d90e79f36642705341d0ba185df51d 100644 --- a/Trigger/TrigSteer/ViewAlgsTest/src/TestViewDriver.h +++ b/Trigger/TrigSteer/ViewAlgsTest/src/TestViewDriver.h @@ -34,6 +34,8 @@ private: // SG::WriteHandle< xAOD::TrigCompositeAuxContainer > m_outputProxyContainerAux; std::vector<std::string> m_viewAlgorithmNames; + int m_roITypeInViews; + std::string m_roIKeyInViews; }; #endif diff --git a/Trigger/TrigValidation/TrigUpgradeTest/CMakeLists.txt b/Trigger/TrigValidation/TrigUpgradeTest/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..05e50a655e5c00147e8ab7353d9a49965de79b5c --- /dev/null +++ b/Trigger/TrigValidation/TrigUpgradeTest/CMakeLists.txt @@ -0,0 +1,12 @@ +################################################################################ +# Package: TrigUpgradeTest +################################################################################ + +# Declare the package name: +atlas_subdir( TrigUpgradeTest ) + +# Declare the package's dependencies: +atlas_depends_on_subdirs( PUBLIC + TestPolicy + ) +atlas_install_runtime( test/TrigUpgradeTest_TestConfiguration.xml ) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/test/TrigUpgradeTest_TestConfiguration.xml b/Trigger/TrigValidation/TrigUpgradeTest/test/TrigUpgradeTest_TestConfiguration.xml new file mode 100644 index 0000000000000000000000000000000000000000..1eb71661e37fcee198d6324fecde5c53b8a02710 --- /dev/null +++ b/Trigger/TrigValidation/TrigUpgradeTest/test/TrigUpgradeTest_TestConfiguration.xml @@ -0,0 +1,67 @@ +<?xml version="1.0"?> +<!DOCTYPE unifiedTestConfiguration SYSTEM "http://www.hep.ucl.ac.uk/atlas/AtlasTesting/DTD/unifiedTestConfiguration.dtd"> +<!-- + *************************************************************************** + * + * TrigP1Test_TestConfiguration.xml.autoconf + * + * This file is used as input to test-xml-autoconf.py during the build. + * It will create TrigP1Test_TestConfiguraton.xml on-the-fly, which is + * used by ATN and RTT tests. + * + * For detailed syntax see: TrigValTools/bin/test-xml-autoconf.py + * + *************************************************************************** + --> +<!-- NB validate this file here before commiting to svn: + /afs/cern.ch/user/r/rtt/public/xmlvalidate.py TrigP1Test_TestConfiguration.xml + --> + +<unifiedTestConfiguration> + + <atn> + <TEST name="menuRun" type="script" suite="TUT"> + <options_atn>get_files -xmls LVL1config_Physics_pp_v7.xml; get_files -xmls HLTTestMenu.xml; athena.py ViewAlgsTest/menuRun.py</options_atn> + <timelimit>5</timelimit> + <expectations> + <returnValue>0</returnValue> + </expectations> + </TEST> + <TEST name="IDRunMC" type="script" suite="TUT"> + <options_atn>get_files -xmls LVL1config_Physics_pp_v7.xml; get_files -data caloRoIData.dat; athena.py --threads=1 ViewAlgsTest/BasicMTTrackingTrigger.py</options_atn> + <timelimit>20</timelimit> + <expectations> + <returnValue>0</returnValue> + </expectations> + </TEST> + <TEST name="IDRunData" type="script" suite="TUT"> + <options_atn>get_files -xmls LVL1config_Physics_pp_v7.xml; athena.py --threads=1 ViewAlgsTest/ID_RawDataMT_Trigger.py</options_atn> + <timelimit>20</timelimit> + <expectations> + <returnValue>0</returnValue> + </expectations> + </TEST> + <TEST name="GraphView1" type="script" suite="TUT"> + <options_atn>athena.py --threads=1 AthViews/GraphViews.py </options_atn> + <timelimit>5</timelimit> + <expectations> + <returnValue>0</returnValue> + </expectations> + </TEST> + <TEST name="GraphView2" type="script" suite="TUT"> + <options_atn>athena.py --threads=2 AthViews/GraphViews.py </options_atn> + <timelimit>5</timelimit> + <expectations> + <returnValue>0</returnValue> + </expectations> + </TEST> + <TEST name="GraphView64" type="script" suite="TUT"> + <options_atn>athena.py --threads=64 AthViews/GraphViews.py </options_atn> + <timelimit>5</timelimit> + <expectations> + <returnValue>0</returnValue> + </expectations> + </TEST> + </atn> + +</unifiedTestConfiguration>