diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/CMakeLists.txt b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/CMakeLists.txt index 1d6c5e79795abb1f4c1ef484cf5778daf5fd541f..69602b2e8928c3737871b93b223f7edd4bca9d06 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/CMakeLists.txt +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/CMakeLists.txt @@ -1,6 +1,4 @@ -################################################################################ -# Package: ISF_FastCaloSimParametrization -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( ISF_FastCaloSimParametrization ) @@ -9,8 +7,7 @@ atlas_subdir( ISF_FastCaloSimParametrization ) find_package( CLHEP ) find_package( Geant4 ) find_package( HepPDT ) -find_package( ROOT COMPONENTS TreePlayer Cint Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint TMVA Graf Graf3d Gpad Html Postscript Gui GX11TTF GX11 ) -find_package( XercesC ) +find_package( ROOT COMPONENTS TreePlayer Core Tree MathCore Hist RIO Physics Graf Gpad ) # Component(s) in the package: atlas_add_root_dictionary( ISF_FastCaloSimParametrizationLib @@ -24,25 +21,24 @@ atlas_add_root_dictionary( ISF_FastCaloSimParametrizationLib ISF_FastCaloSimParametrization/CaloGeometry.h ISF_FastCaloSimParametrization/CaloGeometryLookup.h Root/LinkDef.h - EXTERNAL_PACKAGES ROOT HepPDT XercesC CLHEP HepMC Geant4 ) + EXTERNAL_PACKAGES ROOT HepPDT CLHEP Geant4 ) atlas_add_library( ISF_FastCaloSimParametrizationLib Root/*.cxx src/lib/CaloGeometryFromCaloDDM.cxx src/lib/CaloGeometryLookup.cxx src/lib/CaloGeometry.cxx ${ISF_FastCaloSimParametrizationLibDictSource} PUBLIC_HEADERS ISF_FastCaloSimParametrization - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} - PRIVATE_INCLUDE_DIRS ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} AtlasHepMCLib CaloGeoHelpers AthenaBaseComps AthenaKernel Identifier GaudiKernel ISF_InterfacesLib TrkEventPrimitives TrkParameters TrkExInterfaces CaloDetDescrLib StoreGateLib SGtests TileConditionsLib - PRIVATE_LINK_LIBRARIES ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} ${GEANT4_LIBRARIES} CaloEvent CaloIdentifier AthenaPoolUtilities GeoAdaptors EventInfo NavFourMom GeneratorObjects LArSimEvent ISF_Event ISF_FastCaloSimEvent ISF_FastCaloSimInterfaces TileDetDescr TileSimEvent TrkGeometry TrkSurfaces TrkMaterialOnTrack ) + LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps AthenaKernel AtlasHepMCLib BarcodeEventLib CaloDetDescrLib CaloInterfaceLib GaudiKernel ISF_FastCaloSimEvent ISF_InterfacesLib LArElecCalib LArReadoutGeometry StoreGateLib TrkEventPrimitives TrkExInterfaces TrkParameters + PRIVATE_LINK_LIBRARIES CaloGeoHelpers ) atlas_add_component( ISF_FastCaloSimParametrization src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${GEANT4_LIBRARIES} CaloDetDescrLib CaloGeoHelpers CaloInterfaceLib AthenaBaseComps AthenaKernel StoreGateLib SGtests Identifier GaudiKernel ISF_InterfacesLib TrkEventPrimitives TrkParameters TrkExInterfaces CaloEvent CaloIdentifier AthenaPoolUtilities GeoAdaptors EventInfo NavFourMom GeneratorObjects LArSimEvent ISF_Event ISF_FastCaloSimEvent ISF_FastCaloSimInterfaces TileConditionsLib TileDetDescr TileSimEvent TrkGeometry TrkSurfaces TrkMaterialOnTrack ISF_FastCaloSimParametrizationLib ) + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${CLHEP_LIBRARIES} ${GEANT4_LIBRARIES} ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps AthenaPoolUtilities AtlasHepMCLib CaloDetDescrLib CaloEvent CaloGeoHelpers CaloIdentifier EventInfo GaudiKernel GeneratorObjects GeoAdaptors GeoModelInterfaces GeoPrimitives ISF_Event ISF_FastCaloSimEvent ISF_FastCaloSimInterfaces ISF_FastCaloSimParametrizationLib ISF_InterfacesLib LArSimEvent NavFourMom StoreGateLib TileConditionsLib TileDetDescr TileSimEvent TrackRecordLib TrkExInterfaces TrkGeometry TrkMaterialOnTrack TrkParameters TrkSurfaces ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) atlas_install_runtime( scripts/*.py ) diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ISF_FastCaloSimParametrizationConfig.py b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ISF_FastCaloSimParametrizationConfig.py index e6faf6943f9c20ff59f6afbdedb00feb83115f22..6ffe0dc58854275dc1fc5ed2cff59848a30b5f9b 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ISF_FastCaloSimParametrizationConfig.py +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ISF_FastCaloSimParametrizationConfig.py @@ -1,16 +1,13 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration """ Tools configurations for ISF_FastCaloSimParametrization """ from AthenaCommon import CfgMgr -from AthenaCommon.Constants import * # FATAL,ERROR etc. -from AthenaCommon.SystemOfUnits import * -from AthenaCommon.DetFlags import DetFlags def getFastCaloSimCaloExtrapolation(name="FastCaloSimCaloExtrapolation", **kwargs): - from ISF_FastCaloSimParametrization.ISF_FastCaloSimParametrizationConf import FastCaloSimCaloExtrapolation + from ISF_FastCaloSimParametrization.ISF_FastCaloSimParametrizationConf import FastCaloSimCaloExtrapolation # noqa: F401 kwargs.setdefault("CaloBoundaryR" , [1148.0, 120.0, 41.0] ) kwargs.setdefault("CaloBoundaryZ" , [3550.0, 4587.0, 4587.0] ) @@ -23,5 +20,5 @@ def getFastCaloSimCaloExtrapolation(name="FastCaloSimCaloExtrapolation", **kwarg def getFastCaloSimGeometryHelper(name="FastCaloSimGeometryHelper", **kwargs): - from ISF_FastCaloSimParametrization.ISF_FastCaloSimParametrizationConf import FastCaloSimGeometryHelper + from ISF_FastCaloSimParametrization.ISF_FastCaloSimParametrizationConf import FastCaloSimGeometryHelper # noqa: F401 return CfgMgr.FastCaloSimGeometryHelper(name, **kwargs) diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ISF_FastCaloSimParametrizationConfigDb.py b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ISF_FastCaloSimParametrizationConfigDb.py index add5acbb48a015c539655b8e739bb5ffc957e4d8..47c052d771621d50cbf9cfcbca4822427287125d 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ISF_FastCaloSimParametrizationConfigDb.py +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ISF_FastCaloSimParametrizationConfigDb.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration """ Configuration database for ISF_FastCaloSimParametrization @@ -6,9 +6,6 @@ Configuration database for ISF_FastCaloSimParametrization from AthenaCommon.CfgGetter import addTool -from AthenaCommon.Constants import * # FATAL,ERROR etc. -import AthenaCommon.SystemOfUnits as Units - # Common tools, services and algorithms used by jobs addTool("ISF_FastCaloSimParametrization.ISF_FastCaloSimParametrizationConfig.getFastCaloSimCaloExtrapolation" , "FastCaloSimCaloExtrapolation" ) addTool("ISF_FastCaloSimParametrization.ISF_FastCaloSimParametrizationConfig.getFastCaloSimGeometryHelper" , "FastCaloSimGeometryHelper" ) diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ISF_NativeFastCaloSimServicesConfig.py b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ISF_NativeFastCaloSimServicesConfig.py index e4cb634abaae692110fce6fd40b4e28e42735e84..e34820e1978865c20a005a2304f1b0ebfb5a0cec 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ISF_NativeFastCaloSimServicesConfig.py +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ISF_NativeFastCaloSimServicesConfig.py @@ -1,22 +1,18 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration """ Tools configurations for ISF_NativeFastCaloSimServices KG Tan, 04/12/2012 """ -from AthenaCommon.CfgGetter import getPrivateTool,getPrivateToolClone,getPublicTool,getPublicToolClone,\ - getService,getServiceClone,getAlgorithm,getAlgorithmClone - -from AthenaCommon.Constants import * # FATAL,ERROR etc. -from AthenaCommon.SystemOfUnits import * -from AthenaCommon.DetFlags import DetFlags +from AthenaCommon.CfgGetter import getPublicTool, getService, getAlgorithm from ISF_Config.ISF_jobProperties import ISF_Flags # IMPORTANT: Flags must be set before tools are retrieved from ISF_FastCaloSimParametrization.ISF_NativeFastCaloSimJobProperties import ISF_NativeFastCaloSimFlags def getPunchThroughTool(name="ISF_PunchThroughTool", **kwargs): - from G4AtlasApps.SimFlags import SimFlags,simFlags + from G4AtlasApps.SimFlags import simFlags + from ISF_FastCaloSimServices.ISF_FastCaloSimJobProperties import ISF_FastCaloSimFlags kwargs.setdefault("RandomNumberService" , simFlags.RandomSvc() ) kwargs.setdefault("RandomStreamName" , ISF_FastCaloSimFlags.RandomStreamName() ) kwargs.setdefault("FilenameLookupTable" , "CaloPunchThroughParametrisation.root" ) @@ -57,7 +53,6 @@ def getCaloCellContainerFinalizerTool(name="ISF_CaloCellContainerFinalizerTool", #### NativeFastCaloSimSvc def getNativeFastCaloSimSvc(name="ISF_NativeFastCaloSimSvc", **kwargs): - from ISF_FastCaloSimParametrization.ISF_NativeFastCaloSimJobProperties import ISF_NativeFastCaloSimFlags kwargs.setdefault("BatchProcessMcTruth" , False ) kwargs.setdefault("SimulateUndefinedBarcodeParticles", False ) kwargs.setdefault("Identifier" , 'NativeFastCaloSim' ) @@ -77,7 +72,7 @@ def getNativeFastCaloSimSvc(name="ISF_NativeFastCaloSimSvc", **kwargs): ISF_NativeFastCaloSimFlags.NativeFastCaloSimIsActive.set_Value_and_Lock(True) # register the FastCaloSim random number streams - from G4AtlasApps.SimFlags import SimFlags,simFlags + from G4AtlasApps.SimFlags import simFlags simFlags.RandomSeedList.addSeed( ISF_NativeFastCaloSimFlags.RandomStreamName(), 98346412, 12461240 ) from ISF_FastCaloSimParametrization.ISF_FastCaloSimParametrizationConf import ISF__NativeFastCaloSimSvc diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ShowerShapeRegression.py b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ShowerShapeRegression.py index c4714fe68d5fc242c995c38f9953b44f11316ea9..e667fc9e969d6e457ab30c921928c9e3aceaa4fb 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ShowerShapeRegression.py +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/ShowerShapeRegression.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration __author__ = 'Christopher Bock - LMU' @@ -164,11 +164,11 @@ class ShowerShapeRegressor(): self.obtain_output_names() - f = ROOT.TFile(self.root_file_name) + f = ROOT.TFile(self.root_file_name) # noqa: F841 chain = ROOT.gDirectory.Get('ISF_HitAnalysis/CaloHitAna') entries = chain.GetEntriesFast() - for current_entry in xrange(entries): + for current_entry in range(entries): print(' Loading entry: %i' % current_entry) j = chain.LoadTree(current_entry) if j < 0: @@ -208,7 +208,7 @@ class ShowerShapeRegressor(): self.cumulative_etaphi_nbins[0], self.cumulative_etaphi_xrange[0], self.cumulative_etaphi_xrange[1], self.cumulative_etaphi_nbins[1], self.cumulative_etaphi_yrange[0], self.cumulative_etaphi_yrange[1]) - for i in xrange(num_hits): + for i in range(num_hits): layer_id = chain.HitSampling[i] if not layer_id == self.selected_layer: @@ -280,9 +280,9 @@ class ShowerShapeRegressor(): y_axis = self.eta_phi_efrac_hists[0].GetYaxis() n_bins_y = y_axis.GetNbins() - for x_bin in xrange(n_bins_x + 1): + for x_bin in range(n_bins_x + 1): x_center = x_axis.GetBinCenter(x_bin) - for y_bin in xrange(n_bins_y + 1): + for y_bin in range(n_bins_y + 1): y_center = x_axis.GetBinCenter(y_bin) for hist in self.eta_phi_efrac_hists: value = hist.GetBinContent(x_bin, y_bin) @@ -294,9 +294,9 @@ class ShowerShapeRegressor(): y_axis = cumulative_histogram.GetYaxis() n_bins_y = y_axis.GetNbins() - for x_bin in xrange(n_bins_x + 1): + for x_bin in range(n_bins_x + 1): x_bin_width = x_axis.GetBinWidth(x_bin) - for y_bin in xrange(n_bins_y + 1): + for y_bin in range(n_bins_y + 1): y_bin_width = y_axis.GetBinWidth(y_bin) area = x_bin_width*y_bin_width @@ -506,9 +506,9 @@ class ShowerShapeRegressor(): y_axis = reference.GetYaxis() n_bins_x = x_axis.GetNbins() n_bins_y = y_axis.GetNbins() - for x in xrange(n_bins_x + 1): + for x in range(n_bins_x + 1): d_eta[0] = x_axis.GetBinCenter(x) - for y in xrange(n_bins_y + 1): + for y in range(n_bins_y + 1): d_phi[0] = y_axis.GetBinCenter(y) r[0] = math.sqrt(d_eta[0]*d_eta[0] + d_phi[0]*d_phi[0]) @@ -555,7 +555,7 @@ class ShowerShapeRegressor(): for key in input_file.GetListOfKeys(): print('Key: %s' % key.GetName()) - if not 'Method_' in key.GetName(): + if 'Method_' not in key.GetName(): continue if not ROOT.gROOT.GetClass(key.GetClassName()).InheritsFrom('TDirectory'): continue @@ -584,11 +584,11 @@ class ShowerShapeRegressor(): plot_obj = plot_key.ReadObj() if isinstance(plot_obj, ROOT.TH2F): plot_name = plot_key.GetName() - if not '_reg_' in plot_name: + if '_reg_' not in plot_name: continue if not ((show_target and '_tgt' in plot_name) or - (not show_target and (not '_tgt' in plot_name))): + (not show_target and ('_tgt' not in plot_name))): continue if not ((compare_to_train and 'train' in plot_name) or diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/fcsTrfArgs.py b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/fcsTrfArgs.py index 17398d1204ebac51913aa0ed138d898d969ebb33..88d243aabfb69aac6d69b36d3519c1b7e27968be 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/fcsTrfArgs.py +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/fcsTrfArgs.py @@ -1,13 +1,10 @@ # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -import argparse import logging msg = logging.getLogger(__name__) -import unittest -import pickle -import os -from PyJobTransforms.trfArgClasses import argFactory, argFile, argInt, argFloat, argString, argSubstep, trfArgParser, argList, argBool, argPOOLFile, argHITSFile, argRDOFile, argSubstepInt, argSubstepBool +from PyJobTransforms.trfArgClasses import argFactory, argPOOLFile, argBool, argString, argInt, argFile + ## Add FCS Ntuple transform arguments def addFCS_NtupArgs(parser): parser.defineArgGroup('FCS_Ntup_tf', 'FCS_Ntup_tf specific options')