ATLAS Offline Software
Loading...
Searching...
No Matches
LArHVScaleConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory import CompFactory
5from AthenaConfiguration.Enums import LHCPeriod
6
7
8def LArHVScaleCfg(configFlags, **props):
9 result=ComponentAccumulator()
10
11 from LArBadChannelTool.LArBadChannelConfig import LArBadChannelCfg, LArBadFebCfg
12
13 from LArGeoAlgsNV.LArGMConfig import LArGMCfg
14 result.merge(LArGMCfg(configFlags))
15
16 from LArCabling.LArHVCablingConfig import LArHVCablingCfg
17 result.merge(LArHVCablingCfg(configFlags))
18
19 result.merge(LArBadFebCfg(configFlags))
20
21 from IOVDbSvc.IOVDbSvcConfig import addFolders
22 LArHVCondAlg=CompFactory.LArHVCondAlg
23
24 if configFlags.Input.isMC:
25 hvcond = LArHVCondAlg(doHV=False, doAffectedHV=False)
26 elif not configFlags.Common.isOnline:
27 result.merge(addFolders(configFlags,["/LAR/DCS/HV/BARREl/I16"], "DCS_OFL", className="CondAttrListCollection"))
28 result.merge(addFolders(configFlags,["/LAR/DCS/HV/BARREL/I8"], "DCS_OFL", className="CondAttrListCollection"))
29
30 result.merge(addFolders(configFlags,["/LAR/HVPathologiesOfl/Pathologies"], "LAR_OFL", className="AthenaAttributeList"))
31 if configFlags.GeoModel.Run is not LHCPeriod.Run1:
32 result.merge(addFolders(configFlags,["/LAR/HVPathologiesOfl/Rvalues"], "LAR_OFL", className="AthenaAttributeList"))
33
34 result.merge(LArBadChannelCfg(configFlags))
35
36 LArHVPathologyDbCondAlg=CompFactory.LArHVPathologyDbCondAlg
37 hvpath = LArHVPathologyDbCondAlg(PathologyFolder="/LAR/HVPathologiesOfl/Pathologies",
38 HVMappingKey="LArHVIdMap",
39 HVPAthologyKey="LArHVPathology")
40 result.addCondAlgo(hvpath)
41
42 from LArConfiguration.LArElecCalibDBConfig import LArElecCalibDBCfg
43 result.merge(LArElecCalibDBCfg(configFlags,["HVScaleCorr",]))
44
45 if configFlags.GeoModel.Run is not LHCPeriod.Run1:
46 hvcond = LArHVCondAlg(HVPathologies="LArHVPathology")
47 else:
48 hvcond = LArHVCondAlg(HVPathologies="LArHVPathology",doR=False)
49 hvcond.keyOutputResidualCorr = props.pop("keyOutputResidualCorr", "LArHVScaleCorrRecomputed")
50 hvcond.keyOutputFullCorr = props.pop("keyOutputFullCorr", "")
51 hvcond.fixHV = props.pop("fixHV", [])
52 hvcond.fixCurrent = props.pop("fixCurrent", [])
53 if len(props) > 0: raise ValueError(f"tool properties not modified: {','.join(props.keys())}")
54 result.addCondAlgo(hvcond)
55
56 return result
57
58
60 # used by LArCalib_HVCorrConfig,py and CaloNoiseConfig.py
61 parser.add_argument('-V','--voltage',type=str, default=[], action='append', nargs=1,
62 help="use -V \"<ID> <HV>\" to set the voltage for this line instead of reading it from DCS")
63 parser.add_argument('-I','--current',type=str, default=[], action='append', nargs=1,
64 help="use -I \"<ID> <current>\" to set the current for this line instead of reading it from DCS")
65
66
68 from itertools import chain
69 from re import match
70 v = list(chain.from_iterable(args.voltage))
71 i = list(chain.from_iterable(args.current))
72 for x in v + i:
73 if match(r"\d+\s+\d+\.?\d*", x) is None:
74 raise ValueError("ERROR: invalid voltage/current specification, should be of the form \"<line ID> <HV>\"")
75 return {"fixHV": v, "fixCurrent": i}
76
77
79 """
80 When two CAs configured a LArHVCondAlg, make an attempt at harmonizing the respective
81 alg properties such that CA deduplication won't fail, as long as the resulting
82 behaviour is unchanged; e.g. enabling extra outputs.
83 Properties for which invariance isn't guaranteed are left unchanged.
84 """
85 alg1 = ca1.getCondAlgo("LArHVCondAlg")
86 alg2 = ca2.getCondAlgo("LArHVCondAlg")
87 if alg1 and alg2:
88 for x, y in ((alg1, alg2), (alg2, alg1)):
89 if x.keyOutputResidualCorr == "": x.keyOutputResidualCorr = y.keyOutputResidualCorr
90 if x.keyOutputFullCorr == "": x.keyOutputFullCorr = y.keyOutputFullCorr
91
92
93if __name__=="__main__":
94 from AthenaConfiguration.AllConfigFlags import initConfigFlags
95
96 flags=initConfigFlags()
97
98 nThreads=1
99 flags.Concurrency.NumThreads = nThreads
100 if nThreads>0:
101 flags.Scheduler.ShowDataDeps = True
102 flags.Scheduler.ShowDataFlow = True
103 flags.Scheduler.ShowControlFlow = True
104 flags.Concurrency.NumConcurrentEvents = nThreads
105
106 flags.Input.Files = ["myESD-data.pool.root"]
107 flags.lock()
108
109 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
110 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
111 cfg=MainServicesCfg(flags)
112 cfg.merge(PoolReadCfg(flags))
113
114 cfg.merge( LArHVScaleCfg(flags) )
115
116 cfg.run(10)
bool match(std::string s1, std::string s2)
match the individual directories of two strings
Definition hcg.cxx:359
LArHVScaleCfg(configFlags, **props)
setConsistentHVScaleOutputKeys(ca1, ca2)