8 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
9 from AthenaConfiguration.ComponentFactory
import CompFactory
10 from AthenaCommon.Logging
import logging
12 _logger = logging.getLogger(
'Calorimeter::StandardCellWeightCalibration')
16 posDec = numStr.find(
".")
26 selStr = numStr[0:posDec-1]
28 selStr = numStr[0:posDec-1] + numStr[posDec+1:]
39 "Cone4Topo" :
"CaloH1WeightsCone4Topo-02-000",
40 "Cone4Tower" :
"CaloH1WeightsCone4Tower-02-000",
41 "ConeTopo" :
"CaloH1WeightsConeTopo-02-000",
42 "ConeTower" :
"CaloH1WeightsConeTower-02-000",
43 "Kt4Topo" :
"CaloH1WeightsKt4Topo-02-000",
44 "Kt4Tower" :
"CaloH1WeightsKt4Tower-02-000",
45 "Kt6Topo" :
"CaloH1WeightsKt6Topo-02-000",
46 "Kt6Tower" :
"CaloH1WeightsKt6Tower-02-000",
47 "Cone4TopoAtlFastII" :
"CaloH1WeightsCone4TopoAtlFastII-02-000",
48 "Cone4TowerAtlFastII" :
"CaloH1WeightsCone4TowerAtlFastII-02-000",
49 "ConeTopoAtlFastII" :
"CaloH1WeightsConeTopoAtlFastII-02-000",
50 "ConeTowerAtlFastII" :
"CaloH1WeightsConeTowerAtlFastII-02-000",
51 "Kt4TopoAtlFastII" :
"CaloH1WeightsKt4TopoAtlFastII-02-000",
52 "Kt4TowerAtlFastII" :
"CaloH1WeightsKt4TowerAtlFastII-02-000",
53 "Kt6TopoAtlFastII" :
"CaloH1WeightsKt6TopoAtlFastII-02-000",
54 "Kt6TowerAtlFastII" :
"CaloH1WeightsKt6TowerAtlFastII-02-000",
57 "Cone4Topo" :
"CaloH1WeightsCone4Topo-01-000",
58 "Cone4Tower" :
"CaloH1WeightsCone4Tower-01-000",
59 "ConeTopo" :
"CaloH1WeightsConeTopo-01-000",
60 "ConeTower" :
"CaloH1WeightsConeTower-01-000",
61 "Kt4Topo" :
"CaloH1WeightsKt4Topo-01-000",
62 "Kt4Tower" :
"CaloH1WeightsKt4Tower-01-000",
63 "Kt6Topo" :
"CaloH1WeightsKt6Topo-01-000",
64 "Kt6Tower" :
"CaloH1WeightsKt6Tower-01-000",
65 "Cone4TopoAtlFastII" :
"CaloH1WeightsCone4TopoAtlFastII-01-000",
66 "Cone4TowerAtlFastII" :
"CaloH1WeightsCone4TowerAtlFastII-01-000",
67 "ConeTopoAtlFastII" :
"CaloH1WeightsConeTopoAtlFastII-01-000",
68 "ConeTowerAtlFastII" :
"CaloH1WeightsConeTowerAtlFastII-01-000",
69 "Kt4TopoAtlFastII" :
"CaloH1WeightsKt4TopoAtlFastII-01-000",
70 "Kt4TowerAtlFastII" :
"CaloH1WeightsKt4TowerAtlFastII-01-000",
71 "Kt6TopoAtlFastII" :
"CaloH1WeightsKt6TopoAtlFastII-01-000",
72 "Kt6TowerAtlFastII" :
"CaloH1WeightsKt6TowerAtlFastII-01-000",
75 "Cone4Topo" :
"CaloH1WeightsCone4Topo-00-000",
76 "Cone4Tower" :
"CaloH1WeightsCone4Tower-00-000",
77 "ConeTopo" :
"CaloH1WeightsConeTopo-00-000",
78 "ConeTower" :
"CaloH1WeightsConeTower-00-000",
79 "Kt4Topo" :
"CaloH1WeightsKt4Topo-00-000",
80 "Kt4Tower" :
"CaloH1WeightsKt4Tower-00-000",
81 "Kt6Topo" :
"CaloH1WeightsKt6Topo-00-000",
82 "Kt6Tower" :
"CaloH1WeightsKt6Tower-00-000",
83 "Cone4TopoAtlFastII" :
"CaloH1WeightsCone4TopoAtlFastII-00-000",
84 "Cone4TowerAtlFastII" :
"CaloH1WeightsCone4TowerAtlFastII-00-000",
85 "ConeTopoAtlFastII" :
"CaloH1WeightsConeTopoAtlFastII-00-000",
86 "ConeTowerAtlFastII" :
"CaloH1WeightsConeTowerAtlFastII-00-000",
87 "Kt4TopoAtlFastII" :
"CaloH1WeightsKt4TopoAtlFastII-00-000",
88 "Kt4TowerAtlFastII" :
"CaloH1WeightsKt4TowerAtlFastII-00-000",
89 "Kt6TopoAtlFastII" :
"CaloH1WeightsKt6TopoAtlFastII-00-000",
90 "Kt6TowerAtlFastII" :
"CaloH1WeightsKt6TowerAtlFastII-00-000",
97 forceOverrideFolder =
False
100 return H1Calibration.forceOverrideFolder
or flags.Input.isMC
111 "Cone4Topo" :
"CaloH1WeightsCone4Topo-"+dbtag,
112 "Cone4Tower" :
"CaloH1WeightsCone4Tower-"+dbtag,
113 "ConeTopo" :
"CaloH1WeightsConeTopo-"+dbtag,
114 "ConeTower" :
"CaloH1WeightsConeTower-"+dbtag,
115 "Kt4Topo" :
"CaloH1WeightsKt4Topo-"+dbtag,
116 "Kt4Tower" :
"CaloH1WeightsKt4Tower-"+dbtag,
117 "Kt6Topo" :
"CaloH1WeightsKt6Topo-"+dbtag,
118 "Kt6Tower" :
"CaloH1WeightsKt6Tower-"+dbtag
123 ddv = flags.GeoModel.AtlasVersion
125 if ddv.startswith(
"ATLAS-CSC"):
126 if ddv >=
"ATLAS-CSC-01-00-01":
127 return H1Calibration.calibdicV13
129 return H1Calibration.calibdicV12
130 elif ddv.startswith(
"ATLAS-Comm"):
131 return H1Calibration.calibdicV13
133 return H1Calibration.calibdicV14
137 """ Retrieves calibration DB parameters from jet finder specs, returns a triplet (key,folder,tag)
140 input = input.replace(
'H1',
'')
145 caldict = H1Calibration.calibration_dict(flags)
147 calibtype = finder+param+input
149 if calibtype
in caldict:
150 key =
'H1Weights' + calibtype
151 tag = caldict[calibtype]
153 folder =
'/CALO/Ofl/'
154 tag =
"CALOOfl"+tag[4:]
157 folder +=
'H1Weights/' + key
159 return (key,folder,tag)
165 if 'Topo' in input:
return H1Calibration.getCalibDBParams(flags,
'Cone',0.4,
'H1Topo',onlyCellWeight,isMC)
166 else:
return H1Calibration.getCalibDBParams(flags,
'Cone',0.4,
'H1Tower',onlyCellWeight,isMC)
168 _logger.warning(
"getCalibDBParams: no dedicated calibration for %s %s %s", finder,mainparam,input)
169 if finder
not in [
'Kt',
'Cone' ] : finder =
'Cone'
170 if input
not in [
'Topo',
'Tower' ] : input =
'Tower'
171 if finder ==
'Kt' : l = [ 0.4, 0.6 ]
172 else: l = [ 0.4, 0.7 ]
173 (m,mainparam) =
min( [ (abs(p-mainparam),p)
for p
in l ] )
174 _logger.warning(
"getCalibDBParams: defaulted calibration to %s %s %s", finder,mainparam,input)
175 return H1Calibration.getCalibDBParams(flags,finder,mainparam,input,onlyCellWeight,isMC)
180 Returns a fully configured H1-style cell weighting calibration tool. This tool only uses cell weights!
182 finder/str : name of jet finder
183 input/str : input objects triggers calibration weights
184 mainparam/float: size parameter for jet
187 (key,folder,tag) = H1Calibration.getCalibDBParams(flags,finder,mainparam,input, onlyCellWeight, flags.Input.isMC)
188 from IOVDbSvc.IOVDbSvcConfig
import addFolders
189 result.merge(
addFolders(flags,folder,
'CALO_OFL' if flags.Input.isMC
else 'CALO',className =
'CaloRec::ToolConstants',
190 tag=tag
if H1Calibration.overrideFolder(flags)
else None))
193 toolName = finder +
editParm(mainparam) + input
194 cellcalibtool = CompFactory.H1WeightToolCSC12Generic(
"H1Weight"+toolName,
196 result.setPrivateTools(cellcalibtool)