From 6d1090cb6272b122ed3809f79ce0903e22a9e6ff Mon Sep 17 00:00:00 2001 From: "Ewelina.Maria.Lobodzinska" Date: Thu, 19 Mar 2020 12:59:32 +0100 Subject: [PATCH] small fixes to make ART tests running --- Event/xAOD/xAODEventInfoCnv/CMakeLists.txt | 12 ++++-- .../xAODEventInfoCnv/src/EventInfoCnvTool.cxx | 14 ++----- .../xAODEventInfoCnv/src/EventInfoCnvTool.h | 11 ++---- .../share/skel.ABtoEVGEN.py | 2 +- .../share/skel.GENtoEVGEN.py | 39 +++++++++---------- .../EvgenJobTransforms/share/skel.GENtoTXT.py | 4 +- Projects/AthGeneration/package_filters.txt | 2 + 7 files changed, 40 insertions(+), 44 deletions(-) diff --git a/Event/xAOD/xAODEventInfoCnv/CMakeLists.txt b/Event/xAOD/xAODEventInfoCnv/CMakeLists.txt index fc08b524b44..5df80e8ebbb 100644 --- a/Event/xAOD/xAODEventInfoCnv/CMakeLists.txt +++ b/Event/xAOD/xAODEventInfoCnv/CMakeLists.txt @@ -10,11 +10,16 @@ atlas_subdir( xAODEventInfoCnv ) set( extra_libs ) set( extra_private_deps ) -if( NOT SIMULATIONBASE ) +if( NOT SIMULATIONBASE AND NOT GENERATIONBASE ) set( extra_private_deps InnerDetector/InDetConditions/InDetBeamSpotService LumiBlock/LumiBlockData) set( extra_libs GeoPrimitives LumiBlockData ) endif() +if ( NOT GENERATIONBASE ) + set( extra_private_deps InnerDetector/InDetConditions/BeamSpotConditionsData ) + set( extra_libs BeamSpotConditionsData ) +endif() + # Declare the package's dependencies: atlas_depends_on_subdirs( PUBLIC @@ -24,7 +29,6 @@ atlas_depends_on_subdirs( Control/AthenaBaseComps Control/AthenaKernel Database/AthenaPOOL/AthenaPoolUtilities - InnerDetector/InDetConditions/BeamSpotConditionsData Event/EventInfo Event/xAOD/xAODEventInfo Event/xAOD/xAODTruth @@ -37,7 +41,7 @@ atlas_depends_on_subdirs( atlas_add_component( xAODEventInfoCnv src/*.h src/*.cxx src/components/*.cxx LINK_LIBRARIES xAODCnvInterfaces AthenaBaseComps - AthenaKernel AthenaPoolUtilities EventInfo xAODEventInfo xAODTruth BeamSpotConditionsData GaudiKernel + AthenaKernel AthenaPoolUtilities EventInfo xAODEventInfo xAODTruth GaudiKernel ${extra_libs} ) # Install files from the package: @@ -55,7 +59,7 @@ atlas_add_test( EvenInfoCnvConfigTestMT SCRIPT test/EventInfoCnv_test.py -n 25 -t 3 PROPERTIES TIMEOUT 300 ) -if( NOT SIMULATIONBASE ) +if( NOT SIMULATIONBASE AND NOT GENERATIONBASE ) atlas_add_test( EventInfoOverlayConfigTest SCRIPT test/EventInfoOverlay_test.py PROPERTIES TIMEOUT 300 ) diff --git a/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvTool.cxx b/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvTool.cxx index f944f145398..445c6021785 100644 --- a/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvTool.cxx +++ b/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvTool.cxx @@ -63,11 +63,9 @@ namespace xAODMaker { // Declare the interface(s) provided by the tool: declareInterface< IEventInfoCnvTool >( this ); -#ifndef XAOD_ANALYSIS -#ifndef SIMULATIONBASE +#if !(defined(SIMULATIONBASE) || defined(XAOD_ANALYSIS) || defined(GENERATIONBASE) ) // Declare the tool's properties: declareProperty( "DisableBeamSpot", m_disableBeamSpot ); -#endif #endif } @@ -76,8 +74,7 @@ namespace xAODMaker { // Greet the user: ATH_MSG_INFO( "Initializing - Package version: " << PACKAGE_VERSION ); -#ifndef XAOD_ANALYSIS -#ifndef SIMULATIONBASE +#if !(defined(SIMULATIONBASE) || defined(XAOD_ANALYSIS) || defined(GENERATIONBASE) ) // Check if the beam position will be available or not: if( detStore()->contains< AthenaAttributeList >( INDET_BEAMPOS ) ) { m_beamCondSvcAvailable = true; @@ -99,7 +96,6 @@ namespace xAODMaker { #else //do nothing, lumi and beam conditions not available -#endif #endif // Return gracefully: @@ -196,8 +192,7 @@ namespace xAODMaker { // Copy/calculate the pileup information: if( ! pileUpInfo ) { bool haveLumi = false; -#ifndef XAOD_ANALYSIS -#ifndef SIMULATIONBASE +#if !(defined(SIMULATIONBASE) || defined(XAOD_ANALYSIS) || defined(GENERATIONBASE) ) if (!m_lumiDataKey.empty()) { SG::ReadCondHandle lumiData (m_lumiDataKey, ctx); if (lumiData->lbAverageLuminosity() != 0 || @@ -215,7 +210,6 @@ namespace xAODMaker { } haveLumi = true; } -#endif #endif if (!haveLumi) { xaod->setActualInteractionsPerCrossing( @@ -310,7 +304,7 @@ namespace xAODMaker { xaod->setSubEvents( subEvents ); } -#if !defined(XAOD_ANALYSIS) && !defined(SIMULATIONBASE) +#if !(defined(SIMULATIONBASE) || defined(XAOD_ANALYSIS) || defined(GENERATIONBASE) ) // Fill the beam spot variables if the necessary service is available: if( m_beamCondSvcAvailable && ( ! pileUpInfo ) ) { SG::ReadCondHandle beamSpotHandle { m_beamSpotKey, ctx }; diff --git a/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvTool.h b/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvTool.h index f307032d1a0..a49c5ee032e 100644 --- a/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvTool.h +++ b/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvTool.h @@ -1,7 +1,7 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: EventInfoCnvTool.h 793565 2017-01-23 22:00:14Z leggett $ @@ -13,8 +13,7 @@ #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#ifndef XAOD_ANALYSIS -#ifndef SIMULATIONBASE +#if !(defined(SIMULATIONBASE) || defined(XAOD_ANALYSIS) || defined(GENERATIONBASE) ) // Beam condition include(s): #include "BeamSpotConditionsData/BeamSpotData.h" @@ -23,7 +22,7 @@ #include "StoreGate/ReadCondHandleKey.h" #endif -#endif + // xAOD include(s): #include "xAODCnvInterfaces/IEventInfoCnvTool.h" @@ -60,14 +59,12 @@ namespace xAODMaker { const EventContext& ctx = Gaudi::Hive::currentContext()) const override; private: -#ifndef XAOD_ANALYSIS -#ifndef SIMULATIONBASE +#if !(defined(SIMULATIONBASE) || defined(XAOD_ANALYSIS) || defined(GENERATIONBASE) ) /// Connection to the beam spot service SG::ReadCondHandleKey m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; SG::ReadCondHandleKey m_lumiDataKey { this, "LumiDataKey", "", "SG key for luminosity data" }; -#endif #endif /// Internal flag for the availability of the beam conditions service diff --git a/Generators/EvgenJobTransforms/share/skel.ABtoEVGEN.py b/Generators/EvgenJobTransforms/share/skel.ABtoEVGEN.py index 6342fa9ea15..b267407e373 100644 --- a/Generators/EvgenJobTransforms/share/skel.ABtoEVGEN.py +++ b/Generators/EvgenJobTransforms/share/skel.ABtoEVGEN.py @@ -184,7 +184,7 @@ def OutputTXTFile(): if len(runArgs.jobConfig) != 1: evgenLog.error("You must supply one and only one jobConfig file argument") sys.exit(1) -msg.info("Using JOBOPTSEARCHPATH!! = '%s'" % os.environ["JOBOPTSEARCHPATH"]) +evgenLog.info("Using JOBOPTSEARCHPATH!! = '%s'" % os.environ["JOBOPTSEARCHPATH"]) FIRST_DIR = (os.environ['JOBOPTSEARCHPATH']).split(":")[0] jofiles = [f for f in os.listdir(FIRST_DIR) if (f.startswith('mc') and f.endswith('.py'))] diff --git a/Generators/EvgenJobTransforms/share/skel.GENtoEVGEN.py b/Generators/EvgenJobTransforms/share/skel.GENtoEVGEN.py index 3eb7ed0dd8b..ebd9d4f4752 100644 --- a/Generators/EvgenJobTransforms/share/skel.GENtoEVGEN.py +++ b/Generators/EvgenJobTransforms/share/skel.GENtoEVGEN.py @@ -202,11 +202,11 @@ def OutputTXTFile(): ## Main job option include ## Only permit one jobConfig argument for evgen: does more than one _ever_ make sense? if len(runArgs.jobConfig) != 1: - msg.info("runArgs.jobConfig '%s'" % runArgs.jobConfig) + evgenLog.info("runArgs.jobConfig '%s'" % runArgs.jobConfig) evgenLog.error("You must supply one and only one jobConfig file argument") sys.exit(1) -msg.info("Using JOBOPTSEARCHPATH!! = '%s'" % os.environ["JOBOPTSEARCHPATH"]) +evgenLog.info("Using JOBOPTSEARCHPATH!! = '%s'" % os.environ["JOBOPTSEARCHPATH"]) FIRST_DIR = (os.environ['JOBOPTSEARCHPATH']).split(":")[0] jofiles = [f for f in os.listdir(FIRST_DIR) if (f.startswith('mc') and f.endswith('.py'))] @@ -389,7 +389,6 @@ if evgenConfig.categories: l2 = next(it) if "L1:" in l2 and "L2:" in l1: l1, l2 = l2, l1 - printfunc "first",l1,"second",l2 bad_cat.extend([l1, l2]) for a1,a2 in allowed_cat: if l1.strip().lower()==a1.strip().lower() and l2.strip().lower()==a2.strip().lower(): @@ -546,7 +545,7 @@ def find_unique_file(pattern): # file, but the number of events is updated to equal the total number of events in all the input files def merge_lhe_files(listOfFiles,outputFile): if(os.path.exists(outputFile)): - printfunc "outputFile ",outputFile," already exists. Will rename to ",outputFile,".OLD" + printfunc("outputFile ",outputFile," already exists. Will rename to ",outputFile,".OLD") os.rename(outputFile,outputFile+".OLD") output = open(outputFile,'w') holdHeader = "" @@ -558,7 +557,7 @@ def merge_lhe_files(listOfFiles,outputFile): for file in listOfFiles: inHeader = True header = "" - printfunc "*** Starting file ",file + printfunc("*** Starting file ",file) for line in open(file,"r"): ## Reading first event signals that we are done with all the header information ## Using this approach means the script will properly handle any metadata stored @@ -598,7 +597,6 @@ def mk_symlink(srcfile, dstfile): os.remove(dstfile) if not os.path.exists(dstfile): evgenLog.info("Symlinking %s to %s" % (srcfile, dstfile)) - printfunc "Symlinking %s to %s" % (srcfile, dstfile) os.symlink(srcfile, dstfile) else: evgenLog.debug("Symlinking: %s is already the same as %s" % (dstfile, srcfile)) @@ -644,7 +642,7 @@ if eventsFile or datFile: input0 = os.path.basename(file).split("._")[0] input1 = (os.path.basename(file).split("._")[1]).split(".")[0] inputroot = input0+"._"+input1 - printfunc "inputroot ",inputroot + evgenLog.info("inputroot %s" % inputroot) realEventsFile = find_unique_file('*%s.*ev*ts' % inputroot) # The only input format where merging is permitted is LHE with open(realEventsFile, 'r') as f: @@ -690,7 +688,7 @@ if _checkattr("description", required=True): msg = evgenConfig.description if _checkattr("notes"): msg += " " + evgenConfig.notes - printfunc "MetaData: %s = %s" % ("physicsComment", msg) + evgenLog.info("MetaData: %s = %s" % ("physicsComment", msg)) if _checkattr("generators", required=True): gennamesvers=[] for item in gennames: @@ -700,33 +698,34 @@ if _checkattr("generators", required=True): gennamesvers.append(item+"(v."+os.environ[generat]+")") else: gennamesvers.append(item) - printfunc "MetaData: %s = %s" % ("generatorName", "+".join(gennamesvers)) + printfunc("MetaData: %s = %s" % ("generatorName", "+".join(gennamesvers))) if _checkattr("process"): - printfunc "MetaData: %s = %s" % ("physicsProcess", evgenConfig.process) + printfunc("MetaData: %s = %s" % ("physicsProcess", evgenConfig.process)) if _checkattr("tune"): - printfunc "MetaData: %s = %s" % ("generatorTune", evgenConfig.tune) + printfunc("MetaData: %s = %s" % ("generatorTune", evgenConfig.tune)) if _checkattr("hardPDF"): - printfunc "MetaData: %s = %s" % ("hardPDF", evgenConfig.hardPDF) + printfunc("MetaData: %s = %s" % ("hardPDF", evgenConfig.hardPDF)) if _checkattr("softPDF"): - printfunc "MetaData: %s = %s" % ("softPDF", evgenConfig.softPDF) + printfunc("MetaData: %s = %s" % ("softPDF", evgenConfig.softPDF)) if _checkattr("nEventsPerJob"): - printfunc "MetaData: %s = %s" % ("nEventsPerJob", evgenConfig.nEventsPerJob) + printfunc("MetaData: %s = %s" % ("nEventsPerJob", evgenConfig.nEventsPerJob)) if _checkattr("keywords"): - printfunc "MetaData: %s = %s" % ("keywords", ", ".join(evgenConfig.keywords).lower()) + printfunc("MetaData: %s = %s" % ("keywords", ", ".join(evgenConfig.keywords).lower())) if _checkattr("categories"): - printfunc "MetaData: %s = %s" % ("categories", ", ".join(evgenConfig.categories)) + printfunc("MetaData: %s = %s" % ("categories", ", ".join(evgenConfig.categories))) if _checkattr("specialConfig"): - printfunc "MetaData: %s = %s" % ("specialConfig", evgenConfig.specialConfig) + printfunc("MetaData: %s = %s" % ("specialConfig", evgenConfig.specialConfig)) # TODO: Require that a contact / JO author is always set if _checkattr("contact"): - printfunc "MetaData: %s = %s" % ("contactPhysicist", ", ".join(evgenConfig.contact)) -printfunc "MetaData: %s = %s" % ("randomSeed", str(runArgs.randomSeed)) + printfunc("MetaData: %s = %s" % ("contactPhysicist", ", ".join(evgenConfig.contact))) + +printfunc("MetaData: %s = %s" % ("randomSeed", str(eunArgs.randomSeed))) # Output list of generator filters used filterNames = [alg.getType() for alg in acas.iter_algseq(filtSeq)] excludedNames = ['AthSequencer', 'PyAthena::Alg', 'TestHepMC'] filterNames = list(set(filterNames) - set(excludedNames)) -printfunc "MetaData: %s = %s" % ("genFilterNames", ", ".join(filterNames)) +printfunc("MetaData: %s = %s" % ("genFilterNames", ", ".join(filterNames))) ##============================================================== diff --git a/Generators/EvgenJobTransforms/share/skel.GENtoTXT.py b/Generators/EvgenJobTransforms/share/skel.GENtoTXT.py index ea226971bcf..cc40046cf74 100644 --- a/Generators/EvgenJobTransforms/share/skel.GENtoTXT.py +++ b/Generators/EvgenJobTransforms/share/skel.GENtoTXT.py @@ -155,7 +155,7 @@ def OutputTXTFile(): ## Only permit one jobConfig argument for evgen: does more than one _ever_ make sense? if len(runArgs.jobConfig) != 1: - msg.info("runArgs.jobConfig %s ", % runArgs.jobConfig) + evgenLog.info("runArgs.jobConfig %s ", % runArgs.jobConfig) evgenLog.error("You must supply one and only one jobConfig file argument. It has to start from mc. and end with .py") sys.exit(1) @@ -169,7 +169,7 @@ evgenLog.info("dsid " + dsid) jofiles = [f for f in os.listdir(FIRST_DIR) if (f.startswith('mc') and f.endswith('.py'))] ## Only permit one JO file in each dsid folder if len(jofiles) !=1: - msg.info("runArgs.jobConfig wrong %s ", % runArgs.jobConfig) + evgenLog.info("runArgs.jobConfig wrong %s ", % runArgs.jobConfig) evgenLog.error("You must supply one and only one jobOption file in DSID directory. It has to start with mc. and end with .py") sys.exit(1) jofile = jofiles[0] diff --git a/Projects/AthGeneration/package_filters.txt b/Projects/AthGeneration/package_filters.txt index 377661dbc1d..bf265a62821 100644 --- a/Projects/AthGeneration/package_filters.txt +++ b/Projects/AthGeneration/package_filters.txt @@ -120,6 +120,8 @@ + Event/xAOD/xAODCutFlow + Event/xAOD/xAODEventFormat + Event/xAOD/xAODEventInfo ++ Event/xAOD/xAODEventInfoCnv ++ Event/xAOD/xAODCnvInterfaces + Event/xAOD/xAODEventShape + Event/xAOD/xAODJet + Event/xAOD/xAODJetAthenaPool -- GitLab