Skip to content
Snippets Groups Projects
Commit 612f25ee authored by Patrick Karl Czodrowski's avatar Patrick Karl Czodrowski Committed by Graeme Stewart
Browse files

fix ATN tests: AthenaTrigRDOtoBS (new input file) thereby hopefully also the...

fix ATN tests: AthenaTrigRDOtoBS (new input file) thereby hopefully also the following AthenaTrigBStoESD and BackCompAthenaTrigBStoESDAOD (TrigAnalysisTest-00-03-60)
parent 72a192d7
No related merge requests found
Showing
with 2782 additions and 0 deletions
This diff is collapsed.
#!/bin/sh
#
# Check that rerunning hypothesis algorithms on AOD with unrealistically high selection on tranverse energy yields zero trigger counts.
# In this case the e10_loose chain is used and the energy threshold for rerunning is set 100 times higher.
#
# mimick timer.log created by trigtest.pl to simply show the date
starttimer=`date +%s`
#
# leave record of current directory in test results and create working directory
echo "List of current directory"
ls -l
#echo "Moving to checkCountsAfterRerun_highETthr"
#mkdir AthenaTrigAOD_rerun_highETthr_checkCounts
#cd AthenaTrigAOD_rerun_highETthr_checkCounts
pwd
date
# search for right output
if [ -e ../AthenaTrigAOD_rerun_highETthr_TrigDecTool/testAthenaTrigAOD_TrigDecTool_test.log ]; then
echo "grepping testAthenaTrigAOD_TrigDecTool_test.log "
rm -rf REGTEST.e10_loose_highETthr.txt
grep "TrigDecChecker " ../AthenaTrigAOD_rerun_highETthr_TrigDecTool/testAthenaTrigAOD_TrigDecTool_test.log | grep "REGTEST chain " | grep "L2_e10_loose " | sort > REGTEST.e10_loose_highETthr.txt
else
echo "../AthenaTrigAOD_rerun_highETthr_TrigDecTool/testAthenaTrigAOD_TrigDecTool_test.log not found "
printf "ATHENA_BAD_EXIT (8)\nATHENA_NO_LOG (16)\nATHENA_ERROR_IN_LOG (32)\nATHENA_REGTEST_FAILED (64)\n exitcode = 120\n maskedcode = 8\n" > summary.log
(( timer=`date +%s` - $starttimer )); printf "$timer $starttimer `date +%s`" > timer.log
exit 0
fi
echo "Logfile has been found!"
# test if REGTEST.e10_loose_highETthr.txt file exists and is not empty and search for differences with reference REGTEST.REF.e10_loose_highETthr.txt
if [ -s REGTEST.e10_loose_highETthr.txt ]; then
rm -rf REGTEST.REF.e10_loose_highETthr.txt
echo "TrigDecChecker INFO REGTEST chain L2_e10_loose accepted events= 0 ( PS: 0 , PT: 0)" > REGTEST.REF.e10_loose_highETthr.txt
diff REGTEST.e10_loose_highETthr.txt REGTEST.REF.e10_loose_highETthr.txt > checklog.log
else
echo "The rerunning of hypothesis algorithms on AOD with a high energy threshold on the e10_loose chain has not been completed! Exit." >> checklog.log
ls
printf "POST_COMMAND1_BAD_EXIT (2)\nATHENA_BAD_EXIT (8)\nATHENA_ERROR_IN_LOG (32)\nATHENA_REGTEST_FAILED (64)\n exitcode = 106\n maskedcode = 8\n" > summary.log
(( timer=`date +%s` - $starttimer )); printf "$timer $starttimer `date +%s`" > timer.log
exit 0
fi
echo "Logfile diff successful."
# count line differences and decide exit code
if [ -e checklog.log ]; then
nerrors=0
while read line
do
(( nerrors += 1 ))
done < checklog.log
else
echo "checklog.log not found"
printf "POST_COMMAND1_BAD_EXIT (2)\nATHENA_ERROR_IN_LOG (32)\nATHENA_REGTEST_FAILED (64)\n exitcode = 98\n maskedcode = 2\n" > summary.log
(( timer=`date +%s` - $starttimer )); printf "$timer $starttimer `date +%s`" > timer.log
exit 0
fi
# return error code if differences found
if [ $nerrors != 0 ]; then
echo "Trigger counts for e10_loose when rerunning hypothesis algorithms on AOD with 100 times higher energy threshold are not 0."
printf "ATHENA_ERROR_IN_LOG (32)\nATHENA_REGTEST_FAILED (64)\n exitcode = 96\n maskedcode = 32\n" > summary.log
echo "Both lines above should be identical."
cat checklog.log
(( timer=`date +%s` - $starttimer )); printf "$timer $starttimer `date +%s`" > timer.log
exit 0
else
# otherwise return exit code 0
echo "Trigger counts for e10_loose when rerunning hypothesis algorithms on AOD with 100 times higher energy threshold are 0 as expected."
printf " exitcode = 0\n maskedcode = 0\n" > summary.log
(( timer=`date +%s` - $starttimer )); printf "$timer $starttimer `date +%s`" > timer.log
exit 0
fi
#!/bin/sh
# Check that rerunning hypothesis algorithms on AOD with tuned selection yields expected trigger counts.
# In this case e10_medium selection criteria are applied to e5_medium chain. The trigger counts for both chains must then be the same.
#
# mimick timer.log created by trigtest.pl to simply show the date
starttimer=`date +%s`
#
# leave record of current directory in test results and create working directory
echo "List of current directory"
ls -l
#echo "Moving to checkCountsAfterRerun_tunedCuts"
#mkdir AthenaTrigAOD_rerun_tunedCuts_checkCounts
#cd AthenaTrigAOD_rerun_tunedCuts_checkCounts
pwd
date
# search for the right output
if [ -e ../AthenaTrigAOD_rerun_tunedCuts_TrigDecTool/testAthenaTrigAOD_TrigDecTool_test.log ]; then
echo "grepping testAthenaTrigAOD_TrigDecTool_test.log "
rm -rf REGTEST_e10.txt
rm -rf REGTEST_e5.txt
grep "TrigDecChecker " ../AthenaTrigAOD_TrigDecTool/testAthenaTrigAOD_TrigDecTool_test.log | grep "REGTEST chain " | grep "L2_e10_medium " | sort > REGTEST_e10.txt
grep "TrigDecChecker " ../AthenaTrigAOD_rerun_tunedCuts_TrigDecTool/testAthenaTrigAOD_TrigDecTool_test.log | grep "REGTEST chain " | grep "L2_e5_medium " | sort > REGTEST_e5.txt
else
echo "../AthenaTrigAOD_rerun_tunedCuts_TrigDecTool/testAthenaTrigAOD_TrigDecTool_test.log not found "
printf "ATHENA_BAD_EXIT (8)\nATHENA_NO_LOG (16)\nATHENA_ERROR_IN_LOG (32)\nATHENA_REGTEST_FAILED (64)\n exitcode = 120\n maskedcode = 8\n" > summary.log
(( timer=`date +%s` - $starttimer )); printf "$timer $starttimer `date +%s`" > timer.log
exit 0
fi
echo "Logfiles have been found!"
# test if REGTEST.FIRST/RERUN.log files exist and are not empty and search for differences in log
if [ -s REGTEST_e5.txt -a -s REGTEST_e10.txt ]; then
sed 's/e10_medium/e5_medium/g' REGTEST_e10.txt > REGTEST_e10_forDiff.txt
diff REGTEST_e5.txt REGTEST_e10_forDiff.txt > checklog.log
else
echo "Job from AOD with tuned cuts after rerunning hypos has not been completed! Exit."
echo "Job from AOD with tuned cuts after rerunning hypos has not been completed! Exit." >> checklog.log
ls
printf "POST_COMMAND1_BAD_EXIT (2)\nATHENA_BAD_EXIT (8)\nATHENA_ERROR_IN_LOG (32)\nATHENA_REGTEST_FAILED (64)\n exitcode = 106\n maskedcode = 8\n" > summary.log
(( timer=`date +%s` - $starttimer )); printf "$timer $starttimer `date +%s`" > timer.log
exit 0
fi
echo "Logfile printout successful."
# count line differences and decide exit code
if [ -e checklog.log ]; then
nerrors=0
while read line
do
(( nerrors += 1 ))
done < checklog.log
else
echo "checklog.log not found"
printf "POST_COMMAND1_BAD_EXIT (2)\nATHENA_ERROR_IN_LOG (32)\nATHENA_REGTEST_FAILED (64)\n exitcode = 98\n maskedcode = 2\n" > summary.log
(( timer=`date +%s` - $starttimer )); printf "$timer $starttimer `date +%s`" > timer.log
exit 0
fi
# return error code if differences found
if [ $nerrors != 0 ]; then
echo "Differences found in trigger counts between e5_medium and e10_medium when rerunning on AOD with e10_medium hypothesis selection on e5_medium."
printf "ATHENA_ERROR_IN_LOG (32)\nATHENA_REGTEST_FAILED (64)\n exitcode = 96\n maskedcode = 32\n" > summary.log
cat checklog.log
(( timer=`date +%s` - $starttimer )); printf "$timer $starttimer `date +%s`" > timer.log
exit 0
else
# otherwise return exit code 0
echo "No differences found in trigger counts between e5_medium and e10_medium when rerunning on AOD with e10_medium hypothesis selection on e5_medium."
printf " exitcode = 0\n maskedcode = 0\n" > summary.log
(( timer=`date +%s` - $starttimer )); printf "$timer $starttimer `date +%s`" > timer.log
exit 0
fi
#!/bin/sh
#
# Compare output of tests starting from a new AOD and an AOD produced by
# re-running the hypos on the same new AOD: all counts should be the same
#
# mimick timer.log created by trigtest.pl to simply show the date
starttimer=`date +%s`
# leave record of current directory in test results and create working directory
echo "List of current directory"
ls -l
echo "Moving to compareCountsAfterRerun"
mkdir AthenaTrigAOD_rerun_compareCounts
cd AthenaTrigAOD_rerun_compareCounts
pwd
date
# search for the right output: important to sort lines
if [ -e ../AthenaTrigAOD_TrigDecTool/testAthenaTrigAOD_TrigDecTool_test.log ]; then
echo "grepping ../AthenaTrigAOD_TrigDecTool/testAthenaTrigAOD_TrigDecTool_test.log "
rm -rf REGTEST.FIRST.txt
grep "TrigDecChecker " ../AthenaTrigAOD_TrigDecTool/testAthenaTrigAOD_TrigDecTool_test.log | grep "REGTEST item " | sort > REGTEST.FIRST.txt
grep "TrigDecChecker " ../AthenaTrigAOD_TrigDecTool/testAthenaTrigAOD_TrigDecTool_test.log | grep "REGTEST chain " | sort >> REGTEST.FIRST.txt
else
echo "../AthenaTrigAOD_TrigDecTool/testAthenaTrigAOD_TrigDecTool_test.log not found "
printf "ATHENA_BAD_EXIT (8)\nATHENA_NO_LOG (16)\nATHENA_ERROR_IN_LOG (32)\nATHENA_REGTEST_FAILED (64)\n exitcode = 120\n maskedcode = 8\n" > summary.log
(( timer=`date +%s` - $starttimer )); printf "$timer $starttimer `date +%s`" > timer.log
exit 0
fi
if [ -e ../AthenaTrigAOD_rerun_TrigDecTool/testAthenaTrigAOD_TrigDecTool_test.log ]; then
echo "grepping testAthenaTrigAOD_rerunHypo_TrigDecTool_test.log "
rm -rf REGTEST.RERUN.txt
grep "TrigDecChecker " ../AthenaTrigAOD_rerun_TrigDecTool/testAthenaTrigAOD_TrigDecTool_test.log | grep "REGTEST item " | sort > REGTEST.RERUN.txt
grep "TrigDecChecker " ../AthenaTrigAOD_rerun_TrigDecTool/testAthenaTrigAOD_TrigDecTool_test.log | grep "REGTEST chain " | sort >> REGTEST.RERUN.txt
else
echo "../AthenaTrigAOD_rerun_TrigDecTool/testAthenaTrigAOD_TrigDecTool_test.log not found "
printf "ATHENA_BAD_EXIT (8)\nATHENA_NO_LOG (16)\nATHENA_ERROR_IN_LOG (32)\nATHENA_REGTEST_FAILED (64)\n exitcode = 120\n maskedcode = 8\n" > summary.log
(( timer=`date +%s` - $starttimer )); printf "$timer $starttimer `date +%s`" > timer.log
exit 0
fi
echo "Logfiles have been found!"
# test if REGTEST.FIRST/RERUN.log files exist and are not empty and search for differences in log
if [ -s REGTEST.FIRST.txt -a -s REGTEST.RERUN.txt ]; then
diff REGTEST.FIRST.txt REGTEST.RERUN.txt > checklog.log
else
echo "At least one of the jobs (from initial AOD or from AOD after rerunning hypos on initial AOD) has not been completed! Exit."
echo "At least one of the jobs (from initial AOD or from AOD after rerunning hypos on initial AOD) has not been completed! Exit." >> checklog.log
ls
printf "POST_COMMAND1_BAD_EXIT (2)\nATHENA_BAD_EXIT (8)\nATHENA_ERROR_IN_LOG (32)\nATHENA_REGTEST_FAILED (64)\n exitcode = 106\n maskedcode = 8\n" > summary.log
(( timer=`date +%s` - $starttimer )); printf "$timer $starttimer `date +%s`" > timer.log
exit 0
fi
echo "Logfile diff successful"
# count line differences and decide exit code
if [ -e checklog.log ]; then
nerrors=0
while read line
do
(( nerrors += 1 ))
done < checklog.log
else
echo "checklog.log not found"
printf "POST_COMMAND1_BAD_EXIT (2)\nATHENA_ERROR_IN_LOG (32)\nATHENA_REGTEST_FAILED (64)\n exitcode = 98\n maskedcode = 2\n" > summary.log
(( timer=`date +%s` - $starttimer )); printf "$timer $starttimer `date +%s`" > timer.log
exit 0
fi
echo "Found $nerrors differences in trigger counts between initial RDO->AOD and AOD->rerun->AOD"
# return error code if differences found
if [ $nerrors != 0 ]; then
echo "$nerrors differences in trigger counts between initial RDO->AOD and AOD->rerun->AOD"
printf "ATHENA_ERROR_IN_LOG (32)\nATHENA_REGTEST_FAILED (64)\n exitcode = 96\n maskedcode = 32\n" > summary.log
cat checklog.log
(( timer=`date +%s` - $starttimer )); printf "$timer $starttimer `date +%s`" > timer.log
exit 0
else
# otherwise return exit code 0
echo "No differences found in trigger counts between initial RDO->AOD and AOD->rerun->AOD"
printf " exitcode = 0\n maskedcode = 0\n" > summary.log
(( timer=`date +%s` - $starttimer )); printf "$timer $starttimer `date +%s`" > timer.log
exit 0
fi
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# Simple wrapper for specific RttScriptRunner instances
# This is done to get "pretty" names on the RTT web pages
import sys, os
sys.path.append(os.path.dirname(sys.modules[__name__].__file__))
from RttScriptRunner_TrigAnalysisTest import RttScriptRunner_TrigAnalysisTest
class CheckLog_TrigAnalysisTest(RttScriptRunner_TrigAnalysisTest):
pass
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# Simple wrapper for specific RttScriptRunner instances
# This is done to get "pretty" names on the RTT web pages
import sys, os
sys.path.append(os.path.dirname(sys.modules[__name__].__file__))
from RttScriptRunner_TrigAnalysisTest import RttScriptRunner_TrigAnalysisTest
class LogTail_TrigAnalysisTest(RttScriptRunner_TrigAnalysisTest):
pass
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# @file: RttScriptRunner.py
# @purpose: Run any command in RTT post-processing
# @author: Frank Winklmeier (fwinkl)
# $Id: RttScriptRunner.py,v 1.3 2008-08-22 11:35:28 fwinkl Exp $
# need to make copy because of odd RTT python search
import sys
import os
class RttScriptRunner_TrigAnalysisTest:
"""
Class to run any command within the RTT post-processing
'command': command to run (including any arguments)
%TESTNAME is replaced with the jobDisplayName (or test name if not set)
%JOBLOG is replaced with the RTT job log file
%BRANCH is replaces with the release branch
$<ENVVAR> is replaced with the environment variable (if exists)
'logfile': log file, if not given write to RTT logger
"""
def __init__(self, paramDict={}):
from Logger import Logger
self.success = 0
self.error = -1
self.logger = Logger()
self.command = paramDict.get('command', None)
self.logfile = paramDict.get('logfile', "test."+self.__class__.__name__+".log")
jDescriptor = paramDict.get('JobDescriptor',None)
if jDescriptor:
testname = jDescriptor.jobDisplayName
if testname=='': testname = jDescriptor.name
self.command = self.command.replace("%TESTNAME",testname)
self.command = self.command.replace("%JOBLOG",jDescriptor.log)
self.command = self.command.replace("%BRANCH",jDescriptor.paths.branch)
for k,v in os.environ.iteritems():
self.command = self.command.replace("$"+k,v)
def run(self):
if not self.command:
self.logger.error("'command' parameter not set")
return self.error
self.logger.debug("ScriptRunner: Executing '%s'" % self.command)
# Run command and get output
import subprocess as sp
proc = sp.Popen(self.command, shell=True, stdout=sp.PIPE, stderr=sp.STDOUT)
stdout = proc.communicate()[0]
# Write output to log file or RTT logger
if self.logfile:
f = open(self.logfile,"w")
f.write(stdout)
f.close()
else:
for l in stdout.splitlines(True): self.logger.info(l.rstrip('\n'))
if proc.returncode!=0: return self.error
else: return self.success
# This is just for testing outside of the RTT
if __name__ == "__main__":
sys.path.append('/afs/cern.ch/atlas/project/RTT/prod/Tools/RunTimeTester/src')
sys.path.append('/afs/cern.ch/atlas/project/RTT/prod/Tools/RunTimeTester/share')
params = {'command' : 'ls -l',
'logfile': 'rttscript.log'}
r = RttScriptRunner_TrigAnalysisTest(params)
status = r.run()
for l in r.logger.debugL: print l,
for l in r.logger.infoL: print l,
for l in r.logger.warningL: print l,
for l in r.logger.errorL: print l,
sys.exit(status)
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# Simple wrapper for specific RttScriptRunner instances
# This is done to get "pretty" names on the RTT web pages
import sys, os
sys.path.append(os.path.dirname(sys.modules[__name__].__file__))
from RttScriptRunner_TrigAnalysisTest import RttScriptRunner_TrigAnalysisTest
class TruncateLog_TrigAnalysisTest(RttScriptRunner_TrigAnalysisTest):
pass
This diff is collapsed.
package TrigAnalysisTest
# =====================================================================
#
# This is the TrigAnalysisTest
#
# =====================================================================
author John Baines <j.baines@rl.ac.uk>
author Simon george <S.George@rhul.ac.uk>
author Ricardo Goncalo <r.goncalo@rhul.ac.uk>
use AtlasPolicy AtlasPolicy-*
#try if we can use AtlasTriggerRunTime instead of AtlasAnalysisRunTime
use AtlasTriggerRunTime AtlasTriggerRunTime-*
#use AtlasAnalysisRunTime AtlasAnalysisRunTime-*
#use RunTimeTester RunTimeTester-* Tools
use TestPolicy TestPolicy-*
apply_pattern declare_python_modules files="../python/__init__.py ../python/PassedTriggerFilter.py"
#declare test job options
apply_pattern declare_joboptions files="*.py"
#RTT declarations
apply_pattern declare_scripts files="../Testing/*.sh ../bin/*.py"
apply_pattern declare_runtime extras="../test/TrigAnalysisTest_TestConfiguration.xml \
../Testing/*.conf \
../bin/RttScriptRunner_TrigAnalysisTest.py \
../bin/CheckLog_TrigAnalysisTest.py \
../bin/LogTail_TrigAnalysisTest.py \
../bin/TruncateLog_TrigAnalysisTest.py \
../bin/checkFileTrigSize_RTT.py"
private
apply_pattern validate_xml
public
macro TrigAnalysisTest_TestConfiguration "../test/TrigAnalysisTest_TestConfiguration.xml"
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
import AthenaPython.PyAthena as PyAthena
from AthenaPython.PyAthena import StatusCode
class PassedTriggerFilter (PyAthena.Alg):
def __init__(self, name='PassedTriggerFilter', **kw):
## init base class
kw['name'] = name
super(PassedTriggerFilter, self).__init__(**kw)
self.__all = 0
self.__pass = 0
self.__stat_per_stream = {}
def initialize(self):
self.sg = PyAthena.py_svc ('StoreGateSvc')
if self.sg is None:
return StatusCode.Failure
return StatusCode.Success
def execute(self):
self.__all += 1
_error = self.msg.error
_info = self.msg.info
evtinfo = self.sg.retrieve ('EventInfo', '')
if evtinfo is None:
return StatusCode.Failure
trigger = evtinfo.trigger_info()
if trigger is None:
_error ('could not retrieve TriggerInfo' )
return StatusCode.Failure
stags = trigger.streamTags()
streams = [s.name() for s in list(stags) if s.type() == 'physics']
_info(str(streams))
for s in streams:
self.__stat_per_stream[s] = self.__stat_per_stream.get(s, 0) + 1
if streams: # empty list == False, non-empty == True
self.__pass += 1
self.setFilterPassed(True)
else:
self.setFilterPassed(False)
return StatusCode.Success
def finalize(self):
_info = self.msg.info
_info('Events Processed : %d' % self.__all)
_info('Events Passed : %d' % self.__pass)
events_duplicated = reduce(lambda x,y: x+y, self.__stat_per_stream.itervalues(), 0)
_info('Events with dup. : %d' % events_duplicated)
for name, count in self.__stat_per_stream.iteritems():
_info('Events in stream %s: %d' % (name, count))
return StatusCode.Success
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# File: TrigAnalysisTest/__init__.py
#!/usr/bin/env python
# copy of TrigAnalysisExamples/CompareESDs.py by Tomasz Bold
#
### import the modules
from RecExConfig.RecFlags import rec
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags as acf
print '... importing ROOT and PyCintex'
import ROOT, PyCintex
import AthenaROOTAccess.transientTree
### define the list of input files
print '... define list of files'
import sys
if '-c' in sys.argv:
opt = sys.argv[sys.argv.index('-c')+1]
exec(opt)
if not ('PoolAODInput1' in dir()):
PoolAODInput1=["/afs/cern.ch/user/t/tbold/public/TDTtest/menu1/AOD.pool.root"]
if not ('PoolAODInput2' in dir()):
PoolAODInput2=["/afs/cern.ch/user/t/tbold/public/TDTtest/menu2/AOD.pool.root"]
### build the transient event and metadata trees
print '... build collection and metadata trees'
#from TrigDecisionTool.BuildTransientTrees import BuildTransientTrees
#(transientTree1, transientMetaDataTree1) = BuildTransientTrees(files1)
CollectionTree1 = ROOT.AthenaROOTAccess.TChainROOTAccess('CollectionTree')
MetaDataTree1 = ROOT.AthenaROOTAccess.TChainROOTAccess('MetaData')
for file1 in PoolAODInput1:
CollectionTree1.Add(file1+'/CollectionTree')
MetaDataTree1.Add(file1+'/MetaData')
transientCollectionTree1 = AthenaROOTAccess.transientTree.makeTree(CollectionTree1)
transientMetaDataTree1 = AthenaROOTAccess.transientTree.makeTree(MetaDataTree1,
persTreeName = 'MetaData',
dhTreeName = 'MetaDataHdrDataHeader')
CollectionTree2 = ROOT.AthenaROOTAccess.TChainROOTAccess('CollectionTree')
MetaDataTree2 = ROOT.AthenaROOTAccess.TChainROOTAccess('MetaData')
for file2 in PoolAODInput2:
CollectionTree2.Add(file2+'/CollectionTree')
MetaDataTree2.Add(file2+'/MetaData')
transientCollectionTree2 = AthenaROOTAccess.transientTree.makeTree(CollectionTree2)
transientMetaDataTree2 = AthenaROOTAccess.transientTree.makeTree(MetaDataTree2,
persTreeName = 'MetaData',
dhTreeName = 'MetaDataHdrDataHeader')
### instantiate the TrigDecisionToolARA
print '... instantiate TrigDecisionToolARA'
tdt1 = ROOT.Trig.TrigDecisionToolARA(transientCollectionTree1, transientMetaDataTree1)
tdt2 = ROOT.Trig.TrigDecisionToolARA(transientCollectionTree2, transientMetaDataTree2)
### changing the output level of the TrigDecisionTool (default is ERROR)
#import AthenaCommon.Constants as Constants
#tdt.setOutputLevel(Constants.WARNING)
### create two triggers
chains1 = tdt1.getChainGroup('EF_.*')
chains2 = tdt2.getChainGroup('EF_.*')
### loop over the events
if transientCollectionTree1.GetEntries() != transientCollectionTree2.GetEntries():
print '... WARNING both files have different number of events in, ',\
transientCollectionTree1.GetEntries(), ' and ', transientCollectionTree2.GetEntries()
nevt = min(transientCollectionTree1.GetEntries(), transientCollectionTree2.GetEntries() )
print '... loop over %i events' % nevt
for evt in xrange(nevt):
eventOK=True
print "... reading event",evt
transientCollectionTree1.GetEntry(evt)
transientCollectionTree2.GetEntry(evt)
c1 = list(chains1.getListOfTriggers())
c2 = list(chains2.getListOfTriggers())
for a in c1:
if a not in c2:
print "REGTEST ... chain ", a ," present in file 1 while not in file 2"
eventOK=False
else:
if tdt1.isPassedBits(a) != tdt2.isPassedBits(a):
print "REGTEST .... chain ", a, " has different isPassedBits in file 1: ", tdt1.isPassedBits(a) ," while in file 2: ", tdt2.isPassedBits(a)
eventOK=False
if eventOK:
print "INFO event OK"
from RecExConfig.RecFlags import rec
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags as acf
import sys,ROOT
from ROOT import TH1F,TH1D,TFile
from ROOT import gDirectory
myfile = TFile('histo.root')
######### Egamma ###################
## LVL1
h = TH1F()
h1 = TH1F()
h2 = TH1F()
h3 = TH1F()
h4 = TH1F()
h = myfile.Get("HLT/EgammaMon/L1/EmIsol;1")
h1 = myfile.Get("HLT/EgammaMon/L1/EmClus;1")
h2 = myfile.Get("HLT/EgammaMon/L1/Eta;1")
h3 = myfile.Get("HLT/EgammaMon/L1/HadCore;1")
h4 = myfile.Get("HLT/EgammaMon/L1/HadIsol;1")
h5 = myfile.Get("HLT/EgammaMon/L1/Phi;1")
## L2Calo
g = TH1F()
g1 = TH1F()
g2 = TH1F()
g3 = TH1F()
g4 = TH1F()
g5 = TH1F()
g = myfile.Get("HLT/EgammaMon/L2Calo/Et;1")
g1 = myfile.Get("HLT/EgammaMon/L2Calo/HadEt;1")
g2 = myfile.Get("HLT/EgammaMon/L2Calo/Rcore;1")
g3 = myfile.Get("HLT/EgammaMon/L2Calo/Rstrip;1")
g4 = myfile.Get("HLT/EgammaMon/L2Calo/eta;1")
g5 = myfile.Get("HLT/EgammaMon/L2Calo/phi;1")
################ Muon ##############################
f = TH1F()
f1 = TH1F()
f2 = TH1F()
f3 = TH1F()
f4 = TH1F()
f5 = TH1F()
f = myfile.Get("HLT/MuonMon/Common_Counter;1")
f1 = myfile.Get("HLT/MuonMon/Offline_Number_Of_LPT_Muon;1")
f2 = myfile.Get("HLT/MuonMon/Offline_Number_Of_Muon;1")
f3 = myfile.Get("HLT/MuonMon/Offline_Number_Of_Selected_CB_Muon;1")
f4 = myfile.Get("HLT/MuonMon/Offline_Number_Of_CB_Muon;1")
f5 = myfile.Get("HLT/MuonMon/Offline_Number_Of_SA_Muon;1")
################# ResultsMon ##########################
m = TH1F()
m1 = TH1F()
m2 = TH1F()
m = myfile.Get("HLT/ResultMon/HLTResultEF;1")
m1 = myfile.Get("HLT/ResultMon/HLTResultL2;1")
m2 = myfile.Get("HLT/ResultMon/L1Events;1")
mynewfile = TFile('histo_new.root','recreate')
mynewfile.mkdir('HLT')
mynewfile.cd('HLT')
gDirectory.pwd()
gDirectory.mkdir('EgammaMon')
mynewfile.cd('HLT/EgammaMon')
gDirectory.pwd()
gDirectory.mkdir('L1')
mynewfile.cd('HLT/EgammaMon/L1')
h.Write()
h1.Write()
h2.Write()
h3.Write()
h4.Write()
h5.Write()
gDirectory.cd('../')
gDirectory.pwd()
gDirectory.mkdir('L2Calo')
mynewfile.cd('HLT/EgammaMon/L2Calo')
g.Write()
g1.Write()
g2.Write()
g3.Write()
g4.Write()
g5.Write()
gDirectory.cd('../../')
gDirectory.pwd()
gDirectory.mkdir('MuonMon')
gDirectory.cd('MuonMon')
f.Write()
f1.Write()
f2.Write()
f3.Write()
f4.Write()
f5.Write()
gDirectory.cd('../')
gDirectory.pwd()
gDirectory.mkdir('ResultMon')
gDirectory.cd('ResultMon')
m.Write();
m1.Write();
m2.Write();
theApp.EvtMax=1
#fileList=['/afs/cern.ch/atlas/project/trigger/pesa-sw/validation/validation-data/valid1.105200.T1_McAtNlo_Jimmy.recon.AOD.e380_s764_r1295/AOD.134900._000001.pool.root.1']
from RecExConfig.RecFlags import rec
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags as acf
rec.readAOD=True
# different input files for ATN and RTT tests
if not acf.EvtMax.is_locked():
acf.EvtMax=2000
if not ('OutputLevel' in dir()):
rec.OutputLevel=INFO
# find input file using a glob in case the previous test is broken
# logic must be identical to what is used in rerunAOD
#if not ('fileList' in dir()):
#added for RTT-chainstore conmpatibility
if not ('fileList' in dir()) and not ('RunningRTT' in dir()):
#just for now take the DC14 as default input
#
default = "../AthenaTrigRDOtoAOD_DC14/AOD.pool.root"
summary = "../AthenaTrigRDOtoAOD_DC14/summary.log"
RDOtoAODokay = False
from os.path import exists
if exists(summary):
fsummary = open(summary)
if "ATHENA_BAD_EXIT" in fsummary.read():
print "WARNING: RDOtoAOD step bad, searching alternatives"
else:
if exists(default):
print "INFO: ouptut from RDOtoAOD step exists: ",default
RDOtoAODokay = True
if RDOtoAODokay:
fileList = [default]
else:
print "WARNING: default AOD file doesn't exist or is bad, searching alternatives"
import glob
pattern="../AthenaTrig*toESDAOD*/AOD*.pool.root"
files=glob.glob(pattern)
if (len(files)==0):
log.fatal(" ERROR FATAL No input AOD file could be found matching '" + pattern + "'")
exit(-1)
elif (len(files)>1):
log.warning("Multiple input AOD files found, taking last one: " + files[-1])
print "All matches to pattern '" + pattern + "': ", files
fileList=[files[-1]]
else:
log.info("Using input AOD file " + files[0])
fileList=files
#added for RTT-chainstore conmpatibility
if not ('RunningRTT' in dir()):
acf.FilesInput=fileList
#acf.FilesInput=fileList
###############################
rec.doCBNT=False
from RecExConfig.RecFlags import rec
rec.doTrigger=True
from RecExConfig.RecAlgsFlags import recAlgs
recAlgs.doTrigger=True
from TriggerJobOpts.TriggerFlags import TriggerFlags
TriggerFlags.doTriggerConfigOnly=True
rec.doWriteAOD=False
rec.doWriteESD=False
rec.doWriteTAG=False
rec.doAOD=False
rec.doDPD=False
rec.doESD=False
doTAG=False
rec.doTruth=True
#-----------------------------------------------------------
include("RecExCommon/RecExCommon_topOptions.py")
#-----------------------------------------------------------
# abort when there is an unchecked status code
StatusCodeSvc.AbortOnError=False
from TrigValAlgs.TrigValAlgsConfig import TrigDecisionChecker
TrigDecChecker = TrigDecisionChecker("TrigDecChecker")
TrigDecChecker.WriteEventDecision=False
TrigDecChecker.MonitoringBlock=100
TrigDecChecker.MonitoredChains=[]
#TrigDecChecker.OutputLevel=DEBUG
#from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool
#tdt = Trig__TrigDecisionTool("TrigDecisionTool")
#ToolSvc += tdt
#from AthenaCommon.GlobalFlags import GlobalFlags
#GlobalFlags.DetGeo.set_atlas()
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
topSequence += TrigDecChecker
include("TriggerTest/TriggerTestCommon.py")
from RecExConfig.RecFlags import rec
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags as acf
if not ('fileList' in dir()):
fileList=['/afs/cern.ch/atlas/project/trigger/pesa-sw/validation/validation-data/valid1.105200.T1_McAtNlo_Jimmy.recon.AOD.e380_s764_r1295/AOD.134900._000001.pool.root.1']
if not fileList == []:
acf.FilesInput=fileList
rec.readAOD=True
if not acf.EvtMax.is_locked():
acf.EvtMax=2000
if not ('OutputLevel' in dir()):
rec.OutputLevel=INFO
###############################
rec.doCBNT=False
#doTrigger=False
rec.doTrigger=False
from RecExConfig.RecAlgsFlags import recAlgs
recAlgs.doTrigger=False
rec.doWriteAOD=False
rec.doWriteESD=False
rec.doWriteTAG=False
rec.doAOD=False
rec.doDPD=False
rec.doESD=False
doTAG=False
rec.doTruth=True
#-----------------------------------------------------------
include("RecExCommon/RecExCommon_topOptions.py")
#-----------------------------------------------------------
# abort when there is an unchecked status code
StatusCodeSvc.AbortOnError=False
from TrigValAlgs.TrigValAlgsConfig import TrigDecisionChecker
TrigDecChecker = TrigDecisionChecker("TrigDecChecker")
TrigDecChecker.WriteEventDecision=False
TrigDecChecker.MonitoringBlock=100
TrigDecChecker.MonitoredChains=['EF_e24_medium_iloose ','EF_mu24']
#TrigDecChecker.MonitoredChains=['L2_e10_medium','EF_e10_medium','L2_mu10','EF_mu10']
from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool
tdt = Trig__TrigDecisionTool("TrigDecisionTool")
ToolSvc += tdt
#from AthenaCommon.GlobalFlags import GlobalFlags
#GlobalFlags.DetGeo.set_atlas()
from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter
cfg = TriggerConfigGetter()
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
topSequence += TrigDecChecker
include("TriggerTest/TriggerTestCommon.py")
# get the name auditor
#theAuditorSvc = AuditorSvc()
#theAuditorSvc.Auditors += [ "NameAuditor"]
#PoolAODInput=['/afs/cern.ch/atlas/project/trigger/pesa-sw/validation/data130003002/AOD.015446._00012.pool.root.2']
from RecExConfig.RecFlags import rec
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags as acf
rec.readAOD=True
# different input files for ATN and RTT tests
if not acf.EvtMax.is_locked():
acf.EvtMax=10
if not ('OutputLevel' in dir()):
rec.OutputLevel=INFO
# look for backup files if RDOtoAOD fails
#if not ('fileList' in dir()):
#added for RTT-chainstore conmpatibility
if not ('fileList' in dir()) and not ('RunningRTT' in dir()):
#default = "../AthenaTrigRDOtoAOD/AOD.pool.root"
#summary = "../AthenaTrigRDOtoAOD/summary.log"
#just for now take the DC14 as default input
#
default = "../AthenaTrigRDOtoAOD_DC14/AOD.pool.root"
summary = "../AthenaTrigRDOtoAOD_DC14/summary.log"
RDOtoAODokay = False
from os.path import exists
if exists(summary):
fsummary = open(summary)
if "ATHENA_BAD_EXIT" in fsummary.read():
print "WARNING: RDOtoAOD step bad, searching alternatives"
else:
if exists(default):
print "INFO: ouptut from RDOtoAOD step exists: ",default
RDOtoAODokay = True
if RDOtoAODokay:
fileList = [default]
else:
print "WARNING: default AOD file doesn't exist or is bad, searching alternatives"
import glob
pattern="../AthenaTrig*toESDAOD*/AOD*.pool.root"
files=glob.glob(pattern)
if (len(files)==0):
log.fatal(" ERROR FATAL No input AOD file could be found matching '" + pattern + "'")
exit(-1)
elif (len(files)>1):
log.warning("Multiple input AOD files found, taking last one: " + files[-1])
print "All matches to pattern '" + pattern + "': ", files
fileList=[files[-1]]
else:
log.info("Using input AOD file " + files[0])
fileList=files
#added for RTT-chainstore conmpatibility
if not ('RunningRTT' in dir()):
acf.FilesInput=fileList
#acf.FilesInput=fileList
###############################
rec.doCBNT=False
#doTrigger=False
rec.doTrigger=False
from RecExConfig.RecAlgsFlags import recAlgs
recAlgs.doTrigger=False
rec.doWriteAOD=False
rec.doWriteESD=False
rec.doWriteTAG=False
rec.doAOD=False
rec.doDPD=False
rec.doESD=False
doTAG=False
rec.doTruth=True
#-----------------------------------------------------------
include("RecExCommon/RecExCommon_topOptions.py")
#-----------------------------------------------------------
# abort when there is an unchecked status code
StatusCodeSvc.AbortOnError=False
####NOTE this still needs to updated for the DC14 menu!!! check what the TrigEDMChecker supports!!! rm L2 etc ..
from TrigValAlgs.TrigValAlgsConfig import TrigEDMChecker
TrigEDMChecker = TrigEDMChecker("TrigEDMChecker")
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
topSequence += TrigEDMChecker
TrigEDMChecker.doDumpAll = True
include("TriggerTest/TriggerTestCommon.py")
# get the name auditor
#theAuditorSvc = AuditorSvc()
#theAuditorSvc.Auditors += [ "NameAuditor"]
from RecExConfig.RecFlags import rec
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags as acf
if not ('fileList' in dir()):
fileList=['/afs/cern.ch/atlas/project/trigger/pesa-sw/validation/validation-data/valid1.105200.T1_McAtNlo_Jimmy.recon.AOD.e380_s764_r1295/AOD.134900._000001.pool.root.1']
# allow this to work in RTT
if not fileList == []:
acf.FilesInput=fileList
rec.readAOD=True
# different input files for ATN and RTT tests
if not acf.EvtMax.is_locked():
acf.EvtMax=2000
if not ('OutputLevel' in dir()):
rec.OutputLevel=INFO
###############################
rec.doCBNT=False
#doTrigger=False
rec.doTrigger=False
from RecExConfig.RecAlgsFlags import recAlgs
recAlgs.doTrigger=False
rec.doWriteAOD=False
rec.doWriteESD=False
rec.doWriteTAG=False
rec.doAOD=False
rec.doDPD=False
rec.doESD=False
doTAG=False
rec.doTruth=True
#-----------------------------------------------------------
include("RecExCommon/RecExCommon_topOptions.py")
#-----------------------------------------------------------
# abort when there is an unchecked status code
StatusCodeSvc.AbortOnError=False
####NOTE this still needs to updated for the DC14 menu!!! check what the TrigEDMChecker supports!!! rm L2 etc ..
from TrigValAlgs.TrigValAlgsConfig import TrigEDMChecker
TrigEDMChecker = TrigEDMChecker("TrigEDMChecker")
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
topSequence += TrigEDMChecker
TrigEDMChecker.doDumpAll = True
include("TriggerTest/TriggerTestCommon.py")
# Setup for just reading the trigger information
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags as acf
#
from RecExConfig.RecFlags import rec
rec.doTrigger=True
from RecExConfig.RecAlgsFlags import recAlgs
recAlgs.doTrigger=True
from TriggerJobOpts.TriggerFlags import TriggerFlags
TriggerFlags.doTriggerConfigOnly=True
rec.doCBNT=False
rec.doWriteAOD=False
rec.doWriteESD=False
rec.doWriteTAG=False
rec.doAOD=False
rec.doDPD=False
rec.doESD=False
doTAG=False
rec.doTruth=True
rec.readAOD=True
# Parse the command line options. You can set
# the test to look for by setting TestType
if not acf.EvtMax.is_locked():
acf.EvtMax=10
if not 'inputFile' in dir():
print "testAthenaTrigAOD_TrigSlimValidation.py: FATAL you must set an input file via '-c inputFile=...'"
import sys
sys.exit(-1)
acf.FilesInput = [inputFile]
# Run the main job options
#-----------------------------------------------------------
include("RecExCommon/RecExCommon_topOptions.py")
#-----------------------------------------------------------
#from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter
#cfg = TriggerConfigGetter()
# Setup the validation algorithm, TrigSlimValAlg
from TrigNavTools.TrigNavToolsConf import HLT__TrigNavigationSlimmingTool
slimmer = HLT__TrigNavigationSlimmingTool()
ToolSvc += slimmer
from TrigValAlgs.TrigValAlgsConfig import TrigSlimValAlg
TrigSlimVal = TrigSlimValAlg()
TrigSlimVal.OutputLevel = INFO
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
topSequence += TrigSlimVal
include("TriggerTest/TriggerTestCommon.py")
# We want to create a new AOD from the existing AOD, only changing
# the navigation structure
from RecExConfig.RecFlags import rec
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags as acf
rec.doCBNT=False
rec.doWriteRDO=False
rec.doWriteESD=False
rec.doWriteAOD=True
rec.doAOD=False
rec.doDPD=False
rec.doWriteTAG=False
rec.readAOD=True
from RecExConfig.RecFlags import rec
rec.doWriteAOD.set_Value_and_Lock(True)
# Parse command line options and setup input/output files
# Note that you can setup the slimming via the commandline
# by setting TestType = "string", where string can be:
# RS<stream> - remove the specified stream
# RF<feature> - remove the specified feature
# Squeeze - remove intermediate elements
# Or any combination of the above
if not acf.EvtMax.is_locked():
acf.EvtMax = 10
if not ('TestType' in dir()):
TestType = 'NoSlim'
if len(TestType) > 0:
TestType = '_' + TestType
# used RDOtoESDAOD test which is more likely to exist
if not ('athenaCommonFlags.PoolAODInput' in dir()):
acf.PoolAODInput = ['../AthenaTrigRDOtoESDAOD/AOD.pool.root']
if not ('athenaCommonFlags.PoolAODOutput' in dir()):
acf.PoolAODOutput='AOD'+TestType+'.pool.root'
acf.FilesInput=acf.PoolAODInput()
if TestType.startswith('_'):
TestType = TestType.replace('_', '', 1)
# Setup slimming
include ("TrigNavTools/TrigNavigationSlimming_topOptions.py")
slimmerAlg.WriteTree = 1
# check if squeezing is needed
if TestType.count('Squeeze') > 0:
slimmerAlg.Squeeze = 1
TestType = TestType.replace('Squeeze', '')
# check feature and stream removal
lastLength = len(TestType) - 1
while lastLength < len(TestType):
lastLength = len(TestType)
if TestType.startswith('RF'):
TestType = TestType.replace('RF', '', 1)
feature = TestType.split('RF')[0].split('RS')[0]
TestType = TestType.replace(feature, '', 1)
slimmerAlg.FeatureExclusionList = slimmerAlg.FeatureExclusionList + [ feature ]
if TestType.startswith('RS'):
TestType = TestType.replace('RS', '', 1)
stream = TestType.split('RF')[0].split('RS')[0]
TestType = TestType.replace(stream, '', 1)
slimmerAlg.StreamExclusionList = slimmerAlg.StreamExclusionList + [ stream ]
slimmerAlg.ProtectOtherStreams = 1
# main jobOption
include ("RecExCommon/RecExCommon_topOptions.py")
#from AthenaCommon.GlobalFlags import GlobalFlags
#GlobalFlags.DetGeo.set_atlas()
from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter
cfg = TriggerConfigGetter()
from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool
ToolSvc += Trig__TrigDecisionTool( "TrigDecisionTool" )
from TrigEDMConfig.TriggerEDM import EDMLibraries
ToolSvc.TrigDecisionTool.Navigation.Dlls = [e for e in EDMLibraries if 'TPCnv' not in e]
include("TriggerTest/TriggerTestCommon.py")
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