diff --git a/PhysicsAnalysis/NtupleDumper/scripts/analyzeRunMC.py b/PhysicsAnalysis/NtupleDumper/scripts/analyzeRunMC.py index 914bcb86b6fef94df8043c52c04fe7d1476f6870..56aca963be7366cfcb1cc7405a0bff6d2a79a8fc 100644 --- a/PhysicsAnalysis/NtupleDumper/scripts/analyzeRunMC.py +++ b/PhysicsAnalysis/NtupleDumper/scripts/analyzeRunMC.py @@ -6,31 +6,13 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory -from MagFieldServices.MagFieldServicesConfig import MagneticFieldSvcCfg +# Move NtupleDumperAlgCfg to python/NtupleDumperConfig +from NtupleDumper.NtupleDumperConfig import NtupleDumperAlgCfg -def NtupleDumperAlgCfg(flags, OutName, **kwargs): - # Initialize GeoModel - from FaserGeoModel.FaserGeoModelConfig import FaserGeometryCfg - acc = FaserGeometryCfg(flags) +#from MagFieldServices.MagFieldServicesConfig import MagneticFieldSvcCfg - acc.merge(MagneticFieldSvcCfg(flags)) - # acc.merge(FaserActsTrackingGeometrySvcCfg(flags)) - # acc.merge(FaserActsAlignmentCondAlgCfg(flags)) - actsExtrapolationTool = CompFactory.FaserActsExtrapolationTool("FaserActsExtrapolationTool") - actsExtrapolationTool.MaxSteps = 10000 - actsExtrapolationTool.TrackingGeometryTool = CompFactory.FaserActsTrackingGeometryTool("TrackingGeometryTool") - - NtupleDumperAlg = CompFactory.NtupleDumperAlg("NtupleDumperAlg",**kwargs) - NtupleDumperAlg.ExtrapolationTool = actsExtrapolationTool - acc.addEventAlgo(NtupleDumperAlg) - - thistSvc = CompFactory.THistSvc() - thistSvc.Output += [f"HIST2 DATAFILE='{OutName}' OPT='RECREATE'"] - acc.addService(thistSvc) - - return acc if __name__ == "__main__": @@ -38,11 +20,11 @@ if __name__ == "__main__": import sys import ROOT - runno=int(sys.argv[1]) - num=int(sys.argv[2]) - filesPerJob=int(sys.argv[3]) + runno=0#int(sys.argv[1]) + num=0#int(sys.argv[2]) + filesPerJob=0#int(sys.argv[3]) - ptag="p0008" + ptag="110038" #"p0008" from AthenaCommon.Logging import log, logging from AthenaCommon.Constants import DEBUG, VERBOSE, INFO @@ -59,9 +41,10 @@ if __name__ == "__main__": #fName = dataDir+"FaserMC-MDC_FS_Aee_100MeV_1Em5_shift-110001-00000-00009-s0007-r0009-xAOD.root" - dataDir=f"/eos/experiment/faser/sim/mdc/foresee/{ptag}/rec/r0009/" - files=sorted(glob.glob(f"{dataDir}/FaserMC-MDC*")) - fileListInitial=files[num*filesPerJob:(num+1)*filesPerJob] + dataDir=f"/eos/experiment/faser/sim/mc22/foresee/{ptag}/rec/r0013/" + files=sorted(glob.glob(f"{dataDir}/FaserMC*")) + fileListInitial=files#[0:filesPerJob] + #if num!=0: fileListInitial=files[num*filesPerJob:(num+1)*filesPerJob] fileList=[] for fName in fileListInitial: try: @@ -70,10 +53,10 @@ if __name__ == "__main__": except OSError: print("Warning bad file: ",fName) - log.info(f"Analyzing Run {runno} files {num*filesPerJob} to {(num+1)*filesPerJob} (num={num})") + log.info(f"Analyzing Model {ptag}") log.info(f"Got {len(fileList)} files out of {len(fileListInitial)}") - outName=f"MC-tuple-{runno:06d}-{num:05d}-{filesPerJob}.root" + outName=f"MC-tuple-{ptag}.root" # Configure ConfigFlags.Input.Files = fileList @@ -95,18 +78,18 @@ if __name__ == "__main__": acc.merge(PoolReadCfg(ConfigFlags)) # algorithm - acc.merge(NtupleDumperAlgCfg(ConfigFlags, outName, UseFlukaWeights=True, CaloConfig=run_config)) + acc.merge(NtupleDumperAlgCfg(ConfigFlags, outName))#UseFlukaWeights=True AthenaEventLoopMgr = CompFactory.AthenaEventLoopMgr() AthenaEventLoopMgr.EventPrintoutInterval=1000 acc.addService(AthenaEventLoopMgr) # # Hack to avoid problem with our use of MC databases when isMC = False - replicaSvc = acc.getService("DBReplicaSvc") - replicaSvc.COOLSQLiteVetoPattern = "" - replicaSvc.UseCOOLSQLite = True - replicaSvc.UseCOOLFrontier = False - replicaSvc.UseGeomSQLite = True + # replicaSvc = acc.getService("DBReplicaSvc") + # replicaSvc.COOLSQLiteVetoPattern = "" + # replicaSvc.UseCOOLSQLite = True + # replicaSvc.UseCOOLFrontier = False + # replicaSvc.UseGeomSQLite = True # Timing #acc.merge(MergeRecoTimingObjCfg(ConfigFlags))