Skip to content
Snippets Groups Projects
Commit 37fa340c authored by Chandler Robert Baker's avatar Chandler Robert Baker
Browse files

Merge branch 'testNewHltDecisionHist' into '23.0'

Debug Stream recovery, addition of HLT_rejected_events histogram

See merge request atlas/athena!64216
parents 1410613b a2a4517f
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,7 @@ from TrigConfStorage.TriggerCoolUtil import TriggerCoolUtil
from TrigConfIO.L1TriggerConfigAccess import L1MenuAccess
from TrigConfIO.HLTTriggerConfigAccess import HLTMenuAccess
from ROOT import TFile
from ROOT import TFile, TH1F
import logging
msg = logging.getLogger("PyJobTransforms." + __name__)
......@@ -67,7 +67,7 @@ def dbgPreRun(inputFileList, outputFileList, argdict = None):
data = [event.run_no(), event.lumi_block(), event.global_id(),
event.lvl1_id(), event.bc_time_seconds(), event.bc_time_nanoseconds()]
msg.info('Event details :%s', data)
# Run debug event analysis and fill output TTree
eventInfo.eventCount(event)
eventInfo.eventInfo(event, l1Info, hltInfo)
......@@ -254,9 +254,29 @@ def getHLTConfigFromArgs(args):
configKeys['HLTPSK'] = int(args['DBhltpskey'].value)
msg.info("Found config keys in args %s", configKeys)
except KeyError:
msg.warn("Config keys not found in argdict")
return {}
return configKeys
def getHltDecision(rejected, outputFile):
'''
Add HLT_rejected_events to outputFile
'''
# Open root output file
hfile = TFile(outputFile, 'UPDATE')
# Define a new histogram called HLT_rejected_events
HLT_rejected_events = TH1F("HLT_rejected_events", "HLT_rejected_events", 3, 0.0, 3.0)
# Fill the histogram if events are rejected by the HLT
# HLT_rejected_events are assigned the value 1
# If all events are accepted the Histogram is empty
HLT_rejected_events.Fill(1, rejected)
# Close output TFile
hfile.Write("HLT_rejected_events",TFile.kOverwrite)
hfile.Close()
return msg.info("Added HLT_rejeceted_events to %s", outputFile)
......@@ -290,7 +290,10 @@ class trigRecoExecutor(athenaExecutor):
log = self._logFileName
msg.debug('Now scanning logfile {0} for HLTMPPU Child Issues'.format(log))
# Using the generator so that lines can be grabbed by subroutines if needed for more reporting
#Count the number of rejected events
rejected = 0
try:
myGen = lineByLine(log, substepName=self._substep)
except IOError as e:
......@@ -322,6 +325,14 @@ class trigRecoExecutor(athenaExecutor):
# write out file line by line
for line in log_file:
merged_file.write(line)
# Check for rejected events in log file
if 'rejected:' in line and int(line[14]) != 0:
#Add the number of rejected events
rejected += int(line[14])
# Add the HLT_rejected_events histogram to the output file
dbgStream.getHltDecision(rejected, self.conf.argdict["outputHIST_DEBUGSTREAMMONFile"].value[0])
except OSError as e:
raise trfExceptions.TransformExecutionException(trfExit.nameToCode('TRF_OUTPUT_FILE_ERROR'),
'Exception raised when merging log files into {0}: {1}'.format(self._logFileName, e))
......@@ -371,7 +382,7 @@ class trigRecoExecutor(athenaExecutor):
msg.info("Search for created BS files, and rename if single file found")
# The following is needed to handle the BS file being written with a different name (or names)
# base is from either the tmp value created by the transform or the value entered by the user
argInDict = {}
if self._rc != 0:
msg.error('HLT step failed (with status %s) so skip BS filename check', self._rc)
......@@ -413,7 +424,7 @@ class trigRecoExecutor(athenaExecutor):
if(splitFailed):
raise trfExceptions.TransformExecutionException(trfExit.nameToCode('TRF_OUTPUT_FILE_ERROR'),
'Did not produce any BS file when selecting CostMonitoring stream with trigbs_extractStream.py in file')
# Run debug step for all streams
if "HIST_DEBUGSTREAMMON" in self.conf.dataDictionary:
self._postExecuteDebug(BSFile)
......@@ -452,6 +463,6 @@ class trigRecoExecutor(athenaExecutor):
msg.info('Will use file created in PreRun step {0}'.format(fileNameDbg))
else:
msg.info('No file created in PreRun step {0}'.format(fileNameDbg))
# Do debug stream postRun step
dbgStream.dbgPostRun(outputBSFile, fileNameDbg[0], self.conf.argdict)
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