diff --git a/Tracker/TrackerRecAlgs/PairVertex/python/PairVertexAlgConfig.py b/Tracker/TrackerRecAlgs/PairVertex/python/PairVertexAlgConfig.py index 46247541be2a987df63ae42c2b2db2a32ed49564..e20ced2168cc629a25cd027d0f07326910ab3481 100644 --- a/Tracker/TrackerRecAlgs/PairVertex/python/PairVertexAlgConfig.py +++ b/Tracker/TrackerRecAlgs/PairVertex/python/PairVertexAlgConfig.py @@ -1,3 +1,104 @@ +/* + +# """ +# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# """ + +# from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +# from AthenaConfiguration.ComponentFactory import CompFactory +# from FaserSCT_GeoModel.FaserSCT_GeoModelConfig import FaserSCT_GeometryCfg +# from MagFieldServices.MagFieldServicesConfig import MagneticFieldSvcCfg + +# #Command line config +# from argparse import ArgumentParser + +# test_file = f"/eos/experiment/faser/sim/mc22/foresee/110033/rec/r0013/" #'/eos/experiment/faser/sim/mdc/foresee/110001/rec/r0009/FaserMC-MDC_FS_Aee_100MeV_1Em5_shift-110001-00000-00009-s0007-r0009-xAOD.root' +# parser=ArgumentParser(description="EventLooper") +# parser.add_argument("-e", "--events", type=int, default=1000) # Max events processed in alg. Set to -1 to process all events. +# parser.add_argument("-r","--runnum",type=int,default=110033) # 110001-4 +# parser.add_argument("-i","--inputfile",type=str,default=test_file) +# parser.add_argument("-v","--version",type=str,default='r0013') # 110001-4 +# ui=parser.parse_args() + +# inputIsMC = 'FaserMC' in ui.inputfile + +# # if test_file!=ui.input: +# # ui.version=ui.input.split('/')[8] +# # ui.runnum=ui.input.split('/')[6] + +# #Get/Make input/output file names +# from ROOT import TFile +# from glob import glob +# dataDir=f"/eos/experiment/faser/sim/mc22/foresee/{ui.runnum}/rec/{ui.version}/" #ui.inputfile #f"/eos/experiment/faser/sim/mdc/foresee/{ui.runnum}/rec/{ui.version}/" +# files=sorted(glob(f"{dataDir}/Faser*")) +# name=files[0].split(dataDir)[-1].split(f'{ui.runnum}')[0].replace('-','_').rstrip('_')#[0]#files[0].split(ui.version+"/")[-1].split("_FS_")[-1].split(f'{ui.runnum}')[0].split() #Generate output file name from input file name + +# def PairVertexAlgCfg(flags, **kwargs): +# acc = FaserSCT_GeometryCfg(flags) +# acc.merge(MagneticFieldSvcCfg(flags)) +# PairVertexAlg = CompFactory.Tracker.PairVertexAlg("PairVertexAlg",**kwargs) +# acc.addEventAlgo(PairVertexAlg) + +# #Hist output +# thistSvc = CompFactory.THistSvc() +# thistSvc.Output = [f"HIST DATAFILE='Ntuple_{name}.root' OPT='RECREATE'"] +# acc.addService(thistSvc) +# return acc + +# if __name__ == "__main__": + +# import sys +# from AthenaCommon.Logging import log, logging +# from AthenaCommon.Constants import DEBUG, VERBOSE, INFO +# from AthenaCommon.Configurable import Configurable +# from CalypsoConfiguration.AllConfigFlags import ConfigFlags +# from AthenaConfiguration.TestDefaults import defaultTestFiles +# from CalypsoConfiguration.MainServicesConfig import MainServicesCfg +# from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg +# from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg + +# # Set up logging and new style config +# log.setLevel(INFO) +# Configurable.configurableRun3Behavior = True + +# # Configure +# ConfigFlags.Input.Files = files # [ui.inputfile] +# ConfigFlags.IOVDb.GlobalTag = "OFLCOND-FASER-02" # Always needed; must match FaserVersionS +# ConfigFlags.IOVDb.DatabaseInstance = "OFLP200" # Use MC conditions for now +# ConfigFlags.Input.ProjectName = "data21" # Needed to bypass autoconfig +# ConfigFlags.Input.isMC = inputIsMC # Needed to bypass autoconfig +# ConfigFlags.GeoModel.FaserVersion = "FASERNU-03" # FASER geometry +# ConfigFlags.Common.isOnline = False +# ConfigFlags.GeoModel.Align.Dynamic = False +# ConfigFlags.Beam.NumberOfCollisions = 0. + +# ConfigFlags.Detector.GeometryFaserSCT = True + +# ConfigFlags.lock() + +# # Core components +# acc = MainServicesCfg(ConfigFlags) +# acc.merge(PoolReadCfg(ConfigFlags)) + +# # algorithm +# acc.merge(PairVertexAlgCfg(ConfigFlags)) + +# # Hack to avoid problem with our use of MC databases when isMC = False +# if not inputIsMC: +# replicaSvc = acc.getService("DBReplicaSvc") +# replicaSvc.COOLSQLiteVetoPattern = "" +# replicaSvc.UseCOOLSQLite = True +# replicaSvc.UseCOOLFrontier = False +# replicaSvc.UseGeomSQLite = True + +# # Execute and finish +# sc = acc.run(maxEvents=ui.events) + +# # Success should be 0 +# sys.exit(not sc.isSuccess()) + +*/ + """ Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration """ @@ -9,27 +110,25 @@ from MagFieldServices.MagFieldServicesConfig import MagneticFieldSvcCfg #Command line config from argparse import ArgumentParser - -test_file = f"/eos/experiment/faser/sim/mc22/foresee/110033/rec/r0013/" #'/eos/experiment/faser/sim/mdc/foresee/110001/rec/r0009/FaserMC-MDC_FS_Aee_100MeV_1Em5_shift-110001-00000-00009-s0007-r0009-xAOD.root' + +test_file = '/eos/experiment/faser/sim/mdc/foresee/110001/rec/r0009/FaserMC-MDC_FS_Aee_100MeV_1Em5_shift-110001-00000-00009-s0007-r0009-xAOD.root' parser=ArgumentParser(description="EventLooper") -parser.add_argument("-e", "--events", type=int, default=1000) # Max events processed in alg. Set to -1 to process all events. -parser.add_argument("-r","--runnum",type=int,default=110033) # 110001-4 parser.add_argument("-i","--inputfile",type=str,default=test_file) -parser.add_argument("-v","--version",type=str,default='r0013') # 110001-4 +parser.add_argument("-e", "--events", type=int, default=1000) # Max events processed in alg. Set to -1 to process all events. +parser.add_argument("-r","--runnum",type=int,default=110001) # 110001-4 ui=parser.parse_args() inputIsMC = 'FaserMC' in ui.inputfile -# if test_file!=ui.input: -# ui.version=ui.input.split('/')[8] -# ui.runnum=ui.input.split('/')[6] - #Get/Make input/output file names from ROOT import TFile from glob import glob -dataDir=f"/eos/experiment/faser/sim/mc22/foresee/{ui.runnum}/rec/{ui.version}/" #ui.inputfile #f"/eos/experiment/faser/sim/mdc/foresee/{ui.runnum}/rec/{ui.version}/" +dataDir=f"/eos/experiment/faser/sim/mdc/foresee/{ui.runnum}/rec/r0009/" files=sorted(glob(f"{dataDir}/Faser*")) -name=files[0].split(dataDir)[-1].split(f'{ui.runnum}')[0].replace('-','_').rstrip('_')#[0]#files[0].split(ui.version+"/")[-1].split("_FS_")[-1].split(f'{ui.runnum}')[0].split() #Generate output file name from input file name +name=files[0].split("r0009/")[-1].split("MDC_FS")[-1].split("shift")[0] #Generate output file name from input file name + +#------------------- + def PairVertexAlgCfg(flags, **kwargs): acc = FaserSCT_GeometryCfg(flags) @@ -39,7 +138,7 @@ def PairVertexAlgCfg(flags, **kwargs): #Hist output thistSvc = CompFactory.THistSvc() - thistSvc.Output = [f"HIST DATAFILE='Ntuple_{name}.root' OPT='RECREATE'"] + thistSvc.Output = [f"HIST DATAFILE='Ntuple{name}.root' OPT='RECREATE'"] acc.addService(thistSvc) return acc