diff --git a/Control/AthenaServices/CMakeLists.txt b/Control/AthenaServices/CMakeLists.txt index aba359a0dc2a193997cdb4041c7b9f354d089728..f0cab614f4d25b3bac75c96bbd2949a0aa8d4c7b 100644 --- a/Control/AthenaServices/CMakeLists.txt +++ b/Control/AthenaServices/CMakeLists.txt @@ -1,4 +1,4 @@ -# $Id: CMakeLists.txt 753795 2016-06-08 23:37:56Z ssnyder $ +# $Id: CMakeLists.txt 771853 2016-09-05 19:26:14Z ssnyder $ ################################################################################ # Package: AthenaServices ################################################################################ @@ -68,6 +68,12 @@ atlas_add_test( AthenaEventLoopMgr_test EXTRA_PATTERNS "^JobOptionsSvc +INFO|^//GP:=" ENVIRONMENT "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/share" ) +atlas_add_test( RCUSvc_test + SOURCES test/RCUSvc_test.cxx + LINK_LIBRARIES TestTools AthenaKernel GaudiKernel EventInfo AthenaBaseComps + EXTRA_PATTERNS "^JobOptionsSvc +INFO|^//GP:=" + ENVIRONMENT "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/share" ) + atlas_add_test( TestStopRun SCRIPT test/TestStopRun.sh EXTRA_PATTERNS "SGAudSvc +INFO Finalizing|SGAudSvc +INFO Initializing|^Py:Athena +INFO executing ROOT6Setup|No duplicates have been found|duplicate entry.*ignored|^Py:ConfigurableDb WARNING|Read module info for|^ToolSvc.* INFO( finalize:)? Removing all tools|^CoreDumpSvc *INFO Handling signals|types added|including file|^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)|local .* libGaudiKernelDict.so|^Number of My|^Py:Athena +INFO using release|^StoreGateSvc +INFO Start|^Py:AthenaDsoDb +INFO could not install alias|Bindings.py:660newobj = object.__new__|Updating ROOT::Reflex::PluginService::SetDebug|^ApplicationMgr +INFO|^StoreGateSvc +INFO" diff --git a/Control/AthenaServices/cmt/requirements b/Control/AthenaServices/cmt/requirements index 6859003714ed74e28d799591a2214b8504caa6e1..cde7dde8e2e5cfdfd769348e9cd34d79d9656a43 100644 --- a/Control/AthenaServices/cmt/requirements +++ b/Control/AthenaServices/cmt/requirements @@ -73,6 +73,10 @@ apply_pattern UnitTest_run unit_test=AthenaEventLoopMgr \ extrapatterns="^JobOptionsSvc +INFO|^//GP:=" macro_append AthenaEventLoopMgr_testlinkopts " -L../$(CMTCONFIG) -lAthenaServices" +apply_pattern UnitTest_run unit_test=RCUSvc \ + extrapatterns="^JobOptionsSvc +INFO|^//GP:=" +macro_append AthenaEventLoopMgr_testlinkopts " -L../$(CMTCONFIG) -lAthenaServices" + apply_pattern athenarun_test name="TestStopRun" \ pre_script="../cmt/setup.sh" \ options="AthenaServices/TestStopRun.py" \ diff --git a/Control/AthenaServices/python/Configurables.py b/Control/AthenaServices/python/Configurables.py index b1bcc07a8a1c0eaff99080ab90f8d6fde250c1b0..33229cb3b9845548f740d246674a3f4d0ea814d0 100644 --- a/Control/AthenaServices/python/Configurables.py +++ b/Control/AthenaServices/python/Configurables.py @@ -100,6 +100,8 @@ class ThinningSvc( _ThinningSvc ): for item in itemlist: clid_or_name, sg_key = item.split('#') clid_or_name = clid_or_name.strip() + if clid_or_name.endswith('!'): # Strip exact flag. + clid_or_name = clid_or_name[:-1] sg_key = sg_key.strip() clid_or_name = _clid_from_string(clid_or_name) if clid_or_name is None: diff --git a/Control/AthenaServices/share/AthenaOutputStream_test.ref b/Control/AthenaServices/share/AthenaOutputStream_test.ref index 876f086e465ab70823c6736e469d29880827f9ff..b4f37dda45991a3435a7e975f5017bc1d16c5acc 100644 --- a/Control/AthenaServices/share/AthenaOutputStream_test.ref +++ b/Control/AthenaServices/share/AthenaOutputStream_test.ref @@ -2,7 +2,7 @@ Initializing Gaudi ApplicationMgr using job opts ../share/AthenaOutputStream_test.txt -JobOptionsSvc INFO # =======> /home/sss/atlas/dvtest/build/../tests/../share/AthenaOutputStream_test.txt +JobOptionsSvc INFO # =======> /afs/cern.ch/user/s/ssnyder/atlas-work3e/Control/AthenaServices/share/../share/AthenaOutputStream_test.txt JobOptionsSvc INFO # (5,1): MessageSvc.OutputLevel = 2 JobOptionsSvc INFO # (6,1): StoreGateSvc.OutputLevel = 2 JobOptionsSvc INFO # (8,1): AthenaOutputStream.OutputLevel = 1 @@ -12,8 +12,8 @@ JobOptionsSvc INFO Job options successfully read in from ../share/AthenaO ApplicationMgr DEBUG Getting my own properties ApplicationMgr SUCCESS ==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v27r1p99) - running on karma on Mon May 16 14:33:25 2016 + Welcome to ApplicationMgr (GaudiCoreSvc v4r1) + running on lxplus013.cern.ch on Wed Oct 19 20:14:12 2016 ==================================================================================================================================== ApplicationMgr INFO Application Manager Configured successfully ServiceManager DEBUG Initializing service AppMgrRunable @@ -25,6 +25,8 @@ EventLoopMgr DEBUG Service base class initialized successfully IncidentSvc DEBUG Property update for OutputLevel : new value = 2 IncidentSvc DEBUG Service base class initialized successfully IncidentSvc DEBUG Adding [AbortEvent] listener '<unknown>' with priority 0 +AlgExecStateSvc DEBUG Property update for OutputLevel : new value = 2 +AlgExecStateSvc DEBUG Service base class initialized successfully EventDataSvc DEBUG Property update for OutputLevel : new value = 2 EventDataSvc DEBUG Service base class initialized successfully EventPersistenc... DEBUG Property update for OutputLevel : new value = 2 @@ -39,21 +41,26 @@ HistogramPersis...WARNING Histograms saving not required. ApplicationMgr INFO Application Manager Initialized successfully ApplicationMgr Ready ClassIDSvc DEBUG Property update for OutputLevel : new value = 2 -ClassIDSvc INFO Initializing ClassIDSvc - package version CLIDComps-00-00-00 ClassIDSvc DEBUG Service base class initialized successfully IncidentSvc DEBUG Adding [ModuleLoaded] listener 'ClassIDSvc' with priority 100 -ClassIDSvc INFO getRegistryEntries: read 2161 CLIDRegistry entries for module ALL -ClassIDSvc DEBUG processCLIDDB: read 412 entries from CLIDDB file: /home/sss/atlas/dvtest/build/share/clid.db -StoreGateSvc INFO Initializing StoreGateSvc - package version StoreGate-00-00-00 +ClassIDSvc INFO getRegistryEntries: read 883 CLIDRegistry entries for module ALL +ClassIDSvc DEBUG processCLIDDB: read 1342 entries from CLIDDB file: /afs/cern.ch/user/s/ssnyder/atlas-work3e/build-x86_64-slc6-gcc49-dbg/x86_64-slc6-gcc49-dbg/share/clid.db +ClassIDSvc DEBUG processCLIDDB: read 13339 entries from CLIDDB file: /afs/cern.ch/atlas/software/builds/nightlies/devval/AtlasOffline/rel_3/InstallArea/x86_64-slc6-gcc49-dbg/share/clid.db +ClassIDSvc DEBUG processCLIDDB: read 175372 entries from CLIDDB file: /afs/cern.ch/atlas/software/builds/nightlies/devval/AtlasSimulation/rel_3/InstallArea/x86_64-slc6-gcc49-dbg/share/clid.db +ClassIDSvc DEBUG processCLIDDB: read 202983 entries from CLIDDB file: /afs/cern.ch/atlas/software/builds/nightlies/devval/AtlasAnalysis/rel_3/InstallArea/x86_64-slc6-gcc49-dbg/share/clid.db +ClassIDSvc DEBUG processCLIDDB: read 202546 entries from CLIDDB file: /afs/cern.ch/atlas/software/builds/nightlies/devval/AtlasTrigger/rel_3/InstallArea/x86_64-slc6-gcc49-dbg/share/clid.db +ClassIDSvc DEBUG processCLIDDB: read 390248 entries from CLIDDB file: /afs/cern.ch/atlas/software/builds/nightlies/devval/AtlasReconstruction/rel_3/InstallArea/x86_64-slc6-gcc49-dbg/share/clid.db +ClassIDSvc DEBUG processCLIDDB: read 40139 entries from CLIDDB file: /afs/cern.ch/atlas/software/builds/nightlies/devval/AtlasEvent/rel_3/InstallArea/x86_64-slc6-gcc49-dbg/share/clid.db +ClassIDSvc DEBUG processCLIDDB: read 11751 entries from CLIDDB file: /afs/cern.ch/atlas/software/builds/nightlies/devval/AtlasConditions/rel_3/InstallArea/x86_64-slc6-gcc49-dbg/share/clid.db +ClassIDSvc DEBUG processCLIDDB: read 2716 entries from CLIDDB file: /afs/cern.ch/atlas/software/builds/nightlies/devval/AtlasCore/rel_3/InstallArea/x86_64-slc6-gcc49-dbg/share/clid.db StoreGateSvc DEBUG Property update for OutputLevel : new value = 2 StoreGateSvc DEBUG Service base class initialized successfully IncidentSvc DEBUG Adding [EndEvent] listener 'StoreGateSvc' with priority 100 IncidentSvc DEBUG Adding [BeginEvent] listener 'StoreGateSvc' with priority 100 ProxyProviderSvc DEBUG Property update for OutputLevel : new value = 2 -ProxyProviderSvc INFO Initializing ProxyProviderSvc - package version SGComps-00-00-00 ToolSvc DEBUG Property update for OutputLevel : new value = 2 ToolSvc DEBUG Service base class initialized successfully -ClassIDSvc INFO getRegistryEntries: read 345 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 1982 CLIDRegistry entries for module ALL AthenaOutputStream DEBUG Property update for OutputLevel : new value = 1 AthenaOutputStreamVERBOSE ServiceLocatorHelper::service: found service EventDataSvc TimelineSvc DEBUG Property update for OutputLevel : new value = 2 @@ -75,26 +82,26 @@ AthenaOutputStream DEBUG Found StoreGateSvc store. ItemListSvc DEBUG Property update for OutputLevel : new value = 2 ItemListSvc DEBUG ItemListSvc initialize OutputStreamSeq... DEBUG Property update for OutputLevel : new value = 2 -OutputStreamSeq... INFO Initializing OutputStreamSequencerSvc - package version AthenaServices-00-00-00 +OutputStreamSeq... INFO Initializing OutputStreamSequencerSvc - package version AthenaServices-01-60-32 MetaDataSvc DEBUG Property update for OutputLevel : new value = 2 -MetaDataSvc INFO Initializing MetaDataSvc - package version AthenaServices-00-00-00 -InputMetaDataStore INFO Initializing InputMetaDataStore - package version StoreGate-00-00-00 +MetaDataSvc INFO Initializing MetaDataSvc - package version AthenaServices-01-60-32 InputMetaDataStore DEBUG Property update for OutputLevel : new value = 2 InputMetaDataStore DEBUG Service base class initialized successfully IncidentSvc DEBUG Adding [EndEvent] listener 'InputMetaDataStore' with priority 100 IncidentSvc DEBUG Adding [BeginEvent] listener 'InputMetaDataStore' with priority 100 -MetaDataStore INFO Initializing MetaDataStore - package version StoreGate-00-00-00 MetaDataStore DEBUG Property update for OutputLevel : new value = 2 MetaDataStore DEBUG Service base class initialized successfully IncidentSvc DEBUG Adding [EndEvent] listener 'MetaDataStore' with priority 100 IncidentSvc DEBUG Adding [BeginEvent] listener 'MetaDataStore' with priority 100 AthenaPoolCnvSvc DEBUG Property update for OutputLevel : new value = 2 -AthenaPoolCnvSvc INFO Initializing AthenaPoolCnvSvc - package version AthenaPoolCnvSvc-00-00-00 +AthenaPoolCnvSvc INFO Initializing AthenaPoolCnvSvc - package version AthenaPoolCnvSvc-00-30-05 DataModelCompatSvc DEBUG Property update for OutputLevel : new value = 2 DataModelCompatSvc DEBUG FILE:LINE (StatusCode DataModelCompatSvc::initialize()): running IncidentSvc DEBUG Adding [BeginEvent] listener 'DataModelCompatSvc' with priority 0 +Warning in <TInterpreter::ReadRootmapFile>: class CaloSampling found in libCaloEventDict.so is already in libISF_FastCaloSimParametrizationLib.so +Warning in <TInterpreter::ReadRootmapFile>: class IntArray found in libISF_FastCaloSimEvent.so is already in libISF_FastCaloSimParametrizationLib.so PoolSvc DEBUG Property update for OutputLevel : new value = 2 -PoolSvc INFO Initializing PoolSvc - package version PoolSvc-00-00-00 +PoolSvc INFO Initializing PoolSvc - package version PoolSvc-00-25-05 AthenaSealSvc DEBUG Property update for OutputLevel : new value = 2 ChronoStatSvc DEBUG Property update for OutputLevel : new value = 2 ChronoStatSvc DEBUG Service base class initialized successfully @@ -116,18 +123,24 @@ PoolSvc INFO io_register[PoolSvc](xmlcatalog_file:PoolFileCatalog.x PoolSvc INFO Set connectionsvc retry/timeout/IDLE timeout to 'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled PoolSvc INFO Frontier compression level set to 5 DBReplicaSvc DEBUG Property update for OutputLevel : new value = 2 -DBReplicaSvc DEBUG HOSTNAME has no domain - try hostname --fqdn -DBReplicaSvc DEBUG HOSTNAME from fqdn: karma -DBReplicaSvc INFO Read replica configuration from /home/sss/atlas/dvtest/build/share/dbreplica.config -DBReplicaSvc INFO No specific match for domain found - use default fallback -DBReplicaSvc DEBUG Candidate server atlas_dd (priority 5) -DBReplicaSvc INFO Total of 1 servers found for host karma [atlas_dd ] +DBReplicaSvc INFO Frontier server at (serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://aiatlas036.cern.ch:8000/atlr)(serverurl=http://aiatlas034.cern.ch:8000/atlr)(serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(serverurl=http://ccsqfatlasli02.in2p3.fr:23128/ccin2p3-AtlasFrontier)(serverurl=http://ccsqfatlasli01.in2p3.fr:23128/ccin2p3-AtlasFrontier)(proxyurl=http://ca-proxy.cern.ch:3128)(proxyurl=http://ca18.cern.ch:3128)(proxyurl=http://ca17.cern.ch:3128)(proxyurl=http://atlast0fsquid.cern.ch:3128)(proxyurl=http://atlassquid1.cern.ch:3128)(proxyurl=http://atlassquid2.cern.ch:3128)(proxyurl=http://atlassquid4.cern.ch:3128) will be considered for COOL data +DBReplicaSvc INFO Read replica configuration from /afs/cern.ch/atlas/software/builds/nightlies/devval/AtlasCore/rel_3/InstallArea/x86_64-slc6-gcc49-dbg/share/dbreplica.config +DBReplicaSvc DEBUG Candidate server ATLF (priority -2700) +DBReplicaSvc DEBUG Candidate server ATLAS_COOLPROD (priority -695) +DBReplicaSvc DEBUG Candidate server atlas_dd (priority -690) +DBReplicaSvc DEBUG Candidate server ATLAS_CONFIG (priority -685) +DBReplicaSvc DEBUG Candidate server INT8R (priority -680) +DBReplicaSvc DEBUG Candidate server INTR (priority -675) +DBReplicaSvc DEBUG Candidate server ATONR_COOL (priority -670) +DBReplicaSvc DEBUG Candidate server ATONR_CONF (priority -665) +DBReplicaSvc DEBUG Candidate server DEVDB11 (priority -660) +DBReplicaSvc DEBUG Candidate server ATLF (priority -2200) +DBReplicaSvc INFO Total of 10 servers found for host lxplus013.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ] PoolSvc INFO Successfully setup replica sorting algorithm PoolSvc DEBUG OutputLevel is 2 -PoolSvc INFO Re-initializing PoolSvc +PoolSvc INFO Setting up APR FileCatalog and Streams PoolSvc INFO POOL WriteCatalog is xmlcatalog_file:PoolFileCatalog.xml -XMLFileCatalog Info Connecting to the catalog -PoolXMLFileCatalog Info Xerces-c initialization Number 0 +PoolSvc INFO Re-initializing PoolSvc FileMgr DEBUG Property update for OutputLevel : new value = 2 FileMgr DEBUG Service base class initialized successfully FileMgr DEBUG Successfully registered handler for tech "ROOT" @@ -156,30 +169,32 @@ IoComponentMgr DEBUG --> io_hasitem() AthenaOutputStream INFO I/O reinitialization... IncidentSvc DEBUG Adding [MetaDataStop] listener 'AthenaOutputStream' with priority 50 AthenaOutputStream DEBUG End initialize +AthenaOutputStreamVERBOSE ServiceLocatorHelper::service: found service AlgExecStateSvc +AlgExecStateSvc DEBUG preInit: will add Alg AthenaOutputStream later AthenaOutputStream DEBUG input handles: 0 AthenaOutputStream DEBUG output handles: 0 AthenaOutputStream DEBUG Registering all Tools in ToolHandleArray HelperTools AthenaOutputStream DEBUG Adding private ToolHandle tool AthenaOutputStream.AthenaOutputStreamTool (AthenaOutputStreamTool) AthenaOutputStream DEBUG Data Deps for AthenaOutputStream -StoreGateSvc DEBUG Recorded object @0xca19e0 with key uno of type Foo(CLID 8101) - in DataObject @0x2da0f40 +StoreGateSvc DEBUG Recorded object @0x4b507b0 with key uno of type Foo(CLID 8101) + in DataObject @0x4b490c0 object modifiable when retrieved -StoreGateSvc DEBUG Recorded object @0x2da2280 with key due of type Foo(CLID 8101) - in DataObject @0x2da2030 +StoreGateSvc DEBUG Recorded object @0x4b50f10 with key due of type Foo(CLID 8101) + in DataObject @0x4b50760 object modifiable when retrieved -StoreGateSvc DEBUG Recorded object @0x2da24e0 with key uno of type Bar(CLID 8107) - in DataObject @0x2da2430 +StoreGateSvc DEBUG Recorded object @0x4b51280 with key uno of type Bar(CLID 8107) + in DataObject @0x4b512a0 object modifiable when retrieved -StoreGateSvc DEBUG Recorded object @0x2da2830 with key due of type Bar(CLID 8107) - in DataObject @0x2da2780 +StoreGateSvc DEBUG Recorded object @0x4b515a0 with key due of type Bar(CLID 8107) + in DataObject @0x4b515f0 object modifiable when retrieved -StoreGateSvc DEBUG Recorded object @0x2da2b20 with key quattro of type Bar(CLID 8107) - in DataObject @0x2da2a70 +StoreGateSvc DEBUG Recorded object @0x4b51890 with key quattro of type Bar(CLID 8107) + in DataObject @0x4b518b0 object modifiable when retrieved -StoreGateSvc DEBUG Recorded object @0x2da2e70 with key cinque of type Bar(CLID 8107) - in DataObject @0x2da2dc0 +StoreGateSvc DEBUG Recorded object @0x4b51b50 with key cinque of type Bar(CLID 8107) + in DataObject @0x4b51b70 object modifiable when retrieved -ClassIDSvc INFO getRegistryEntries: read 988 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 803 CLIDRegistry entries for module ALL AthenaOutputStr...WARNING add: can not find clid 13 in clid db AthenaOutputStream DEBUG addItemObjects(13,"*") called AthenaOutputStream DEBUG Key:* diff --git a/Control/AthenaServices/share/FPEControlSvc_test.ref b/Control/AthenaServices/share/FPEControlSvc_test.ref index 7e4c44940b12e43b080eef7bdaec7957009a19f1..dce5ec98626eb2fe6b0b8ca0a2e213d454302873 100644 --- a/Control/AthenaServices/share/FPEControlSvc_test.ref +++ b/Control/AthenaServices/share/FPEControlSvc_test.ref @@ -1,21 +1,19 @@ Initializing Gaudi ApplicationMgr using job opts ../share/FPEControlSvc_test.txt -JobOptionsSvc INFO -//GP:================================================================================ -//GP: include "../share/FPEControlSvc_test.txt" (0,0) -ApplicationMgr.DLLs += [ "AthenaServices" ] ; //GP: (1,1) -ApplicationMgr.ExtSvc += [ "FPEControlSvc" ] ; //GP: (1,1) -//GP: end "../share/FPEControlSvc_test.txt" (7,1) -//GP:================================================================================ - +/cvmfs/sft.cern.ch/lcg/contrib/gcc/4.9.3/x86_64-slc6/include/c++/4.9.3/bits/regex.h:1545:11: runtime error: load of value 80, which is not a valid value for type 'bool' +JobOptionsSvc INFO # =======> /afs/cern.ch/work/s/ssnyder/builds/atlas-work3/build-x86_64-slc6-gcc49-dbg/Control/AthenaServices/unitTestRun/../share/FPEControlSvc_test.txt +JobOptionsSvc INFO # (5,1): ApplicationMgr.DLLs += ["AthenaServices"] +JobOptionsSvc INFO # (6,1): ApplicationMgr.ExtSvc += ["FPEControlSvc"] JobOptionsSvc INFO Job options successfully read in from ../share/FPEControlSvc_test.txt ApplicationMgr SUCCESS ==================================================================================================================================== - Welcome to ApplicationMgr $Revision: 1.77 $ - running on lxplus252.cern.ch on Mon Oct 3 20:57:31 2011 + Welcome to ApplicationMgr (GaudiCoreSvc v28r0) + running on lxplus032.cern.ch on Sat Dec 24 03:47:01 2016 ==================================================================================================================================== +/cvmfs/sft.cern.ch/lcg/contrib/gcc/4.9.3/x86_64-slc6/include/c++/4.9.3/bits/regex.h:1545:11: runtime error: load of value 240, which is not a valid value for type 'bool' ApplicationMgr INFO Successfully loaded modules : AthenaServices +FPEControlSvc INFO FILE:LINE (void FPEControlSvc::prophand(Property&)): Enable: divbyzero overflow invalid Disable: (none) ApplicationMgr INFO Application Manager Configured successfully FPEControlSvc INFO FILE:LINE (void FPEControlSvc::prophand(Property&)): Enable: divbyzero overflow invalid Disable: (none) EventLoopMgr WARNING Unable to locate service "EventSelector" diff --git a/Control/AthenaServices/share/RCUSvc_test.ref b/Control/AthenaServices/share/RCUSvc_test.ref new file mode 100644 index 0000000000000000000000000000000000000000..3761336104f50e446b419ecfd9b31f500bbb3940 --- /dev/null +++ b/Control/AthenaServices/share/RCUSvc_test.ref @@ -0,0 +1,43 @@ + + +Initializing Gaudi ApplicationMgr using job opts ../share/RCUSvc_test.txt +JobOptionsSvc INFO # =======> /home/sss/atlas/dvtest/build/../tests/../share/RCUSvc_test.txt +JobOptionsSvc INFO # (4,1): MessageSvc.OutputLevel = 2 +JobOptionsSvc INFO # (6,1): RCUSvc.HiveWhiteBoardSvc = "TestWhiteBoard" +JobOptionsSvc INFO Job options successfully read in from ../share/RCUSvc_test.txt +ApplicationMgr DEBUG Getting my own properties +ApplicationMgr SUCCESS +==================================================================================================================================== + Welcome to ApplicationMgr (GaudiCoreSvc v27r1p99) + running on karma on Wed Aug 31 23:21:11 2016 +==================================================================================================================================== +ApplicationMgr INFO Application Manager Configured successfully +ServiceManager DEBUG Initializing service AppMgrRunable +AppMgrRunable DEBUG Property update for OutputLevel : new value = 2 +AppMgrRunable DEBUG Service base class initialized successfully +ServiceManager DEBUG Initializing service EventLoopMgr +EventLoopMgr DEBUG Property update for OutputLevel : new value = 2 +EventLoopMgr DEBUG Service base class initialized successfully +IncidentSvc DEBUG Property update for OutputLevel : new value = 2 +IncidentSvc DEBUG Service base class initialized successfully +IncidentSvc DEBUG Adding [AbortEvent] listener '<unknown>' with priority 0 +AlgExecStateSvc DEBUG Property update for OutputLevel : new value = 2 +AlgExecStateSvc DEBUG Service base class initialized successfully +EventDataSvc DEBUG Property update for OutputLevel : new value = 2 +EventDataSvc DEBUG Service base class initialized successfully +EventPersistenc... DEBUG Property update for OutputLevel : new value = 2 +EventPersistenc... DEBUG Service base class initialized successfully +EventLoopMgr WARNING Unable to locate service "EventSelector" +EventLoopMgr WARNING No events will be processed from external input. +HistogramDataSvc DEBUG Property update for OutputLevel : new value = 2 +HistogramDataSvc DEBUG Service base class initialized successfully +HistogramPersis... DEBUG 'CnvServices':[ 'RootHistSvc' ] +HistogramPersis... DEBUG Service base class initialized successfully +HistogramPersis...WARNING Histograms saving not required. +ApplicationMgr INFO Application Manager Initialized successfully +ApplicationMgr Ready +RCUSvc DEBUG Property update for OutputLevel : new value = 2 +TestWhiteBoard DEBUG Property update for OutputLevel : new value = 2 +IncidentSvc DEBUG Adding [EndEvent] listener 'RCUSvc' with priority 0 +test1 +test2 diff --git a/Control/AthenaServices/share/RCUSvc_test.txt b/Control/AthenaServices/share/RCUSvc_test.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ef070300fe86c4364ea4aef862ff5b0c1a7a28d --- /dev/null +++ b/Control/AthenaServices/share/RCUSvc_test.txt @@ -0,0 +1,7 @@ +// $Id$ +// job opts for RCUSvc unit test + +MessageSvc.OutputLevel = 2; + +Athena::RCUSvc.HiveWhiteBoardSvc = "TestWhiteBoard"; + diff --git a/Control/AthenaServices/src/AthDictLoaderSvc.cxx b/Control/AthenaServices/src/AthDictLoaderSvc.cxx index a9cc5fe2aa578bd136e436760e1126e23b75166d..83e9ee7178bd04499ede169c7f384a75669ec91e 100644 --- a/Control/AthenaServices/src/AthDictLoaderSvc.cxx +++ b/Control/AthenaServices/src/AthDictLoaderSvc.cxx @@ -29,7 +29,7 @@ AthDictLoaderSvc::AthDictLoaderSvc (const std::string& name, ISvcLocator* pSvcLocator) : ::AthService( name, pSvcLocator ), - m_dsodb (NULL), + m_dsodb (nullptr), m_doRecursiveLoad (true), m_clidSvc ("ClassIDSvc", name) { diff --git a/Control/AthenaServices/src/AthTPCnvSvc.cxx b/Control/AthenaServices/src/AthTPCnvSvc.cxx index cbeba45f29e1582404173079f0caa6a14e366fb1..7b466fde5a6dcf0a253775ea25b275cc28787c9c 100644 --- a/Control/AthenaServices/src/AthTPCnvSvc.cxx +++ b/Control/AthenaServices/src/AthTPCnvSvc.cxx @@ -57,7 +57,7 @@ ITPCnvBase* AthTPCnvSvc::load_tpcnv(const std::string& cls) { ITPCnvBase* cnv = ITPCnvBase::Factory::create (cls); - if (cnv == 0) { + if (cnv == nullptr) { ATH_MSG_INFO("could not load class [" << cls << "] via Reflex::PluginService"); } @@ -76,9 +76,9 @@ AthTPCnvSvc::t2p_cnv(const std::string& transClassName, { ITPCnvBase* cnv = ITPCnvBase::Factory::create (prefix(type) + "_TRANS_" + transClassName); - if (cnv == 0 && type != Athena::TPCnvType::Athena) + if (cnv == nullptr && type != Athena::TPCnvType::Athena) return t2p_cnv (transClassName); - if (cnv == 0) { + if (cnv == nullptr) { ATH_MSG_WARNING("Could not load converter for transient class [" << transClassName << "]"); } @@ -98,22 +98,22 @@ AthTPCnvSvc::t2p_cnv(const CLID& transClid, std::string trans_type; if (!m_clidSvc->getTypeNameOfID(transClid, trans_type).isSuccess()) { ATH_MSG_INFO("could not get a type-name for clid [" << transClid << "]"); - return 0; + return nullptr; } ITPCnvBase* cnv = ITPCnvBase::Factory::create (prefix(type) + "_TRANS_" + trans_type); - if (cnv == 0) { + if (cnv == nullptr) { // try a typeinfo-name before bailing out... if (!m_clidSvc->getTypeInfoNameOfID(transClid, trans_type).isSuccess()) { ATH_MSG_INFO("could not get a typeinfo-name for clid [" << transClid << "]"); - return 0; + return nullptr; } cnv = ITPCnvBase::Factory::create (prefix(type) + "_TRANS_" + trans_type); } - if (cnv == 0 && type != Athena::TPCnvType::Athena) + if (cnv == nullptr && type != Athena::TPCnvType::Athena) return t2p_cnv (transClid); - if (cnv == 0) { + if (cnv == nullptr) { ATH_MSG_WARNING("could not load converter for transient CLID [" << transClid << "] (" << trans_type << ")"); } @@ -131,9 +131,9 @@ AthTPCnvSvc::p2t_cnv(const std::string& persClassName, Athena::TPCnvType::Value type /*= Athena::TPCnvType::Athena*/) { ITPCnvBase* cnv = ITPCnvBase::Factory::create (prefix(type) + "_PERS_" + persClassName); - if (cnv == 0 && type != Athena::TPCnvType::Athena) + if (cnv == nullptr && type != Athena::TPCnvType::Athena) return p2t_cnv (persClassName); - if (cnv == 0) { + if (cnv == nullptr) { ATH_MSG_WARNING("Could not load converter for persistent class [" << persClassName << "]"); } diff --git a/Control/AthenaServices/src/AthenaEventLoopMgr.cxx b/Control/AthenaServices/src/AthenaEventLoopMgr.cxx index 63c7a6788f463ae470743f04e1c0f3df5f4875fd..fcb420202215a7a771d288953e0edbc323181d43 100644 --- a/Control/AthenaServices/src/AthenaEventLoopMgr.cxx +++ b/Control/AthenaServices/src/AthenaEventLoopMgr.cxx @@ -52,11 +52,11 @@ AthenaEventLoopMgr::AthenaEventLoopMgr(const std::string& nam, : MinimalEventLoopMgr(nam, svcLoc), m_incidentSvc ( "IncidentSvc", nam ), m_eventStore( "StoreGateSvc", nam ), - m_evtSelector(0), m_evtContext(0), + m_evtSelector(nullptr), m_evtContext(nullptr), m_histoDataMgrSvc( "HistogramDataSvc", nam ), m_histoPersSvc ( "HistogramPersistencySvc", nam ), m_activeStoreSvc ( "ActiveStoreSvc", nam ), - m_pITK(0), + m_pITK(nullptr), m_currentRun(0), m_firstRun(true), m_tools(this), m_nevt(0), m_writeHists(false), m_msg( msgSvc(), nam ), m_nev(0), m_proc(0), m_useTools(false), @@ -115,7 +115,7 @@ StatusCode AthenaEventLoopMgr::initialize() m_msg.setLevel( m_outputLevel.value() ); m_msg << MSG::INFO << "Initializing " << name() - << " - package version " << PACKAGE_VERSION << endreq ; + << " - package version " << PACKAGE_VERSION << endmsg ; StatusCode sc = MinimalEventLoopMgr::initialize(); @@ -123,7 +123,7 @@ StatusCode AthenaEventLoopMgr::initialize() { m_msg << MSG::ERROR << "Failed to initialize base class MinimalEventLoopMgr" - << endreq; + << endmsg; return sc; } else { // re-configure our MsgStream: @@ -140,7 +140,7 @@ StatusCode AthenaEventLoopMgr::initialize() { m_msg << MSG::FATAL << "Error retrieving pointer to StoreGateSvc" - << endreq; + << endmsg; return sc; } @@ -151,7 +151,7 @@ StatusCode AthenaEventLoopMgr::initialize() sc = m_incidentSvc.retrieve(); if( !sc.isSuccess() ) { - m_msg << MSG::FATAL << "Error retrieving IncidentSvc." << endreq; + m_msg << MSG::FATAL << "Error retrieving IncidentSvc." << endmsg; return sc; } @@ -163,7 +163,7 @@ StatusCode AthenaEventLoopMgr::initialize() { m_msg << MSG::FATAL << "IProperty interface not found in ApplicationMgr." - << endreq; + << endmsg; return StatusCode::FAILURE; } @@ -176,7 +176,7 @@ StatusCode AthenaEventLoopMgr::initialize() { m_msg << MSG::FATAL << "Error retrieving HistogramDataSvc" - << endreq; + << endmsg; return sc; } @@ -194,10 +194,10 @@ StatusCode AthenaEventLoopMgr::initialize() if( !sc.isSuccess() ) { m_msg << MSG::WARNING << "Histograms cannot not be saved - though required." - << endreq; + << endmsg; } else { - IService *is = 0; + IService *is = nullptr; if (histPersName == "ROOT") { sc = serviceLocator()->service("RootHistSvc", is); } else if ( histPersName == "HBOOK" ) { @@ -207,12 +207,12 @@ StatusCode AthenaEventLoopMgr::initialize() if (sc.isFailure()) { m_msg << MSG::ERROR << "could not locate actual Histogram persistency service" - << endreq; + << endmsg; } else { Service *s = dynamic_cast<Service*>(is); - if (s == 0) { + if (s == nullptr) { m_msg << MSG::ERROR << "Could not dcast HistPersSvc to a Service" - << endreq; + << endmsg; } else { const Property &prop = s->getProperty("OutputFile"); std::string val; @@ -225,7 +225,7 @@ StatusCode AthenaEventLoopMgr::initialize() m_msg << MSG::VERBOSE << "could not dcast OutputFile property to a StringProperty." << " Need to fix Gaudi." - << endreq; + << endmsg; val = prop.toString(); @@ -247,7 +247,7 @@ StatusCode AthenaEventLoopMgr::initialize() } else { if (m_msg.level() <= MSG::DEBUG) { m_msg << MSG::DEBUG << "Histograms saving not required." - << endreq; } } + << endmsg; } } //------------------------------------------------------------------------- // Setup EventSelector service //------------------------------------------------------------------------- @@ -255,11 +255,11 @@ StatusCode AthenaEventLoopMgr::initialize() // the evt sel is usually specified as a property of ApplicationMgr if (selName.empty()) sc = setProperty(prpMgr->getProperty("EvtSel")); - if (sc.isFailure()) m_msg << MSG::WARNING << "Unable to set EvtSel property" << endreq; + if (sc.isFailure()) m_msg << MSG::WARNING << "Unable to set EvtSel property" << endmsg; // We do not expect a Event Selector necessarily being declared if( !selName.empty() && selName != "NONE") { - IEvtSelector* theEvtSel(0); + IEvtSelector* theEvtSel(nullptr); StatusCode sc(serviceLocator()->service( selName, theEvtSel )); if( sc.isSuccess() && ( theEvtSel != m_evtSelector ) ) { // Event Selector changed (or setup for the first time) @@ -268,20 +268,20 @@ StatusCode AthenaEventLoopMgr::initialize() // reset iterator if (m_evtSelector->createContext(m_evtContext).isFailure()) { m_msg << MSG::FATAL << "Can not create the event selector Context." - << endreq; + << endmsg; return StatusCode::FAILURE; } if (m_msg.level() <= MSG::INFO) { INamedInterface* named (dynamic_cast< INamedInterface* >(theEvtSel)); - if (0 != named) { + if (nullptr != named) { m_msg << MSG::INFO << "Setup EventSelector service " << named->name( ) - << endreq; + << endmsg; } } } else if (sc.isFailure()) { m_msg << MSG::FATAL << "No valid event selector called " << selName - << endreq; + << endmsg; return StatusCode::FAILURE; } } @@ -307,10 +307,17 @@ StatusCode AthenaEventLoopMgr::initialize() sc = m_activeStoreSvc.retrieve(); if( !sc.isSuccess() ) { - m_msg << MSG::FATAL << "Error retrieving ActiveStoreSvc." << endreq; + m_msg << MSG::FATAL << "Error retrieving ActiveStoreSvc." << endmsg; return sc; } + // Get the AlgExecStateSvc + m_aess = serviceLocator()->service("AlgExecStateSvc"); + if( !m_aess.isValid() ) { + fatal() << "Error retrieving AlgExecStateSvc" << endmsg; + return StatusCode::FAILURE; + } + // create the EventContext object m_eventContext = new EventContext(); @@ -330,11 +337,11 @@ AthenaEventLoopMgr::setupTimeKeeper(Property&) { // We do not expect a TimeKeeper necessarily being declared if( tkName != "NONE" && tkName.length() != 0) { if (!(serviceLocator()->service( tkName, m_pITK, true)).isSuccess()) - m_msg << MSG::ERROR << "TimeKeeper not found." << endreq; + m_msg << MSG::ERROR << "TimeKeeper not found." << endmsg; else m_msg << MSG::INFO << "No TimeKeeper selected. " << "No time limit control on event loop." - << endreq; + << endmsg; } } @@ -348,9 +355,9 @@ AthenaEventLoopMgr::setClearStorePolicy(Property&) { m_msg << MSG::FATAL << "Unknown policy [" << policyName << "] for the 'ClearStore-policy !" - << endreq + << endmsg << "Valid values are: BeginEvent, EndEvent" - << endreq; + << endmsg; throw GaudiException("Can not setup 'ClearStore'-policy", name(), StatusCode::FAILURE); @@ -401,7 +408,7 @@ StatusCode AthenaEventLoopMgr::finalize() { m_msg << MSG::ERROR << "Error in Algorithm Finalize" - << endreq; + << endmsg; } StatusCode sc2 = writeHistograms(true); @@ -409,7 +416,7 @@ StatusCode AthenaEventLoopMgr::finalize() { m_msg << MSG::ERROR << "Error in writing Histograms" - << endreq; + << endmsg; } // Release all interfaces (ignore StatusCodes) @@ -420,18 +427,18 @@ StatusCode AthenaEventLoopMgr::finalize() m_evtSelector = releaseInterface(m_evtSelector); m_incidentSvc.release().ignore(); - delete m_evtContext; m_evtContext = 0; + delete m_evtContext; m_evtContext = nullptr; - delete m_eventContext; m_eventContext = 0; + delete m_eventContext; m_eventContext = nullptr; if(m_useTools) { tool_iterator firstTool = m_tools.begin(); tool_iterator lastTool = m_tools.end(); unsigned int toolCtr = 0; m_msg << MSG::INFO - << "Summary of AthenaEvtLoopPreSelectTool invocation: (invoked/success/failure)" << endreq; + << "Summary of AthenaEvtLoopPreSelectTool invocation: (invoked/success/failure)" << endmsg; m_msg << MSG::INFO - << "-----------------------------------------------------" << endreq; + << "-----------------------------------------------------" << endmsg; for ( ; firstTool != lastTool; firstTool++ ) { m_msg << MSG::INFO @@ -449,7 +456,7 @@ StatusCode AthenaEventLoopMgr::finalize() << "/" << m_toolReject[toolCtr] << ")" - << endreq; + << endmsg; toolCtr++; } } @@ -473,7 +480,7 @@ StatusCode AthenaEventLoopMgr::writeHistograms(bool force) { sc = iret; m_msg << MSG::ERROR << "Error while traversing Histogram data store" - << endreq; + << endmsg; } IDataSelector* objects = agent.selectedObjects(); @@ -490,19 +497,19 @@ StatusCode AthenaEventLoopMgr::writeHistograms(bool force) { bool crt(false); IOpaqueAddress* pAddr = (*i)->registry()->address(); - if (pAddr == 0) { + if (pAddr == nullptr) { iret = m_histoPersSvc->createRep(*i, pAddr); if ( iret.isSuccess() ) { (*i)->registry()->setAddress(pAddr); crt = true; } else { m_msg << MSG::ERROR << "calling createRep for " - << (*i)->registry()->identifier() << endreq; + << (*i)->registry()->identifier() << endmsg; } } if (iret.isSuccess()) { - assert(pAddr != 0); + assert(pAddr != nullptr); iret = m_histoPersSvc->updateRep(pAddr, *i); if (iret.isSuccess() && crt == true) { @@ -519,7 +526,7 @@ StatusCode AthenaEventLoopMgr::writeHistograms(bool force) { } // end of loop over Objects if (force || (writeInterval != 0 && m_nevt%writeInterval == 0) ) { - if (m_msg.level() <= MSG::DEBUG) { m_msg << MSG::DEBUG << "committing Histograms" << endreq; } + if (m_msg.level() <= MSG::DEBUG) { m_msg << MSG::DEBUG << "committing Histograms" << endmsg; } m_histoPersSvc->conversionSvc()->commitOutput("",true).ignore(); } @@ -547,7 +554,7 @@ StatusCode AthenaEventLoopMgr::beginRunAlgorithms(const EventInfo& event) { if ( !sc.isSuccess() ) { m_msg << MSG::INFO << "beginRun of algorithm " << (*ita)->name() << " failed with StatusCode::" << sc - << endreq; + << endmsg; return sc; } } @@ -572,7 +579,7 @@ StatusCode AthenaEventLoopMgr::endRunAlgorithms() { if ( !sc.isSuccess() ) { m_msg << MSG::INFO << "endRun of algorithm " << (*ita)->name() << " failed with StatusCode::" << sc - << endreq; + << endmsg; return sc; } } @@ -596,18 +603,18 @@ StatusCode AthenaEventLoopMgr::initializeAlgorithms() { m_msg << MSG::ERROR << "Unable to initialize Algorithm: " << (*ita)->name() - << endreq; + << endmsg; return sc; } Algorithm* alg = dynamic_cast<Algorithm*>( (IAlgorithm*)(*ita) ); - if (alg != 0) { + if (alg != nullptr) { alg->setContext( m_eventContext ); } else { m_msg << MSG::ERROR << "Unable to dcast IAlgorithm " << (*ita)->name() << " to Algorithm" - << endreq; + << endmsg; return StatusCode::FAILURE; } } @@ -621,9 +628,20 @@ StatusCode AthenaEventLoopMgr::initializeAlgorithms() { m_msg << MSG::ERROR << "Unable to initialize Output Stream: " << (*ita)->name() - << endreq; + << endmsg; return sc; } + + Algorithm* alg = dynamic_cast<Algorithm*>( (IAlgorithm*)(*ita) ); + if (alg != nullptr) { + alg->setContext( m_eventContext ); + } else { + m_msg << MSG::ERROR + << "Unable to dcast IAlgorithm " << (*ita)->name() + << " to Algorithm" + << endmsg; + return StatusCode::FAILURE; + } } return StatusCode::SUCCESS; @@ -639,12 +657,16 @@ StatusCode AthenaEventLoopMgr::executeAlgorithms() { ita != m_topAlgList.end(); ita++ ) { - (*ita)->resetExecuted(); const StatusCode& sc = (*ita)->sysExecute(); + // this duplicates what is already done in Algorithm::sysExecute, which + // calls Algorithm::setExecuted, but eventually we plan to remove that + // function + m_aess->algExecState(*ita,*m_eventContext).setExecuted(true); + m_aess->algExecState(*ita,*m_eventContext).setExecStatus(sc); if ( !sc.isSuccess() ) { m_msg << MSG::INFO << "Execution of algorithm " << (*ita)->name() << " failed with StatusCode::" << sc - << endreq; + << endmsg; return sc; } } @@ -658,13 +680,13 @@ StatusCode AthenaEventLoopMgr::executeAlgorithms() { //========================================================================= StatusCode AthenaEventLoopMgr::executeEvent(void* /*par*/) { - const EventInfo* pEvent(0); + const EventInfo* pEvent(nullptr); std::unique_ptr<EventInfo> pEventPtr; if ( m_evtContext ) { // Deal with the case when an EventSelector is provided // Retrieve the Event object const AthenaAttributeList* pAttrList = eventStore()->tryConstRetrieve<AthenaAttributeList>(); - if ( pAttrList != 0) { // Try making EventID-only EventInfo object from in-file TAG + if ( pAttrList != nullptr && pAttrList->size() > 6 ) { // Try making EventID-only EventInfo object from in-file TAG try { unsigned int runNumber = (*pAttrList)["RunNumber"].data<unsigned int>(); unsigned long long eventNumber = (*pAttrList)["EventNumber"].data<unsigned long long>(); @@ -673,13 +695,13 @@ StatusCode AthenaEventLoopMgr::executeEvent(void* /*par*/) unsigned int lumiBlock = (*pAttrList)["LumiBlockN"].data<unsigned int>(); unsigned int bunchId = (*pAttrList)["BunchId"].data<unsigned int>(); pEventPtr = CxxUtils::make_unique<EventInfo> - (new EventID(runNumber, eventNumber, eventTime, eventTimeNS, lumiBlock, bunchId), (EventType*)0); + (new EventID(runNumber, eventNumber, eventTime, eventTimeNS, lumiBlock, bunchId), (EventType*)nullptr); pEvent = pEventPtr.get(); } catch (...) { } /* FIXME: PvG, not currently written - if ( pEvent != 0 ) { // Try adding EventType information + if ( pEvent != 0 && pAttrList->size() > 7 ) { // Try adding EventType information try { float eventWeight = (*pAttrList)["EventWeight"].data<float>(); const EventType* pType = new EventType(); @@ -691,11 +713,11 @@ StatusCode AthenaEventLoopMgr::executeEvent(void* /*par*/) } */ } - if ( pEvent == 0 ) { + if ( pEvent == nullptr ) { StatusCode sc = eventStore()->retrieve(pEvent); if( !sc.isSuccess() ) { m_msg << MSG::ERROR - << "Unable to retrieve Event root object" << endreq; + << "Unable to retrieve Event root object" << endmsg; return (StatusCode::FAILURE); } } @@ -710,25 +732,20 @@ StatusCode AthenaEventLoopMgr::executeEvent(void* /*par*/) StatusCode sc = eventStore()->record(std::move(pEventPtr),""); if( !sc.isSuccess() ) { m_msg << MSG::ERROR - << "Error declaring event data object" << endreq; + << "Error declaring event data object" << endmsg; return (StatusCode::FAILURE); } } assert(pEvent); - // m_eventContext->setEventID( EventIDBase(pEvent->event_ID()->run_number(), - // pEvent->event_ID()->event_number(), - // pEvent->event_ID()->time_stamp(), - // pEvent->event_ID()->time_stamp_ns_offset(), - // pEvent->event_ID()->lumi_block(), - // pEvent->event_ID()->bunch_crossing_id()) ); - m_eventContext->setEventID( *((EventIDBase*) pEvent->event_ID()) ); - m_eventContext->setEvt (m_nev); + m_eventContext->set(m_nev,0); m_eventContext->setProxy( eventStore()->hiveProxyDict() ); Gaudi::Hive::setCurrentContext( m_eventContext ); + m_aess->reset(*m_eventContext); + /// Fire begin-Run incident if new run: if (m_firstRun || (m_currentRun != pEvent->event_ID()->run_number()) ) { @@ -741,7 +758,7 @@ StatusCode AthenaEventLoopMgr::executeEvent(void* /*par*/) m_msg << MSG::INFO << " ===>>> start of run " << m_currentRun << " <<<===" - << endreq; + << endmsg; if (!(this->beginRunAlgorithms(*pEvent)).isSuccess()) return (StatusCode::FAILURE); } @@ -751,8 +768,8 @@ StatusCode AthenaEventLoopMgr::executeEvent(void* /*par*/) // Call any attached tools to reject events early unsigned int toolCtr=0; if(m_useTools) { - tool_iterator theTool = m_tools.begin(); - tool_iterator lastTool = m_tools.end(); + tool_store::iterator theTool = m_tools.begin(); + tool_store::iterator lastTool = m_tools.end(); while(toolsPassed && theTool!=lastTool ) { toolsPassed = (*theTool)->passEvent(pEvent); @@ -770,11 +787,11 @@ StatusCode AthenaEventLoopMgr::executeEvent(void* /*par*/) if (doEvtHeartbeat) { if(!m_useTools) m_msg << MSG::INFO << " ===>>> start processing event #" << evtNumber << ", run #" << m_currentRun - << " " << m_nev << " events processed so far <<<===" << endreq; + << " " << m_nev << " events processed so far <<<===" << endmsg; else m_msg << MSG::INFO << " ===>>> start processing event #" << evtNumber << ", run #" << m_currentRun << " " << m_nev << " events read and " << m_proc - << " events processed so far <<<===" << endreq; + << " events processed so far <<<===" << endmsg; } // Reset the timeout singleton @@ -788,7 +805,7 @@ StatusCode AthenaEventLoopMgr::executeEvent(void* /*par*/) m_msg << MSG::ALWAYS << "A stopRun was requested by an incidentListener. " << "Do not process this event." - << endreq; + << endmsg; return (StatusCode::SUCCESS); } @@ -798,8 +815,11 @@ StatusCode AthenaEventLoopMgr::executeEvent(void* /*par*/) // Call the execute() method of all top algorithms StatusCode sc = executeAlgorithms(); + + if(!sc.isSuccess()) { eventFailed = true; + m_aess->setEventStatus( EventStatus::AlgFail, *m_eventContext ); /// m_failureMode 1, /// RECOVERABLE: skip algorithms, but do not terminate job @@ -810,7 +830,7 @@ StatusCode AthenaEventLoopMgr::executeEvent(void* /*par*/) << "Skipping remaining algorithms." << std::endl << "\tNo output will be written for this event, " << "but job will continue to next event" - << endreq; + << endmsg; eventFailed = false; } @@ -820,16 +840,17 @@ StatusCode AthenaEventLoopMgr::executeEvent(void* /*par*/) << "Skipping remaining algorithms." << std::endl << "\tNo output will be written for this event, " << "but job will continue to next event" - << endreq; + << endmsg; eventFailed = false; } } else { + m_aess->setEventStatus( EventStatus::Success, *m_eventContext ); + // Call the execute() method of all output streams for (ListAlg::iterator ito = m_outStreamList.begin(); ito != m_outStreamList.end(); ito++ ) { - (*ito)->resetExecuted(); sc = (*ito)->sysExecute(); if( !sc.isSuccess() ) { eventFailed = true; @@ -848,14 +869,14 @@ StatusCode AthenaEventLoopMgr::executeEvent(void* /*par*/) if (doEvtHeartbeat) { if(!m_useTools) m_msg << MSG::INFO << " ===>>> done processing event #" << evtNumber << ", run #" << m_currentRun - << " " << m_nev << " events processed so far <<<===" << endreq; + << " " << m_nev << " events processed so far <<<===" << endmsg; else m_msg << MSG::INFO << " ===>>> done processing event #" << evtNumber << ", run #" << m_currentRun << " " << m_nev << " events read and " << m_proc - << " events processed so far <<<===" << endreq; + << " events processed so far <<<===" << endmsg; std::ofstream outfile( "eventLoopHeartBeat.txt"); if ( !outfile ) { - m_msg << MSG::ERROR << " unable to open: eventLoopHeartBeat.txt" << endreq; + m_msg << MSG::ERROR << " unable to open: eventLoopHeartBeat.txt" << endmsg; } else { outfile << " done processing event #" << evtNumber << ", run #" << m_currentRun << " " << m_nev << " events read so far <<<===" << std::endl; @@ -917,7 +938,7 @@ StatusCode AthenaEventLoopMgr::nextEvent(int maxevt) while((maxevt == -1 || m_nevt < maxevt) && - (noTimeLimit = (m_pITK == 0 || m_pITK->nextIter()) ) ) { + (noTimeLimit = (m_pITK == nullptr || m_pITK->nextIter()) ) ) { if(m_doChrono && total_nevt>0) m_chronoStatSvc->chronoStart("EventLoopMgr"); //start after first event if(m_doChrono && total_nevt>0) m_chronoStatSvc->chronoStart("EventLoopMgr_preexec"); @@ -926,7 +947,7 @@ StatusCode AthenaEventLoopMgr::nextEvent(int maxevt) if ( m_scheduledStop ) { m_scheduledStop = false; m_msg << MSG::ALWAYS - << "A stopRun was requested. Terminating event loop." << endreq; + << "A stopRun was requested. Terminating event loop." << endmsg; break; } @@ -941,7 +962,7 @@ StatusCode AthenaEventLoopMgr::nextEvent(int maxevt) sc = eventStore()->clearStore(); if( !sc.isSuccess() ) { m_msg << MSG::ERROR - << "Clear of Event data store failed" << endreq; + << "Clear of Event data store failed" << endmsg; m_incidentSvc->fireIncident(Incident(name(),"EndEvtLoop")); return sc; } @@ -955,7 +976,7 @@ StatusCode AthenaEventLoopMgr::nextEvent(int maxevt) if ( m_evtContext ) { // Deal with the case when an EventSelector is provided - IOpaqueAddress* addr = 0; + IOpaqueAddress* addr = nullptr; sc = m_evtSelector->next(*m_evtContext); @@ -963,44 +984,44 @@ StatusCode AthenaEventLoopMgr::nextEvent(int maxevt) { // This is the end of the loop. No more events in the selection m_msg << MSG::INFO - << "No more events in event selection " << endreq; + << "No more events in event selection " << endmsg; sc = StatusCode::SUCCESS; break; } if (m_evtSelector->createAddress(*m_evtContext, addr).isFailure()) { m_msg << MSG::ERROR - << "Could not create an IOpaqueAddress" << endreq; + << "Could not create an IOpaqueAddress" << endmsg; break; } // Most iterators provide the IOA of an event header (EventInfo, DataHeader) - if (0 != addr) { + if (nullptr != addr) { //create its proxy sc = eventStore()->recordAddress(addr); if( !sc.isSuccess() ) { m_msg << MSG::WARNING - << "Error declaring Event object" << endreq; + << "Error declaring Event object" << endmsg; continue; } } if ((sc=eventStore()->loadEventProxies()).isFailure()) { m_msg << MSG::ERROR - << "Error loading Event proxies" << endreq; + << "Error loading Event proxies" << endmsg; continue; } } if(m_doChrono && total_nevt>1) m_chronoStatSvc->chronoStop("EventLoopMgr_preexec"); if(m_doChrono && total_nevt>1) m_chronoStatSvc->chronoStart("EventLoopMgr_execute"); // Execute event for all required algorithms - sc = executeEvent(0); + sc = executeEvent(nullptr); if(m_doChrono && total_nevt>1) m_chronoStatSvc->chronoStop("EventLoopMgr_execute"); if(m_doChrono && total_nevt>1) m_chronoStatSvc->chronoStart("EventLoopMgr_postexec"); if( !sc.isSuccess() ) { m_msg << MSG::ERROR - << "Terminating event processing loop due to errors" << endreq; + << "Terminating event processing loop due to errors" << endmsg; break; } @@ -1011,7 +1032,7 @@ StatusCode AthenaEventLoopMgr::nextEvent(int maxevt) sc = eventStore()->clearStore(); if( !sc.isSuccess() ) { m_msg << MSG::ERROR - << "Clear of Event data store failed" << endreq; + << "Clear of Event data store failed" << endmsg; break; } } @@ -1033,9 +1054,9 @@ StatusCode AthenaEventLoopMgr::nextEvent(int maxevt) StatusCode AthenaEventLoopMgr::seek (int evt) { IEventSeek* is = dynamic_cast<IEventSeek*> (m_evtSelector); - if (is == 0) { + if (is == nullptr) { m_msg << MSG::ERROR << "Seek failed; unsupported by event selector" - <<endreq; + <<endmsg; return StatusCode::FAILURE; } StatusCode sc = is->seek(evt); @@ -1043,12 +1064,12 @@ StatusCode AthenaEventLoopMgr::seek (int evt) m_nevt = evt; if (m_evtSelector->createContext(m_evtContext).isFailure()) { m_msg << MSG::FATAL << "Can not create the event selector Context." - << endreq; + << endmsg; return StatusCode::FAILURE; } } else { - m_msg << MSG::ERROR << "Seek failed." << endreq; + m_msg << MSG::ERROR << "Seek failed." << endmsg; } return sc; } @@ -1068,9 +1089,9 @@ int AthenaEventLoopMgr::curEvent() const int AthenaEventLoopMgr::size() { ICollectionSize* cs = dynamic_cast<ICollectionSize*> (m_evtSelector); - if (cs == 0) { + if (cs == nullptr) { m_msg << MSG::ERROR << "Collection size unsupported by event selector" - <<endreq; + <<endmsg; return -1; } return cs->size(); @@ -1082,53 +1103,53 @@ void AthenaEventLoopMgr::handle(const Incident& inc) return; if(!m_evtContext || !m_firstRun) { - m_msg << MSG::WARNING << "Skipping BeforeFork handler. Either no event selector is provided or begin run has already passed" << endreq; + m_msg << MSG::WARNING << "Skipping BeforeFork handler. Either no event selector is provided or begin run has already passed" << endmsg; } // Initialize Algorithms and Output Streams StatusCode sc = initializeAlgorithms(); if(sc.isFailure()) { - m_msg << MSG::ERROR << "Failed to initialize Algorithms" << endreq; + m_msg << MSG::ERROR << "Failed to initialize Algorithms" << endmsg; return; } // Construct EventInfo - const EventInfo* pEvent(0); - IOpaqueAddress* addr = 0; + const EventInfo* pEvent(nullptr); + IOpaqueAddress* addr = nullptr; sc = m_evtSelector->next(*m_evtContext); if(!sc.isSuccess()) { - m_msg << MSG::INFO << "No more events in event selection " << endreq; + m_msg << MSG::INFO << "No more events in event selection " << endmsg; return; } sc = m_evtSelector->createAddress(*m_evtContext, addr); if (sc.isFailure()) { - m_msg << MSG::ERROR << "Could not create an IOpaqueAddress" << endreq; + m_msg << MSG::ERROR << "Could not create an IOpaqueAddress" << endmsg; return; } - if (0 != addr) { + if (nullptr != addr) { //create its proxy sc = eventStore()->recordAddress(addr); if(!sc.isSuccess()) { - m_msg << MSG::ERROR << "Error declaring Event object" << endreq; + m_msg << MSG::ERROR << "Error declaring Event object" << endmsg; return; } } if(eventStore()->loadEventProxies().isFailure()) { - m_msg << MSG::WARNING << "Error loading Event proxies" << endreq; + m_msg << MSG::WARNING << "Error loading Event proxies" << endmsg; return; } // Retrieve the Event object sc = eventStore()->retrieve(pEvent); if(!sc.isSuccess()) { - m_msg << MSG::ERROR << "Unable to retrieve Event root object" << endreq; + m_msg << MSG::ERROR << "Unable to retrieve Event root object" << endmsg; return; } sc = beginRunAlgorithms(*pEvent); if (!sc.isSuccess()) { - m_msg << MSG::ERROR << "beginRunAlgorithms() failed" << endreq; + m_msg << MSG::ERROR << "beginRunAlgorithms() failed" << endmsg; return; } @@ -1140,7 +1161,7 @@ void AthenaEventLoopMgr::handle(const Incident& inc) if(s_clearStore==ClearStorePolicy::EndEvent) { sc = eventStore()->clearStore(); if(!sc.isSuccess()) { - m_msg << MSG::ERROR << "Clear of Event data store failed" << endreq; + m_msg << MSG::ERROR << "Clear of Event data store failed" << endmsg; } } } @@ -1168,5 +1189,5 @@ AthenaEventLoopMgr::queryInterface(const InterfaceID& riid, } StoreGateSvc* AthenaEventLoopMgr::eventStore() const { - return &*m_eventStore; + return m_eventStore.get(); } diff --git a/Control/AthenaServices/src/AthenaEventLoopMgr.h b/Control/AthenaServices/src/AthenaEventLoopMgr.h index 8e922027993ec272a2f532c1be56e2f1fb1558cb..293c7db4f07e1e411aa7ec3e44e439b3ba4a2f33 100644 --- a/Control/AthenaServices/src/AthenaEventLoopMgr.h +++ b/Control/AthenaServices/src/AthenaEventLoopMgr.h @@ -36,6 +36,7 @@ #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/MinimalEventLoopMgr.h" #include "GaudiKernel/IIncidentListener.h" +#include "GaudiKernel/IAlgExecStateSvc.h" #include "AthenaKernel/Timeout.h" #include "AthenaKernel/IAthenaEvtLoopPreSelectTool.h" #include "AthenaKernel/IEventSeek.h" @@ -177,6 +178,10 @@ protected: /// Initialize all algorithms and output streams StatusCode initializeAlgorithms(); +protected: + /// Reference to the Algorithm Execution State Svc + SmartIF<IAlgExecStateSvc> m_aess; + public: /// implementation of IAppMgrUI::initalize virtual StatusCode initialize(); diff --git a/Control/AthenaServices/src/AthenaHiveEventLoopMgr.cxx b/Control/AthenaServices/src/AthenaHiveEventLoopMgr.cxx index b348dc74df0bf8e4834f19aee1ffc5a8cdd94967..d0f14b9be8bfef0d4bd813ccfea88d61559616e5 100644 --- a/Control/AthenaServices/src/AthenaHiveEventLoopMgr.cxx +++ b/Control/AthenaServices/src/AthenaHiveEventLoopMgr.cxx @@ -130,7 +130,7 @@ StatusCode AthenaHiveEventLoopMgr::initialize() m_msg.setLevel( m_outputLevel.value() ); m_msg << MSG::INFO << "Initializing " << name() - << " - package version " << PACKAGE_VERSION << endreq ; + << " - package version " << PACKAGE_VERSION << endmsg ; StatusCode sc = MinimalEventLoopMgr::initialize(); @@ -138,7 +138,7 @@ StatusCode AthenaHiveEventLoopMgr::initialize() { m_msg << MSG::ERROR << "Failed to initialize base class MinimalEventLoopMgr" - << endreq; + << endmsg; return sc; } else { // re-configure our MsgStream: @@ -170,20 +170,18 @@ StatusCode AthenaHiveEventLoopMgr::initialize() return StatusCode::FAILURE; } -#ifdef REENTRANT_GAUDI - m_algExecMgr = serviceLocator()->service("AlgExecMgr"); - if( !m_algExecMgr.isValid() ) { - fatal() << "Error retrieving AlgExecMgr" << endmsg; + m_aess = serviceLocator()->service("AlgExecStateSvc"); + if( !m_aess.isValid() ) { + fatal() << "Error retrieving AlgExecStateSvc" << endmsg; return StatusCode::FAILURE; } -#endif sc = m_eventStore.retrieve(); if( !sc.isSuccess() ) { m_msg << MSG::FATAL << "Error retrieving pointer to StoreGateSvc" - << endreq; + << endmsg; return sc; } @@ -194,7 +192,7 @@ StatusCode AthenaHiveEventLoopMgr::initialize() sc = m_incidentSvc.retrieve(); if( !sc.isSuccess() ) { - m_msg << MSG::FATAL << "Error retrieving IncidentSvc." << endreq; + m_msg << MSG::FATAL << "Error retrieving IncidentSvc." << endmsg; return sc; } @@ -206,7 +204,7 @@ StatusCode AthenaHiveEventLoopMgr::initialize() { m_msg << MSG::FATAL << "IProperty interface not found in ApplicationMgr." - << endreq; + << endmsg; return StatusCode::FAILURE; } @@ -219,7 +217,7 @@ StatusCode AthenaHiveEventLoopMgr::initialize() { m_msg << MSG::FATAL << "Error retrieving HistogramDataSvc" - << endreq; + << endmsg; return sc; } @@ -237,7 +235,7 @@ StatusCode AthenaHiveEventLoopMgr::initialize() if( !sc.isSuccess() ) { m_msg << MSG::WARNING << "Histograms cannot not be saved - though required." - << endreq; + << endmsg; } else { IService *is = 0; @@ -250,12 +248,12 @@ StatusCode AthenaHiveEventLoopMgr::initialize() if (sc.isFailure()) { m_msg << MSG::ERROR << "could not locate actual Histogram persistency service" - << endreq; + << endmsg; } else { Service *s = dynamic_cast<Service*>(is); if (s == 0) { m_msg << MSG::ERROR << "Could not dcast HistPersSvc to a Service" - << endreq; + << endmsg; } else { const Property &prop = s->getProperty("OutputFile"); std::string val; @@ -268,7 +266,7 @@ StatusCode AthenaHiveEventLoopMgr::initialize() m_msg << MSG::VERBOSE << "could not dcast OutputFile property to a StringProperty." << " Need to fix Gaudi." - << endreq; + << endmsg; val = prop.toString(); @@ -290,7 +288,7 @@ StatusCode AthenaHiveEventLoopMgr::initialize() } else { if (m_msg.level() <= MSG::DEBUG) { m_msg << MSG::DEBUG << "Histograms saving not required." - << endreq; } } + << endmsg; } } //------------------------------------------------------------------------- // Setup EventSelector service //------------------------------------------------------------------------- @@ -298,7 +296,7 @@ StatusCode AthenaHiveEventLoopMgr::initialize() // the evt sel is usually specified as a property of ApplicationMgr if (selName.empty()) sc = setProperty(prpMgr->getProperty("EvtSel")); - if (sc.isFailure()) m_msg << MSG::WARNING << "Unable to set EvtSel property" << endreq; + if (sc.isFailure()) m_msg << MSG::WARNING << "Unable to set EvtSel property" << endmsg; // We do not expect a Event Selector necessarily being declared if( !selName.empty() && selName != "NONE") { @@ -311,7 +309,7 @@ StatusCode AthenaHiveEventLoopMgr::initialize() // reset iterator if (m_evtSelector->createContext(m_evtContext).isFailure()) { m_msg << MSG::FATAL << "Can not create the event selector Context." - << endreq; + << endmsg; return StatusCode::FAILURE; } if (m_msg.level() <= MSG::INFO) { @@ -319,12 +317,12 @@ StatusCode AthenaHiveEventLoopMgr::initialize() if (0 != named) { m_msg << MSG::INFO << "Setup EventSelector service " << named->name( ) - << endreq; + << endmsg; } } } else if (sc.isFailure()) { m_msg << MSG::FATAL << "No valid event selector called " << selName - << endreq; + << endmsg; return StatusCode::FAILURE; } } @@ -350,7 +348,7 @@ StatusCode AthenaHiveEventLoopMgr::initialize() sc = m_activeStoreSvc.retrieve(); if( !sc.isSuccess() ) { - m_msg << MSG::FATAL << "Error retrieving ActiveStoreSvc." << endreq; + m_msg << MSG::FATAL << "Error retrieving ActiveStoreSvc." << endmsg; return sc; } @@ -363,7 +361,7 @@ StatusCode AthenaHiveEventLoopMgr::initialize() inline StoreGateSvc* AthenaHiveEventLoopMgr::eventStore() const { - return &*m_eventStore; + return m_eventStore.get(); } //========================================================================= @@ -375,11 +373,11 @@ AthenaHiveEventLoopMgr::setupTimeKeeper(Property&) { // We do not expect a TimeKeeper necessarily being declared if( tkName != "NONE" && tkName.length() != 0) { if (!(serviceLocator()->service( tkName, m_pITK, true)).isSuccess()) - m_msg << MSG::ERROR << "TimeKeeper not found." << endreq; + m_msg << MSG::ERROR << "TimeKeeper not found." << endmsg; else m_msg << MSG::INFO << "No TimeKeeper selected. " << "No time limit control on event loop." - << endreq; + << endmsg; } } @@ -393,9 +391,9 @@ AthenaHiveEventLoopMgr::setClearStorePolicy(Property&) { m_msg << MSG::FATAL << "Unknown policy [" << policyName << "] for the 'ClearStore-policy !" - << endreq + << endmsg << "Valid values are: BeginEvent, EndEvent" - << endreq; + << endmsg; throw GaudiException("Can not setup 'ClearStore'-policy", name(), StatusCode::FAILURE); @@ -446,7 +444,7 @@ StatusCode AthenaHiveEventLoopMgr::finalize() { m_msg << MSG::ERROR << "Error in Service base class Finalize" - << endreq; + << endmsg; } StatusCode sc2 = writeHistograms(true); @@ -454,7 +452,7 @@ StatusCode AthenaHiveEventLoopMgr::finalize() { m_msg << MSG::ERROR << "Error in writing Histograms" - << endreq; + << endmsg; } // Release all interfaces (ignore StatusCodes) @@ -482,9 +480,9 @@ StatusCode AthenaHiveEventLoopMgr::finalize() tool_iterator lastTool = m_tools.end(); unsigned int toolCtr = 0; m_msg << MSG::INFO - << "Summary of AthenaEvtLoopPreSelectTool invocation: (invoked/success/failure)" << endreq; + << "Summary of AthenaEvtLoopPreSelectTool invocation: (invoked/success/failure)" << endmsg; m_msg << MSG::INFO - << "-----------------------------------------------------" << endreq; + << "-----------------------------------------------------" << endmsg; for ( ; firstTool != lastTool; firstTool++ ) { m_msg << MSG::INFO @@ -502,7 +500,7 @@ StatusCode AthenaHiveEventLoopMgr::finalize() << "/" << m_toolReject[toolCtr] << ")" - << endreq; + << endmsg; toolCtr++; } } @@ -526,7 +524,7 @@ StatusCode AthenaHiveEventLoopMgr::writeHistograms(bool force) { sc = iret; m_msg << MSG::ERROR << "Error while traversing Histogram data store" - << endreq; + << endmsg; } IDataSelector* objects = agent.selectedObjects(); @@ -550,7 +548,7 @@ StatusCode AthenaHiveEventLoopMgr::writeHistograms(bool force) { crt = true; } else { m_msg << MSG::ERROR << "calling createRep for " - << (*i)->registry()->identifier() << endreq; + << (*i)->registry()->identifier() << endmsg; } } @@ -572,7 +570,7 @@ StatusCode AthenaHiveEventLoopMgr::writeHistograms(bool force) { } // end of loop over Objects if (force || (writeInterval != 0 && m_nevt%writeInterval == 0) ) { - if (m_msg.level() <= MSG::DEBUG) { m_msg << MSG::DEBUG << "committing Histograms" << endreq; } + if (m_msg.level() <= MSG::DEBUG) { m_msg << MSG::DEBUG << "committing Histograms" << endmsg; } m_histoPersSvc->conversionSvc()->commitOutput("",true).ignore(); } @@ -643,7 +641,7 @@ StatusCode AthenaHiveEventLoopMgr::executeEvent(void* createdEvts_IntPtr ) m_msg << MSG::ALWAYS << "A stopRun was requested by an incidentListener. " << "Do not process this event." - << endreq; + << endmsg; createdEvts = -1; return (StatusCode::SUCCESS); } @@ -675,7 +673,7 @@ StatusCode AthenaHiveEventLoopMgr::executeEvent(void* createdEvts_IntPtr ) m_msg << MSG::INFO << " ===>>> start of run " << m_currentRun << " <<<===" - << endreq; + << endmsg; if (!(this->beginRunAlgorithms(*pEvent)).isSuccess()) return (StatusCode::FAILURE); } @@ -714,13 +712,13 @@ StatusCode AthenaHiveEventLoopMgr::executeEvent(void* createdEvts_IntPtr ) m_msg << MSG::INFO << " ===>>> start processing event #" << evtNumber << ", run #" << m_currentRun << " on slot " << evtContext->slot() << ", " << m_proc - << " events processed so far <<<===" << endreq; + << " events processed so far <<<===" << endmsg; else m_msg << MSG::INFO << " ===>>> start processing event #" << evtNumber << ", run #" << m_currentRun << " on slot " << evtContext->slot() << ", " << m_nev << " events read and " << m_proc - << " events processed so far <<<===" << endreq; + << " events processed so far <<<===" << endmsg; } // Reset the timeout singleton @@ -850,7 +848,7 @@ StatusCode AthenaHiveEventLoopMgr::nextEvent(int maxevt) sc = executeEvent(&createdEvts); if (sc.isFailure()) { m_msg << MSG::ERROR - << "Terminating event processing loop due to errors" << endreq; + << "Terminating event processing loop due to errors" << endmsg; loop_ended = true; } @@ -897,7 +895,7 @@ StatusCode AthenaHiveEventLoopMgr::seek (int evt) IEventSeek* is = dynamic_cast<IEventSeek*> (m_evtSelector); if (is == 0) { m_msg << MSG::ERROR << "Seek failed; unsupported by event selector" - <<endreq; + <<endmsg; return StatusCode::FAILURE; } StatusCode sc = is->seek(evt); @@ -905,12 +903,12 @@ StatusCode AthenaHiveEventLoopMgr::seek (int evt) m_nevt = evt; if (m_evtSelector->createContext(m_evtContext).isFailure()) { m_msg << MSG::FATAL << "Can not create the event selector Context." - << endreq; + << endmsg; return StatusCode::FAILURE; } } else { - m_msg << MSG::ERROR << "Seek failed." << endreq; + m_msg << MSG::ERROR << "Seek failed." << endmsg; } return sc; } @@ -932,7 +930,7 @@ int AthenaHiveEventLoopMgr::size() ICollectionSize* cs = dynamic_cast<ICollectionSize*> (m_evtSelector); if (cs == 0) { m_msg << MSG::ERROR << "Collection size unsupported by event selector" - <<endreq; + <<endmsg; return -1; } return cs->size(); @@ -948,13 +946,13 @@ void AthenaHiveEventLoopMgr::handle(const Incident& inc) return; if(!m_evtContext || !m_firstRun) { - m_msg << MSG::WARNING << "Skipping BeforeFork handler. Either no event selector is provided or begin run has already passed" << endreq; + m_msg << MSG::WARNING << "Skipping BeforeFork handler. Either no event selector is provided or begin run has already passed" << endmsg; } // Initialize Algorithms and Output Streams StatusCode sc = initializeAlgorithms(); if(sc.isFailure()) { - m_msg << MSG::ERROR << "Failed to initialize Algorithms" << endreq; + m_msg << MSG::ERROR << "Failed to initialize Algorithms" << endmsg; return; } @@ -963,38 +961,38 @@ void AthenaHiveEventLoopMgr::handle(const Incident& inc) IOpaqueAddress* addr = 0; sc = m_evtSelector->next(*m_evtContext); if(!sc.isSuccess()) { - m_msg << MSG::INFO << "No more events in event selection " << endreq; + m_msg << MSG::INFO << "No more events in event selection " << endmsg; return; } sc = m_evtSelector->createAddress(*m_evtContext, addr); if (sc.isFailure()) { - m_msg << MSG::ERROR << "Could not create an IOpaqueAddress" << endreq; + m_msg << MSG::ERROR << "Could not create an IOpaqueAddress" << endmsg; return; } if (0 != addr) { //create its proxy sc = eventStore()->recordAddress(addr); if(!sc.isSuccess()) { - m_msg << MSG::ERROR << "Error declaring Event object" << endreq; + m_msg << MSG::ERROR << "Error declaring Event object" << endmsg; return; } } if(eventStore()->loadEventProxies().isFailure()) { - m_msg << MSG::WARNING << "Error loading Event proxies" << endreq; + m_msg << MSG::WARNING << "Error loading Event proxies" << endmsg; return; } // Retrieve the Event object sc = eventStore()->retrieve(pEvent); if(!sc.isSuccess()) { - m_msg << MSG::ERROR << "Unable to retrieve Event root object" << endreq; + m_msg << MSG::ERROR << "Unable to retrieve Event root object" << endmsg; return; } sc = beginRunAlgorithms(*pEvent); if (!sc.isSuccess()) { - m_msg << MSG::ERROR << "beginRunAlgorithms() failed" << endreq; + m_msg << MSG::ERROR << "beginRunAlgorithms() failed" << endmsg; return; } @@ -1008,7 +1006,7 @@ void AthenaHiveEventLoopMgr::handle(const Incident& inc) if(s_clearStore==ClearStorePolicy::EndEvent) { sc = eventStore()->clearStore(); if(!sc.isSuccess()) { - m_msg << MSG::ERROR << "Clear of Event data store failed" << endreq; + m_msg << MSG::ERROR << "Clear of Event data store failed" << endmsg; } } } @@ -1090,12 +1088,12 @@ int AthenaHiveEventLoopMgr::declareEventRootAddress(const EventContext* ctx){ if ( !sc.isSuccess() ) { // This is the end of the loop. No more events in the selection - info() << "No more events in event selection " << endreq; + info() << "No more events in event selection " << endmsg; return 0; } if (m_evtSelector->createAddress(*m_evtContext, addr).isFailure()) { - error() << "Could not create an IOpaqueAddress" << endreq; + error() << "Could not create an IOpaqueAddress" << endmsg; return -1; } @@ -1106,18 +1104,18 @@ int AthenaHiveEventLoopMgr::declareEventRootAddress(const EventContext* ctx){ sc = eventStore()->recordAddress(addr); if( !sc.isSuccess() ) { //! FIXME ??? - warning() << "Error declaring Event object" << endreq; + warning() << "Error declaring Event object" << endmsg; return 0; } } if ((sc=eventStore()->loadEventProxies()).isFailure()) { - error() << "Error loading Event proxies" << endreq; + error() << "Error loading Event proxies" << endmsg; return -1; } // Retrieve the Event object sc = eventStore()->retrieve(pEvent); if( !sc.isSuccess() ) { - error() << "Unable to retrieve Event root object" << endreq; + error() << "Unable to retrieve Event root object" << endmsg; return -1; } @@ -1148,7 +1146,7 @@ int AthenaHiveEventLoopMgr::declareEventRootAddress(const EventContext* ctx){ << eventStore()->name() << endmsg; sc = eventStore()->record(pEvent,"McEventInfo"); if( !sc.isSuccess() ) { - error() << "Error declaring event data object" << endreq; + error() << "Error declaring event data object" << endmsg; return -1; } } @@ -1167,9 +1165,7 @@ StatusCode AthenaHiveEventLoopMgr::createEventContext(EventContext*& evtContext m_nevt = createdEvts; -#ifdef REENTRANT_GAUDI - m_algExecMgr->reset(*evtContext); -#endif + m_aess->reset(*evtContext); StatusCode sc = m_whiteboard->selectStore(evtContext->slot()); if (sc.isFailure()){ @@ -1223,15 +1219,10 @@ AthenaHiveEventLoopMgr::drainScheduler(int& finishedEvts){ continue; } -#ifdef REENTRANT_GAUDI - if (m_algExecMgr->eventStatus(*thisFinishedEvtContext) != EventStatus::Success) { + if (m_aess->eventStatus(*thisFinishedEvtContext) != EventStatus::Success) { fatal() << "Failed event detected on " << thisFinishedEvtContext << " w/ fail mode: " - << m_algExecMgr->eventStatus(*thisFinishedEvtContext) << endmsg; -#else - if (thisFinishedEvtContext->evtFail()){ - fatal() << "Failed event detected on " << thisFinishedEvtContext << endmsg; -#endif + << m_aess->eventStatus(*thisFinishedEvtContext) << endmsg; delete thisFinishedEvtContext; fail = true; continue; @@ -1244,7 +1235,7 @@ AthenaHiveEventLoopMgr::drainScheduler(int& finishedEvts){ const EventInfo* pEvent(0); if (m_whiteboard->selectStore(thisFinishedEvtContext->slot()).isSuccess()) { if (eventStore()->retrieve(pEvent).isFailure()) { - error() << "DrainSched: unable to get EventInfo obj" << endreq; + error() << "DrainSched: unable to get EventInfo obj" << endmsg; delete thisFinishedEvtContext; fail = true; continue; @@ -1254,7 +1245,7 @@ AthenaHiveEventLoopMgr::drainScheduler(int& finishedEvts){ } } else { error() << "DrainSched: unable to select store " - << thisFinishedEvtContext->slot() << endreq; + << thisFinishedEvtContext->slot() << endmsg; delete thisFinishedEvtContext; fail = true; continue; @@ -1286,15 +1277,15 @@ AthenaHiveEventLoopMgr::drainScheduler(int& finishedEvts){ if(!m_useTools) info() << " ===>>> done processing event #" << n_evt << ", run #" << n_run << " on slot " << thisFinishedEvtContext->slot() << ", " - << m_proc << " events processed so far <<<===" << endreq; + << m_proc << " events processed so far <<<===" << endmsg; else info() << " ===>>> done processing event #" << n_evt << ", run #" << n_run << " on slot " << thisFinishedEvtContext->slot() << ", " << m_nev << " events read and " << m_proc - << " events processed so far <<<===" << endreq; + << " events processed so far <<<===" << endmsg; std::ofstream outfile( "eventLoopHeartBeat.txt"); if ( !outfile ) { - error() << " unable to open: eventLoopHeartBeat.txt" << endreq; + error() << " unable to open: eventLoopHeartBeat.txt" << endmsg; fail = true; delete thisFinishedEvtContext; continue; diff --git a/Control/AthenaServices/src/AthenaHiveEventLoopMgr.h b/Control/AthenaServices/src/AthenaHiveEventLoopMgr.h index 44a5669ea7625982eb816f24bc567d8f8204909e..d5dfa34342729b0401a9de520d49e75c0fec6ace 100644 --- a/Control/AthenaServices/src/AthenaHiveEventLoopMgr.h +++ b/Control/AthenaServices/src/AthenaHiveEventLoopMgr.h @@ -9,7 +9,7 @@ /** @file AthenaHiveEventLoopMgr.h @brief The default ATLAS batch event loop manager. - * $Id: AthenaHiveEventLoopMgr.h 749157 2016-05-23 17:46:39Z leggett $ + * $Id: AthenaHiveEventLoopMgr.h 780883 2016-10-27 20:16:15Z leggett $ */ #include <string> @@ -44,10 +44,7 @@ #include "GaudiKernel/IEvtSelector.h" #include "GaudiKernel/IHiveWhiteBoard.h" #include "GaudiKernel/IScheduler.h" - -#ifdef REENTRANT_GAUDI - #include "GaudiKernel/IAlgExecMgr.h" -#endif +#include "GaudiKernel/IAlgExecStateSvc.h" // Standard includes #include <functional> @@ -200,13 +197,12 @@ protected: /// Reference to the Algorithm resource pool SmartIF<IAlgResourcePool> m_algResourcePool; + /// Reference to the Algorithm Execution State Svc + SmartIF<IAlgExecStateSvc> m_aess; + /// Property interface of ApplicationMgr SmartIF<IProperty> m_appMgrProperty; -#ifdef REENTRANT_GAUDI - SmartIF<IAlgExecMgr> m_algExecMgr; -#endif - /// A shortcut for the scheduler SmartIF<IScheduler> m_schedulerSvc; /// Clear a slot in the WB diff --git a/Control/AthenaServices/src/AthenaJobOptionsSvc.cxx b/Control/AthenaServices/src/AthenaJobOptionsSvc.cxx index c1e6048001687b7c30bfea88149ba394ae84c312..d135cabd9ed29477f6f328882a8fc0c3ddebf261 100644 --- a/Control/AthenaServices/src/AthenaJobOptionsSvc.cxx +++ b/Control/AthenaServices/src/AthenaJobOptionsSvc.cxx @@ -40,7 +40,7 @@ JobOptionsSvc::JobOptionsSvc( const std::string& name, ISvcLocator* pSvcLocator ) : ::AthService( name, pSvcLocator ), m_jobosvc("JobOptionsSvc/AthWrapped_JobOptionsSvc", name), - m_cat_fd (NULL) + m_cat_fd (nullptr) { // // Property declaration @@ -94,7 +94,7 @@ StatusCode JobOptionsSvc::initialize() ATH_MSG_INFO("opening [" << m_cat_fname << "] to dump properties'" " of all components"); m_cat_fd = fopen(m_cat_fname.c_str(), "w+"); - if (m_cat_fd == 0) { + if (m_cat_fd == nullptr) { ATH_MSG_ERROR("could not open the pythonized catalogue output file [" << m_cat_fname << "] !"); return StatusCode::FAILURE; @@ -121,7 +121,7 @@ StatusCode JobOptionsSvc::finalize() // return StatusCode::FAILURE; // } - if (m_cat_fd != NULL) { + if (m_cat_fd != nullptr) { fprintf(m_cat_fd, "%s", "\n" @@ -206,7 +206,7 @@ JobOptionsSvc::setMyProperties( const std::string& client, IProperty* me ) //ATH_MSG_INFO("::setMyProperties(" << client << ")... [done]"); // no dumping was requested... - if (m_cat_fd == 0) { + if (m_cat_fd == nullptr) { return sc; } @@ -316,12 +316,18 @@ JobOptionsSvc::removePropertyFromCatalogue( const std::string& client, } /// Get the properties associated to a given client -const std::vector<const Property*>* +const std::vector<const Gaudi::Details::PropertyBase*>* JobOptionsSvc::getProperties( const std::string& client) const { return m_jobosvc->getProperties(client); } +const Gaudi::Details::PropertyBase* +JobOptionsSvc::getClientProperty( const std::string& client, + const std::string& name ) const { + return m_jobosvc->getClientProperty(client, name); +} + /// Get the list of clients std::vector<std::string> JobOptionsSvc::getClients() const diff --git a/Control/AthenaServices/src/AthenaJobOptionsSvc.h b/Control/AthenaServices/src/AthenaJobOptionsSvc.h index 143c96a479657f854e8dd75d4ec17370d5738ceb..1e985f238f3a5c15c8d37869a0dea24769bf923d 100644 --- a/Control/AthenaServices/src/AthenaJobOptionsSvc.h +++ b/Control/AthenaServices/src/AthenaJobOptionsSvc.h @@ -23,7 +23,6 @@ // GaudiKernel #include "GaudiKernel/IJobOptionsSvc.h" #include "GaudiKernel/ServiceHandle.h" -#include "GaudiKernel/PropertyMgr.h" // Forward declaration class ISvcLocator; @@ -77,10 +76,17 @@ class JobOptionsSvc /// Remove a property from the JobOptions catalog virtual StatusCode removePropertyFromCatalogue( const std::string& client, const std::string& name ); + /// Get the properties associated to a given client - virtual const std::vector<const Property*>* + virtual const std::vector<const Gaudi::Details::PropertyBase*>* getProperties( const std::string& client) const; + /// Get a property for a client + virtual const Gaudi::Details::PropertyBase* + getClientProperty( const std::string& client, + const std::string& name ) const; + + /// Get the list of clients virtual std::vector<std::string> getClients() const; @@ -124,7 +130,6 @@ class JobOptionsSvc std::string m_dirSearchPath; // optional output file to dump all properties std::string m_dump ; ///< optional output file to dump all properties - PropertyMgr m_pmgr; /// switch to dump the full python-like configuration table /// if empty string (default) no dump diff --git a/Control/AthenaServices/src/AthenaOutputStream.cxx b/Control/AthenaServices/src/AthenaOutputStream.cxx index 0228eb1e573df8f6c91718f25c81549ebd0af16f..23d7fc59cb7dcf5b3a3c641890f038633921845a 100644 --- a/Control/AthenaServices/src/AthenaOutputStream.cxx +++ b/Control/AthenaServices/src/AthenaOutputStream.cxx @@ -24,6 +24,7 @@ #include "StoreGate/StoreGateSvc.h" #include "SGTools/DataProxy.h" +#include "SGTools/TransientAddress.h" #include "SGTools/ProxyMap.h" #include "SGTools/SGIFolder.h" #include "SGTools/CLIDRegistry.h" @@ -72,20 +73,23 @@ namespace { : public DataBucketBase { public: - AltDataBucket (void* ptr, CLID clid, const std::type_info& tinfo) - : m_ptr (ptr), m_clid (clid), m_tinfo (tinfo) + AltDataBucket (void* ptr, CLID clid, const std::type_info& tinfo, + const SG::DataProxy& proxy) + : m_proxy(this, makeTransientAddress(clid, proxy).release()), + m_ptr (ptr), m_clid (clid), m_tinfo (tinfo) { + addRef(); } virtual const CLID& clID() const override { return m_clid; } virtual void* object() override { return m_ptr; } virtual const std::type_info& tinfo() const override { return m_tinfo; } virtual void* cast (CLID /*clid*/, - SG::IRegisterTransient* /*irt*/ = 0, + SG::IRegisterTransient* /*irt*/ = nullptr, bool /*isConst*/ = true) const override { std::abort(); } virtual void* cast (const std::type_info& tinfo, - SG::IRegisterTransient* /*irt*/ = 0, + SG::IRegisterTransient* /*irt*/ = nullptr, bool /*isConst*/ = true) const override { if (tinfo == m_tinfo) return m_ptr; @@ -97,11 +101,38 @@ namespace { private: + static + std::unique_ptr<SG::TransientAddress> + makeTransientAddress (CLID clid, const SG::DataProxy& oldProxy); + + SG::DataProxy m_proxy; void* m_ptr; CLID m_clid; const std::type_info& m_tinfo; }; -} + + + std::unique_ptr<SG::TransientAddress> + AltDataBucket::makeTransientAddress (CLID clid, const SG::DataProxy& oldProxy) + { + const SG::TransientAddress& oldTad = *oldProxy.transientAddress(); + auto newTad = std::make_unique<SG::TransientAddress> + (clid, oldTad.name()); + newTad->setAlias (oldTad.alias()); + for (CLID tclid : oldTad.transientID()) { + // Note: this will include derived CLIDs. + // Strictly speaking, that's not right; however, filtering them + // out can break ElementLinks (for example those used by + // ShallowAuxContainer). One will not actually be able to get + // a pointer of the derived type, as the conversions in StorableConversion + // only support derived->base, not the other way around. + newTad->setTransientID (tclid); + } + return newTad; + } + + +} // anonymous namespace //**************************************************************************** @@ -221,9 +252,9 @@ StatusCode AthenaOutputStream::initialize() { ATH_MSG_FATAL("Cannot find " << m_helperTools); return(status); } - ATH_MSG_INFO("Found " << m_helperTools << endreq << "Data output: " << m_outputName); + ATH_MSG_INFO("Found " << m_helperTools << endmsg << "Data output: " << m_outputName); - for (std::vector<ToolHandle<IAthenaOutputTool> >::const_iterator iter = m_helperTools.begin(); + for (std::vector<ToolHandle<IAthenaOutputTool> >::iterator iter = m_helperTools.begin(); iter != m_helperTools.end(); iter++) { if (!(*iter)->postInitialize().isSuccess()) { status = StatusCode::FAILURE; @@ -262,7 +293,7 @@ void AthenaOutputStream::handle(const Incident& inc) { if (inc.type() == "MetaDataStop") { // Moved preFinalize of helper tools to stop - want to optimize the // output file in finalize RDS 12/2009 - for (std::vector<ToolHandle<IAthenaOutputTool> >::const_iterator iter = m_helperTools.begin(); + for (std::vector<ToolHandle<IAthenaOutputTool> >::iterator iter = m_helperTools.begin(); iter != m_helperTools.end(); iter++) { if (!(*iter)->preFinalize().isSuccess()) { ATH_MSG_ERROR("Cannot finalize helper tool"); @@ -290,7 +321,7 @@ void AthenaOutputStream::handle(const Incident& inc) { throw GaudiException("Cannot get JobOptionsSvc", name(), StatusCode::FAILURE); } const std::vector<const Property*>* fhProps = joSvc->getProperties(name() + "_FH"); - if (fhProps != 0) { + if (fhProps != nullptr) { StringArrayProperty fhProperty("ItemList", std::vector<std::string>()); for (std::vector<const Property*>::const_iterator iter = fhProps->begin(), last = fhProps->end(); iter != last; iter++) { @@ -309,9 +340,9 @@ void AthenaOutputStream::handle(const Incident& inc) { } } m_p2BWritten->clear(); - IProperty *pAsIProp(0); + IProperty *pAsIProp(nullptr); if ((m_p2BWritten.retrieve()).isFailure() || - 0 == (pAsIProp = dynamic_cast<IProperty*>(&*m_p2BWritten)) || + nullptr == (pAsIProp = dynamic_cast<IProperty*>(&*m_p2BWritten)) || (pAsIProp->setProperty("ItemList", m_metadataItemList.toString())).isFailure()) { throw GaudiException("Folder property [metadataItemList] not found", name(), StatusCode::FAILURE); } @@ -329,7 +360,7 @@ void AthenaOutputStream::handle(const Incident& inc) { throw GaudiException("Folder property [itemList] not found", name(), StatusCode::FAILURE); } ATH_MSG_INFO("Records written: " << m_events); - for (std::vector<ToolHandle<IAthenaOutputTool> >::const_iterator iter = m_helperTools.begin(); + for (std::vector<ToolHandle<IAthenaOutputTool> >::iterator iter = m_helperTools.begin(); iter != m_helperTools.end(); iter++) { if (!(*iter)->postInitialize().isSuccess()) { ATH_MSG_ERROR("Cannot initialize helper tool"); @@ -367,7 +398,7 @@ StatusCode AthenaOutputStream::finalize() { StatusCode AthenaOutputStream::execute() { bool failed = false; - for (std::vector<ToolHandle<IAthenaOutputTool> >::const_iterator iter = m_helperTools.begin(); + for (std::vector<ToolHandle<IAthenaOutputTool> >::iterator iter = m_helperTools.begin(); iter != m_helperTools.end(); iter++) { if (!(*iter)->preExecute().isSuccess()) { failed = true; @@ -379,7 +410,7 @@ StatusCode AthenaOutputStream::execute() { failed = true; } } - for (std::vector<ToolHandle<IAthenaOutputTool> >::const_iterator iter = m_helperTools.begin(); + for (std::vector<ToolHandle<IAthenaOutputTool> >::iterator iter = m_helperTools.begin(); iter != m_helperTools.end(); iter++) { if(!(*iter)->postExecute().isSuccess()) { failed = true; @@ -521,7 +552,7 @@ void AthenaOutputStream::addItemObjects(const SG::FolderItem& item) this->tokenizeAtSep( keyTokens, item_key, wildCard ); ATH_MSG_VERBOSE("Done calling tokenizeAtStep( " << keyTokens << ", " << item_key << ", " << wildCard << ")" ); //std::pair<std::string, std::string> key = breakAtSep(item_key, wildCard); - SG::TransientAddress* tAddr = 0; + SG::TransientAddress* tAddr = nullptr; // Now loop over any found proxies for (; iter != end; ++iter) { SG::DataProxy* itemProxy(iter->second); @@ -561,18 +592,18 @@ void AthenaOutputStream::addItemObjects(const SG::FolderItem& item) if (keyMatch && !xkeyMatch) { if (m_forceRead && itemProxy->isValid()) { if (!m_persToPers) { - if (0 == itemProxy->accessData()) { + if (nullptr == itemProxy->accessData()) { ATH_MSG_ERROR(" Could not get data object for id " << item.id() << ",\"" << itemProxy->name()); } } else if (true /*m_exemptPersToPers.find(item.id()) != m_exemptPersToPers.end()*/) { - if (0 == itemProxy->accessData()) { + if (nullptr == itemProxy->accessData()) { ATH_MSG_ERROR(" Could not get data object for id " << item.id() << ",\"" << itemProxy->name()); } } } - if (0 != itemProxy->object()) { + if (nullptr != itemProxy->object()) { if( std::find(m_objects.begin(), m_objects.end(), itemProxy->object()) == m_objects.end() && std::find(m_altObjects.begin(), m_altObjects.end(), itemProxy->object()) == m_altObjects.end() ) { @@ -580,6 +611,7 @@ void AthenaOutputStream::addItemObjects(const SG::FolderItem& item) // If the exact flag is set, make a new DataObject // holding the object as the requested type. DataBucketBase* dbb = dynamic_cast<DataBucketBase*> (itemProxy->object()); + if (!dbb) std::abort(); void* ptr = dbb->cast (item.id()); if (!ptr) { // Hard cast @@ -588,8 +620,8 @@ void AthenaOutputStream::addItemObjects(const SG::FolderItem& item) auto altbucket = CxxUtils::make_unique<AltDataBucket> (ptr, item.id(), - *CLIDRegistry::CLIDToTypeinfo (item.id())); - altbucket->setRegistry (itemProxy); + *CLIDRegistry::CLIDToTypeinfo (item.id()), + *itemProxy); m_objects.push_back(altbucket.get()); m_ownedObjects.push_back (std::move(altbucket)); m_altObjects.push_back (itemProxy->object()); @@ -617,14 +649,14 @@ void AthenaOutputStream::addItemObjects(const SG::FolderItem& item) // reset an auxiliary store back to not being slimmed, after // a previous stream slimmed it. if (item_key.find( "Aux." ) == ( item_key.size() - 4 )) { - SG::IAuxStoreIO* auxio(0); + SG::IAuxStoreIO* auxio(nullptr); try { SG::fromStorable(itemProxy->object(), auxio, true); }catch( const std::exception& ) { // exception from Control/StoreGateBindings/src/SgPyDataModel.cxx:71 ATH_MSG_DEBUG( "Error in casting object with CLID " << itemProxy->clID() << " to SG::IAuxStoreIO*" ); - auxio = 0; + auxio = nullptr; } if( auxio ) { // collect dynamic Aux selection (parse the line, attributes separated by dot) @@ -679,7 +711,7 @@ void AthenaOutputStream::addItemObjects(const SG::FolderItem& item) } } // proxy loop if (!added && !removed) { - if (m_persToPers && tAddr != 0) { + if (m_persToPers && tAddr != nullptr) { ATH_MSG_DEBUG(" Going to attempt direct persistent copy for " << item.id() << ",\"" << item_key << "\""); DataObject* ics = new DataObject(); @@ -707,18 +739,18 @@ void AthenaOutputStream::addItemObjects(const SG::FolderItem& item) void AthenaOutputStream::itemListHandler(Property& /* theProp */) { // Assuming concrete SG::Folder also has an itemList property - IProperty *pAsIProp(0); + IProperty *pAsIProp(nullptr); if ((m_p2BWritten.retrieve()).isFailure() || - 0 == (pAsIProp = dynamic_cast<IProperty*>(&*m_p2BWritten)) || + nullptr == (pAsIProp = dynamic_cast<IProperty*>(&*m_p2BWritten)) || (pAsIProp->setProperty(m_itemList)).isFailure()) { throw GaudiException("Folder property [itemList] not found", name(), StatusCode::FAILURE); } } void AthenaOutputStream::excludeListHandler(Property& /* theProp */) { - IProperty *pAsIProp(0); + IProperty *pAsIProp(nullptr); if ((m_decoder.retrieve()).isFailure() || - 0 == (pAsIProp = dynamic_cast<IProperty*>(&*m_decoder)) || + nullptr == (pAsIProp = dynamic_cast<IProperty*>(&*m_decoder)) || (pAsIProp->setProperty("ItemList", m_excludeList.toString())).isFailure()) { throw GaudiException("Folder property [itemList] not found", name(), StatusCode::FAILURE); } @@ -811,7 +843,7 @@ StatusCode AthenaOutputStream::io_reinit() { return StatusCode::FAILURE; } incSvc->addListener(this, "MetaDataStop", 50); - for (std::vector<ToolHandle<IAthenaOutputTool> >::const_iterator iter = m_helperTools.begin(); + for (std::vector<ToolHandle<IAthenaOutputTool> >::iterator iter = m_helperTools.begin(); iter != m_helperTools.end(); iter++) { if (!(*iter)->postInitialize().isSuccess()) { ATH_MSG_ERROR("Cannot initialize helper tool"); @@ -821,7 +853,7 @@ StatusCode AthenaOutputStream::io_reinit() { } StatusCode AthenaOutputStream::io_finalize() { ATH_MSG_INFO("I/O finalization..."); - for (std::vector<ToolHandle<IAthenaOutputTool> >::const_iterator iter = m_helperTools.begin(); + for (std::vector<ToolHandle<IAthenaOutputTool> >::iterator iter = m_helperTools.begin(); iter != m_helperTools.end(); iter++) { if (!(*iter)->preFinalize().isSuccess()) { ATH_MSG_ERROR("Cannot finalize helper tool"); diff --git a/Control/AthenaServices/src/AthenaOutputStream.h b/Control/AthenaServices/src/AthenaOutputStream.h index 475aafd4ab06cb963986c50a6852a590e16d8a18..8808befe1f50a05f9404f9308963845677adc1c1 100644 --- a/Control/AthenaServices/src/AthenaOutputStream.h +++ b/Control/AthenaServices/src/AthenaOutputStream.h @@ -98,7 +98,7 @@ protected: /// Objects overridden by `exact' handling. IDataSelector m_altObjects; /// Collection of DataObject instances owned by this service. - /// FIXME: it would be simpler to just have m_objets be a vector + /// FIXME: it would be simpler to just have m_objects be a vector /// of DataObjectSharedPtr<DataObject>, but that implies interface changes. std::vector<std::unique_ptr<DataObject> > m_ownedObjects; /// Number of events written to this output stream diff --git a/Control/AthenaServices/src/AthenaOutputStreamTool.cxx b/Control/AthenaServices/src/AthenaOutputStreamTool.cxx index b700cf87b61a7981f21f6b3476562a6594771053..60f61f6e8d14b2ed00e8ff25b969238067312108 100644 --- a/Control/AthenaServices/src/AthenaOutputStreamTool.cxx +++ b/Control/AthenaServices/src/AthenaOutputStreamTool.cxx @@ -143,15 +143,15 @@ AthenaOutputStreamTool::connectServices() if ( m_cnvSvc.type() == "AthenaPoolCnvSvc" ) { ATH_MSG_ERROR ("The use of AthenaOutputStreamTool for AthenaPool data is deprecated !" - << endreq + << endmsg << " Please use AthenaPoolOutputStreamTool from OutputStreamAthenaPool instead." - << endreq - << " theApp.Dlls += [ \"OutputStreamAthenaPool\" ]" << endreq + << endmsg + << " theApp.Dlls += [ \"OutputStreamAthenaPool\" ]" << endmsg << " StreamExample = Algorithm( \"AthenaOutputStream/\" + streamName )" - << endreq + << endmsg << " StreamExample.WritingTool = \"AthenaPoolOutputStreamTool\"" - << endreq - << " ..." << endreq + << endmsg + << " ..." << endmsg << " Or, try importing 'AthenaPoolCnvSvc.WriteAthenaPool'"); return (StatusCode::FAILURE); } @@ -263,7 +263,7 @@ AthenaOutputStreamTool::streamObjects(const TypeKeyPairs& typeKeys ) return( StatusCode::FAILURE); } - DataObject* dObj = 0; + DataObject* dObj = nullptr; // Two options: no key or explicit key if (key.size() == 0) { // No key @@ -351,7 +351,7 @@ AthenaOutputStreamTool::streamObjects (const DataObjectVec& dataObjects) } ATH_MSG_DEBUG ("Trying to write out DataObject twice (type/key): " << typeName << " " << dataObject->name() - << endreq + << endmsg << " Skipping this one. "); continue; } @@ -359,7 +359,7 @@ AthenaOutputStreamTool::streamObjects (const DataObjectVec& dataObjects) written.insert(dataObject); } // Write out object - IOpaqueAddress* addr(0); + IOpaqueAddress* addr(nullptr); if ( (m_cnvSvc->createRep(dataObject, addr)).isSuccess() ) { dataObject->registry()->setAddress(addr); // SG::DataProxy* proxy = dynamic_cast<SG::DataProxy*>(dataObject->registry()); diff --git a/Control/AthenaServices/src/AthenaSealSvc.cxx b/Control/AthenaServices/src/AthenaSealSvc.cxx index ff22e8600a6880f70ba0489994d82cc3f081d4ce..22f5b79c4016a1c4a9c2633088efeae7077018d2 100644 --- a/Control/AthenaServices/src/AthenaSealSvc.cxx +++ b/Control/AthenaServices/src/AthenaSealSvc.cxx @@ -35,7 +35,6 @@ PURPOSE: Verify dictionary completeness by attempting to load all #include "GaudiKernel/IAlgManager.h" #include "GaudiKernel/IAlgorithm.h" #include "GaudiKernel/SmartIF.h" -#include "GaudiKernel/PropertyMgr.h" #include "GaudiKernel/System.h" #include <errno.h> @@ -300,7 +299,7 @@ AthenaSealSvc::show_member (const ReflexMember& m) const msg(MSG::VERBOSE) << " -- type: " << "[unknown]"; } } - msg(MSG::VERBOSE) << endreq; + msg(MSG::VERBOSE) << endmsg; } //---------------------------------------------------------------------------- @@ -313,7 +312,7 @@ AthenaSealSvc::show_type (const ReflexType& t) const return; // show info of members - msg(MSG::VERBOSE) << "Members of class " << t.Name() << ":" << endreq; + msg(MSG::VERBOSE) << "Members of class " << t.Name() << ":" << endmsg; for (size_t i = 0; i < t.DataMemberSize(); ++i) { ReflexMember m = t.DataMemberAt(i); if (m) { @@ -354,7 +353,7 @@ AthenaSealSvc::member_is_ok(const std::string& typeName, } #if ROOT_VERSION_CODE > ROOT_VERSION(6,0,0) if( typeName.find("DataVector<") == 0 && memberName == "m_pCont") { - msg(MSG::VERBOSE) << "**** Ignoring " << typeName << "." << memberName << endreq; + msg(MSG::VERBOSE) << "**** Ignoring " << typeName << "." << memberName << endmsg; return (true); } #endif @@ -382,7 +381,7 @@ AthenaSealSvc::find_extra_types (const ReflexType& t, // check that types of the fields are defined if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Looking for members of type " << t.Name() << ":" - << " newTypes size " << newTypes.size() << endreq; + << " newTypes size " << newTypes.size() << endmsg; for (size_t i = 0; i < t.DataMemberSize(); ++i) { ReflexMember m = t.DataMemberAt(i); if (m) { @@ -396,7 +395,7 @@ AthenaSealSvc::find_extra_types (const ReflexType& t, if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << " Skipping check for transient member " << m.Name() << " of type " << t2.Name() - << endreq; + << endmsg; continue; } // Also skip static members. @@ -404,12 +403,12 @@ AthenaSealSvc::find_extra_types (const ReflexType& t, if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << " Skipping check for static member " << m.Name() << " of type " << t2.Name() - << endreq; + << endmsg; continue; } if (t2) { newTypes.push_back(t2); - if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << " found class " << t2.Name() << endreq; + if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << " found class " << t2.Name() << endmsg; } } } @@ -417,7 +416,7 @@ AthenaSealSvc::find_extra_types (const ReflexType& t, // Add in types for each superclass if (t.IsClass()) { if(t.BaseSize()) { - if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << " Loop over superclass names " << endreq; + if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << " Loop over superclass names " << endmsg; } for (size_t i = 0; i < t.BaseSize(); ++i) { ReflexBase b = t.BaseAt(i); @@ -431,7 +430,7 @@ AthenaSealSvc::find_extra_types (const ReflexType& t, if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << ". Type IS defined in dictionary. "; newTypes.push_back(tb); } - if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << endreq; + if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << endmsg; } } } @@ -440,7 +439,7 @@ AthenaSealSvc::find_extra_types (const ReflexType& t, // Add in types for templates if (t.IsTemplateInstance()) { if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << " Loop over template args of " << t.Name()<< " " - << endreq; + << endmsg; for (size_t i = 0; i < t.TemplateArgumentSize(); ++i) { ReflexType ta = t.TemplateArgumentAt(i); @@ -450,7 +449,7 @@ AthenaSealSvc::find_extra_types (const ReflexType& t, std::string name = ta.Name(7); // skip single digit strings if (name.size() == 1 && isdigit(name[0])) { - if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Skip template arg: " << name << " is digit " << endreq; + if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Skip template arg: " << name << " is digit " << endmsg; continue; } if ('*' == name[name.size()-1]) name = name.substr(0, name.size()-1); @@ -467,7 +466,7 @@ AthenaSealSvc::find_extra_types (const ReflexType& t, << name << " ntypes before load " << ntypesBefore << " ntypes loaded " << ReflexType::TypeSize() - ntypesBefore - << " top level class " << m_currentClassName << endreq; + << " top level class " << m_currentClassName << endmsg; } @@ -476,31 +475,31 @@ AthenaSealSvc::find_extra_types (const ReflexType& t, if (ta) { newTypes.push_back(ta); - if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << " name " << ta.Name()<< " " << endreq; + if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << " name " << ta.Name()<< " " << endmsg; } else { if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << " type not found " << taname - << " isnum: " << isnum(taname) << endreq; + << " isnum: " << isnum(taname) << endmsg; if (!(ignoreName(t) || ignoreName(ta) || isnum(taname) )) { if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "****> Missing type for template argument " << taname << " of template " << t.Name() - << endreq; + << endmsg; if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "****> For the moment, we DO NOT return FAILURE - so expect abort if type is really missing!! " - << endreq; + << endmsg; } } if (t.IsPointer()) { - if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << " type is pointer: " << t.Name() << endreq; + if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << " type is pointer: " << t.Name() << endmsg; } // Check for pointers and add in simple class // msg(MSG::VERBOSE) << "Checking for pointer class: " -// <<((*it2)) << endreq; +// <<((*it2)) << endmsg; // std::string nm = (*it2); // nm = nm.substr(0, nm.size() - 1); -// msg(MSG::VERBOSE) << " try class " << nm << " " << endreq; +// msg(MSG::VERBOSE) << " try class " << nm << " " << endmsg; } } @@ -524,11 +523,11 @@ AthenaSealSvc::incorrect_guid (const ReflexType& t) const if ('a' <= clid[i] && clid[i] <= 'z') { msg(MSG::ERROR) << "-----> Found lower case letter in class guid: pos, value - " - << i << ", " << clid[i] << endreq + << i << ", " << clid[i] << endmsg << "-----> For class, guid " - << t.Name() << ", " << clid << endreq + << t.Name() << ", " << clid << endmsg << "-----> The guid MUST be all upper case. " - << endreq; + << endmsg; result = true; } } @@ -575,9 +574,9 @@ AthenaSealSvc::missing_member_types (const ReflexType& t) const is_enum = true; #endif - msg(MSG::VERBOSE) << "Checking member: " << m.Name() << " of type " << t1.Name(7) << "::" << t2.Name(7) << endreq; + msg(MSG::VERBOSE) << "Checking member: " << m.Name() << " of type " << t1.Name(7) << "::" << t2.Name(7) << endmsg; #ifndef ROOT6_MIGRATION_HAVE_REFLEX - msg(MSG::VERBOSE) << "Trans:" << transient << " Static:" << is_static << " Enum:" << is_enum << " Const:" << m.IsConstant() << endreq; + msg(MSG::VERBOSE) << "Trans:" << transient << " Static:" << is_static << " Enum:" << is_enum << " Const:" << m.IsConstant() << endmsg; #endif if (!t2 && !member_is_ok(t1.Name(), m.Name()) && !transient && !is_static && !is_enum ) { @@ -724,7 +723,7 @@ StatusCode AthenaSealSvc::checkClass(const std::string& typeName) const if (!clid.size()) { ATH_MSG_ERROR ("-----> MISSING GUID (id in selection file) for class " << t.Name() - << endreq + << endmsg << "-----> This is needed for ALL DataObjects "); return (StatusCode::FAILURE); } @@ -801,7 +800,7 @@ StatusCode AthenaSealSvc::checkClass(const std::string& typeName) const ATH_MSG_DEBUG ("checkClass - NO MISSING FIELDS!!!" - << endreq + << endmsg << "checkClass - Number of types on exit " << ReflexType::TypeSize()); // ATH_MSG_VERBOSE ("Classes checked: "); @@ -1002,18 +1001,18 @@ AthenaSealSvc::missingTypes(const ReflexType& t) const else { if (!ignoreName(bname)) { if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) - << endreq + << endmsg << " ****> Missing base class not defined in dictionary!! " - << endreq + << endmsg << " ****> Looking for base class " << bname << " of type " << t.Name() - << endreq; + << endmsg; isMissingTypes = true; } } } } - if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << endreq; + if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << endmsg; } } diff --git a/Control/AthenaServices/src/AthenaSharedMemoryTool.cxx b/Control/AthenaServices/src/AthenaSharedMemoryTool.cxx index 646859e9bf7d39ef1031025b093119f791495524..de7b31fb016ea847be6b7e570f2969178b019d8a 100644 --- a/Control/AthenaServices/src/AthenaSharedMemoryTool.cxx +++ b/Control/AthenaServices/src/AthenaSharedMemoryTool.cxx @@ -30,12 +30,12 @@ struct ShareEventHeader { AthenaSharedMemoryTool::AthenaSharedMemoryTool(const std::string& type, const std::string& name, const IInterface* parent) : AthAlgTool(type, name, parent), - m_maxSize(16 * 1024 * 1024), + m_maxSize(32 * 1024 * 1024), m_maxDataClients(256), m_num(-1), m_dataClients(), - m_payload(0), - m_status(0), + m_payload(nullptr), + m_status(nullptr), m_fileSeqNumber(0), m_isServer(false), m_isClient(false), @@ -46,8 +46,8 @@ AthenaSharedMemoryTool::AthenaSharedMemoryTool(const std::string& type, //___________________________________________________________________________ AthenaSharedMemoryTool::~AthenaSharedMemoryTool() { - delete m_payload; m_payload = 0; - delete m_status; m_status = 0; + delete m_payload; m_payload = nullptr; + delete m_status; m_status = nullptr; } //___________________________________________________________________________ @@ -153,7 +153,7 @@ StatusCode AthenaSharedMemoryTool::makeClient(int num) { boost::interprocess::shared_memory_object shm(boost::interprocess::open_only, m_sharedMemory.value().c_str(), boost::interprocess::read_write); - if (m_payload == 0) { + if (m_payload == nullptr) { m_payload = new boost::interprocess::mapped_region(shm, boost::interprocess::read_write, 0, m_maxSize); m_status = new boost::interprocess::mapped_region(shm, boost::interprocess::read_write, m_maxSize + num * sizeof(ShareEventHeader), sizeof(ShareEventHeader)); } @@ -185,23 +185,26 @@ StatusCode AthenaSharedMemoryTool::putEvent(long eventNumber, const void* source ATH_MSG_DEBUG("Waiting for putEvent, eventNumber = " << eventNumber); return(StatusCode::RECOVERABLE); } - if (source == 0 && nbytes == 0) { + if (source == nullptr && nbytes == 0) { ATH_MSG_DEBUG("putEvent got last Event marker"); evtH->evtSeqNumber = 0; evtH->fileSeqNumber = 0; evtH->evtSize = 0; evtH->evtOffset = 0; + m_status->flush(0, sizeof(ShareEventHeader)); return(StatusCode::SUCCESS); } evtH->evtProcessStatus = ShareEventHeader::CLEARED; - if (source != 0 && source != m_payload->get_address()) { + if (source != nullptr && source != m_payload->get_address()) { std::memcpy(m_payload->get_address(), source, nbytes); + m_payload->flush(0, nbytes); } evtH->evtSeqNumber = eventNumber; evtH->fileSeqNumber = m_fileSeqNumber; evtH->evtSize = nbytes; evtH->evtOffset = 0; evtH->evtCoreStatusFlag = status; + m_status->flush(0, sizeof(ShareEventHeader)); evtH->evtProcessStatus = ShareEventHeader::FILLED; return(StatusCode::SUCCESS); } @@ -211,7 +214,7 @@ StatusCode AthenaSharedMemoryTool::getLockedEvent(void** target, unsigned int& s ShareEventHeader* evtH = static_cast<ShareEventHeader*>(m_status->get_address()); if (evtH->evtProcessStatus == ShareEventHeader::LOCKED) { const std::size_t nbytes = evtH->evtSize; - if (target != 0) { + if (target != nullptr) { char* buf = new char[nbytes]; std::memcpy(buf, static_cast<char*>(m_payload->get_address()) + evtH->evtOffset, nbytes); *target = buf; @@ -264,19 +267,28 @@ StatusCode AthenaSharedMemoryTool::putObject(const void* source, size_t nbytes, ATH_MSG_DEBUG("Waiting for CLEARED putObject, client = " << num); return(StatusCode::RECOVERABLE); } - if (source != 0 && source != m_payload->get_address()) { - std::memcpy(m_payload->get_address(), source, nbytes); - evtH->evtSize = nbytes; + if (source == nullptr) { + evtH->evtSize = evtH->evtOffset; + evtH->evtOffset = 0; + m_status->flush(num * sizeof(ShareEventHeader), sizeof(ShareEventHeader)); + evtH->evtProcessStatus = ShareEventHeader::FILLED; } else { - evtH->evtSize = 0; + if (evtH->evtOffset + sizeof(size_t) + nbytes > m_maxSize) { + ATH_MSG_ERROR("Object location = " << evtH->evtOffset << " greater than maximum for client = " << num); + return(StatusCode::FAILURE); + } + std::memcpy(static_cast<char*>(m_payload->get_address()) + evtH->evtOffset, &nbytes, sizeof(size_t)); + evtH->evtOffset += sizeof(size_t); + std::memcpy(static_cast<char*>(m_payload->get_address()) + evtH->evtOffset, source, nbytes); + evtH->evtOffset += nbytes; + m_payload->flush(evtH->evtOffset - sizeof(size_t) - nbytes, sizeof(size_t) + nbytes); } - evtH->evtProcessStatus = ShareEventHeader::FILLED; return(StatusCode::SUCCESS); } //___________________________________________________________________________ StatusCode AthenaSharedMemoryTool::getObject(void** target, size_t& nbytes, int num) { - if (target == 0) { + if (target == nullptr) { return(StatusCode::SUCCESS); } void* status = static_cast<char*>(m_status->get_address()) + num * sizeof(ShareEventHeader); @@ -285,15 +297,19 @@ StatusCode AthenaSharedMemoryTool::getObject(void** target, size_t& nbytes, int ATH_MSG_DEBUG("Waiting for FILLED getObject, client = " << num); return(StatusCode::RECOVERABLE); } - nbytes = evtH->evtSize; - if (nbytes > 0) { + if (evtH->evtOffset < evtH->evtSize) { + std::memcpy(&nbytes, static_cast<char*>(m_payload->get_address()) + evtH->evtOffset, sizeof(size_t)); + evtH->evtOffset += sizeof(size_t); char* buf = new char[nbytes]; - std::memcpy(buf, static_cast<char*>(m_payload->get_address()), nbytes); + std::memcpy(buf, static_cast<char*>(m_payload->get_address()) + evtH->evtOffset, nbytes); *target = buf; - } else { - *target = m_payload->get_address(); + evtH->evtOffset += nbytes; + } + if (evtH->evtOffset == evtH->evtSize) { + evtH->evtOffset = 0; + m_status->flush(num * sizeof(ShareEventHeader), sizeof(ShareEventHeader)); + evtH->evtProcessStatus = ShareEventHeader::UNLOCKED; } - evtH->evtProcessStatus = ShareEventHeader::UNLOCKED; return(StatusCode::SUCCESS); } @@ -305,7 +321,7 @@ StatusCode AthenaSharedMemoryTool::clearObject(char** tokenString, int& num) { ATH_MSG_DEBUG("Waiting for FILL clearObject"); return(StatusCode::RECOVERABLE); } - if (*tokenString == 0) { + if (*tokenString == nullptr) { *tokenString = new char[maxTokenLength]; } ATH_MSG_DEBUG("Getting Token in clearObject"); @@ -323,7 +339,7 @@ StatusCode AthenaSharedMemoryTool::clearObject(char** tokenString, int& num) { ATH_MSG_DEBUG("Waiting for LOCK clearObject, client = " << i); return(StatusCode::RECOVERABLE); } else if ((i == num || num < 0) && evtH->evtProcessStatus == ShareEventHeader::LOCKED) { - if (*tokenString == 0) { + if (*tokenString == nullptr) { *tokenString = new char[maxTokenLength]; } ATH_MSG_DEBUG("Getting Token in clearObject, client = " << i); @@ -358,6 +374,8 @@ StatusCode AthenaSharedMemoryTool::clearObject(char** tokenString, int& num) { num = -1; return(StatusCode::SUCCESS); } + evtH->evtSize = 0; + m_status->flush(0, sizeof(ShareEventHeader)); evtH->evtProcessStatus = ShareEventHeader::CLEARED; return(StatusCode::SUCCESS); } @@ -378,8 +396,11 @@ StatusCode AthenaSharedMemoryTool::lockObject(const char* tokenString, int num) } strncpy(evtH->token, tokenString, maxTokenLength - 1); evtH->token[maxTokenLength - 1] = 0; if (m_isServer) { + evtH->evtSize = 0; + m_status->flush(num * sizeof(ShareEventHeader), sizeof(ShareEventHeader)); evtH->evtProcessStatus = ShareEventHeader::CLEARED; } else { + m_status->flush(num * sizeof(ShareEventHeader), sizeof(ShareEventHeader)); evtH->evtProcessStatus = ShareEventHeader::LOCKED; } return(StatusCode::SUCCESS); diff --git a/Control/AthenaServices/src/AthenaSummarySvc.cxx b/Control/AthenaServices/src/AthenaSummarySvc.cxx index e6890ead2ae4c0fefa23883630c975650c735d0d..a9f89f387613fdb23b09d720ed74852a5648aedb 100644 --- a/Control/AthenaServices/src/AthenaSummarySvc.cxx +++ b/Control/AthenaServices/src/AthenaSummarySvc.cxx @@ -36,7 +36,7 @@ static std::string levelNames[MSG::NUM_LEVELS]; using namespace std; -char* AthenaSummarySvc::s_block = 0; +char* AthenaSummarySvc::s_block = nullptr; bool AthenaSummarySvc::s_badalloc = false; const char* II("\001"); @@ -137,8 +137,8 @@ inline void tolower(std::string &s) AthenaSummarySvc::AthenaSummarySvc( const std::string& name, ISvcLocator* svc ) : AthService( name, svc ), m_log(msgSvc(), name), p_incSvc("IncidentSvc",name), - p_logMsg(0), - m_new(0),m_status(0),m_eventsRead(0),m_eventsWritten(0), + p_logMsg(nullptr), + m_new(nullptr),m_status(0),m_eventsRead(0),m_eventsWritten(0), m_eventsSkipped(0),m_runs(0) { @@ -175,9 +175,9 @@ StatusCode AthenaSummarySvc::initialize() { m_log.setLevel( m_outputLevel.value() ); m_log << MSG::DEBUG << "Initializing AthenaSummarySvc version " - << PACKAGE_VERSION << endreq; + << PACKAGE_VERSION << endmsg; - m_log << MSG::DEBUG << "Service initialized" << endreq; + m_log << MSG::DEBUG << "Service initialized" << endmsg; int pri=100; p_incSvc->addListener( this, "BeginInputFile", pri, true); @@ -207,7 +207,7 @@ StatusCode AthenaSummarySvc::initialize() { vector<string>::const_iterator itr; for (itr=m_extraInc.value().begin(); itr != m_extraInc.value().end(); ++itr) { - m_log << MSG::DEBUG << "Tracking incident \"" << *itr << "\"" << endreq; + m_log << MSG::DEBUG << "Tracking incident \"" << *itr << "\"" << endmsg; addListener(*itr); } @@ -216,26 +216,26 @@ StatusCode AthenaSummarySvc::initialize() { #else p_logMsg = dynamic_cast< ILoggedMessageSvc* > ( msgSvc() ); #endif - if (p_logMsg == 0) { + if (p_logMsg == nullptr) { m_log << MSG::INFO << "unable dcast IMessageSvc to ILoggedMessageSvc: " << "not scanning for keywords in logs, or printing logged messages" - << endreq; + << endmsg; } else { if (m_keywords.value().size() > 0) { IProperty *ip = dynamic_cast<IProperty*>( p_logMsg ); - if (ip != 0) { + if (ip != nullptr) { if (ip->setProperty(m_keywords).isFailure()) { m_log << MSG::ERROR << "could not set keywords property of LoggedMessageSvc" - << endreq; + << endmsg; } else { m_log << MSG::INFO << "Scanning log for keyword \"" << m_keywords - << "\". CAVEAT EMPTOR - THIS IS VERY SLOW!!" << endreq; + << "\". CAVEAT EMPTOR - THIS IS VERY SLOW!!" << endmsg; } } else { m_log << MSG::ERROR << "could not dcast LoggedMessageSvc to IProperty" - << endreq; + << endmsg; } } @@ -246,7 +246,7 @@ StatusCode AthenaSummarySvc::initialize() { m_summaryFormat = fmt; // save some space for the summary output if we run out of memory - m_log << MSG::DEBUG << "allocating block of 100 pages" << endreq; + m_log << MSG::DEBUG << "allocating block of 100 pages" << endmsg; s_block = new char[ sysconf( _SC_PAGESIZE ) * 100 ]; @@ -258,7 +258,7 @@ StatusCode AthenaSummarySvc::initialize() { StatusCode AthenaSummarySvc::reinitialize() { - delete[] s_block; s_block = 0; + delete[] s_block; s_block = nullptr; s_block = new char[ sysconf( _SC_PAGESIZE ) * 100 ]; return s_block ? StatusCode::SUCCESS : StatusCode::FAILURE; @@ -271,14 +271,14 @@ StatusCode AthenaSummarySvc::finalize() { StatusCode status = createSummary(); // cleanup - delete[] s_block; s_block = 0; + delete[] s_block; s_block = nullptr; std::set_new_handler( m_new ); status = AthService::finalize(); if ( status.isSuccess() ) - m_log << MSG::DEBUG << "Service finalised successfully" << endreq; + m_log << MSG::DEBUG << "Service finalised successfully" << endmsg; return status; @@ -306,13 +306,13 @@ AthenaSummarySvc::queryInterface(const InterfaceID& riid, void** ppvInterface) void AthenaSummarySvc::addListener( const std::string& inc ) { - m_log << MSG::DEBUG << "now listening to incident " << inc << endreq; + m_log << MSG::DEBUG << "now listening to incident " << inc << endmsg; if (m_extraIncidents.find( inc ) == m_extraIncidents.end()) { p_incSvc->addListener( this, inc, 100, true); m_extraIncidents[inc] = map<string,int>(); } else { - m_log << MSG::INFO << "already listening to Incident " << inc << endreq; + m_log << MSG::INFO << "already listening to Incident " << inc << endmsg; } } @@ -322,7 +322,7 @@ AthenaSummarySvc::addListener( const std::string& inc ) { void AthenaSummarySvc::addSummary(const std::string& dict, const std::string& info) { - m_log << MSG::DEBUG << "adding extra info: " << dict << "/" << info << endreq; + m_log << MSG::DEBUG << "adding extra info: " << dict << "/" << info << endmsg; m_extraInfo.push_back( make_pair(dict,info) ); @@ -340,16 +340,16 @@ AthenaSummarySvc::newHandler() { throw std::bad_alloc(); // default behavior (no print-out) // release our block to create working space for finalize() - delete[] s_block; s_block = 0; + delete[] s_block; s_block = nullptr; // print onto std::cerr rather than MsgStream, as it's more innocuous std::cerr << "AthenaSummarySvc FATAL out of memory: saving summary ..." << std::endl; - IAthenaSummarySvc *ipa(0); + IAthenaSummarySvc *ipa(nullptr); Gaudi::svcLocator()->service("AthenaSummarySvc",ipa).ignore(); - if (ipa != 0) { + if (ipa != nullptr) { std::string btrace; if ( System::backTrace(btrace,5,3) ) { ipa->addSummary("badalloc backtrace",btrace); @@ -376,14 +376,14 @@ void AthenaSummarySvc::handle(const Incident &inc) { m_log << MSG::DEBUG << "handle incident: " << inc.type() << " " - << inc.source() << endreq; + << inc.source() << endmsg; string fileName; const FileIncident *fi = dynamic_cast<const FileIncident*>( &inc ); - if (fi != 0) { + if (fi != nullptr) { // FIXME!!! waiting on AthenaPoolKernel-00-00-07 - m_log << MSG::INFO << " -> file incident: " << fi->fileName() << " [GUID: " << fi->fileGuid() << "]" << endreq; + m_log << MSG::INFO << " -> file incident: " << fi->fileName() << " [GUID: " << fi->fileGuid() << "]" << endmsg; fileName = fi->fileName(); } else { fileName = inc.source(); @@ -432,17 +432,17 @@ AthenaSummarySvc::handle(const Incident &inc) { StatusCode AthenaSummarySvc::createSummary() { - m_log << MSG::DEBUG << " createSummary " << endreq; + m_log << MSG::DEBUG << " createSummary " << endmsg; std::ofstream ofs; ofs.open(m_summaryFile.value().c_str()); if (!ofs) { m_log << MSG::ERROR << "Unable to open output file \"" << m_summaryFile.value() << "\"" - << endreq; + << endmsg; return StatusCode::FAILURE; } - m_log << MSG::DEBUG << "Writing to \"" << m_summaryFile.value() << "\"" << endreq; + m_log << MSG::DEBUG << "Writing to \"" << m_summaryFile.value() << "\"" << endmsg; if (m_summaryFormat.value() == "ascii" || m_summaryFormat.value() == "both") { createASCII(ofs); @@ -464,7 +464,7 @@ AthenaSummarySvc::createSummary() { void AthenaSummarySvc::createASCII( std::ofstream& ofs ) { - m_log << MSG::DEBUG << " createASCII" << endreq; + m_log << MSG::DEBUG << " createASCII" << endmsg; list<string>::const_iterator itr; @@ -511,19 +511,19 @@ AthenaSummarySvc::createASCII( std::ofstream& ofs ) { ofs << " WARNING: " << msgSvc()->messageCount( MSG::WARNING ) << endl; ofs << " INFO: " << msgSvc()->messageCount( MSG::INFO ) << endl; - if (p_logMsg != 0) { + if (p_logMsg != nullptr) { IntegerProperty thresh("loggingLevel",MSG::VERBOSE); IProperty *ip = dynamic_cast<IProperty*>( p_logMsg ); - if (ip != 0) { + if (ip != nullptr) { if (ip->getProperty(&thresh).isFailure()) { m_log << MSG::ERROR << "could not get loggingLevel property of LoggedMessageSvc" - << endreq; + << endmsg; } } else { m_log << MSG::ERROR << "could not dcast LoggedMessageSvc to IProperty" - << endreq; + << endmsg; } @@ -579,7 +579,7 @@ AthenaSummarySvc::createASCII( std::ofstream& ofs ) { if (service("PerfMonSvc",ipms,false).isFailure()) { m_log << MSG::DEBUG << "unable to get the PerfMonSvc: not printing perf summaries" - << endreq; + << endmsg; } else { ofs << "Monitored Components:" << endl; @@ -608,7 +608,7 @@ AthenaSummarySvc::createASCII( std::ofstream& ofs ) { void AthenaSummarySvc::createDict( std::ofstream& ofd) { - m_log << MSG::DEBUG << " createDict" << endreq; + m_log << MSG::DEBUG << " createDict" << endmsg; list<string>::const_iterator itr; @@ -677,19 +677,19 @@ AthenaSummarySvc::createDict( std::ofstream& ofd) { p.add("message count",msg); - if (p_logMsg != 0) { + if (p_logMsg != nullptr) { IntegerProperty thresh("loggingLevel",MSG::VERBOSE); IProperty *ip = dynamic_cast<IProperty*>( p_logMsg ); - if (ip != 0) { + if (ip != nullptr) { if (ip->getProperty(&thresh).isFailure()) { m_log << MSG::ERROR << "could not get loggingLevel property of LoggedMessageSvc" - << endreq; + << endmsg; } } else { m_log << MSG::ERROR << "could not dcast LoggedMessageSvc to IProperty" - << endreq; + << endmsg; } PD mlog; @@ -751,7 +751,7 @@ AthenaSummarySvc::createDict( std::ofstream& ofd) { if (service("PerfMonSvc",ipms,false).isFailure()) { m_log << MSG::DEBUG << "unable to get the PerfMonSvc: not printing perf summaries" - << endreq; + << endmsg; } else { PD mon,ini,exe,fin; diff --git a/Control/AthenaServices/src/AthenaYamplTool.cxx b/Control/AthenaServices/src/AthenaYamplTool.cxx index 1312f8064da394c91650d9ff1a5ef790ddd65ad2..0e4fbbe8e060a73da99dbd82fae36ad74bdcca52 100644 --- a/Control/AthenaServices/src/AthenaYamplTool.cxx +++ b/Control/AthenaServices/src/AthenaYamplTool.cxx @@ -33,9 +33,9 @@ AthenaYamplTool::AthenaYamplTool(const std::string& type, , m_many2one(true) , m_chronoStatSvc("ChronoStatSvc", name) , m_incidentSvc("IncidentSvc", name) - , m_socketFactory(0) - , m_clientSocket(0) - , m_serverSocket(0) + , m_socketFactory(nullptr) + , m_clientSocket(nullptr) + , m_serverSocket(nullptr) { declareProperty("ChannelName", m_channel = name); declareProperty("Many2One", m_many2one); @@ -136,11 +136,11 @@ StatusCode AthenaYamplTool::putEvent(long eventNumber, const void* source, std:: ATH_MSG_ERROR("putEvent called when Tool is not a Server!"); return StatusCode::FAILURE; } - if (source == 0 && nbytes == 0) { + if (source == nullptr && nbytes == 0) { ATH_MSG_DEBUG("putEvent got last Event marker"); return(StatusCode::SUCCESS); } - if (source == 0) { + if (source == nullptr) { ATH_MSG_ERROR("putEvent got null source"); return(StatusCode::FAILURE); } @@ -160,7 +160,7 @@ StatusCode AthenaYamplTool::putEvent(long eventNumber, const void* source, std:: memcpy((char*)message+sizeof(evtH),source,nbytes); // Wait for incoming request - char *ping = 0; // can be something else + char *ping = nullptr; // can be something else m_serverSocket->recv(ping); m_serverSocket->send(message,nbytes+sizeof(evtH)); return(StatusCode::SUCCESS); diff --git a/Control/AthenaServices/src/ClearStorePolicy.cxx b/Control/AthenaServices/src/ClearStorePolicy.cxx index 797de96e3662b9310dec1fed721b53b6a7d524c8..dfe7cdc0c21ed9c44beb52c88955504867f5ecf2 100644 --- a/Control/AthenaServices/src/ClearStorePolicy.cxx +++ b/Control/AthenaServices/src/ClearStorePolicy.cxx @@ -13,7 +13,7 @@ ClearStorePolicy::Type clearStorePolicy( const std::string& policyName, msg << MSG::WARNING << "Unknown policy [" << policyName << "] for the 'clear-store' " << "policy !! We'll use 'BeginEvent' instead !!" - << endreq; + << endmsg; return ClearStorePolicy::BeginEvent; } } diff --git a/Control/AthenaServices/src/CoreDumpSvc.cxx b/Control/AthenaServices/src/CoreDumpSvc.cxx index c77d43cbd1cf060273d194d7490183d40d434131..3aa3e09c37bbcf33b517026ea4345b621834534c 100644 --- a/Control/AthenaServices/src/CoreDumpSvc.cxx +++ b/Control/AthenaServices/src/CoreDumpSvc.cxx @@ -62,7 +62,7 @@ namespace CoreDumpSvcHandler SigHandler_t oldSigHandler; ///< old signal handlers bool callOldHandler(true); ///< forward calls to old handlers? - CoreDumpSvc* coreDumpSvc(0); ///< pointer to CoreDumpSvc + CoreDumpSvc* coreDumpSvc(nullptr); ///< pointer to CoreDumpSvc /** * Signal handler for the CoreDumpSvc @@ -106,9 +106,9 @@ namespace CoreDumpSvcHandler //================================================================================ CoreDumpSvc::CoreDumpSvc( const std::string& name, ISvcLocator* pSvcLocator ) : AthService( name, pSvcLocator ), - m_siginfo(0), + m_siginfo(nullptr), m_eventCounter(0), - m_abortTimer(0, NULL, Athena::AlgorithmTimer::AlgorithmTimerConfig(Athena::AlgorithmTimer::USEREALTIME | Athena::AlgorithmTimer::DELIVERYBYTHREAD ) ) + m_abortTimer(0, 0, Athena::AlgorithmTimer::AlgorithmTimerConfig(Athena::AlgorithmTimer::USEREALTIME | Athena::AlgorithmTimer::DELIVERYBYTHREAD ) ) { // Set us as the current instance CoreDumpSvcHandler::coreDumpSvc = this; @@ -160,7 +160,7 @@ CoreDumpSvc::CoreDumpSvc( const std::string& name, ISvcLocator* pSvcLocator ) : CoreDumpSvc::~CoreDumpSvc() { - CoreDumpSvcHandler::coreDumpSvc = 0; + CoreDumpSvcHandler::coreDumpSvc = nullptr; } void CoreDumpSvc::propertyHandler(Property& p) @@ -245,7 +245,7 @@ StatusCode CoreDumpSvc::finalize() StatusCode CoreDumpSvc::queryInterface(const InterfaceID& riid, void** ppvInterface) { - if ( ppvInterface==0 ) return StatusCode::FAILURE; + if ( ppvInterface==nullptr ) return StatusCode::FAILURE; if ( ICoreDumpSvc::interfaceID().versionMatch(riid) ) *ppvInterface = static_cast<ICoreDumpSvc*>(this); @@ -291,7 +291,7 @@ void CoreDumpSvc::print() std::string CoreDumpSvc::dump() const { std::ostringstream os; - const time_t now = time(0); + const time_t now = time(nullptr); os << "-------------------------------------------------------------------------------------" << "\n"; os << "Core dump from " << name() << " on " << System::hostName() @@ -365,14 +365,14 @@ std::string CoreDumpSvc::dump() const } // Check if the AlgContextSvc is running - IAlgContextSvc* algContextSvc(0); + IAlgContextSvc* algContextSvc(nullptr); if (service("AlgContextSvc", algContextSvc, /*createIf=*/ false).isSuccess() && algContextSvc) { IAlgorithm* alg = algContextSvc->currentAlg(); os << "Current algorithm: " << (alg ? alg->name() : "<NONE>") << "\n"; os << "Algorithm stack: "; - if ( algContextSvc->algorithms().size()==0 ) os << "<EMPTY>" << "\n"; + if ( !alg || algContextSvc->algorithms().size()==0 ) os << "<EMPTY>" << "\n"; else { os << "\n"; IAlgContextSvc::Algorithms::const_iterator iter; @@ -393,7 +393,7 @@ std::string CoreDumpSvc::dump() const os << " atlasAddress2Line --file <logfile>\n"; os << "-------------------------------------------------------------------------------------"; - IAthenaSummarySvc *iass(0); + IAthenaSummarySvc *iass(nullptr); if (service("AthenaSummarySvc",iass,false).isSuccess() && iass) { iass->addSummary("CoreDumpSvc",os.str()); iass->setStatus(1); @@ -412,8 +412,8 @@ void CoreDumpSvc::handle(const Incident& incident) { m_sysCoreDump["Last incident"] = incident.source() + ":" + incident.type(); - const EventIncident* eventInc(0); - if (0 != (eventInc = dynamic_cast<const EventIncident*>(&incident))) { + const EventIncident* eventInc(nullptr); + if (nullptr != (eventInc = dynamic_cast<const EventIncident*>(&incident))) { const EventID* eventID = eventInc->eventInfo().event_ID(); if (eventID) { std::ostringstream oss; @@ -428,6 +428,8 @@ void CoreDumpSvc::handle(const Incident& incident) else if (incident.type() == "StoreCleared") { // Try to force reallocation. std::string newstr = m_sysCoreDump["EventID"]; + // Intentional: + // cppcheck-suppress selfAssignment newstr[0] = newstr[0]; m_sysCoreDump["EventID"] = newstr; } @@ -487,7 +489,7 @@ StatusCode CoreDumpSvc::uninstallSignalHandler() for ( iter=CoreDumpSvcHandler::oldSigHandler.begin(); iter!=CoreDumpSvcHandler::oldSigHandler.end(); ++iter ) { - int ret = sigaction(iter->first, &(iter->second), 0); + int ret = sigaction(iter->first, &(iter->second), nullptr); if ( ret!=0 ) { sc = StatusCode::FAILURE; ATH_MSG_WARNING diff --git a/Control/AthenaServices/src/DecisionSvc.cxx b/Control/AthenaServices/src/DecisionSvc.cxx index 40f226feb70e9ddf6f3ee3eb930266d4b2cd5fe6..a0a8ff0dfefb14ebaf7b14511d74974ef511255d 100644 --- a/Control/AthenaServices/src/DecisionSvc.cxx +++ b/Control/AthenaServices/src/DecisionSvc.cxx @@ -16,6 +16,7 @@ // Gaudi include files #include "GaudiKernel/IIncidentSvc.h" #include "GaudiKernel/FileIncident.h" +#include "GaudiKernel/EventContext.h" #include <algorithm> #include <sstream> @@ -29,32 +30,19 @@ DecisionSvc::DecisionSvc(const std::string& name, m_cutflowSvc("",name), #else m_cutflowSvc("CutFlowSvc/CutFlowSvc",name), + m_algstateSvc("AlgExecStateSvc",name), #endif - m_eventCount(0), - m_badEvents(0) + m_eventCount(0) { declareProperty("CalcStats",m_calcStats); ATH_MSG_DEBUG ("In DecisionSvc::DecisionSvc "); assert( pSvcLocator ); - - // Allocate m_SacceptAlgNames vector - m_SacceptAlgNames = new std::vector<std::string>; - // Allocate m_SrequireAlgNames vector - m_SrequireAlgNames = new std::vector<std::string>; - // Allocate m_SvetoAlgNames vector - m_SvetoAlgNames = new std::vector<std::string>; - // Allocate m_streamNames - m_streamNames = new std::vector<std::string>; } DecisionSvc::~DecisionSvc() { - delete m_SacceptAlgNames; - delete m_SrequireAlgNames; - delete m_SvetoAlgNames; - delete m_streamNames; } StatusCode @@ -75,6 +63,13 @@ DecisionSvc::initialize() // Set to be listener for BeginRun // Declares top filters to ICutFlowSvc if (and only if) needed (David Cote, Sep 2010) + // Get handle to exec state service for retrieving decisions + if (!m_algstateSvc.retrieve().isSuccess()) { + ATH_MSG_ERROR("Coulc not retrieve handle to AlgExecStateSvc"); + return StatusCode::FAILURE; + } + + // Must listen to EndEvent (why?) ServiceHandle<IIncidentSvc> incSvc("IncidentSvc", this->name()); if (!incSvc.retrieve().isSuccess()) { ATH_MSG_ERROR("Unable to get the IncidentSvc"); @@ -89,15 +84,16 @@ DecisionSvc::initialize() StatusCode DecisionSvc::finalize() { +/* ATH_MSG_INFO("-- OUTPUT STREAM EVENT OVERLAP SUMMARY --"); - msg(MSG::INFO) << "List of registered " << m_streamNames->size() + msg(MSG::INFO) << "List of registered " << m_streamNames.size() << " Streams: "; - for(std::vector<std::string>::const_iterator it = m_streamNames->begin(); - it != m_streamNames->end(); ++it){ + for(std::vector<std::string>::const_iterator it = m_streamNames.begin(); + it != m_streamNames.end(); ++it){ msg(MSG::INFO)<< (*it) << " "; } - msg(MSG::INFO)<<endreq; + msg(MSG::INFO)<<endmsg; if (m_calcStats) { // Print unstreamed event count ATH_MSG_INFO(" Unstreamed events " << m_badEvents); @@ -116,14 +112,15 @@ DecisionSvc::finalize() if (xit->second.at(sid)>0) { for (unsigned int sid2 = 0; sid2 < xit->second.size(); ++sid2) { if (sid != sid2 && xit->second.at(sid2)>0) { - msg() << MSG::INFO << " --> overlap fraction " << m_streamNames->at(sid2) - << " " << std::fixed << std::setprecision(2) << float(xit->second.at(sid2))/float(xit->second.at(sid)) << endreq; + msg() << MSG::INFO << " --> overlap fraction " << m_streamNames.at(sid2) + << " " << std::fixed << std::setprecision(2) << float(xit->second.at(sid2))/float(xit->second.at(sid)) << endmsg; } } } sid++; } } +*/ ATH_MSG_INFO ("Finalized successfully."); @@ -136,42 +133,9 @@ DecisionSvc::interpretAlgMap() { StatusCode status = StatusCode::SUCCESS; - for(std::map<std::string, std::vector<std::string> >::iterator ait = m_stream_accept.begin(); - ait != m_stream_accept.end(); ++ait){ - - status = decodeAlgorithms(ait->first, ait->second, &m_stream_acceptAlgs); - if( !status.isSuccess() ) - { - ATH_MSG_FATAL ("Unable to decodeAcceptAlgs."); - return status; - } - } - - for(std::map<std::string, std::vector<std::string> >::iterator ait = m_stream_require.begin(); - ait != m_stream_require.end(); ++ait){ - - status = decodeAlgorithms(ait->first, ait->second, &m_stream_requireAlgs); - if( !status.isSuccess() ) - { - ATH_MSG_FATAL ("Unable to decodeRequireAlgs."); - return status; - } - } - - for(std::map<std::string, std::vector<std::string> >::iterator ait = m_stream_veto.begin(); - ait != m_stream_veto.end(); ++ait){ - - status = decodeAlgorithms(ait->first, ait->second, &m_stream_vetoAlgs ); - if( !status.isSuccess() ) - { - ATH_MSG_FATAL ("Unable to decodeVetoAlgs."); - return status; - } - } - // Fill up m_streamNames vector std::set<std::string> uniStreams; - m_streamNames->clear(); + m_streamNames.clear(); // first take list of streams from accept streams for(std::map<std::string, std::vector<std::string> >::iterator iter = m_stream_accept.begin(); iter != m_stream_accept.end(); ++iter){ @@ -187,7 +151,7 @@ DecisionSvc::interpretAlgMap() iter != m_stream_veto.end(); ++iter){ uniStreams.insert(iter->first); } - std::copy(uniStreams.begin(),uniStreams.end(),std::back_inserter(*m_streamNames)); + std::copy(uniStreams.begin(),uniStreams.end(),std::back_inserter(m_streamNames)); return status; } @@ -207,13 +171,13 @@ DecisionSvc::addStream(const std::string& stream) std::map<std::string, std::vector<std::string> >::iterator it = m_stream_accept.find(stream); if(it != m_stream_accept.end()){ // ok, it exists, then do nothing - msg(MSG::WARNING) << "Stream name : " << stream << " already been registered!" << endreq; + msg(MSG::WARNING) << "Stream name : " << stream << " already been registered!" << endmsg; status = StatusCode::FAILURE; }else{ //if the stream doesn't exist yet, then insert it to the accept list with an empty vector of Algs std::vector<std::string> tmpvec; tmpvec.clear(); - msg(MSG::INFO) << "Inserting stream: "<< stream << " with no Algs" << endreq; + msg(MSG::INFO) << "Inserting stream: "<< stream << " with no Algs" << endmsg; m_stream_accept.insert(std::make_pair(stream, tmpvec)); status = StatusCode::SUCCESS; } @@ -256,7 +220,7 @@ DecisionSvc::fillMap(std::map<std::string, std::vector<std::string> >& streamsMo // it seems the alg was already inserted, warn the user msg(MSG::ERROR) << "Alg name : " << name << " of stream " << stream - << " has already been registered!" << endreq; + << " has already been registered!" << endmsg; return StatusCode::FAILURE; } } @@ -278,11 +242,11 @@ DecisionSvc::fillMap(std::map<std::string, std::vector<std::string> >& streamsMo } }else{ - msg(MSG::WARNING) << "State of DecisionSvc is " << m_frozen << " ( " << false << " - open, " << true << " - frozen )" << endreq; - msg(MSG::WARNING) << "Adding Algs not allowed anymore!"<< endreq; + msg(MSG::WARNING) << "State of DecisionSvc is " << m_frozen << " ( " << false << " - open, " << true << " - frozen )" << endmsg; + msg(MSG::WARNING) << "Adding Algs not allowed anymore!"<< endmsg; } } else{ - msg(MSG::WARNING) << "Algorithm " << name << " doesn't exist - ignored" << endreq; + msg(MSG::WARNING) << "Algorithm " << name << " doesn't exist - ignored" << endmsg; } } @@ -292,6 +256,10 @@ DecisionSvc::fillMap(std::map<std::string, std::vector<std::string> >& streamsMo StatusCode DecisionSvc::addAcceptAlg(const std::string& name, const std::string& stream) { + // Add alg to list of streams + std::vector<std::string>::iterator it = std::find(m_streamNames.begin(), m_streamNames.end(),stream); + if (it != m_streamNames.end()) m_streamNames.push_back(stream); + // Fill map of stream to alg return fillMap(m_stream_accept,name,stream); } @@ -299,6 +267,10 @@ StatusCode DecisionSvc::addRequireAlg(const std::string& name, const std::string& stream) { + // Add alg to list of streams + std::vector<std::string>::iterator it = std::find(m_streamNames.begin(), m_streamNames.end(),stream); + if (it != m_streamNames.end()) m_streamNames.push_back(stream); + // Fill map of stream to alg return fillMap(m_stream_require,name,stream); } @@ -306,169 +278,40 @@ StatusCode DecisionSvc::addVetoAlg(const std::string& name, const std::string& stream) { + // Add alg to list of streams + std::vector<std::string>::iterator it = std::find(m_streamNames.begin(), m_streamNames.end(),stream); + if (it != m_streamNames.end()) m_streamNames.push_back(stream); + // Fill map of stream to alg return fillMap(m_stream_veto,name,stream); } - -// Given a list of names, it checks for the Algorithm objects in the memory from AlgMgr, -// and copy the pointers of Algorithm objects to the streamname -- Algorithm map -StatusCode -DecisionSvc::decodeAlgorithms(const std::string& stream, - const std::vector<std::string>& theNames, - std::map<std::string, std::vector<Algorithm*> > * theAlgMap ) -{ - msg(MSG::DEBUG) << "In DecisionSvc::decodeAlgorithms " << endreq ; - // Reset the list of Algorithms - // theAlgs->clear( ); - std::vector<Algorithm*> tempAlgs; - - IAlgManager* theAlgMgr; - StatusCode result = serviceLocator( )->getService("ApplicationMgr", - IAlgManager::interfaceID(), - *pp_cast<IInterface>(&theAlgMgr)); - - if ( result.isSuccess( ) ) { - - // Build the list of Algorithms from the names list - const std::vector<std::string>& nameList = theNames; - std::vector<std::string>::const_iterator it; - std::vector<std::string>::const_iterator itend = nameList.end( ); - for (it = nameList.begin(); it != itend; it++) { - - // Check whether the supplied name corresponds to an existing - // Algorithm object. - const std::string& theName = (*it); - IAlgorithm* theIAlg; - Algorithm* theAlgorithm; - result = theAlgMgr->getAlgorithm( theName, theIAlg ); - if ( result.isSuccess( ) ) { - theAlgorithm = dynamic_cast<Algorithm*>(theIAlg); - if (0==theAlgorithm) { - result = StatusCode::FAILURE; - } - } - if ( result.isSuccess( ) ) { - - // Check that the specified algorithm doesn't already exist in the list - std::vector<Algorithm*>::iterator ita; - std::vector<Algorithm*>::iterator itaend = tempAlgs.end( ); - for (ita = tempAlgs.begin(); ita != itaend; ita++) { - Algorithm* existAlgorithm = (*ita); - if ( theAlgorithm == existAlgorithm ) { - result = StatusCode::FAILURE; - break; - } - } - if ( result.isSuccess( ) ) { - // theAlgs->push_back( theAlgorithm ); - tempAlgs.push_back( theAlgorithm ); - } - } else { - ATH_MSG_FATAL (theName << " doesn't exist -- trying to get pointer to a non-existing Algorithm! Stop the job!"); - result = StatusCode::FAILURE; - return result; - } - } - - theAlgMap->insert(std::make_pair(stream, tempAlgs)); - - result = StatusCode::SUCCESS; - } else { - ATH_MSG_FATAL ("Can't locate ApplicationMgr!!!"); - } - - return result; -} - -const std::vector<std::string>* DecisionSvc::getStreams() const +const std::vector<std::string> DecisionSvc::getStreams() const { return m_streamNames; } -const std::vector<std::string> * +const std::vector<std::string> DecisionSvc::getAcceptAlgs(const std::string& stream) const { - m_SacceptAlgNames->clear(); - - if(m_frozen == true){ - //Loop over all streams of accept type and find the one of interest - std::map<std::string, std::vector<Algorithm*> >::const_iterator itAlgs = m_stream_acceptAlgs.find(stream); - if(itAlgs != m_stream_acceptAlgs.end()){ - // get a handle of the streams' *existing* algos vector - std::vector<Algorithm*> vecAlgs = itAlgs->second; - if ( ! vecAlgs.empty( ) ) { - std::vector<Algorithm*>::iterator it; - std::vector<Algorithm*>::iterator itend = vecAlgs.end( ); - for (it = vecAlgs.begin(); it != itend; it++) { - m_SacceptAlgNames->push_back((*it)->name()); - } - }else{ - ATH_MSG_WARNING ("No proper AcceptAlgs got registered to DecisionSvc"); - } - } - }else{ - ATH_MSG_WARNING ("DecisionSvc accessors only available after start()"); - } - - return m_SacceptAlgNames; - + auto iter = m_stream_accept.find(stream); + if (iter != m_stream_accept.end()) return iter->second; + return std::vector<std::string>(); } -const std::vector<std::string> * +const std::vector<std::string> DecisionSvc::getRequireAlgs(const std::string& stream) const { - m_SrequireAlgNames->clear(); - - - if(m_frozen == true){ - //Loop over all streams of accept type and find the one of interest - std::map<std::string, std::vector<Algorithm*> >::const_iterator itAlgs = m_stream_requireAlgs.find(stream); - if(itAlgs != m_stream_requireAlgs.end()){ - // get a handle of the streams' *existing* algos vector - std::vector<Algorithm*> vecAlgs = itAlgs->second; - if ( ! vecAlgs.empty( ) ) { - std::vector<Algorithm*>::iterator it; - std::vector<Algorithm*>::iterator itend = vecAlgs.end( ); - for (it = vecAlgs.begin(); it != itend; it++) { - m_SrequireAlgNames->push_back((*it)->name()); - } - }else{ - ATH_MSG_WARNING ("No proper RequireAlgs got registered to DecisionSvc"); - } - } - }else{ - ATH_MSG_WARNING ("DecisionSvc accessors only available after start()"); - } - - return m_SrequireAlgNames; + auto iter = m_stream_require.find(stream); + if (iter != m_stream_require.end()) return iter->second; + return std::vector<std::string>(); } -const std::vector<std::string> * +const std::vector<std::string> DecisionSvc::getVetoAlgs(const std::string& stream) const { - m_SvetoAlgNames->clear(); - - if(m_frozen == true){ - //Loop over all streams of accept type and find the one of interest - std::map<std::string, std::vector<Algorithm*> >::const_iterator itAlgs = m_stream_vetoAlgs.find(stream); - if(itAlgs != m_stream_vetoAlgs.end()){ - // get a handle of the streams' *existing* algos vector - std::vector<Algorithm*> vecAlgs = itAlgs->second; - if ( ! vecAlgs.empty( ) ) { - std::vector<Algorithm*>::iterator it; - std::vector<Algorithm*>::iterator itend = vecAlgs.end( ); - for (it = vecAlgs.begin(); it != itend; it++) { - m_SvetoAlgNames->push_back((*it)->name()); - } - }else{ - ATH_MSG_WARNING ("No proper VetoAlgs got registered to DecisionSvc"); - } - } - }else{ - ATH_MSG_WARNING ("DecisionSvc accessors only available after start()"); - } - - return m_SvetoAlgNames; + auto iter = m_stream_veto.find(stream); + if (iter != m_stream_veto.end()) return iter->second; + return std::vector<std::string>(); } @@ -480,6 +323,15 @@ DecisionSvc::getVetoAlgs(const std::string& stream) const bool DecisionSvc::isEventAccepted( const std::string& stream ) const +{ + EventContext ec; + ec.setValid(false); + return isEventAccepted(stream,ec); +} + +bool +DecisionSvc::isEventAccepted( const std::string& stream, + const EventContext& ectx) const { ATH_MSG_DEBUG("In DecisionSvc::isEventAccepted( " << stream << " )"); @@ -487,36 +339,34 @@ DecisionSvc::isEventAccepted( const std::string& stream ) const // By construction a stream is accepted bool result = true; + bool found_accept = false; bool found_require = false; bool found_veto = false; - //Loop over all streams of accept type and find the one of interest - std::map<std::string, std::vector<Algorithm*> >::const_iterator itAlgs = m_stream_acceptAlgs.find(stream); - if(itAlgs != m_stream_acceptAlgs.end()){ + //Loop over all streams of accept type and find the one of interest + auto itAlgs = m_stream_accept.find(stream); + if(itAlgs != m_stream_accept.end()){ found_accept = true; // get a handle of the streams' algos vector - std::vector<Algorithm*> vecAlgs = itAlgs->second; + std::vector<std::string> vecAlgs = itAlgs->second; // Loop over all Algorithms in the list to see // whether any have been executed and have their filter // passed flag set. Any match causes the event to be // provisionally accepted. if ( ! vecAlgs.empty( ) ) { result = false; - std::vector<Algorithm*>::iterator it; - std::vector<Algorithm*>::iterator itend = vecAlgs.end( ); - for (it = vecAlgs.begin(); it != itend; it++) { - Algorithm* theAlgorithm = (*it); - // little cross check__________________ - msg(MSG::DEBUG) << "Algorithm " << theAlgorithm->name() - << "got Executed? "; - if(theAlgorithm->isExecuted() == true) { - msg(MSG::DEBUG) << " Yes!" << endreq; - } else { - msg(MSG::DEBUG) << " No!" << endreq; - } - // ______________________ - if ( theAlgorithm->isExecuted( ) && theAlgorithm->filterPassed( ) ) { + for (auto it = vecAlgs.begin(); it != vecAlgs.end(); it++) { + bool isE,fp; + if (ectx.valid()) { + isE = m_algstateSvc->algExecState(*it,ectx).isExecuted(); + fp = m_algstateSvc->algExecState(*it,ectx).filterPassed(); + } + else { + isE = m_algstateSvc->algExecState(*it).isExecuted(); + fp = m_algstateSvc->algExecState(*it).filterPassed(); + } + if (isE && fp) { result = true; break; } @@ -524,65 +374,59 @@ DecisionSvc::isEventAccepted( const std::string& stream ) const } } - //Loop over all streams of require type and find the one of interest - itAlgs = m_stream_requireAlgs.find(stream); - if(itAlgs != m_stream_requireAlgs.end()){ + //Loop over all streams of require type and find the one of interest + itAlgs = m_stream_require.find(stream); + if(itAlgs != m_stream_require.end()){ found_require = true; // get a handle of the streams' algos vector - std::vector<Algorithm*> vecAlgs = itAlgs->second; - // Loop over all Algorithms in the required list to see - // whether all have been executed and have their filter - // passed flag set. Any mismatch causes the event to be - // rejected. - if ( result && ! vecAlgs.empty( ) ) { - std::vector<Algorithm*>::iterator it; - std::vector<Algorithm*>::iterator itend = vecAlgs.end( ); - for (it = vecAlgs.begin(); it != itend; it++) { - Algorithm* theAlgorithm = (*it); - // little cross check__________________ - msg(MSG::DEBUG) << "Algorithm " << theAlgorithm->name() - << "got Executed? "; - if(theAlgorithm->isExecuted() == true) { - msg(MSG::DEBUG) << " Yes!" << endreq; - } else { - msg(MSG::DEBUG) << " No!" << endreq; - } - // ______________________ - if ( ! theAlgorithm->isExecuted( ) || ! theAlgorithm->filterPassed( ) ) { - result = false; - break; - } - } + std::vector<std::string> vecAlgs = itAlgs->second; + // Loop over all Algorithms in the list to see + // whether any have been executed and have their filter + // passed flag set. Any match causes the event to be + // provisionally accepted. + if ( ! vecAlgs.empty( ) ) { + for (auto it = vecAlgs.begin(); it != vecAlgs.end(); it++) { + bool isE,fp; + if (ectx.valid()) { + isE = m_algstateSvc->algExecState(*it,ectx).isExecuted(); + fp = m_algstateSvc->algExecState(*it,ectx).filterPassed(); + } + else { + isE = m_algstateSvc->algExecState(*it).isExecuted(); + fp = m_algstateSvc->algExecState(*it).filterPassed(); + } + if (!isE || !fp) { + result = false; + break; + } + } } } - //Loop over all streams of veto type and find the one of interest - itAlgs = m_stream_vetoAlgs.find(stream); - if(itAlgs != m_stream_vetoAlgs.end()){ + //Loop over all streams of veto type and find the one of interest + itAlgs = m_stream_veto.find(stream); + if(itAlgs != m_stream_veto.end()){ found_veto = true; // get a handle of the streams' algos vector - std::vector<Algorithm*> vecAlgs = itAlgs->second; - // Loop over all Algorithms in the veto list to see + std::vector<std::string> vecAlgs = itAlgs->second; + // Loop over all Algorithms in the list to see // whether any have been executed and have their filter // passed flag set. Any match causes the event to be - // rejected. - if ( result && ! vecAlgs.empty( ) ) { - std::vector<Algorithm*>::iterator it; - std::vector<Algorithm*>::iterator itend = vecAlgs.end( ); - for (it = vecAlgs.begin(); it != itend; it++) { - Algorithm* theAlgorithm = (*it); - // little cross check__________________ - msg(MSG::DEBUG) << "Algorithm " << theAlgorithm->name() - << "got Executed? "; - if(theAlgorithm->isExecuted() == true) { - msg(MSG::DEBUG) << " Yes!" << endreq; - } else { - msg(MSG::DEBUG) << " No!" << endreq; - } - // ______________________ - if ( theAlgorithm->isExecuted( ) && theAlgorithm->filterPassed( ) ) { - result = false; - break; + // provisionally accepted. + if ( ! vecAlgs.empty( ) ) { + for (auto it = vecAlgs.begin(); it != vecAlgs.end(); it++) { + bool isE,fp; + if (ectx.valid()) { + isE = m_algstateSvc->algExecState(*it,ectx).isExecuted(); + fp = m_algstateSvc->algExecState(*it,ectx).filterPassed(); + } + else { + isE = m_algstateSvc->algExecState(*it).isExecuted(); + fp = m_algstateSvc->algExecState(*it).filterPassed(); + } + if ( isE && fp ) { + result = false; + break; } } } @@ -592,7 +436,6 @@ DecisionSvc::isEventAccepted( const std::string& stream ) const ATH_MSG_DEBUG("Stream: " << stream << " not found registered in DecisionSvc -- accepting event by default "); } - return result; } @@ -602,7 +445,7 @@ DecisionSvc::handle(const Incident& inc) { const FileIncident* fileInc = dynamic_cast<const FileIncident*>(&inc); std::string fileName; - if (fileInc == 0) { + if (fileInc == nullptr) { fileName = "Undefined "; } else { fileName = fileInc->fileName(); @@ -610,13 +453,14 @@ DecisionSvc::handle(const Incident& inc) ATH_MSG_DEBUG("handle() " << inc.type() << " for file: " << fileName); +/* // Statistics if (inc.type()=="EndEvent" && m_calcStats) { m_eventCount++; unsigned int streamCount = 0; unsigned int acceptCount = 0; - for (std::vector<std::string>::const_iterator it = m_streamNames->begin(); - it != m_streamNames->end(); ++it) { + for (std::vector<std::string>::const_iterator it = m_streamNames.begin(); + it != m_streamNames.end(); ++it) { if (this->isEventAccepted(*it)) { // set streamed flag acceptCount++; @@ -626,8 +470,8 @@ DecisionSvc::handle(const Incident& inc) ATH_MSG_ERROR("Stream counting map not initialized properly"); } else { - for (std::vector<std::string>::const_iterator it2 = m_streamNames->begin(); - it2 != m_streamNames->end(); ++it2) { + for (std::vector<std::string>::const_iterator it2 = m_streamNames.begin(); + it2 != m_streamNames.end(); ++it2) { if (this->isEventAccepted(*it2)) { (m_stream2Counts[*it2])[streamCount]++; } @@ -643,6 +487,7 @@ DecisionSvc::handle(const Incident& inc) if (olit != m_overlapLevelCounts.end()) (olit->second)++; else m_overlapLevelCounts.insert(std::make_pair(acceptCount,1)); } +*/ } @@ -654,17 +499,26 @@ StatusCode DecisionSvc::start() m_frozen = true; // initialize statistics vector + /* if (m_calcStats) { - for(std::vector<std::string>::const_iterator ait = m_streamNames->begin(); - ait != m_streamNames->end(); ++ait) { + for(std::vector<std::string>::const_iterator ait = m_streamNames.begin(); + ait != m_streamNames.end(); ++ait) { std::vector<unsigned int> temp; - std::fill_n(back_inserter(temp), m_streamNames->size(), (unsigned int)0); + std::fill_n(back_inserter(temp), m_streamNames.size(), (unsigned int)0); m_stream2Counts.insert(std::make_pair(*ait,temp)); } } + */ //Retrieve CutFlowSvc if (and only if) needed - if( m_SacceptAlgNames->size()>0 or m_SrequireAlgNames->size()>0 or m_SvetoAlgNames->size()>0 ){ + auto teststreams = [](const auto& m) + { + for (const auto& p : m) + if (!p.second.empty()) return true; + return false; + }; + + if( teststreams(m_stream_accept) || teststreams(m_stream_require) || teststreams(m_stream_veto)) { if (!m_cutflowSvc.empty()) { if (m_cutflowSvc.retrieve().isFailure()) @@ -683,8 +537,8 @@ StatusCode DecisionSvc::start() void DecisionSvc::DeclareToCutFlowSvc() { - for(std::vector<std::string>::const_iterator ait = m_streamNames->begin(); - ait != m_streamNames->end(); ++ait) { + for(std::vector<std::string>::const_iterator ait = m_streamNames.begin(); + ait != m_streamNames.end(); ++ait) { std::string streamName=*ait; std::vector<std::string> accFilt; std::vector<std::string> reqFilt; @@ -754,7 +608,7 @@ StatusCode DecisionSvc::queryInterface( const InterfaceID& riid, void** ppvi ) { // valid placeholder? - if ( 0 == ppvi ) { return StatusCode::FAILURE ; } // RETURN + if ( nullptr == ppvi ) { return StatusCode::FAILURE ; } // RETURN if ( IDecisionSvc::interfaceID() == riid ) { *ppvi = static_cast<IDecisionSvc*>(this); diff --git a/Control/AthenaServices/src/DecisionSvc.h b/Control/AthenaServices/src/DecisionSvc.h index dd425b8248216d02b09dc5af6fec545a8284cb10..5cd8eca113e152e0202593ca79e4c174fd2d056c 100644 --- a/Control/AthenaServices/src/DecisionSvc.h +++ b/Control/AthenaServices/src/DecisionSvc.h @@ -34,6 +34,7 @@ #include "GaudiKernel/IProperty.h" #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/IIncidentListener.h" +#include "GaudiKernel/IAlgExecStateSvc.h" // Athena includes #include "AthenaBaseComps/AthService.h" @@ -82,36 +83,17 @@ public: /// Return list of AcceptAlg names - const std::vector<std::string> * getAcceptAlgs(const std::string& stream) const; + const std::vector<std::string> getAcceptAlgs(const std::string& stream) const; /// Return list of RequireAlg names - const std::vector<std::string> * getRequireAlgs(const std::string& stream) const; + const std::vector<std::string> getRequireAlgs(const std::string& stream) const; /// Return list of VetoAlg names - const std::vector<std::string> * getVetoAlgs(const std::string& stream) const; + const std::vector<std::string> getVetoAlgs(const std::string& stream) const; /// Return list of Streams - const std::vector<std::string> * getStreams() const; + const std::vector<std::string> getStreams() const; private: StatusCode interpretAlgMap(); - /// Decode list of Algorithms that this stream accepts - //StatusCode decodeAcceptAlgs(const std::string& stream, - // const std::vector<std::string>& acceptNames, - // std::map<std::string, std::vector<Algorithm*> > * theAlgMap ); - /// Decode list of Algorithms that this stream requires - //StatusCode decodeRequireAlgs(const std::string& stream, - // const std::vector<std::string>& requireNames, - // std::map<std::string, std::vector<Algorithm*> > * theAlgMap ); - /// Decode list of Algorithms that this stream is vetoed by - //StatusCode decodeVetoAlgs(const std::string& stream, - // const std::vector<std::string>& vetoNames, - // std::map<std::string, std::vector<Algorithm*> > * theAlgMap ); - - - /// Decode specified list of Algorithms - StatusCode decodeAlgorithms(const std::string& stream, - const std::vector<std::string>& theNames, - std::map<std::string, std::vector<Algorithm*> > * theAlgMap ); - /////////////////////////////////////////////////////////////////// // Const methods: @@ -120,6 +102,7 @@ private: public: /// Test whether this event should be output bool isEventAccepted(const std::string& stream ) const; + bool isEventAccepted(const std::string& stream, const EventContext& ) const; virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvi ); @@ -130,24 +113,17 @@ private: std::map<std::string, std::vector<std::string> > m_stream_require; std::map<std::string, std::vector<std::string> > m_stream_veto; - /// Maps of streams -- Algorithms' object pointers' vectors - std::map<std::string, std::vector<Algorithm*> > m_stream_acceptAlgs; - std::map<std::string, std::vector<Algorithm*> > m_stream_requireAlgs; - std::map<std::string, std::vector<Algorithm*> > m_stream_vetoAlgs; - - std::vector<std::string> * m_streamNames; - std::vector<std::string> * m_SacceptAlgNames; - std::vector<std::string> * m_SrequireAlgNames; - std::vector<std::string> * m_SvetoAlgNames; + std::vector<std::string> m_streamNames; bool m_calcStats; bool m_frozen; ServiceHandle<ICutFlowSvc> m_cutflowSvc; + ServiceHandle<IAlgExecStateSvc> m_algstateSvc; - std::map<std::string, std::vector<unsigned int> > m_stream2Counts; + //std::map<std::string, std::vector<unsigned int> > m_stream2Counts; unsigned int m_eventCount; - unsigned int m_badEvents; - std::map<unsigned int, unsigned int> m_overlapLevelCounts; + //unsigned int m_badEvents; + //std::map<unsigned int, unsigned int> m_overlapLevelCounts; void DeclareToCutFlowSvc(); StatusCode fillMap(std::map<std::string, std::vector<std::string> >& streamsModeMap, diff --git a/Control/AthenaServices/src/EvtIdModifierSvc.cxx b/Control/AthenaServices/src/EvtIdModifierSvc.cxx index d9960397bacc9fc16f3aa95ba231162f64e4aca4..c87c7d397f81a9ee751eb86c4a6551984beb7762 100644 --- a/Control/AthenaServices/src/EvtIdModifierSvc.cxx +++ b/Control/AthenaServices/src/EvtIdModifierSvc.cxx @@ -76,7 +76,7 @@ StatusCode EvtIdModifierSvc::initialize() { ATH_MSG_INFO ("Initializing " << name() << "..."); - std::vector<EventID::number_type>& val = m_evtNpletsProp; + std::vector<uint64_t>& val = m_evtNpletsProp; if (val.size()) { // they should be Nplets... if (val.size() % NPLETSZ == 0) { @@ -99,7 +99,7 @@ StatusCode EvtIdModifierSvc::initialize() } } // free-up some memory - std::vector<EventID::number_type>(0).swap(val); + std::vector<uint64_t>(0).swap(val); if (msgLvl(MSG::DEBUG)) { msg(MSG::DEBUG) << "store being modified: [" @@ -119,7 +119,7 @@ StatusCode EvtIdModifierSvc::initialize() << ", mod_bit=0x" << std::hex << i.mod_bit << std::dec << "], "; } - msg(MSG::DEBUG) << "]" << endreq; + msg(MSG::DEBUG) << "]" << endmsg; } // initialize our cursor @@ -182,7 +182,7 @@ EvtIdModifierSvc::run_number() const /** @brief return the current evt-nbr (after modification) */ -number_type +uint64_t EvtIdModifierSvc::event_number() const { return m_current.evtnbr; diff --git a/Control/AthenaServices/src/EvtIdModifierSvc.h b/Control/AthenaServices/src/EvtIdModifierSvc.h index 1d432ebe99a37a874b73628820d2b74733d1b8f4..a2f74860c0636f9dd0763393477248ff5495c4cf 100644 --- a/Control/AthenaServices/src/EvtIdModifierSvc.h +++ b/Control/AthenaServices/src/EvtIdModifierSvc.h @@ -34,7 +34,7 @@ template <class TYPE> class SvcFactory; struct ItemModifier { EventID::number_type runnbr; - EventID::number_type evtnbr; + uint64_t evtnbr; EventID::number_type timestamp; EventID::number_type lbknbr; EventID::number_type nevts; @@ -89,7 +89,7 @@ class EvtIdModifierSvc /** @brief return the current evt-nbr (after modification) */ - virtual number_type event_number() const; + virtual uint64_t event_number() const; /** @brief return the current time-stamp (after modification) */ @@ -154,7 +154,7 @@ class EvtIdModifierSvc /// (prop) list of n-plets /// (run-nbr, evt-nbr, time-stamp, lbk-nbr, nbr-of-events-per-lbk, mod-bit) - std::vector<EventID::number_type> m_evtNpletsProp; + std::vector<uint64_t> m_evtNpletsProp; /// (prop) Name of the event store whose EventIDs will be modified. std::string m_evtStoreName; diff --git a/Control/AthenaServices/src/FPEControlSvc.cxx b/Control/AthenaServices/src/FPEControlSvc.cxx index df0183c116a3bec791d122f055e2dd30c11d6606..18918a7b3de673a8d9870cdcf1b21665e0f4155b 100644 --- a/Control/AthenaServices/src/FPEControlSvc.cxx +++ b/Control/AthenaServices/src/FPEControlSvc.cxx @@ -25,6 +25,7 @@ FPEControlSvc::FPEControlSvc( const std::string& name, ISvcLocator* svc ) : AthService( name, svc ), m_toolSvc ("ToolSvc", name), m_env(), + m_haveEnv(false), m_enabled (0), m_disabled (0), m_removeInFinalize(false), @@ -49,9 +50,6 @@ FPEControlSvc::FPEControlSvc( const std::string& name, ISvcLocator* svc ) */ StatusCode FPEControlSvc::initialize() { - // Save the current FP environment. - fegetenv (&m_env); - // And change the exception mask. prophand (m_exceptions); @@ -98,9 +96,6 @@ StatusCode FPEControlSvc::finalize() // remove only if requested if (m_removeInFinalize) { - // Remove ourself as an observer. - m_toolSvc->unRegisterObserver (this); - // Restore the FP environment to what is was before we ran. fesetenv (&m_env); } @@ -159,16 +154,15 @@ std::string mask_to_string (int mask) */ void FPEControlSvc::prophand (Property& /*prop*/) { - // Don't do anything if we haven't initialized yet - // (m_env won't be set). - // vile hack to handle v19/v20 API diff without branching -#ifdef GAUDIKERNEL_STATEMACHINE_H_ - if (FSMState() == Gaudi::StateMachine::OFFLINE) return; -#else - if (state() == IService::OFFLINE) return; -#endif - // Reset to the FP environment before we started. - fesetenv (&m_env); + if (!m_haveEnv) { + // Save the current FP environment. + fegetenv (&m_env); + m_haveEnv = true; + } + else { + // Reset to the FP environment before we started. + fesetenv (&m_env); + } // Figure out which exceptions to enable/disable. m_enabled = 0; diff --git a/Control/AthenaServices/src/FPEControlSvc.h b/Control/AthenaServices/src/FPEControlSvc.h index 65fe85b913bf9847940136387c9979415a5aa88e..dd75d6ffa6c5b00c227a2cc65288bf1154d196a4 100644 --- a/Control/AthenaServices/src/FPEControlSvc.h +++ b/Control/AthenaServices/src/FPEControlSvc.h @@ -82,6 +82,9 @@ private: /// The FP environment before we initialize. fenv_t m_env; + /// Flag that we've retrieved the environment. + bool m_haveEnv; + /// Mask of enabled exceptions. int m_enabled; diff --git a/Control/AthenaServices/src/ItemListSvc.cxx b/Control/AthenaServices/src/ItemListSvc.cxx index 60a422ea6e4f5518875103bfd0221bf1da722a88..0c126bf2ff890529f1690bc7fc32e4619a0e895c 100644 --- a/Control/AthenaServices/src/ItemListSvc.cxx +++ b/Control/AthenaServices/src/ItemListSvc.cxx @@ -147,7 +147,7 @@ StatusCode ItemListSvc::queryInterface( const InterfaceID& riid, void** ppvi ) { // valid placeholder? - if ( 0 == ppvi ) { return StatusCode::FAILURE ; } // RETURN + if ( nullptr == ppvi ) { return StatusCode::FAILURE ; } // RETURN if ( IItemListSvc::interfaceID() == riid ) { *ppvi = static_cast<IItemListSvc*>(this); diff --git a/Control/AthenaServices/src/LoggedMessageSvc.cxx b/Control/AthenaServices/src/LoggedMessageSvc.cxx index a4afd34266e578f96c0ec2f75110d5e87e0de039..b57dbd89146501d0dfd81bf0d68deab03336e5a2 100644 --- a/Control/AthenaServices/src/LoggedMessageSvc.cxx +++ b/Control/AthenaServices/src/LoggedMessageSvc.cxx @@ -113,7 +113,7 @@ LoggedMessageSvc::~LoggedMessageSvc() LoggedStreamsMap_t::iterator endStream = m_loggedStreams.end(); for ( ; iStream != endStream; ++iStream ) { delete iStream->second; - iStream->second = 0; + iStream->second = nullptr; } } //############################################################################# @@ -327,7 +327,7 @@ void LoggedMessageSvc::setupThreshold(Property& prop) { return; } else if (prop.name() == "keywords") { StringArrayProperty *sap = dynamic_cast<StringArrayProperty*>( &prop ); - if (sap!= 0 && sap->value().size() > 0) { + if (sap!= nullptr && sap->value().size() > 0) { m_keysUsed = true; } else { m_keysUsed = false; @@ -340,7 +340,7 @@ void LoggedMessageSvc::setupThreshold(Property& prop) { } StringArrayProperty *sap = dynamic_cast<StringArrayProperty*>( &prop); - if (sap == 0) { + if (sap == nullptr) { std::cerr << "could not dcast " << prop.name() << " to a StringArrayProperty (which it should be!)" << endl; return; @@ -733,7 +733,7 @@ void LoggedMessageSvc::eraseStream( int message_type ) // void LoggedMessageSvc::eraseStream( int key, std::ostream* stream ) { - if ( 0 != stream ) { + if ( nullptr != stream ) { bool changed = true; while( changed ) { changed = false; @@ -758,7 +758,7 @@ void LoggedMessageSvc::eraseStream( int key, std::ostream* stream ) { // void LoggedMessageSvc::eraseStream( std::ostream* stream ) { - if ( 0 != stream ) { + if ( nullptr != stream ) { bool changed = true; while( changed ) { changed = false; @@ -980,7 +980,7 @@ void LoggedMessageSvc::tee( const std::string& sourceName, LoggedStreamsMap_t::iterator iStream = m_loggedStreams.find( sourceName ); if ( iStream != iEnd ) { delete iStream->second; - iStream->second = 0; + iStream->second = nullptr; m_loggedStreams.erase( iStream ); } diff --git a/Control/AthenaServices/src/MemoryRescueSvc.cxx b/Control/AthenaServices/src/MemoryRescueSvc.cxx index 14f59aea3c8be1053ed4aeb0bbcb99cc2d9d7dfe..5003712359f78f5ff255b0681847a21af6ee32fa 100644 --- a/Control/AthenaServices/src/MemoryRescueSvc.cxx +++ b/Control/AthenaServices/src/MemoryRescueSvc.cxx @@ -12,13 +12,13 @@ //- data ------------------------------------------------------------------ -char* MemoryRescueSvc::s_block = 0; +char* MemoryRescueSvc::s_block = nullptr; //========================================================================= // Standard Constructor //========================================================================= MemoryRescueSvc::MemoryRescueSvc( const std::string& name, ISvcLocator* svc ) - : AthService( name, svc ), m_new( 0 ) + : AthService( name, svc ), m_new( nullptr ) { declareProperty("NumberOfPages", m_pages=12800); // 50MB on 32, 100MB on 64 m_new = std::set_new_handler( &MemoryRescueSvc::newHandler ); @@ -29,7 +29,7 @@ MemoryRescueSvc::MemoryRescueSvc( const std::string& name, ISvcLocator* svc ) //========================================================================= MemoryRescueSvc::~MemoryRescueSvc() { - delete[] s_block; s_block = 0; + delete[] s_block; s_block = nullptr; std::set_new_handler( m_new ); } @@ -38,7 +38,7 @@ MemoryRescueSvc::~MemoryRescueSvc() //========================================================================= StatusCode MemoryRescueSvc::reinitialize() { - delete[] s_block; s_block = 0; + delete[] s_block; s_block = nullptr; if ( 0 < (int)m_pages ) { ATH_MSG_DEBUG ("allocating block of " << (int)m_pages << " pages"); @@ -72,7 +72,7 @@ StatusCode MemoryRescueSvc::initialize() //========================================================================= StatusCode MemoryRescueSvc::finalize() { - delete[] s_block; s_block = 0; + delete[] s_block; s_block = nullptr; return Service::finalize(); } @@ -86,7 +86,7 @@ void MemoryRescueSvc::newHandler() throw std::bad_alloc(); // default behavior (no print-out) // release our block to create working space for finalize() - delete[] s_block; s_block = 0; + delete[] s_block; s_block = nullptr; // print onto std::cerr rather than MsgStream, as it's more innocuous std::cerr << "MemoryRescueSvc FATAL out of memory: taking the application down ..." diff --git a/Control/AthenaServices/src/MetaDataSvc.cxx b/Control/AthenaServices/src/MetaDataSvc.cxx index b29fe0b7fe91b06630c8d19b62ddbd80aee5a717..370c90954e751bf8e5921e0ed364ef5d4aad3734 100644 --- a/Control/AthenaServices/src/MetaDataSvc.cxx +++ b/Control/AthenaServices/src/MetaDataSvc.cxx @@ -106,7 +106,7 @@ StatusCode MetaDataSvc::initialize() { ATH_MSG_WARNING("Cannot get JobOptionsSvc."); } else { const std::vector<const Property*>* evtselProps = joSvc->getProperties("EventSelector"); - if (evtselProps != 0) { + if (evtselProps != nullptr) { for (std::vector<const Property*>::const_iterator iter = evtselProps->begin(), last = evtselProps->end(); iter != last; iter++) { if ((*iter)->name() == "InputCollections") { @@ -148,13 +148,13 @@ StatusCode MetaDataSvc::stop() { ATH_MSG_WARNING("Cannot get JobOptionsSvc."); } else { const std::vector<const Property*>* evtselProps = joSvc->getProperties("EventSelector"); - if (evtselProps != 0) { + if (evtselProps != nullptr) { for (std::vector<const Property*>::const_iterator iter = evtselProps->begin(), last = evtselProps->end(); iter != last; iter++) { if ((*iter)->name() == "InputCollections") { // Get EventSelector to fire End...File incidents. ServiceHandle<IEvtSelector> evtsel("EventSelector", this->name()); - IEvtSelector::Context* ctxt(0); + IEvtSelector::Context* ctxt(nullptr); if (!evtsel->releaseContext(ctxt).isSuccess()) { ATH_MSG_WARNING("Cannot release context on EventSelector."); } @@ -207,36 +207,19 @@ StatusCode MetaDataSvc::loadAddresses(StoreID::type storeID, IAddressProvider::t for (std::list<SG::ObjectWithVersion<DataHeader> >::const_iterator iter = allVersions.begin(), last = allVersions.end(); iter != last; iter++, verNumber++) { const DataHeader* dataHeader = iter->dataObject; - if (dataHeader == 0) { + if (dataHeader == nullptr) { ATH_MSG_ERROR("Could not get DataHeader, will not read Metadata"); return(StatusCode::FAILURE); } for (std::vector<DataHeaderElement>::const_iterator dhIter = dataHeader->begin(), dhLast = dataHeader->end(); dhIter != dhLast; dhIter++) { const CLID clid = dhIter->getPrimaryClassID(); - SG::VersionedKey myVersObjKey(dhIter->getKey(), verNumber); - IOpaqueAddress* opqAddr = 0; - if (dhIter->getToken() == 0 - || !m_addrCrtr->createAddress(m_storageType, clid, dhIter->getToken()->toString(), opqAddr).isSuccess()) { - ATH_MSG_ERROR("Could not create IOpaqueAddress, will not read Metadata object"); - continue; - } - SG::TransientAddress* tadd = 0; - if (verNumber == 0 && clid != ClassID_traits<DataHeader>::ID()) { - tadd = new SG::TransientAddress(clid, dhIter->getKey(), opqAddr); - } else { - tadd = new SG::TransientAddress(clid, myVersObjKey, opqAddr); - } - if (tadd->clID() == ClassID_traits<DataHeader>::ID()) { - delete tadd; tadd = 0; - } else { - std::set<unsigned int> clids = dhIter->getClassIDs(); - for (std::set<unsigned int>::const_iterator iter = clids.begin(), last = clids.end(); - iter != last; iter++) { - tadd->setTransientID(*iter); - } - tadd->setAlias(dhIter->getAlias()); - tads.push_back(tadd); + if (clid != ClassID_traits<DataHeader>::ID()) { + SG::VersionedKey myVersObjKey(dhIter->getKey(), verNumber); + std::string key = dhIter->getKey(); + if (verNumber != 0) + key = myVersObjKey; + tads.push_back(dhIter->getAddress (key)); } } } @@ -250,7 +233,7 @@ StatusCode MetaDataSvc::updateAddress(StoreID::type, SG::TransientAddress*) { //__________________________________________________________________________ void MetaDataSvc::handle(const Incident& inc) { const FileIncident* fileInc = dynamic_cast<const FileIncident*>(&inc); - if (fileInc == 0) { + if (fileInc == nullptr) { ATH_MSG_ERROR("Unable to get FileName from EndInputFile incident"); return; } @@ -364,14 +347,14 @@ StatusCode MetaDataSvc::initInputMetaDataStore(const std::string& fileName) { ATH_MSG_DEBUG("initInputMetaDataStore: MetaData Store already contains DataHeader, key = " << myVersKey); } else { const unsigned long ipar[2] = { (unsigned long)verNumber , 0 }; - IOpaqueAddress* opqAddr = 0; + IOpaqueAddress* opqAddr = nullptr; if (!m_addrCrtr->createAddress(m_storageType, ClassID_traits<DataHeader>::ID(), par, ipar, opqAddr).isSuccess()) { if (!m_addrCrtr->createAddress(m_storageType, ClassID_traits<DataHeader>::ID(), parOld, ipar, opqAddr).isSuccess()) { break; } } if (m_inputDataStore->recordAddress(myVersKey, opqAddr).isFailure()) { - delete opqAddr; opqAddr = 0; + delete opqAddr; opqAddr = nullptr; ATH_MSG_WARNING("initInputMetaDataStore: Cannot create proxy for DataHeader, key = " << myVersKey); } } @@ -380,16 +363,25 @@ StatusCode MetaDataSvc::initInputMetaDataStore(const std::string& fileName) { if (!loadAddresses(StoreID::METADATA_STORE, tList).isSuccess()) { ATH_MSG_WARNING("Unable to load MetaData Proxies"); } - for (std::list<SG::TransientAddress*>::iterator iter = tList.begin(), last = tList.end(); - iter != last; iter++) { - if (m_inputDataStore->contains((*iter)->clID(), (*iter)->name())) { - ATH_MSG_DEBUG("initInputMetaDataStore: MetaData Store already contains clid = " << (*iter)->clID() << ", key = " << (*iter)->name()); + for (SG::TransientAddress* tad : tList) { + CLID clid = tad->clID(); + if (m_inputDataStore->contains(tad->clID(), tad->name())) { + ATH_MSG_DEBUG("initInputMetaDataStore: MetaData Store already contains clid = " << clid << ", key = " << tad->name()); } else { - if (!m_inputDataStore->recordAddress((*iter)->name(), (*iter)->address())) { - ATH_MSG_ERROR("initInputMetaDataStore: Cannot create proxy for clid = " << (*iter)->clID() << ", key = " << (*iter)->name()); + if (!m_inputDataStore->recordAddress(tad->name(), tad->address())) { + ATH_MSG_ERROR("initInputMetaDataStore: Cannot create proxy for clid = " << clid << ", key = " << tad->name()); } } - delete (*iter); *iter = 0; + + for (CLID tclid : tad->transientID()) { + if (tclid != clid) { + if (m_inputDataStore->symLink (clid, tad->name(), tclid).isFailure()) { + ATH_MSG_WARNING("Cannot make autosymlink from " << + clid << "/" << tad->name() << " to " << tclid); + } + } + } + delete tad; } tList.clear(); } diff --git a/Control/AthenaServices/src/MixingEventSelector.cxx b/Control/AthenaServices/src/MixingEventSelector.cxx index bcd4308872aca91830ccb6ea559a332ebf2ef1b6..046249a99830a78f1a61b033196ff09ff9668d21 100644 --- a/Control/AthenaServices/src/MixingEventSelector.cxx +++ b/Control/AthenaServices/src/MixingEventSelector.cxx @@ -10,6 +10,7 @@ #include "EventInfo/EventType.h" #include "EventInfo/TriggerInfo.h" #include "SGTools/ClassID_traits.h" +#include "SGTools/StorableConversions.h" #include "StoreGate/StoreGateSvc.h" #include "SGTools/DataProxy.h" #include "AthenaKernel/getMessageSvc.h" @@ -17,6 +18,7 @@ #include "GaudiKernel/GaudiException.h" #include "GaudiKernel/ListItem.h" #include "GaudiKernel/MsgStream.h" +#include "GaudiKernel/GenericAddress.h" #include "CLHEP/Random/RandFlat.h" #include <boost/lexical_cast.hpp> #include <boost/tokenizer.hpp> @@ -40,14 +42,14 @@ ofstream outfile2("status.txt"); #endif MixingEventSelector::MixingEventSelector(const string& name, ISvcLocator* svc) : - AthService(name,svc), + extends<AthService, IEvtSelector, IConverter>(name,svc), m_helperTools(this), m_trigList(), m_pCurrentTrigger(m_trigList.end()), m_eventPos(0), m_pEventStore( "StoreGateSvc", name ), m_atRndmSvc("AtRndmGenSvc", name), m_randomStreamName("MixingEventSelectorStream"), - m_chooseRangeRand(0) + m_chooseRangeRand(nullptr) { declareProperty("TriggerList", m_triggerListProp, "list of triggers (streams) to be used. Format is SelectorType/SelectorName:firstEventToUse:lastEventToUse. One assumes events are consecutively numbered."); @@ -79,7 +81,7 @@ MixingEventSelector::initialize() { //setup random stream CLHEP::HepRandomEngine* collEng(m_atRndmSvc->GetEngine(m_randomStreamName.value())); - if(0 == collEng ) { + if(nullptr == collEng ) { ATH_MSG_ERROR ("can not get random stream " << m_randomStreamName.value()); return StatusCode::FAILURE; } @@ -87,7 +89,7 @@ MixingEventSelector::initialize() { m_chooseRangeRand = new CLHEP::RandFlat(*(collEng), 0.0, 1.0); StatusCode sc= m_helperTools.retrieve(); - std::vector<ToolHandle<IAthenaSelectorTool> >::const_iterator + std::vector<ToolHandle<IAthenaSelectorTool> >::iterator i(m_helperTools.begin()), iE(m_helperTools.end()); while (sc.isSuccess() && (i != iE)) sc = (*i++)->postInitialize(); @@ -100,7 +102,7 @@ MixingEventSelector::finalize() { << " - package version " << PACKAGE_VERSION); StatusCode sc(StatusCode::SUCCESS); - std::vector<ToolHandle<IAthenaSelectorTool> >::const_iterator + std::vector<ToolHandle<IAthenaSelectorTool> >::iterator i(m_helperTools.begin()), iE(m_helperTools.end()); while (i != iE) ((*i++)->preFinalize()).ignore(); @@ -141,10 +143,10 @@ MixingEventSelector::decodeTrigger(string triggDescr) { ListItem selTN(*iToken++); const bool CREATEIF(true); //get selector - IEvtSelector* pSelector(0); + IEvtSelector* pSelector(nullptr); if ((serviceLocator()->service(selTN.type(), selTN.name(), pSelector, CREATEIF)).isSuccess()) { //must be an address provider - if (0 != dynamic_cast<IEvtSelector*>(pSelector) ) { + if (nullptr != dynamic_cast<IEvtSelector*>(pSelector) ) { //FIXME if (!pSelector.done()) { //try to add to trig list unsigned int firstEvt(boost::lexical_cast<unsigned int>(*iToken++)); @@ -152,7 +154,7 @@ MixingEventSelector::decodeTrigger(string triggDescr) { if (m_trigList.add(Trigger(pSelector, firstEvt, lastEvt))) { if (msgLvl(MSG::DEBUG)) { INamedInterface *pNamed(dynamic_cast<INamedInterface*>(pSelector)); - if (0 != pNamed) { + if (nullptr != pNamed) { msg() << "decodeTrigger: added selector " << pNamed->name() << " first event to be read " << firstEvt << " last event to be read " << lastEvt << endmsg; @@ -193,19 +195,6 @@ MixingEventSelector::decodeTrigger(string triggDescr) { } //can parse property string } -StatusCode -MixingEventSelector::queryInterface( const InterfaceID& riid, void** ppvInterface ) { - if ( IEvtSelector::interfaceID().versionMatch(riid) ) { - *ppvInterface = (IEvtSelector*)this; - } - else { - // Interface is not directly available: try out a base class - return AthService::queryInterface(riid, ppvInterface); - } - addRef(); - return StatusCode::SUCCESS; -} - #ifndef NDEBUG #define FORWARD___DEBUG( METHOD )\ { ATH_MSG_VERBOSE ("forwarding " << #METHOD << " to service "\ @@ -215,7 +204,7 @@ MixingEventSelector::queryInterface( const InterfaceID& riid, void** ppvInterfac #endif StatusCode MixingEventSelector::createContext(IEvtSelector::Context*& pctxt) const { - pctxt=0; + pctxt=nullptr; if (!validTrigger()) return StatusCode::FAILURE; TriggerList::iterator iTr(m_trigList.begin()); StatusCode sc(StatusCode::FAILURE); @@ -264,12 +253,12 @@ MixingEventSelector::next(IEvtSelector::Context& /*c*/) const { StatusCode MixingEventSelector::createAddress(const IEvtSelector::Context& /*c*/, IOpaqueAddress*& pAddr) const { - pAddr=0; + pAddr=nullptr; if (!validTrigger()) return StatusCode::FAILURE; FORWARD___DEBUG( createAddress ) return (currentTrigger()->createAddress(pAddr)).isSuccess() && - pAddr != 0; + pAddr != nullptr; } StatusCode @@ -279,8 +268,23 @@ MixingEventSelector::preLoadAddresses(StoreID::type /*storeID*/, } StatusCode -MixingEventSelector::loadAddresses(StoreID::type /*storeID*/, IAddressProvider::tadList& /*tads*/ ) { - return addMergedEventInfo(); +MixingEventSelector::loadAddresses(StoreID::type storeID, + IAddressProvider::tadList& /*tads*/ ) +{ + if (storeID != StoreID::EVENT_STORE) + return StatusCode::SUCCESS; + + CLID mclid = ClassID_traits<MergedEventInfo>::ID(); + auto addr = std::make_unique<GenericAddress> (0, mclid); + auto tad = std::make_unique<SG::TransientAddress> (mclid, + m_mergedEventInfoKey, + addr.release(), + false); + auto dp = std::make_unique<SG::DataProxy> (tad.release(), + this, + true); + ATH_CHECK( m_pEventStore->addToStore (mclid, dp.release()) ); + return StatusCode::SUCCESS; } StatusCode @@ -290,29 +294,6 @@ MixingEventSelector::updateAddress(StoreID::type,SG::TransientAddress*) { #undef FORWARD___DEBUG -StatusCode MixingEventSelector::addMergedEventInfo() const { - const EventInfo* pEInfo(0); - if (!(m_pEventStore->retrieve(pEInfo)).isSuccess()) { - ATH_MSG_ERROR - ("addMergedEventInfo: event store does not contains "\ - "an EventInfo object!"); - return StatusCode::RECOVERABLE; - } - //copy the original event into the MergedEventInfo and record it - if (!(m_pEventStore->record(new MergedEventInfo(*pEInfo, m_outputRunNumber, - getEventNo()), - m_mergedEventInfoKey.value())).isSuccess()) { - ATH_MSG_ERROR - ("addMergedEventInfo: could not record MergedEventInfo"); - return StatusCode::RECOVERABLE; - } - - //finally slam a new EventID in place of the old! HACK!!! - (const_cast<EventInfo*>(pEInfo))->setEventID( - new EventID(m_outputRunNumber, getEventNo())); - return StatusCode::SUCCESS; -} - unsigned long MixingEventSelector::getEventNo() const { return ( (m_eventNumbers.value().size() > m_eventPos) ? m_eventNumbers.value()[m_eventPos] : @@ -325,7 +306,7 @@ MixingEventSelector::setCurrentTrigger() const { //we look for the first trigger which is not done do { //if called before initialize, choose the last trigger in list - unsigned int iTrig = (0 != m_chooseRangeRand) ? + unsigned int iTrig = (nullptr != m_chooseRangeRand) ? (unsigned int)(m_chooseRangeRand->fire() * double(m_trigList.todo())) : m_trigList.todo(); m_pCurrentTrigger = m_trigList.elementInRange(iTrig); @@ -437,13 +418,13 @@ MixingEventSelector::Trigger::Trigger(IEvtSelector* pSel, unsigned int lastEvt): m_pSelector(pSel), m_firstEvent(firstEvt), m_toRead(lastEvt+1), m_todo(m_toRead-firstEvt), m_reads(0), - m_current(0) + m_current(nullptr) { } IEvtSelector::Context& MixingEventSelector::Trigger::currentContext() const { //make sure we have a context! - if (0 == m_current) { - IEvtSelector::Context* pTmp(0); + if (nullptr == m_current) { + IEvtSelector::Context* pTmp(nullptr); if ((createContext(pTmp)).isFailure()) throw GaudiException("MixingEventSelector::Trigger::currentContext(): can't create context", name(),StatusCode::FAILURE); @@ -525,3 +506,106 @@ StatusCode MixingEventSelector::resetCriteria(const std::string&, IEvtSelector::Context&)const { return StatusCode::FAILURE; } + + +// IConverter implementation. +const CLID& MixingEventSelector::objType() const +{ + return ClassID_traits<EventInfo>::ID(); +} +long MixingEventSelector::repSvcType() const +{ + return 0; +} + + +/** Create the transient representation of an object. + The transient representation is created by loading the + persistent object using the source information + contained in the address. + @return Status code indicating success or failure + @param pAddress Opaque address information to retrieve the + requested object from the store in order to + produce the transient object. + @param refpObject Reference to location of pointer of the + created object. +*/ +StatusCode MixingEventSelector::createObj(IOpaqueAddress* /*pAddress*/, + DataObject*& refpObject) +{ + const EventInfo* pEInfo(nullptr); + if (!(m_pEventStore->retrieve(pEInfo)).isSuccess()) { + ATH_MSG_ERROR + ("addMergedEventInfo: event store does not contain "\ + "an EventInfo object!"); + return StatusCode::RECOVERABLE; + } + + // copy the original event to a new MergedEventInfo + auto mei = std::make_unique<MergedEventInfo> (*pEInfo, + m_outputRunNumber, + getEventNo()); + refpObject = SG::asStorable (std::move (mei)); + + + //finally slam a new EventID in place of the old! HACK!!! FIXME!! + (const_cast<EventInfo*>(pEInfo))->setEventID( + new EventID(m_outputRunNumber, getEventNo())); + + return StatusCode::SUCCESS; +} + + +// IConverter dummies. +StatusCode MixingEventSelector::setDataProvider(IDataProviderSvc* /*pService*/) +{ + std::abort(); +} +SmartIF<IDataProviderSvc>& MixingEventSelector::dataProvider() const +{ + std::abort(); +} +StatusCode MixingEventSelector::setConversionSvc(IConversionSvc* /*pService*/) +{ + std::abort(); +} +SmartIF<IConversionSvc>& MixingEventSelector::conversionSvc() const +{ + std::abort(); +} +StatusCode MixingEventSelector::setAddressCreator(IAddressCreator* /*creator*/) +{ + std::abort(); +} +SmartIF<IAddressCreator>& MixingEventSelector::addressCreator() const +{ + std::abort(); +} +StatusCode MixingEventSelector::fillObjRefs(IOpaqueAddress* /*pAddress*/, DataObject* /*pObject*/) +{ + std::abort(); +} +StatusCode MixingEventSelector::updateObj(IOpaqueAddress* /*pAddress*/, DataObject* /*refpObject*/) +{ + std::abort(); +} +StatusCode MixingEventSelector::updateObjRefs(IOpaqueAddress* /*pAddress*/, DataObject* /*pObject*/) +{ + std::abort(); +} +StatusCode MixingEventSelector::createRep(DataObject* /*pObject*/, IOpaqueAddress*& /*refpAddress*/) +{ + std::abort(); +} +StatusCode MixingEventSelector::fillRepRefs(IOpaqueAddress* /*pAddress*/, DataObject* /*pObject*/) +{ + std::abort(); +} +StatusCode MixingEventSelector::updateRep(IOpaqueAddress* /*pAddress*/, DataObject* /*pObject*/) +{ + std::abort(); +} +StatusCode MixingEventSelector::updateRepRefs(IOpaqueAddress* /*pAddress*/, DataObject* /*pObject*/) +{ + std::abort(); +} diff --git a/Control/AthenaServices/src/MixingEventSelector.h b/Control/AthenaServices/src/MixingEventSelector.h index 2c7223461547c94f0ab0b608c821772e08bfcf8b..4f1839fb828209a008f4680cb7ccf5154eb19dc6 100644 --- a/Control/AthenaServices/src/MixingEventSelector.h +++ b/Control/AthenaServices/src/MixingEventSelector.h @@ -23,6 +23,7 @@ #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/IEvtSelector.h" +#include "GaudiKernel/IConverter.h" #include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/StatusCode.h" #include "GaudiKernel/Property.h" /*StringArrayProperty*/ @@ -64,9 +65,9 @@ namespace CLHEP { * will shuffle the first 100 events, then move to the second hundred, etc * */ -class MixingEventSelector : virtual public AthService, - virtual public IEvtSelector, - virtual public IAddressProvider +class MixingEventSelector + : public extends<AthService, IEvtSelector, IConverter>, + virtual public IAddressProvider { public: /** @class Context @@ -80,39 +81,58 @@ public: } ; ///\name IEvtSelector implementation //@{ - virtual StatusCode next(IEvtSelector::Context& refCtxt) const; + virtual StatusCode next(IEvtSelector::Context& refCtxt) const override; virtual StatusCode createAddress(const IEvtSelector::Context& refCtxt, - IOpaqueAddress*&) const; - - virtual StatusCode createContext(IEvtSelector::Context*& refpCtxt) const; - virtual StatusCode last(IEvtSelector::Context&) const; - virtual StatusCode next(IEvtSelector::Context&, int) const; - virtual StatusCode previous(IEvtSelector::Context&) const; - virtual StatusCode previous(IEvtSelector::Context&,int) const; - virtual StatusCode rewind(IEvtSelector::Context& refCtxt) const; - virtual StatusCode releaseContext(IEvtSelector::Context*& refCtxt) const; - virtual StatusCode resetCriteria(const std::string& cr,IEvtSelector::Context& c) const; + IOpaqueAddress*&) const override; + + virtual StatusCode createContext(IEvtSelector::Context*& refpCtxt) const override; + virtual StatusCode last(IEvtSelector::Context&) const override; + virtual StatusCode next(IEvtSelector::Context&, int) const override; + virtual StatusCode previous(IEvtSelector::Context&) const override; + virtual StatusCode previous(IEvtSelector::Context&,int) const override; + virtual StatusCode rewind(IEvtSelector::Context& refCtxt) const override; + virtual StatusCode releaseContext(IEvtSelector::Context*& refCtxt) const override; + virtual StatusCode resetCriteria(const std::string& cr,IEvtSelector::Context& c) const override; //@} ///\name IAddressProvider interface (forwarded to current Trigger) //@{ virtual StatusCode preLoadAddresses(StoreID::type storeID , - IAddressProvider::tadList& tads ); + IAddressProvider::tadList& tads ) override; virtual StatusCode loadAddresses(StoreID::type storeID , - IAddressProvider::tadList& tads ); + IAddressProvider::tadList& tads ) override; virtual StatusCode updateAddress(StoreID::type storeID , - SG::TransientAddress* tad); + SG::TransientAddress* tad) override; //@} - /// IInterface implementation - virtual StatusCode queryInterface( const InterfaceID& riid, - void** ppvInterface ); + /// \name IConverter implementation. + //@{ + virtual const CLID& objType() const override; + virtual long repSvcType() const override; + virtual StatusCode createObj(IOpaqueAddress* pAddress, DataObject*& refpObject) override; + + // The rest of these are dummies. + virtual StatusCode setDataProvider(IDataProviderSvc* pService) override; + virtual SmartIF<IDataProviderSvc>& dataProvider() const override; + virtual StatusCode setConversionSvc(IConversionSvc* pService) override; + virtual SmartIF<IConversionSvc>& conversionSvc() const override; + virtual StatusCode setAddressCreator(IAddressCreator* creator) override; + virtual SmartIF<IAddressCreator>& addressCreator() const override; + virtual StatusCode fillObjRefs(IOpaqueAddress* pAddress, DataObject* pObject) override; + virtual StatusCode updateObj(IOpaqueAddress* pAddress, DataObject* refpObject) override; + virtual StatusCode updateObjRefs(IOpaqueAddress* pAddress, DataObject* pObject) override; + virtual StatusCode createRep(DataObject* pObject, IOpaqueAddress*& refpAddress) override; + virtual StatusCode fillRepRefs(IOpaqueAddress* pAddress, DataObject* pObject) override; + virtual StatusCode updateRep(IOpaqueAddress* pAddress, DataObject* pObject) override; + virtual StatusCode updateRepRefs(IOpaqueAddress* pAddress, DataObject* pObject) override; + //@} + /// \name Service implementation //@{ - virtual StatusCode initialize(); - virtual StatusCode finalize(); + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; //@} /// TriggerList property call-back. Decode TriggerList, obtain selector ptrs @@ -234,7 +254,6 @@ private: //@{ ///setup and lookup m_evtsNotUsedSoFar. Returns next event no unsigned long getEventNo() const; - StatusCode addMergedEventInfo() const; mutable unsigned long m_eventPos; ///< the internal event number //@} typedef ServiceHandle<StoreGateSvc> StoreGateSvc_t; diff --git a/Control/AthenaServices/src/MultipleEventLoopMgr.cxx b/Control/AthenaServices/src/MultipleEventLoopMgr.cxx index 73ddcae04165e9fabfb4607866d26f05ceef311c..85e8be5b5b0a45ab81985586c8db62991c9ae068 100644 --- a/Control/AthenaServices/src/MultipleEventLoopMgr.cxx +++ b/Control/AthenaServices/src/MultipleEventLoopMgr.cxx @@ -22,7 +22,7 @@ MultipleEventLoopMgr::MultipleEventLoopMgr(const std::string& nam, ISvcLocator* svcLoc) : AthenaEventLoopMgr(nam, svcLoc), m_pToolSvc( "ToolSvc", nam ), - m_pAlgMgr(0), m_passDone(0) + m_pAlgMgr(nullptr), m_passDone(0) { declareProperty("NextPassFilter", m_nextPassFilterName); declareProperty("ToBeReinitialized", m_toBeReInitializedNames); @@ -34,7 +34,7 @@ MultipleEventLoopMgr::~MultipleEventLoopMgr() { IAlgManager* MultipleEventLoopMgr::algMgr() { - if ( 0 == m_pAlgMgr ) { + if ( nullptr == m_pAlgMgr ) { SmartIF<IAlgManager> algMan(serviceLocator()); if( algMan.isValid() ) m_pAlgMgr=&*algMan; else throw GaudiException("IAlgManager not found", name(), StatusCode::FAILURE); @@ -45,22 +45,22 @@ MultipleEventLoopMgr::algMgr() { INextPassFilter* MultipleEventLoopMgr::nextPassFilter() { - INextPassFilter* pFilter(0); + INextPassFilter* pFilter(nullptr); const string& filterName(m_nextPassFilterName.value()); if (!(filterName.empty())) { ListItem theFilter(filterName); - IAlgTool* pHoldTool(0); + IAlgTool* pHoldTool(nullptr); if ( (m_pToolSvc->retrieveTool(theFilter.type(), theFilter.name(), pHoldTool)).isSuccess() ) { pFilter=dynamic_cast<INextPassFilter*>(pHoldTool); } - IAlgorithm* pHoldAlg(0); - if (0 == pFilter && + IAlgorithm* pHoldAlg(nullptr); + if (nullptr == pFilter && (algMgr()->getAlgorithm(theFilter.name(), pHoldAlg)).isSuccess() ) { pFilter=dynamic_cast<INextPassFilter*>(pHoldAlg); } } - if (0 == pFilter) { + if (nullptr == pFilter) { ListItem theFilter(filterName); MsgStream log(msgSvc(), name()); log << MSG::WARNING << "Could not locate filter " @@ -73,7 +73,7 @@ MultipleEventLoopMgr::doNextPass() { INextPassFilter* pFilter(nextPassFilter()); //if no tool found or tool not an INextPassFilter we return false //and terminate the multiple pass iteration - return ( 0 != pFilter && pFilter->doNextPass() ); + return ( nullptr != pFilter && pFilter->doNextPass() ); } StatusCode MultipleEventLoopMgr::reInitList() { @@ -83,7 +83,7 @@ MultipleEventLoopMgr::reInitList() { vector<string>::const_iterator iEnd(theNames.end()); while ( sc.isSuccess() && (iN != iEnd) ) { ListItem theSvc(*iN++); //not really needed but safer... - IService* pSvc(0); + IService* pSvc(nullptr); sc = serviceLocator()->getService(theSvc.name(), pSvc); if (sc.isSuccess()) sc = pSvc->reinitialize(); } @@ -95,11 +95,11 @@ MultipleEventLoopMgr::nextEvent(int maxevt) { StatusCode sc; do { MsgStream log(msgSvc(), name()); - log << MSG::INFO << "nextEvent: starting pass #" << m_passDone << endreq; + log << MSG::INFO << "nextEvent: starting pass #" << m_passDone << endmsg; // Reset run number to assure BeginRun each rewind m_currentRun = 0; sc = AthenaEventLoopMgr::nextEvent(maxevt); - log << MSG::INFO << "nextEvent: finished pass #" << m_passDone << endreq; + log << MSG::INFO << "nextEvent: finished pass #" << m_passDone << endmsg; m_passDone++; } while ( sc.isSuccess() && //pass ok doNextPass() && //another one? diff --git a/Control/AthenaServices/src/OutputStreamSequencerSvc.cxx b/Control/AthenaServices/src/OutputStreamSequencerSvc.cxx index 4d21993dfdc778bb4b95d1bba5da1821ba1dcf02..b00bdee427bcafdd170070e4e831f98277f9203e 100644 --- a/Control/AthenaServices/src/OutputStreamSequencerSvc.cxx +++ b/Control/AthenaServices/src/OutputStreamSequencerSvc.cxx @@ -82,7 +82,7 @@ void OutputStreamSequencerSvc::handle(const Incident& inc) { m_fileSequenceNumber++; m_fileSequenceLabel.clear(); const FileIncident* fileInc = dynamic_cast<const FileIncident*>(&inc); - if (fileInc != 0) { + if (fileInc != nullptr) { m_fileSequenceLabel = fileInc->fileName(); } } diff --git a/Control/AthenaServices/src/PageAccessControlSvc.cxx b/Control/AthenaServices/src/PageAccessControlSvc.cxx index 02aa31c3b3974ddb13195be8ce3c8ef01b4b70bf..3e576f3e2fbaae9e9c9a1e2705c3d370a87106c6 100644 --- a/Control/AthenaServices/src/PageAccessControlSvc.cxx +++ b/Control/AthenaServices/src/PageAccessControlSvc.cxx @@ -17,19 +17,19 @@ PageAccessControlSvc::PageAccessControlSvc( const std::string& name, } bool PageAccessControlSvc::startMonitoring () { - int rc = sigaction(SIGSEGV,NULL, &m_saveSEGVaction); + int rc = sigaction(SIGSEGV,nullptr, &m_saveSEGVaction); if (0==rc) { struct sigaction sa(m_saveSEGVaction); sa.sa_sigaction= cPtrAccessSEGVHandler; sa.sa_flags=SA_SIGINFO; //off we go - rc=sigaction(SIGSEGV,&sa,NULL); + rc=sigaction(SIGSEGV,&sa,nullptr); } return (0==rc); } bool PageAccessControlSvc::stopMonitoring () { - return (0 == sigaction(SIGSEGV,&m_saveSEGVaction, NULL)); + return (0 == sigaction(SIGSEGV,&m_saveSEGVaction, nullptr)); } /// has this pointer been accessed (read/written) @@ -40,7 +40,7 @@ bool PageAccessControlSvc::accessed(const void* address) const { StatusCode PageAccessControlSvc::initialize() { StatusCode sc(StatusCode::SUCCESS); msg(MSG::INFO) << "Initializing " << name() - << " - package version " << PACKAGE_VERSION << endreq ; + << " - package version " << PACKAGE_VERSION << endmsg ; if (m_autoMonitor.value() && !this->startMonitoring()) sc = StatusCode::FAILURE; return sc; } @@ -48,7 +48,7 @@ StatusCode PageAccessControlSvc::initialize() { StatusCode PageAccessControlSvc::finalize() { StatusCode sc(StatusCode::SUCCESS); msg(MSG::INFO) << "Finalizing " << name() - << " - package version " << PACKAGE_VERSION << endreq ; + << " - package version " << PACKAGE_VERSION << endmsg ; if (m_autoMonitor.value()) { if (this->stopMonitoring()) this->report(); else sc = StatusCode::FAILURE; @@ -76,17 +76,17 @@ PageAccessControlSvc::queryInterface(const InterfaceID& riid, void** ppvInterfac void PageAccessControlSvc::report() const { - msg(MSG::INFO) << "Access monitoring report" << endreq; + msg(MSG::INFO) << "Access monitoring report" << endmsg; PtrAccessSEGVHandler::const_iterator i(m_SEGVHandler.beginAccessedPtrs()), e(m_SEGVHandler.endAccessedPtrs()); while (i != e) { - msg(MSG::DEBUG) << "accessed pointer at @" << std::hex << *i++ << endreq; + msg(MSG::DEBUG) << "accessed pointer at @" << std::hex << *i++ << endmsg; } PageAccessControl::const_iterator ia(m_accessControl.beginProtectedPtrs()), ea(m_accessControl.endProtectedPtrs()); while (ia != ea) { msg(MSG::DEBUG) << "protected page at @" << std::hex << ia->addr - << " accessed "<< ia->restored << " times" << endreq; + << " accessed "<< ia->restored << " times" << endmsg; ++ia; } } diff --git a/Control/AthenaServices/src/PyAthenaEventLoopMgr.cxx b/Control/AthenaServices/src/PyAthenaEventLoopMgr.cxx index 77c05d3eef399ef37b8c82e25d372b2853278175..46dbf9d8222301abeabf00c84f05b1d0b3eb0280 100644 --- a/Control/AthenaServices/src/PyAthenaEventLoopMgr.cxx +++ b/Control/AthenaServices/src/PyAthenaEventLoopMgr.cxx @@ -48,7 +48,7 @@ namespace { // Outside access to the event loop manager //========================================================================= PyAthenaEventLoopMgr* PyAthenaEventLoopMgr::pointer() { - IEventProcessor* ep = 0; + IEventProcessor* ep = nullptr; static const bool CREATEIF( false ); if ( ( Gaudi::svcLocator()->service( "PyAthenaEventLoopMgr", ep, CREATEIF ) ).isSuccess() ) { @@ -56,7 +56,7 @@ PyAthenaEventLoopMgr* PyAthenaEventLoopMgr::pointer() { return dynamic_cast< PyAthenaEventLoopMgr* >( ep ); } - return 0; + return nullptr; } @@ -65,7 +65,7 @@ PyAthenaEventLoopMgr* PyAthenaEventLoopMgr::pointer() { //========================================================================= PyAthenaEventLoopMgr::PyAthenaEventLoopMgr( const std::string& name, ISvcLocator* svcLoc ) - : AthenaEventLoopMgr( name, svcLoc ), m_manager( 0 ) + : AthenaEventLoopMgr( name, svcLoc ), m_manager( nullptr ) { /// overrides the base-class default: for interactive use, it is mandatory /// to leave the store untouched at the end of the event (so people can @@ -83,7 +83,7 @@ PyObject* PyAthenaEventLoopMgr::setManager( PyObject* mgr ) if ( ! PyObject_HasAttrString( mgr, execalgs ) ) { PyErr_SetString( PyExc_TypeError, "given object is not a manager" ); - return 0; + return nullptr; } // set on ourselves @@ -100,17 +100,17 @@ PyObject* PyAthenaEventLoopMgr::setManager( PyObject* mgr ) } // hand the python side its interfaces - PyObject* pyself = PyCObject_FromVoidPtr( (void*)static_cast< IEventSeek* >( this ), 0 ); + PyObject* pyself = PyCObject_FromVoidPtr( (void*)static_cast< IEventSeek* >( this ), nullptr ); PyObject* method = PyString_FromString( "_installServices" ); PyObject* result = PyObject_CallMethodObjArgs( mgr, method, pyself, 0 ); Py_DECREF( method ); Py_DECREF( pyself ); if ( ! result ) - return 0; + return nullptr; // return old value (with its refcount), if set previously; or None - if ( old != 0 ) + if ( old != nullptr ) return old; Py_INCREF( Py_None ); @@ -144,7 +144,7 @@ StatusCode PyAthenaEventLoopMgr::initialize() if ( pyelm ) { PyObject* args = PyTuple_New( 0 ); - PyObject* self = PyObject_Call( pyelm, args, 0 ); + PyObject* self = PyObject_Call( pyelm, args, nullptr ); Py_DECREF( args ); Py_DECREF( pyelm ); @@ -180,7 +180,7 @@ StatusCode PyAthenaEventLoopMgr::initialize() StatusCode PyAthenaEventLoopMgr::executeAlgorithms() { // forward to call to the python-side object - if ( m_manager != 0 ) + if ( m_manager != nullptr ) { // forward call, if python side manager available PyObject* result = PyObject_CallMethod( m_manager, execalgs, (char*)"" ); @@ -202,7 +202,7 @@ StatusCode PyAthenaEventLoopMgr::executeAlgorithms() MsgStream log( msgSvc(), name() ); log << MSG::ERROR << "result from python event loop manager has unexpected type." - << endreq; + << endmsg; Py_DECREF( result ); return StatusCode::FAILURE; } diff --git a/Control/AthenaServices/src/RCUSvc.cxx b/Control/AthenaServices/src/RCUSvc.cxx new file mode 100644 index 0000000000000000000000000000000000000000..eb14b618b82b207f812f3fce6cca17396efe7ea0 --- /dev/null +++ b/Control/AthenaServices/src/RCUSvc.cxx @@ -0,0 +1,102 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id$ +/** + * @file AthenaServices/src/RCUSvc.cxx + * @author scott snyder <snyder@bnl.gov> + * @date Aug, 2016 + * @brief + */ + + +#include "RCUSvc.h" + + +namespace Athena { + + +/** + * @brief Standard Gaudi constructor. + * @param name Service name. + * @svc Service locator. + */ +RCUSvc::RCUSvc (const std::string& name, ISvcLocator* svc) + : extends<AthService, IRCUSvc, IIncidentListener> (name, svc), + m_hiveWhiteBoardSvc ("SG::HiveMgrSvc", name), + m_incidentSvc ("IncidentSvc", name) +{ + declareProperty ("HiveWhiteBoardSvc", m_hiveWhiteBoardSvc); + declareProperty ("IncidentSvc", m_incidentSvc); +} + + +/** + * @brief Standard Gaudi initialize method. + */ +StatusCode RCUSvc::initialize() +{ + ATH_CHECK( AthService::initialize() ); + ATH_CHECK( m_hiveWhiteBoardSvc.retrieve() ); + ATH_CHECK( m_incidentSvc.retrieve() ); + + m_incidentSvc->addListener (this, IncidentType::EndEvent); + return StatusCode::SUCCESS; +} + + +/** + * @brief Return the current number of event slots. + */ +size_t RCUSvc::getNumSlots() const +{ + return m_hiveWhiteBoardSvc->getNumberOfStores(); +} + + +/** + * @brief Add a new RCU object to the set being managed. + * @param obj The RCU object to add. + */ +void RCUSvc::add (IRCUObject* obj) +{ + lock_t g (m_mutex); + m_objs.insert (obj); +} + + +/** + * @brief Remove an RCU object to the set being managed. + * @param obj The RCU object to remove. + * + * Returns failure if the requested object isn't in the managed set. + */ +StatusCode RCUSvc::remove (IRCUObject* obj) +{ + lock_t g (m_mutex); + set_t::iterator it = m_objs.find (obj); + if (it == m_objs.end()) + return StatusCode::FAILURE; + m_objs.erase (it); + return StatusCode::SUCCESS; +} + + +/** + * @brief Gaudi incident handler. + * + * Declare all managed objects quiescent at EndEvent. + */ +void RCUSvc::handle (const Incident& inc) +{ + lock_t g (m_mutex); + if (inc.type() == IncidentType::EndEvent) { + for (IRCUObject* p : m_objs) + p->quiescent (inc.context()); + } +} + + +} // namespace Athena + diff --git a/Control/AthenaServices/src/RCUSvc.h b/Control/AthenaServices/src/RCUSvc.h new file mode 100644 index 0000000000000000000000000000000000000000..fb6e1539ac30b1113f92613da9d9036899cbc7d8 --- /dev/null +++ b/Control/AthenaServices/src/RCUSvc.h @@ -0,0 +1,108 @@ +// This file's extension implies that it's C, but it's really -*- C++ -*-. + +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id$ +/** + * @file AthenaServices/src/RCUSvc.h + * @author scott snyder <snyder@bnl.gov> + * @date Aug, 2016 + * @brief Service to allow cleaning up RCU objects at the EndEvent. + */ + + +#ifndef ATHENASERIVCES_RCUSVC_H +#define ATHENASERIVCES_RCUSVC_H + + +#include "AthenaKernel/IRCUSvc.h" +#include "AthenaBaseComps/AthService.h" +#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/IHiveWhiteBoard.h" +#include "GaudiKernel/IIncidentSvc.h" +#include "GaudiKernel/IIncidentListener.h" +#include <unordered_map> +#include <mutex> + + +namespace Athena { + + +/** + * @brief Service to allow cleaning up RCU objects at the EndEvent. + * + * For a summary of RCU usage, see AthenaKernel/RCUObject.h. + * This service keeps a registry of RCU objects. At EndEvent, + * it declares them quiescent for the current event slot. + */ +class RCUSvc + : public extends<AthService, IRCUSvc, IIncidentListener> +{ +public: + /** + * @brief Standard Gaudi constructor. + * @param name Service name. + * @svc Service locator. + */ + RCUSvc (const std::string& name, ISvcLocator* svc); + + + /** + * @brief Standard Gaudi initialize method. + */ + virtual StatusCode initialize() override; + + + /** + * @brief Return the current number of event slots. + */ + virtual size_t getNumSlots() const override; + + + /** + * @brief Add a new RCU object to the set being managed. + * @param obj The RCU object to add. + */ + virtual void add (IRCUObject* obj) override; + + + /** + * @brief Remove an RCU object to the set being managed. + * @param obj The RCU object to remove. + * + * Returns failure if the requested object isn't in the managed set. + */ + virtual StatusCode remove (IRCUObject* obj) override; + + + /** + * @brief Gaudi incident handler. + * + * Declare all managed objects quiescent at EndEvent. + */ + virtual void handle (const Incident& inc) override; + + +private: + /// Set of managed objects. + typedef std::unordered_set<IRCUObject*> set_t; + set_t m_objs; + + /// The hive WB service. Used to get the current number of slots. + ServiceHandle<IHiveWhiteBoard> m_hiveWhiteBoardSvc; + + /// Gaudi incident service. + ServiceHandle<IIncidentSvc> m_incidentSvc; + + /// Mutex protecting access to m_objs. + std::mutex m_mutex; + typedef std::lock_guard<std::mutex> lock_t; +}; + + +} // namespace Athena + + +#endif // not ATHENASERIVCES_RCUSVC_H diff --git a/Control/AthenaServices/src/SetFatalHandler.cxx b/Control/AthenaServices/src/SetFatalHandler.cxx index a164c027ea01e0a13eb6fbeb8746b6e791511e91..57963956bf14c46a9bd74a7167ff7680fdf92fe3 100644 --- a/Control/AthenaServices/src/SetFatalHandler.cxx +++ b/Control/AthenaServices/src/SetFatalHandler.cxx @@ -53,7 +53,7 @@ void AthenaServices::SetFatalHandler( int flags ) { Athena::Signal::handle( SIGINT, ExitOnInt ); } else { - Athena::Signal::handleFatal(0, IOFD_INVALID, 0, 0, flags ); + Athena::Signal::handleFatal(nullptr, IOFD_INVALID, nullptr, nullptr, flags ); Athena::Signal::handle( SIGINT, ExitOnInt ); } diff --git a/Control/AthenaServices/src/SimplePOSIXTimeKeeperSvc.cxx b/Control/AthenaServices/src/SimplePOSIXTimeKeeperSvc.cxx index 6dd0dc80ee25a772199d786ae84f8afeb50cfee4..2d4326defe214adf8ae58c023f6b986f0499c614 100644 --- a/Control/AthenaServices/src/SimplePOSIXTimeKeeperSvc.cxx +++ b/Control/AthenaServices/src/SimplePOSIXTimeKeeperSvc.cxx @@ -48,9 +48,9 @@ SimplePOSIXTimeKeeperSvc::nextIter() { //the end if ((msg().level() == MSG::INFO && timeOver()) || msg().level() < MSG::INFO) { - msg() << msg().level() << *this << endreq; + msg() << msg().level() << *this << endmsg; } - //FIXME log.level() < MSG::INFO) log << *this << endreq; + //FIXME log.level() < MSG::INFO) log << *this << endmsg; return doNext; } diff --git a/Control/AthenaServices/src/TestRandomSeqAlg.cxx b/Control/AthenaServices/src/TestRandomSeqAlg.cxx index 8d3f39b85c02e3daea3e7344239c8aa87eafdc94..579f00be5e004f80480a85892e0b1f22f58a8c39 100644 --- a/Control/AthenaServices/src/TestRandomSeqAlg.cxx +++ b/Control/AthenaServices/src/TestRandomSeqAlg.cxx @@ -10,7 +10,7 @@ TestRandomSeqAlg::TestRandomSeqAlg(const std::string& name, ISvcLocator* pSvcLoc m_rndmSvc("AtRanluxGenSvc", name), m_streamName("TEST"), m_noOfNo(10), - m_pEng(0) + m_pEng(nullptr) { declareProperty("RndmSvc", m_rndmSvc, "the IAtRndmGenSvc we want to test (default AtRanluxGenSvc"); declareProperty("StreamName", m_streamName, " random number stream to use (default TEST"); diff --git a/Control/AthenaServices/src/ThinningOutputTool.cxx b/Control/AthenaServices/src/ThinningOutputTool.cxx index ad4568ced65e11e6f18cb7f039b698337702a2ef..ca545a70a197c14aef0470ffb3842b57e9fb3619 100644 --- a/Control/AthenaServices/src/ThinningOutputTool.cxx +++ b/Control/AthenaServices/src/ThinningOutputTool.cxx @@ -38,7 +38,7 @@ ThinningOutputTool::ThinningOutputTool( const std::string& type, const IInterface* parent ) : AthAlgTool( type, name, parent ), m_thinningSvc ( "ThinningSvc", name ), - m_activeSvc ( 0 ) + m_activeSvc ( nullptr ) { // // Property declaration @@ -135,11 +135,11 @@ StatusCode ThinningOutputTool::preExecute() ATH_MSG_DEBUG ("force-loading proxy(clid=[" << p->clID() << "], " << "key=[" << p->name() << "])..."); - if ( 0 == p->accessData() ) { + if ( nullptr == p->accessData() ) { ATH_MSG_WARNING ("Could not accessData(clid=[" << p->clID() << "], " << "key=[" << p->name() << "]) !" - << endreq + << endmsg << "Thinning might segfault under certain conditions..."); } } @@ -158,11 +158,11 @@ StatusCode ThinningOutputTool::preExecute() ATH_MSG_DEBUG ("force-loading proxy(clid=[" << p->clID() << "], " << "key=[" << p->name() << "])..."); - if ( 0 == p->accessData() ) { + if ( nullptr == p->accessData() ) { ATH_MSG_WARNING ("Could not accessData(clid=[" << p->clID() << "], " << "key=[" << p->name() << "]) !" - << endreq + << endmsg << "Thinning might segfault under certain conditions..."); } } @@ -174,7 +174,7 @@ StatusCode ThinningOutputTool::preExecute() // apply thinning only if needed if ( doThinning && !m_thinningSvc->commit().isSuccess() ) { ATH_MSG_ERROR - ("IThinningSvc::commit() failed !" << endreq + ("IThinningSvc::commit() failed !" << endmsg << "Containers (and ElementLinks pointing to their elements) are " << "most probably in a corrupted state !!"); allGood = false; @@ -194,7 +194,7 @@ StatusCode ThinningOutputTool::postExecute() const bool doThinning = m_thinningSvc->thinningOccurred(); if ( doThinning && !m_thinningSvc->rollback().isSuccess() ) { ATH_MSG_ERROR - ("IThinningSvc::rollback() failed !" << endreq + ("IThinningSvc::rollback() failed !" << endmsg << "Containers (and ElementLinks pointing to their elements) are " << "most probably in a corrupted state !!"); allGood = false; diff --git a/Control/AthenaServices/src/ThinningSvc.cxx b/Control/AthenaServices/src/ThinningSvc.cxx index 67fcc527b2b971ed015c2895c91956969cff5f7b..9140eef8da656602af0f270a3b097941474b61de 100644 --- a/Control/AthenaServices/src/ThinningSvc.cxx +++ b/Control/AthenaServices/src/ThinningSvc.cxx @@ -83,9 +83,9 @@ StatusCode ThinningSvc::initialize() ATH_MSG_INFO ("Initializing " << name() << "..."); // Set to be listener for beginning of event - IIncidentSvc* incSvc = 0; + IIncidentSvc* incSvc = nullptr; if ( !service("IncidentSvc",incSvc).isSuccess() || - 0 == incSvc ) { + nullptr == incSvc ) { ATH_MSG_ERROR ("Unable to get the IncidentSvc"); return StatusCode::FAILURE; } @@ -219,7 +219,7 @@ std::size_t ThinningSvc::index_impl( const SG::DataProxy* cproxy, std::size_t idx ) const { - if ( 0 == cproxy ) { + if ( nullptr == cproxy ) { // this is now demoted to ::DEBUG as it may very well happen (even in // sound cases) that e.g. an ElementLink has no proxy (e.g. it points to // another file and BackNavigation was disabled) @@ -243,7 +243,7 @@ ThinningSvc::index_impl( const SG::DataProxy* cproxy, if ( dbg ) { msg(MSG::VERBOSE) << idx << "] (no-thinning-occured)" - << endreq; + << endmsg; } return idx; } @@ -255,7 +255,7 @@ ThinningSvc::index_impl( const SG::DataProxy* cproxy, if ( dbg ) { msg(MSG::VERBOSE) << idx << "] (obj-not-thinned)" - << endreq; + << endmsg; } return idx; } @@ -265,7 +265,7 @@ ThinningSvc::index_impl( const SG::DataProxy* cproxy, if ( i == indexMap.end() ) { // element has been thinned away... if ( dbg ) { - msg(MSG::VERBOSE) << "<removed>" << "]" << endreq; + msg(MSG::VERBOSE) << "<removed>" << "]" << endmsg; } return IThinningSvc::RemovedIdx; } @@ -276,7 +276,7 @@ ThinningSvc::index_impl( const SG::DataProxy* cproxy, } else { msg(MSG::VERBOSE) << "<removed>]"; } - msg(MSG::VERBOSE) << endreq; + msg(MSG::VERBOSE) << endmsg; } return i->second; } @@ -291,7 +291,7 @@ ThinningSvc::is_thinned_impl(const SG::DataProxy* p) const return false; } - if (0 == p) { + if (nullptr == p) { // this is now demoted to ::DEBUG as it may very well happen (even in // sound cases) that e.g. an ElementLink has no proxy (e.g. it points to // another file and BackNavigation was disabled) @@ -310,8 +310,8 @@ ThinningSvc::is_thinned_impl(const SG::DataProxy* p) const void ThinningSvc::handle( const Incident& inc ) { - ATH_MSG_DEBUG ("Entering handle(): " << endreq - << " Incidence type: " << inc.type() << endreq + ATH_MSG_DEBUG ("Entering handle(): " << endmsg + << " Incidence type: " << inc.type() << endmsg << " from: " << inc.source()); // Only clearing the store for BeginEvent incident if ( inc.type() == IncidentType::BeginEvent ) { @@ -415,7 +415,7 @@ ThinningSvc::rollback() } if ( !allOk ) { ATH_MSG_WARNING ("some problem occurred while rolling-back thinning !" - << endreq + << endmsg << " (trying nonetheless to revert slimming)..."); } else { ATH_MSG_DEBUG @@ -438,7 +438,7 @@ ThinningSvc::rollback() } if ( !allOk ) { ATH_MSG_WARNING ("some problem occurred while rolling-back slimming !" - << endreq + << endmsg << " (trying nonetheless to revert slimming)..."); } else { ATH_MSG_DEBUG @@ -453,7 +453,7 @@ ThinningSvc::handler( SG::DataProxy* proxy ) { ThinningStore_t::iterator i = m_thinningStore.find( proxy ); if ( i == m_thinningStore.end() ) { - return 0; + return nullptr; } return i->second.get<1>(); } @@ -463,11 +463,11 @@ ThinningSvc::filter_impl( IThinningHdlr* handler, SG::DataProxy* proxy, const Filter_t& filter, const IThinningSvc::Operator::Type op ) { - if ( 0 == proxy ) { + if ( nullptr == proxy ) { msg(MSG::WARNING) << "Received a null DataProxy ! " << "No thinning will occur for that 'object' !" - << endreq; + << endmsg; if (m_ownedHandlers.find(handler) == m_ownedHandlers.end()) delete handler; return StatusCode::RECOVERABLE; @@ -494,7 +494,7 @@ ThinningSvc::filter_impl( IThinningHdlr* handler, SG::DataProxy* proxy, if (mitr==m.end()) { ATH_MSG_ERROR ("could not apply filter for proxy [" << proxy->name() << "]" - << endreq + << endmsg << "indices do not match !"); return StatusCode::FAILURE; } @@ -508,7 +508,7 @@ ThinningSvc::filter_impl( IThinningHdlr* handler, SG::DataProxy* proxy, if (mitr==m.end()) { ATH_MSG_ERROR ("could not apply filter for proxy [" << proxy->name() << "]" - << endreq + << endmsg << "indices do not match !"); return StatusCode::FAILURE; } @@ -517,7 +517,7 @@ ThinningSvc::filter_impl( IThinningHdlr* handler, SG::DataProxy* proxy, } else { msg(MSG::ERROR) << "Unknown operator being passed for merging of filters !!" - << endreq; + << endmsg; return StatusCode::FAILURE; } } @@ -537,7 +537,7 @@ ThinningSvc::cleanupStore() iStoreEnd = m_slimmingStore.end(); iStore != iStoreEnd; ++iStore ) { - delete iStore->second; iStore->second = 0; + delete iStore->second; iStore->second = nullptr; } m_slimmingStore.clear(); @@ -548,7 +548,7 @@ ThinningSvc::cleanupStore() iStore != iStoreEnd; ++iStore ) { IThinningHdlr* hdlr = iStore->second.get<1>(); - delete hdlr; hdlr = 0; + delete hdlr; hdlr = nullptr; } m_thinningStore.clear(); m_ownedHandlers.clear(); @@ -565,10 +565,10 @@ ThinningSvc::cleanupStore() StatusCode ThinningSvc::register_slimmer (ISlimmingHdlr *handler) { - if (0==handler) { + if (nullptr==handler) { msg (MSG::ERROR) << "received null pointer to ISlimmingHdlr !" - << endreq; + << endmsg; return StatusCode::FAILURE; } @@ -578,18 +578,18 @@ ThinningSvc::register_slimmer (ISlimmingHdlr *handler) msg (MSG::ERROR) << "A slimmer was already registered for object at [" << obj << "] of " << "type [" << System::typeinfoName (handler->type_id()) << "] !" - << endreq + << endmsg << "Previous slimmer was registered by [" << itr->second->requester()->name() << "]" - << endreq + << endmsg << "Current slimmer is being registered by [" << handler->requester()->name() << "]" - << endreq + << endmsg << "sorry: multi-pass slimming isn't supported !" - << endreq + << endmsg << " --- now deleting your slim-handler ---" - << endreq; - delete handler; handler = 0; + << endmsg; + delete handler; handler = nullptr; return StatusCode::FAILURE; } diff --git a/Control/AthenaServices/src/UserDataSvc.cxx b/Control/AthenaServices/src/UserDataSvc.cxx index 3c73a82169eb0e02563c03b2171ae1ff55a7f573..e414933fcb1dad03a7da44052b90179b1591ac1d 100644 --- a/Control/AthenaServices/src/UserDataSvc.cxx +++ b/Control/AthenaServices/src/UserDataSvc.cxx @@ -12,7 +12,7 @@ UserDataSvc::UserDataSvc(const std::string& name, ISvcLocator* pSvcLocator ) : AthService(name,pSvcLocator), m_storeGateSvc("StoreGateSvc",name), - m_userData(0), + m_userData(nullptr), m_eventABC(IAthenaBarCode::UNDEFINEDBARCODE){ declareProperty("StoreGateSvc",m_storeGateSvc); @@ -24,14 +24,14 @@ UserDataSvc::~UserDataSvc() {} StatusCode UserDataSvc::initialize() { if (m_storeGateSvc.retrieve().isFailure()) { - msg(MSG::ERROR) << "Failed to retrieve StoreGateSvc" << endreq; + msg(MSG::ERROR) << "Failed to retrieve StoreGateSvc" << endmsg; return StatusCode::FAILURE; } - IIncidentSvc* incSvc = 0; + IIncidentSvc* incSvc = nullptr; if (service("IncidentSvc",incSvc).isFailure()) { - msg(MSG::ERROR) << "Unable to get the IncidentSvc" << endreq; + msg(MSG::ERROR) << "Unable to get the IncidentSvc" << endmsg; return StatusCode::FAILURE; } incSvc->addListener( this, IncidentType::BeginEvent ); @@ -48,7 +48,7 @@ StatusCode UserDataSvc::finalize() { void UserDataSvc::handle( const Incident& inc ) { ATH_MSG_DEBUG ("Incident handle. Incident type " << inc.type() << " from " << inc.source()); - m_userData=NULL; + m_userData=nullptr; getUserDataStore(); return; } @@ -60,9 +60,9 @@ void UserDataSvc::getUserDataStore() { m_userData=new UserDataStore; StatusCode sc=m_storeGateSvc->record(m_userData,m_key); if (sc.isFailure()) { - msg(MSG::ERROR) << "Failed to record UserDataStore with key " << m_key << endreq; + msg(MSG::ERROR) << "Failed to record UserDataStore with key " << m_key << endmsg; delete m_userData; - m_userData=NULL; + m_userData=nullptr; return; } ATH_MSG_DEBUG("Successfully created UserDataStore Object with key " << m_key); @@ -76,8 +76,8 @@ void UserDataSvc::getUserDataStore() { const UserDataStore* cUDS; StatusCode sc=m_storeGateSvc->retrieve(cUDS,m_key); if (sc.isFailure()) { - msg(MSG::ERROR) << "Failed to retrieve UserDataStore with key " << m_key << endreq; - m_userData=NULL; + msg(MSG::ERROR) << "Failed to retrieve UserDataStore with key " << m_key << endmsg; + m_userData=nullptr; return; } //Now cast away const'ness. This is necessary b/c data objects read from an input file @@ -148,7 +148,7 @@ StatusCode UserDataSvc::typeIDtoAny(const std::type_info &decoinfo, void* & deco else if (this->AnyFromType<std::vector<double> >(decoinfo,deco,out)) return StatusCode::SUCCESS; else { - msg(MSG::ERROR) << "Unsupported type " << decoinfo.name() << endreq; + msg(MSG::ERROR) << "Unsupported type " << decoinfo.name() << endmsg; return StatusCode::FAILURE; } } @@ -168,12 +168,12 @@ int UserDataSvc::vdecorateElement(const IAthenaBarCode &abc, const std::string& int UserDataSvc::vgetElementDecoration(const IAthenaBarCode &abc, const std::string& label, const std::type_info &decoinfo, void *&deco) { - const boost::any* value=0; + const boost::any* value=nullptr; if (this->retrieveAny(abc,label,value).isFailure()) { return -1; } if (value->type()!=decoinfo) { - msg(MSG::ERROR) << "Typeid mismatch! " << value->type().name() << " vs " << decoinfo.name() << endreq; + msg(MSG::ERROR) << "Typeid mismatch! " << value->type().name() << " vs " << decoinfo.name() << endmsg; return -1; } @@ -205,7 +205,7 @@ int UserDataSvc::vgetElementDecoration(const IAthenaBarCode &abc, const std::str deco=(void*)boost::any_cast<bool>(value); } else { - msg(MSG::ERROR) << "Unsupported/unknown type " << decoinfo.name() << ", label=" << label << endreq; + msg(MSG::ERROR) << "Unsupported/unknown type " << decoinfo.name() << ", label=" << label << endmsg; return -1; } diff --git a/Control/AthenaServices/src/components/AthenaServices_entries.cxx b/Control/AthenaServices/src/components/AthenaServices_entries.cxx index b1ce6c8bfe7b9318d220bc7eb90aa73a265fd67e..2f2aef7b1dad9bc7b41f8589e45750e9246c3296 100644 --- a/Control/AthenaServices/src/components/AthenaServices_entries.cxx +++ b/Control/AthenaServices/src/components/AthenaServices_entries.cxx @@ -24,6 +24,7 @@ #include "../AthenaSummarySvc.h" #include "../LoggedMessageSvc.h" #include "../AthenaJobOptionsSvc.h" +#include "../RCUSvc.h" #include "../AthTPCnvSvc.h" #include "../EvtIdModifierSvc.h" #include "../TestRandomSeqAlg.h" @@ -62,6 +63,7 @@ DECLARE_SERVICE_FACTORY( ItemListSvc ) DECLARE_SERVICE_FACTORY( AthenaSummarySvc ) DECLARE_SERVICE_FACTORY( LoggedMessageSvc ) DECLARE_NAMESPACE_SERVICE_FACTORY( Athena, JobOptionsSvc ) +DECLARE_NAMESPACE_SERVICE_FACTORY( Athena, RCUSvc ) DECLARE_SERVICE_FACTORY( AthTPCnvSvc ) DECLARE_SERVICE_FACTORY( EvtIdModifierSvc ) DECLARE_SERVICE_FACTORY( MetaDataSvc ) diff --git a/Control/AthenaServices/src/initPyInterpreter.cxx b/Control/AthenaServices/src/initPyInterpreter.cxx index 282bc5381ddb4908083e98a3b071ec5377f0108b..71ae5ff60467b1b0cf26c7a24d2edbc52e640b81 100644 --- a/Control/AthenaServices/src/initPyInterpreter.cxx +++ b/Control/AthenaServices/src/initPyInterpreter.cxx @@ -32,7 +32,7 @@ namespace { { if (display) { // fetch error - PyObject* pytype = 0, *pyvalue = 0, *pytrace = 0; + PyObject* pytype = nullptr, *pyvalue = nullptr, *pytrace = nullptr; PyErr_Fetch (&pytype, &pyvalue, &pytrace); Py_XINCREF (pytype); Py_XINCREF (pyvalue); diff --git a/Control/AthenaServices/test/AthenaEventLoopMgr_test.cxx b/Control/AthenaServices/test/AthenaEventLoopMgr_test.cxx index 33ba89a13b65c6c6a3eb8e38c83388f26e84b2f4..a6a3958207428a3b1b0dad9c2223e6d0382ca99f 100644 --- a/Control/AthenaServices/test/AthenaEventLoopMgr_test.cxx +++ b/Control/AthenaServices/test/AthenaEventLoopMgr_test.cxx @@ -123,6 +123,7 @@ public: StatusCode TestConverter::createObj(IOpaqueAddress* addr, DataObject *& pO) { TestAddress* taddr = dynamic_cast<TestAddress*> (addr); + if (!taddr) std::abort(); pO = taddr->m_object; return StatusCode::SUCCESS; } @@ -299,14 +300,17 @@ class swallowsemicolon; void testit (IService* mgr) { IEventProcessor* iep = dynamic_cast<IEventProcessor*> (mgr); + if (!iep) std::abort(); assert (iep->nextEvent(1)); assert (iep->nextEvent(3)); ICollectionSize* isize = dynamic_cast<ICollectionSize*> (mgr); + if (!isize) std::abort(); int sz = isize->size(); std::cout << "size: " << sz << "\n"; IEventSeek* iseek = dynamic_cast<IEventSeek*> (mgr); + if (!iseek) std::abort(); StatusCode sc = iseek->seek (1); std::cout << "seek: " << sc.isSuccess() << "\n"; @@ -318,7 +322,7 @@ void test1 (ISvcLocator* svcloc) { std::cout << "test1\n"; - IService *mgr = 0; + IService *mgr = nullptr; if (svcloc->service ("AthenaEventLoopMgr/AthenaEventLoopMgr1", mgr).isFailure()) std::abort(); testit (mgr); @@ -329,7 +333,7 @@ void test2 (ISvcLocator* svcloc) { std::cout << "test2\n"; - IService *mgr = 0; + IService *mgr = nullptr; if (svcloc->service ("AthenaEventLoopMgr/AthenaEventLoopMgr2", mgr).isFailure()) std::abort(); testit (mgr); @@ -339,7 +343,7 @@ void test2 (ISvcLocator* svcloc) int main() { errorcheck::ReportMessage::hideErrorLocus(); - ISvcLocator* svcloc = 0; + ISvcLocator* svcloc = nullptr; if (!Athena_test::initGaudi("AthenaEventLoopMgr_test.txt", svcloc)) { std::cerr << "This test can not be run" << std::endl; return 0; diff --git a/Control/AthenaServices/test/AthenaOutputStream_test.cxx b/Control/AthenaServices/test/AthenaOutputStream_test.cxx index 3de39d8a7a626e8826aa43d6ebcf5f14f7168d85..f1bc16f5b3e378f2f88fce7344c6b27f2d8468c0 100644 --- a/Control/AthenaServices/test/AthenaOutputStream_test.cxx +++ b/Control/AthenaServices/test/AthenaOutputStream_test.cxx @@ -38,7 +38,7 @@ int main() { errorcheck::ReportMessage::hideErrorLocus(); const std::string appName = "AthenaOutputStream_test"; cout << "*** " << appName << " starts ***" <<endl; - ISvcLocator* pSvcLoc(0); + ISvcLocator* pSvcLoc(nullptr); if (!initGaudi("AthenaOutputStream_test.txt", pSvcLoc)) { cerr << "This test can not be run" << endl; return 0; @@ -60,7 +60,7 @@ int main() { SmartIF<IAlgManager> algMan(IAlgManager::interfaceID(), pSvcLoc); #endif assert( algMan.isValid() ); - IAlgorithm* pAlg(0); + IAlgorithm* pAlg(nullptr); assert( (algMan->createAlgorithm( "AthenaOutputStream", "AthenaOutputStream", pAlg)).isSuccess() ); assert( (pAlg->sysInitialize()).isSuccess() ); @@ -90,6 +90,7 @@ int main() { for (DataObject* obj : *pStream->selectedObjects()) { DataBucketBase* dbb = dynamic_cast<DataBucketBase*> (obj); + if (!dbb) std::abort(); const SG::DataProxy* proxy = pStore->proxy (dbb->object()); std::cout << dbb->clID() << " " << proxy->name() << "\n"; } diff --git a/Control/AthenaServices/test/FPEControlSvc_test.cxx b/Control/AthenaServices/test/FPEControlSvc_test.cxx index 512509a7fb5b732c47759c32124c7bbd250b8de3..9861c79b63cb55212775d95289a46300a7c8d2e3 100644 --- a/Control/AthenaServices/test/FPEControlSvc_test.cxx +++ b/Control/AthenaServices/test/FPEControlSvc_test.cxx @@ -54,14 +54,14 @@ float testit (bool expectsig) int main() { errorcheck::ReportMessage::hideErrorLocus(); - ISvcLocator* svcloc = 0; + ISvcLocator* svcloc = nullptr; if (!Athena_test::initGaudi("FPEControlSvc_test.txt", svcloc)) { std::cerr << "This test can not be run" << std::endl; return 0; } assert(svcloc); - IService *tmpsvc = 0; + IService *tmpsvc = nullptr; if (svcloc->service ("FPEControlSvc", tmpsvc).isFailure()) std::abort(); Service* svc = dynamic_cast<Service*> (tmpsvc); diff --git a/Control/AthenaServices/test/RCUSvc_test.cxx b/Control/AthenaServices/test/RCUSvc_test.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f078f02ecd48c93bb42e1fc0d3aa5e8414c1cc92 --- /dev/null +++ b/Control/AthenaServices/test/RCUSvc_test.cxx @@ -0,0 +1,268 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id$ +/** + * @file AthenaServices/test/RCUSvc_test.cxx + * @author scott snyder + * @date Aug 2016 + * @brief Regression test for RCUSvc + */ + + +#undef NDEBUG +#include "AthenaBaseComps/AthService.h" +#include "AthenaKernel/IRCUSvc.h" +#include "AthenaKernel/errorcheck.h" +#include "TestTools/initGaudi.h" +#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/IHiveWhiteBoard.h" +#include "GaudiKernel/DeclareFactoryEntries.h" +#include "boost/thread/shared_mutex.hpp" +#include "boost/thread/shared_lock_guard.hpp" +#include <iostream> +#include <cassert> + + +using Athena::IRCUSvc; +using Athena::RCUObject; +using Athena::RCURead; +using Athena::RCUUpdate; + + +const int nslots = 4; +const int nobjs = 3; + + +class TestWhiteBoard + : public extends<AthService, IHiveWhiteBoard> +{ +public: + TestWhiteBoard (const std::string& name, ISvcLocator* svc) + : extends<AthService, IHiveWhiteBoard> (name, svc) + {} + + virtual StatusCode selectStore(size_t /*partitionIndex*/) override { std::abort(); } + virtual StatusCode clearStore(size_t /*partitionIndex*/) override { std::abort(); } + virtual StatusCode setNumberOfStores(size_t /*slots*/) override { std::abort(); } + virtual StatusCode getNewDataObjects(DataObjIDColl& /*products*/) override { std::abort(); } + virtual bool newDataObjectsPresent() override { std::abort(); } + virtual size_t allocateStore( int /*evtnumber*/ ) override { std::abort(); } + virtual StatusCode freeStore( size_t /*partitionIndex*/ ) override { std::abort(); } + virtual size_t getPartitionNumber(int /*eventnumber*/) const override { std::abort(); } + + virtual size_t getNumberOfStores() const override { return nslots; } +}; + + +DECLARE_SERVICE_FACTORY( TestWhiteBoard ) + + +struct Payload +{ + Payload (int x=0) + : a(x), b(x), c(x), d(x) + { + ++ninstance; + } + Payload& operator= (const Payload&) = default; + ~Payload() + { + --ninstance; + if (dolog) { + std::lock_guard<std::mutex> g (m_mutex); + m_dlog.push_back(a); + } + } + static + std::vector<int> getlog() + { + std::lock_guard<std::mutex> g (m_mutex); + std::vector<int> log; + log.swap (m_dlog); + return log; + } + void check(int x) const + { + assert (a == x); + assert (b == x); + assert (c == x); + assert (d == x); + } + void check() const + { + check(a); + } + int a, b, c, d; + + static std::atomic<int> ninstance; + static bool dolog; + +private: + static std::vector<int> m_dlog; + static std::mutex m_mutex; +}; + +std::atomic<int> Payload::ninstance; +bool Payload::dolog = true; +std::vector<int> Payload::m_dlog; +std::mutex Payload::m_mutex; + + +void test1 (IRCUSvc& svc) +{ + std::cout << "test1\n"; + std::unique_ptr<RCUObject<Payload> > rcuo = svc.newrcu<Payload> (10); + { + RCURead<Payload> r (*rcuo); + r->check(10); + } + { + RCUUpdate<Payload> u (*rcuo); + u->check(10); + u.update (std::make_unique<Payload> (2)); + u->check(2); + } + { + RCURead<Payload> r (*rcuo); + r->check(2); + } + assert (Payload::getlog().empty()); + + IIncidentListener& listener = dynamic_cast<IIncidentListener&> (svc); + listener.handle (Incident ("test", IncidentType::EndEvent, + EventContext (0, 0))); + assert (Payload::getlog().empty()); + listener.handle (Incident ("test", IncidentType::EndEvent, + EventContext (0, 1))); + listener.handle (Incident ("test", IncidentType::EndEvent, + EventContext (0, 2))); + assert (Payload::getlog().empty()); + + listener.handle (Incident ("test", IncidentType::EndEvent, + EventContext (0, 3))); + assert (Payload::getlog() == std::vector<int>{10}); +} + + +class ThreadedTest +{ +public: + ThreadedTest (IRCUSvc& svc); + void runtest(); + + struct testThread + { + testThread (ThreadedTest& test, int iworker, IRCUSvc& svc) + : m_test(test), m_iworker(iworker), m_svc(svc) {} + void operator()(); + + ThreadedTest& m_test; + int m_iworker; + IRCUSvc& m_svc; + }; + +private: + boost::shared_mutex m_sm; + std::vector<std::unique_ptr<RCUObject<Payload> > > m_objs; + IRCUSvc& m_svc; +}; + + +ThreadedTest::ThreadedTest (IRCUSvc& svc) + : m_svc (svc) +{ + for (int i=0; i < nobjs; i++) + m_objs.push_back (svc.newrcu<Payload>()); +} + +void ThreadedTest::runtest() +{ + std::thread threads[nslots]; + m_sm.lock(); + for (int i=0; i < nslots; i++) + threads[i] = std::thread (testThread (*this, i, m_svc)); + // Try to get the threads starting as much at the same time as possible. + m_sm.unlock(); + for (int i=0; i < nslots; i++) + threads[i].join(); + IIncidentListener& listener = dynamic_cast<IIncidentListener&> (m_svc); + for (int i=0; i < nslots; i++) { + listener.handle (Incident ("test", IncidentType::EndEvent, + EventContext (0, i))); + } +} + + +void ThreadedTest::testThread::operator()() +{ + boost::shared_lock_guard<boost::shared_mutex> guard (m_test.m_sm); + Gaudi::Hive::setCurrentContextId (m_iworker); + IIncidentListener& listener = dynamic_cast<IIncidentListener&> (m_svc); + + for (int i=0; i < 10000; i++) { + RCUObject<Payload>& obj = *m_test.m_objs[i%nobjs]; + if (i%5 == 0) { + auto r = obj.reader(); + r->check(); + } + else if (i%29 == 0) { + if (i%2 == 0) { + auto r = obj.readerQuiesce (EventContext (0, m_iworker)); + r->check(); + } + else { + auto r = obj.readerQuiesce(); + r->check(); + } + } + else if (i%17 == 0) { + RCUObject<Payload>::Update_t u (obj); + u.update (std::make_unique<Payload> (u->a)); + } + + if (i%13 == 0) { + listener.handle (Incident ("test", IncidentType::EndEvent, + EventContext (0, m_iworker))); + } + } +} + + +void test2 (IRCUSvc& svc) +{ + std::cout << "test2\n"; + Payload::dolog = false; + assert (Payload::ninstance == 0); + { + ThreadedTest test (svc); + for (int i=0; i < 1000; i++) + test.runtest(); + assert (Payload::ninstance == nobjs); + } + assert (Payload::ninstance == 0); +} + + +int main() +{ + errorcheck::ReportMessage::hideErrorLocus(); + ISvcLocator* svcloc = 0; + if (!Athena_test::initGaudi("RCUSvc_test.txt", svcloc)) { + std::cerr << "This test can not be run" << std::endl; + return 1; + } + assert(svcloc); + + ServiceHandle<IRCUSvc> svc ("Athena::RCUSvc", "test"); + if (svc.retrieve().isFailure()) { + std::cerr << "Can't retrieve service." << std::endl; + return 1; + } + + test1 (*svc); + test2 (*svc); + + return 0; +}