7 from AthenaConfiguration.ComponentAccumulator 
import ComponentAccumulator
 
    8 from AthenaConfiguration.ComponentFactory 
import CompFactory
 
   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.""" 
   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")
 
   26     name = 
'ToolConstantsCondAlg_' + key
 
   28     ToolConstantsCondAlg = CompFactory.ToolConstantsCondAlg 
 
   29     alg = ToolConstantsCondAlg (name,
 
   30                                 COOLFolderKey = COOLFolder,
 
   31                                 ToolConstantsKey = key,
 
   32                                 DetStoreKey = DetStoreKey)
 
   33     result.addCondAlgo (alg)
 
   38 if __name__ == 
"__main__":
 
   39     from AthenaConfiguration.AllConfigFlags 
import initConfigFlags
 
   41     flags.Input.Files = []
 
   44     print (
'--- detstore')
 
   45     acc1 = ToolConstantsCondAlgCfg (flags, 
'key1', DetStoreKey=
'ds1')
 
   46     acc1.printConfig(summariseProps=
True)
 
   50     acc2 = ToolConstantsCondAlgCfg (flags, 
'key2', COOLFolder=
'folder2')
 
   51     acc2.printConfig(summariseProps=
True)
 
   56         acc3 = ToolConstantsCondAlgCfg (flags, 
'key3', COOLFolder=
'folder3', DetStoreKey=
'ds3')
 
   60         assert 0, 
'not caught'