ATLAS Offline Software
Loading...
Searching...
No Matches
LArShapeDumperSkeleton.py
Go to the documentation of this file.
1# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
2
3import sys
4
5from PyJobTransforms.CommonRunArgsToFlags import commonRunArgsToFlags
6from PyJobTransforms.TransformUtils import processPreExec, processPreInclude, processPostExec, processPostInclude
7from LArCafJobs.LArShapeDumperConfig import LArShapeDumperCfg
8from AthenaConfiguration.MainServicesConfig import MainServicesCfg
9
10
11def fromRunArgs(runArgs):
12 from AthenaCommon.Logging import logging
13 mlog_SCD = logging.getLogger( 'LArShapeDumperSkeleton' )
14
15 from AthenaConfiguration.AllConfigFlags import initConfigFlags
16
17 flags=initConfigFlags()
18 from LArCafJobs.LArShapeDumperFlags import addShapeDumpFlags
19 addShapeDumpFlags(flags)
20
21 commonRunArgsToFlags(runArgs, flags)
22
23 processPreInclude(runArgs, flags)
24 processPreExec(runArgs, flags)
25
26 from AthenaConfiguration.TestDefaults import defaultGeometryTags
27 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
28 flags.LAr.ROD.forceIter=True
29 flags.LAr.OFCShapeFolder="4samples3bins17phases"
30 flags.Input.Files=runArgs.inputBSFile
31 flags.LArShapeDump.outputNtup=runArgs.outputNTUP_SAMPLESMONFile
32
33 flags.LArShapeDump.energySCCut = 500.
34
35 #protection for LArPEB event:
36 flags.Trigger.triggerConfig = 'DB'
37 flags.Trigger.L1.doCTP = True
38 flags.Trigger.L1.doMuon=False
39 flags.Trigger.L1.doCalo=False
40 flags.Trigger.L1.doTopo=False
41
42 if hasattr(runArgs,"outputNTUP_HECNOISEFile"):
43 flags.LArShapeDump.HECNoiseNtup=runArgs.outputNTUP_HECNOISEFile
44
45 if runArgs.doSC:
46 from LArConditionsCommon.LArRunFormat import getLArDTInfoForRun
47 try:
48 runinfo=getLArDTInfoForRun(flags.Input.RunNumbers[0], connstring="COOLONL_LAR/CONDBR2")
49 except Exception:
50 mlog_SCD.warning("Could not get DT run info, using defaults !")
51 flags.LArShapeDump.ndigitsSC=6
52 flags.LArShapeDump.nrawSC=1
53 flags.LArShapeDump.rawSCKey="SC_ET_ID"
54 flags.LArShapeDump.digitsKeySC="SC_ADC_BAS"
55 fw=5
56 else:
57 fw=runinfo.FWversion()
58 for i in range(0,len(runinfo.streamTypes())):
59 if runinfo.streamTypes()[i] == "SelectedEnergy":
60 flags.LArShapeDump.rawSCKey = "SC_ET_ID"
61 flags.LArShapeDump.nrawSC = runinfo.streamLengths()[i]
62 elif runinfo.streamTypes()[i] == "Energy":
63 flags.LArShapeDump.rawSCKey = "SC_ET"
64 flags.LArShapeDump.nrawSC = runinfo.streamLengths()[i]
65 elif runinfo.streamTypes()[i] == "RawADC":
66 flags.LArShapeDump.digitsKeySC="SC"
67 flags.LArShapeDump.ndigitsSC = runinfo.streamLengths()[i]
68 elif runinfo.streamTypes()[i] == "ADC":
69 flags.LArShapeDump.digitsKeySC="SC_ADC_BAS"
70 flags.LArShapeDump.ndigitsSC = runinfo.streamLengths()[i]
71
72 # To respect --athenaopts
73 flags.fillFromArgs()
74
75 flags.lock()
76
77 cfg=MainServicesCfg(flags)
78 cfg.merge(LArShapeDumperCfg(flags))
79
80 processPostInclude(runArgs, flags, cfg)
81 processPostExec(runArgs, flags, cfg)
82
83 if runArgs.doSC and fw==6:
84 from IOVDbSvc.IOVDbSvcConfig import addOverride
85 cfg.merge(addOverride(flags,"/LAR/Identifier/LatomeMapping","LARIdentifierLatomeMapping-fw6"))
86
87 # Run the final accumulator
88 sc = cfg.run()
89 sys.exit(not sc.isSuccess())