ATLAS Offline Software
TrigOutputHandlingConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentFactory import CompFactory
4 from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
5 
6 def HLTResultMTMakerCfg(flags, name="HLTResultMTMaker"):
7 
8  m = CompFactory.HLTResultMTMaker(name)
9 
10  # ROBs/SubDets which are enabled but not necessarily part of the ROS-ROB map
11  from libpyeformat_helper import SourceIdentifier,SubDetector
12  subdets = [
13  SubDetector.TDAQ_CALO_CLUSTER_PROC_ROI,
14  SubDetector.TDAQ_CALO_JET_PROC_ROI,
15  SubDetector.TDAQ_HLT,
16  SubDetector.TDAQ_FTK,
17  SubDetector.TDAQ_CALO_TOPO_PROC,
18  SubDetector.TDAQ_CALO_DIGITAL_PROC,
19  SubDetector.TDAQ_CALO_FEAT_EXTRACT_ROI,
20  ]
21  m.ExtraSubDets = []
22  for subdetId in subdets:
23  m.ExtraSubDets.append( int(subdetId) )
24 
25  def addROBs(dest,subdet,modules):
26  for moduleId in modules:
27  dest.append(SourceIdentifier(subdet,moduleId).code())
28 
29  m.ExtraROBs = []
30  addROBs(m.ExtraROBs, SubDetector.TDAQ_CALO_CLUSTER_PROC_ROI, [0xa8, 0xa9, 0xaa, 0xab])
31  addROBs(m.ExtraROBs, SubDetector.TDAQ_CALO_JET_PROC_ROI, [0xac, 0xad])
32  addROBs(m.ExtraROBs, SubDetector.TDAQ_MUON_CTP_INTERFACE, [0x01])
33  addROBs(m.ExtraROBs, SubDetector.TDAQ_CTP, [0x01])
34  addROBs(m.ExtraROBs, SubDetector.TDAQ_CALO_TOPO_PROC, [0x81, 0x91, 0x82, 0x92])
35 
36  # Configure HLT result monitoring histograms
37  m.MonTool = GenericMonitoringTool(flags, 'MonTool', HistPath='HLTFramework/'+name)
38  m.MonTool.defineHistogram('TIME_makeResult', path='EXPERT', type='TH1F', title='makeResult() call time;Time [ms];Events',
39  xbins=200, xmin=0, xmax=50 )
40  m.MonTool.defineHistogram('TIME_makeResult_extRange', path='EXPERT', type='TH1F', title='makeResult() call time;Time [ms];Events',
41  xbins=200, xmin=0, xmax=50, opt='kCanRebin' )
42  m.MonTool.defineHistogram('PEB_RemovedROBs_SubDet', path='EXPERT', type='TH1F',
43  title='SubDet ID of ROBs removed from PEB streams because disabled in DetMask;;Entries',
44  xbins=80, xmin=0, xmax=80)
45  m.MonTool.defineHistogram('PEB_RemovedSubDets', path='EXPERT', type='TH1F',
46  title='SubDetectors removed from PEB streams because disabled in DetMask;;Entries',
47  xbins=80, xmin=0, xmax=80)
48 
49  return m
50 
51 def TriggerEDMSerialiserToolCfg(flags, name="Serialiser"):
52 
53  from TrigEDMConfig.DataScoutingInfo import getFullHLTResultID
54 
55  TriggerEDMSerialiserTool = CompFactory.TriggerEDMSerialiserTool
56  # Configuration helper methods
57  def addCollection(self, typeNameAux, moduleIds, allowTruncation=False):
58  defs = [typeNameAux,
59  ','.join([f"{id}" for id in moduleIds])]
60  if allowTruncation:
61  defs.append('allowTruncation')
62  self.CollectionsToSerialize.append( ';'.join(defs) )
63 
64  def addCollectionToMainResult(self, typeNameAux, allowTruncation=False):
65  self.addCollection(typeNameAux, [getFullHLTResultID()], allowTruncation)
66 
67  def addCollectionListToResults(self, typeNameAuxList, moduleIds, allowTruncation=False):
68  for typeNameAux in typeNameAuxList:
69  self.addCollection(typeNameAux, moduleIds, allowTruncation)
70 
71  def addCollectionListToMainResult(self, typeNameAuxList, allowTruncation=False):
72  self.addCollectionListToResults(typeNameAuxList, [getFullHLTResultID()], allowTruncation)
73 
74  # Add the helper methods to the TriggerEDMSerialiserTool python class
75  TriggerEDMSerialiserTool.addCollection = addCollection
76  TriggerEDMSerialiserTool.addCollectionToMainResult = addCollectionToMainResult
77  TriggerEDMSerialiserTool.addCollectionListToResults = addCollectionListToResults
78  TriggerEDMSerialiserTool.addCollectionListToMainResult = addCollectionListToMainResult
79 
80  # Create and return a serialiser tool object
81  serialiser = TriggerEDMSerialiserTool(name)
82 
83  from TrigEDMConfig.TriggerEDMRun3 import tpMap
84  tpTool = CompFactory.TrigSerTPTool()
85  tpTool.TPMap = tpMap()
86  serialiser.TPTool = tpTool
87 
88  from TrigEDMConfig.DataScoutingInfo import TruncationThresholds as truncThresholds
89  serialiser.TruncationThresholds = truncThresholds
90 
91  # Configure monitoring histograms
92  serialiser.MonTool = GenericMonitoringTool(flags, 'MonTool', HistPath='HLTFramework/'+name)
93  for prefix in ['', 'Allowed']: # two sets of histogram for regular and allowed truncation
94  serialiser.MonTool.defineHistogram(f'{prefix}Truncation_ModuleId', path='EXPERT', type='TH1F',
95  title='Module IDs of truncated HLT results;Module ID;Num of truncated results',
96  xbins=20, xmin=0, xmax=20)
97  serialiser.MonTool.defineHistogram(f'{prefix}Truncation_TotalSize', path='EXPERT', type='TH1F',
98  title='Total size of truncated HLT result;Size [kB];Num of truncated results',
99  xbins=200, xmin=0, xmax=5000)
100  serialiser.MonTool.defineHistogram(f'{prefix}Truncation_LargestName', path='EXPERT', type='TH1F',
101  title='Name of the largest collection;;Num of truncated results',
102  xbins=1, xmin=0, xmax=1)
103  serialiser.MonTool.defineHistogram(f'{prefix}Truncation_LargestSize', path='EXPERT', type='TH1F',
104  title='Size of the largest collection;Size [kB];Num of truncated results',
105  xbins=200, xmin=0, xmax=5000)
106 
107  return serialiser
108 
109 def StreamTagMakerToolCfg(name="StreamTagMakerTool"):
110 
111  stmaker = CompFactory.StreamTagMakerTool(name)
112  # Extra configuration may come here
113 
114  return stmaker
115 
116 
117 def TriggerBitsMakerToolCfg(name="TriggerBitsMakerTool"):
118 
119  bitsmaker = CompFactory.TriggerBitsMakerTool(name)
120  # Extra configuration may come here
121 
122  return bitsmaker
123 
124 def DecisionSummaryMakerAlgCfg(flags, name="DecisionSummaryMakerAlg"):
125  alg = CompFactory.DecisionSummaryMakerAlg(name)
126  alg.MonTool = GenericMonitoringTool(flags, 'MonTool', HistPath='HLTFramework/'+name)
127  alg.MonTool.defineHistogram('RoIsDEta', path='EXPERT', type='TH1F',
128  title='Change of RoI eta position between initial and final RoI;delta eta;N final RoIs',
129  xbins=51, xmin=-1.02, xmax=1.02)
130  alg.MonTool.defineHistogram('RoIsDPhi', path='EXPERT', type='TH1F',
131  title='Change of RoI phi position between initial and final RoI;delta phi;N final RoIs',
132  xbins=51, xmin=-1.02, xmax=1.02)
133  alg.MonTool.defineHistogram('RoIsDZed', path='EXPERT', type='TH1F',
134  title='Change of RoI z position between initial and final RoI;delta z;N final RoIs',
135  xbins=51, xmin=-204, xmax=204)
136  return alg
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
TriggerEDMSerialiserTool
Tool responsible for filling an HLT result object with serialised EDM collections.
Definition: TriggerEDMSerialiserTool.h:38
TrigOutputHandlingConfig.HLTResultMTMakerCfg
def HLTResultMTMakerCfg(flags, name="HLTResultMTMaker")
Definition: TrigOutputHandlingConfig.py:6
dumpHVPathFromNtuple.append
bool append
Definition: dumpHVPathFromNtuple.py:91
python.DataScoutingInfo.getFullHLTResultID
def getFullHLTResultID()
Definition: DataScoutingInfo.py:73
python.TriggerEDMRun3.tpMap
def tpMap()
Definition: TriggerEDMRun3.py:1169
histSizes.code
code
Definition: histSizes.py:129
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
GenericMonitoringTool
Definition: GenericMonitoringTool.py:1
TrigOutputHandlingConfig.TriggerEDMSerialiserToolCfg
def TriggerEDMSerialiserToolCfg(flags, name="Serialiser")
Definition: TrigOutputHandlingConfig.py:51
Muon::IDC_Helper::addCollection
IDC::IDENTIFIABLE * addCollection(const Identifier collId, IDC *idc, const IDHELPER &idHelper, MsgStream &log)
TrigOutputHandlingConfig.StreamTagMakerToolCfg
def StreamTagMakerToolCfg(name="StreamTagMakerTool")
Definition: TrigOutputHandlingConfig.py:109
TrigOutputHandlingConfig.TriggerBitsMakerToolCfg
def TriggerBitsMakerToolCfg(name="TriggerBitsMakerTool")
Definition: TrigOutputHandlingConfig.py:117
TrigOutputHandlingConfig.DecisionSummaryMakerAlgCfg
def DecisionSummaryMakerAlgCfg(flags, name="DecisionSummaryMakerAlg")
Definition: TrigOutputHandlingConfig.py:124