Skip to content
Snippets Groups Projects
Commit 132fc548 authored by Adam Edward Barton's avatar Adam Edward Barton
Browse files

Merge branch 'trigexamples_threadsafety' into 'master'

TrigExPartialEB: Thread safety fix and some cleanup

See merge request atlas/athena!21060
parents b4552207 b1c9c529
No related branches found
No related tags found
9 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!28528Revert 63f845ae,!27054Atr20369 210,!26342Monopole: Handle fractionally charged particles,!21060TrigExPartialEB: Thread safety fix and some cleanup
HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB
......@@ -22,7 +22,7 @@ atlas_depends_on_subdirs( PUBLIC
Trigger/TrigAlgorithms/TrigPartialEventBuilding )
# External dependencies:
find_package( Boost COMPONENTS filesystem thread system )
find_package( Boost )
find_package( tdaq-common )
# Component(s) in the package:
......@@ -31,11 +31,9 @@ atlas_add_component( TrigExPartialEB
src/components/*.cxx
INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS}
LINK_LIBRARIES ${Boost_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} AthenaBaseComps EventInfo GaudiKernel
TrigROBDataProviderSvcLib AthenaKernel StoreGateLib SGtests ByteStreamCnvSvcBaseLib
TrigROBDataProviderSvcLib AthenaKernel StoreGateLib ByteStreamCnvSvcBaseLib
TrigDataAccessMonitoringLib TrigSteeringEvent TrigT1Result DecisionHandlingLib
TrigPartialEventBuildingLib )
# Install files from the package:
atlas_install_headers( TrigExPartialEB )
atlas_install_joboptions( share/*.py )
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "AthenaBaseComps/AthAlgorithm.h"
#include "GaudiKernel/SmartIF.h"
#include "EventInfo/TriggerInfo.h"
#include "EventInfo/EventInfo.h"
#include "EventInfo/EventID.h"
#include "EventInfo/EventType.h"
#include "eformat/eformat.h"
#include "TrigROBDataProviderSvc/ITrigROBDataProviderSvc.h"
#include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h"
#include <stdint.h>
#include <set>
/////////////////////////////////////////////////////////////////////////////
class StreamTag;
class MTCalibPeb:public AthAlgorithm {
public:
MTCalibPeb(const std::string& name, ISvcLocator* pSvcLocator);
StatusCode initialize();
StatusCode execute();
StatusCode finalize();
private:
static std::string s_dataScoutingResultName;
typedef ServiceHandle<IROBDataProviderSvc> IIROBDataProviderSvc_t;
/// Reference to the ROBDataProviderSvc service
IIROBDataProviderSvc_t m_robDataProviderSvc;
// Reference to a ROBDataProviderSvc which implements also the Hlt additions
SmartIF<ITrigROBDataProviderSvc> m_hltROBDataProviderSvc;
// L1 info retrieval
BooleanProperty m_retrieveLvl1;
// ROB retrieval
BooleanProperty m_retrieveROBs;
typedef std::vector<uint32_t> Uint32Array_t;
typedef std::map<std::string, Uint32Array_t > MapStringUint32Array_t;
typedef std::map<std::string, std::vector<int> > MapStringVector_t;
typedef SimpleProperty< Uint32Array_t > Uint32ArrayProperty_t;
typedef SimpleProperty< MapStringVector_t > MapStringVectorProperty_t;
MapStringVectorProperty_t m_mapRobIdsProperty;
MapStringUint32Array_t m_mapRobIds;
IntegerProperty m_timeBetweenRobRetMicroSec;
// string identifier for the HLT instance (L2,EF)
StringProperty m_hltInstance;
// base name of the HLT result object in Storegate
StringProperty m_hltResultName;
// StoreGate Keys = m_hltResultName + "_" + m_hltInstance
std::string m_hltResultSGKey;
// base name of the ROBDataMonitorCollection object in Storegate
StringProperty m_ROBDataMonitorCollection_SG_Name;
// StreamTags
typedef SimpleProperty< std::vector< std::vector<std::string> > > StreamTagProperty_t;
StreamTagProperty_t m_listStreamTags;
typedef std::vector< TriggerInfo::StreamTag > StreamTagVector_t;
StreamTagVector_t m_configuredStreamTags;
// Chains
Uint32ArrayProperty_t m_configuredChainNumbers;
uint32_t m_max_chain_counter;
void setTriggerTypeBit(unsigned int bit, std::vector<uint32_t>& bitarray);
// random accept
DoubleProperty m_acceptRate;
bool randomAccept(double rate);
// Cpu burn time
IntegerProperty m_burnTimeMicroSec;
IntegerProperty m_burnTimeCycles;
unsigned int randomCPUBurn(int burntime);
// Helper to fill Rob and SubDet IDs into StreamTags
void streamTagRobDetHelper(std::string input_str, std::set<TriggerInfo::number_type>& output_set);
// Helper to print StreamTags
std::string printStreamTags(const std::vector<TriggerInfo::StreamTag>& rhs);
};
std::ostream& operator<<(std::ostream& os, const std::set<TriggerInfo::number_type>& rhs);
#**************************************************************
#
# MTCalibPeb example
#
#==============================================================
from AthenaCommon.AppMgr import ServiceMgr as svcMgr
from AthenaCommon.Constants import *
from AthenaCommon import CfgMgr
svcMgr.ROBDataProviderSvc.OutputLevel = OUTPUTLEVEL
svcMgr.ByteStreamAddressProviderSvc.OutputLevel = OUTPUTLEVEL
svcMgr.ByteStreamAddressProviderSvc.TypeNames += [
"ROIB::RoIBResult/RoIBResult"
]
#--------------------------------------------------------------
# Private Application Configuration options
#--------------------------------------------------------------
HelloWorld = CfgMgr.MTCalibPeb("HelloWorld")
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
topSequence += HelloWorld
#--------------------------------------------------------------
# Algorithms Private Options
#--------------------------------------------------------------
from TriggerJobOpts.TriggerFlags import TriggerFlags
if TriggerFlags.doLVL2():
hltInstance = 'L2'
elif TriggerFlags.doEF():
hltInstance = 'EF'
else:
hltInstance = 'HLT'
#
#--- the HLT instance = L2/EF/HLT
#
HelloWorld.HLTInstance = hltInstance
#
#--- the base name of the partial event building info SG key
#
HelloWorld.HLTResultName="HLTResult"
#
#--- retrieve the Level-1 result
#
HelloWorld.RetrieveLvl1 = TRUE
#
#--- retrieve the ROBs over the network
#
HelloWorld.RetrieveROBs = TRUE
#
#--- time between ROB retrievals over the network in micro seconds
# (Caution: this will add to the total proceesing time a time value of
# Time = # of ROS retrievals * TimeBetweenRobRet)
# (<= 0: fixed retrieval time, > 0: random retrieval time in [0,value])
#
HelloWorld.TimeBetweenRobRet = 1000
#
#--- Give a dictionary of ROBs to be registered for preloading or retrieved from the
# ROS over the network (they have to be contained in the input file)
# Remarks:
# 1) the string keys have to be unique
# 2) use a consecutive numbering in the first field to preserve the order of configured operations
# 3) keyword :ADD: Robs will be registered for prefetching
# keyword :GET: Robs will be retrieved from ROS
# keyword :COL: collect all ROBs for event = event building
#
#--- empty dictionary of ROBs
# HelloWorld.RobId = {}
# ------------------
HelloWorld.RobId = {
"01 :ADD: Preload ": [ 0x42002a, 0x42002b ], # robs for 1st preload
"02 :ADD: Preload ": [ 0x42002e, 0x42002f ], # robs for 2nd preload
"03 :GET: Retrieve ": [ 0x42002e, 0x420060 ], # robs for 1st retrieval
"04 :ADD: Preload ": [ 0x420060 ], # robs for 3rd preload
"05 :ADD: Preload ": [ 0x420064 ], # robs for 4th preload
"06 :ADD: Preload ": [ 0x42002e, 0x420060 ], # robs for 5th preload
"07 :GET: Retrieve ": [ 0x420060 ], # robs for 2nd retrieval
"08 :GET: Retrieve ": [ 0x420064 ], # robs for 3rd retrieval
"09 :COL: Ev.Build ": [ 0x0 ] # event building
}
#
#--- specify Stream Tags for accepted events
# mandatory: (stream name, stream type, obeys lumi block)
# for calibration StreamTags optionally a list of Robs and/or sub detectors for PEB can be specified
# (stream name, stream type, obeys lumi block, [list of Robs], [list of sub detectors])
#
HelloWorld.ConfiguredStreamTags = [
['MyPhysicStream1','physics','true'],
['MyDebugStream1','debug','false'],
['MyCalibStream1','calibration','false','[0x42002a, 0x42002b]','[0x41,0x42]'],
['DataScouting_05_Muon','calibration','false','[0x7c0005]'],
['DataScouting_13_Jet','calibration','true','[0x7c000d]']
]
#
#--- specify accepted chain numbers
#
HelloWorld.ConfiguredChainNumbers = [ 1,2,3,4,55 ]
#
#--- specify random accept rate
# (< 0. event always rejected, > 1. event always accept)
#
HelloWorld.RandomAcceptRate = 1.5
#
#--- specify burn time in micro seconds (total time = BurnTime*NumberOfBurnCycles)
# (<= 0 fixed burn time, > 0 random burn time in [0,value])
#
HelloWorld.BurnTime = 100 # time burned in each loop iteration
HelloWorld.NumberOfBurnCycles = 10 # number of iterations
#
#==============================================================
#
# End of MTCalibPeb example
#
#**************************************************************
#include "TrigExPartialEB/MTCalibPeb.h"
#include "../MTCalibPebHypoAlg.h"
#include "../MTCalibPebHypoTool.h"
DECLARE_COMPONENT( MTCalibPeb )
DECLARE_COMPONENT( MTCalibPebHypoAlg )
DECLARE_COMPONENT( MTCalibPebHypoTool )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment