8def eFexByteStreamToolCfg(flags, name, *, writeBS=False, TOBs=True, xTOBs=False, multiSlice=False, decodeInputs=False):
9 acc = ComponentAccumulator()
10
11 tool = CompFactory.eFexByteStreamTool(name)
12
13 if writeBS:
14
15
16 tool.eEMContainerReadKey = "L1_eEMxRoI" if xTOBs else "L1_eEMRoI"
17 tool.eTAUContainerReadKey = "L1_eTauxRoI" if xTOBs else "L1_eTauRoI"
18 tool.eEMContainerWriteKey = ""
19 tool.eTAUContainerWriteKey = ""
20 else:
21
22 tool.eEMContainerReadKey = ""
23 tool.eTAUContainerReadKey = ""
24 if TOBs or xTOBs or multiSlice:
25 efex_roi_moduleids = [0x1000,0x1100]
26 tool.ROBIDs = [int(SourceIdentifier(SubDetector.TDAQ_CALO_FEAT_EXTRACT_ROI, moduleid)) for moduleid in efex_roi_moduleids]
27 if TOBs:
28 tool.eEMContainerWriteKey = "L1_eEMRoI"
29 tool.eTAUContainerWriteKey = "L1_eTauRoI"
30 if xTOBs:
31 tool.eEMxContainerWriteKey = "L1_eEMxRoI"
32 tool.eTAUxContainerWriteKey = "L1_eTauxRoI"
33 if multiSlice:
34 tool.eEMSliceContainerWriteKey = "L1_eEMxRoIOutOfTime"
35 tool.eTAUSliceContainerWriteKey = "L1_eTauxRoIOutOfTime"
36 if decodeInputs:
37 efex_raw_ids = []
38 inputId = int(SourceIdentifier(SubDetector.TDAQ_CALO_FEAT_EXTRACT_DAQ, 0x1000))
39 for shelf in range(0,2):
40 for module in range(0,12):
41 efex_raw_ids += [inputId + shelf*0x100 + module*0x010 ]
42 tool.ROBIDs += efex_raw_ids
43 tool.eTowerContainerWriteKey = "L1_eFexDataTowers"
44
45 if flags.Output.HISTFileName != '' or flags.Trigger.doHLT:
46 if flags.Trigger.doHLT:
47 from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
49 topDir = "EXPERT"
50 monTool.defineHistogram('efexDecoderErrorTitle,efexDecoderErrorLocation;errors', path=topDir, type='TH2I',
51 title='Decoder Errors;Title;Location',
52 xbins=1,xmin=0,xmax=1,
53 ybins=1,ymin=0,ymax=1,
54 opt=['kCanRebin'],merge="merge")
55 tool.MonTool = monTool
56 else:
57
58
59 from TrigT1CaloMonitoring.LVL1CaloMonitoringConfig import L1CaloMonitorCfgHelper
60 helper = L1CaloMonitorCfgHelper(flags,None,name)
61
62
63
64 helper.defineHistogram('efexDecoderErrorTitle,efexDecoderErrorLocation;h_efex_errors', type='TH2I',
65 path="Developer/ByteStreamDecoders",
66 fillGroup = f'{name}MonTool',
67 title='eFEX Decoder Errors;Title;Location',
68 xbins=1,xmin=0,xmax=1,
69 ybins=1,ymin=0,ymax=1,
70 opt=['kCanRebin','kAlwaysCreate'],merge="merge")
71 helper.defineHistogram('lbn,decoderError;h_efex_errors_vs_lbn', type='TH2I',
72 path="Expert/ByteStreamDecoders",
73 hanConfig={"algorithm":"Histogram_Empty","description":"Should be empty. Please report any errors to eFEX software experts."},
74 fillGroup = f'{name}MonTool',
75 title='eFEX Decoder Errors;LB;Error',
76 xbins=1,xmin=0,xmax=1,
77 ybins=1,ymin=0,ymax=1,
78 opt=['kAddBinsDynamically','kCanRebin','kAlwaysCreate'],merge="merge")
79 tool.MonTool = helper.fillGroups[f'{name}MonTool']
80 acc.merge(helper.result())
81
82
83 acc.setPrivateTools(tool)
84 return acc
85
86