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 if hasattr(runArgs,"doPEBStream") and runArgs.doPEBStream:
59 for i in range(0,len(runinfo.streamTypesPEB())):
60 if runinfo.streamTypesPEB()[i] == "SelectedEnergy":
61 flags.LArShapeDump.rawSCKey = "SC_ET_ID"
62 flags.LArShapeDump.nrawSC = runinfo.streamLengthsPEB()[i]
63 elif runinfo.streamTypesPEB()[i] == "Energy":
64 flags.LArShapeDump.rawSCKey = "SC_ET"
65 flags.LArShapeDump.nrawSC = runinfo.streamLengthsPEB()[i]
66 elif runinfo.streamTypesPEB()[i] == "RawADC":
67 flags.LArShapeDump.digitsKeySC="SC"
68 flags.LArShapeDump.ndigitsSC = runinfo.streamLengthsPEB()[i]
69 elif runinfo.streamTypesPEB()[i] == "ADC":
70 flags.LArShapeDump.digitsKeySC="SC_ADC_BAS"
71 flags.LArShapeDump.ndigitsSC = runinfo.streamLengthsPEB()[i]
72 else:
73 for i in range(0,len(runinfo.streamTypes())):
74 if runinfo.streamTypes()[i] == "SelectedEnergy":
75 flags.LArShapeDump.rawSCKey = "SC_ET_ID"
76 flags.LArShapeDump.nrawSC = runinfo.streamLengths()[i]
77 elif runinfo.streamTypes()[i] == "Energy":
78 flags.LArShapeDump.rawSCKey = "SC_ET"
79 flags.LArShapeDump.nrawSC = runinfo.streamLengths()[i]
80 elif runinfo.streamTypes()[i] == "RawADC":
81 flags.LArShapeDump.digitsKeySC="SC"
82 flags.LArShapeDump.ndigitsSC = runinfo.streamLengths()[i]
83 elif runinfo.streamTypes()[i] == "ADC":
84 flags.LArShapeDump.digitsKeySC="SC_ADC_BAS"
85 flags.LArShapeDump.ndigitsSC = runinfo.streamLengths()[i]
86
87 # To respect --athenaopts
88 flags.fillFromArgs()
89
90 flags.lock()
91
92 cfg=MainServicesCfg(flags)
93 cfg.merge(LArShapeDumperCfg(flags))
94
95 processPostInclude(runArgs, flags, cfg)
96 processPostExec(runArgs, flags, cfg)
97
98 if runArgs.doSC and fw==6:
99 from IOVDbSvc.IOVDbSvcConfig import addOverride
100 cfg.merge(addOverride(flags,"/LAR/Identifier/LatomeMapping","LARIdentifierLatomeMapping-fw6"))
101
102 # Run the final accumulator
103 sc = cfg.run()
104 sys.exit(not sc.isSuccess())