11def ToolConstantsCondAlgCfg (flags, key, DetStoreKey='', COOLFolder=''):
12 """Configure a conditions algorithm to convert inline COOL data or detector store data to ToolConstants.
13 KEY is also the key of the output conditions object.
14 For reading from COOL inline data, COOLFOLDER gives the name
15 of the COOL folder; the dta are given by KEY within the folder.
16 The caller should register the folder with IOVDbSvc.
17 For copying a ToolConstants object from the detector store,
18 set DETSTOREKEY to the key of the object to copy."""
19
20 if ((DetStoreKey == '' and COOLFolder == '') or
21 (DetStoreKey != '' and COOLFolder != '')):
22 raise RuntimeError ("ToolConstantsCondAlgCfg: For key " + key + ", exactly one of DetStoreKey or COOLFolder must be specified")
23
24 result = ComponentAccumulator()
25
26 name = 'ToolConstantsCondAlg_' + key
27
28 ToolConstantsCondAlg = CompFactory.ToolConstantsCondAlg
29 alg = ToolConstantsCondAlg (name,
30 COOLFolderKey = COOLFolder,
31 ToolConstantsKey = key,
32 DetStoreKey = DetStoreKey)
33 result.addCondAlgo (alg)
34
35 return result
36
37