ATLAS Offline Software
CaloBCIDCoeffsCondAlgConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 # File: CaloRec/python/CaloBCIDCoeffsCondAlgConfig.py
4 # Created: Mar 2020, sss
5 # Purpose: Configure CaloBCIDCoeffsCondAlg.
6 
7 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
8 from AthenaConfiguration.ComponentFactory import CompFactory
9 from IOVDbSvc.IOVDbSvcConfig import addFolderList
10 
11 
13  result = ComponentAccumulator()
14 
15  from LArRecUtils.LArRecUtilsConfig import LArMCSymCondAlgCfg
16  result.merge (LArMCSymCondAlgCfg (flags))
17 
18  if flags.Input.isMC is False:
19  #For data, the regular shape is the 4-sample one used to Q-factor computation by LArRawChannelBuilder
20  #Here we need a 32-sample, symmetrized shape. Therfore the re-key'ing and the dedicated LArPileUpShapeSymCondAlg
21 
22  if flags.Common.isOnline:
23  result.merge(addFolderList(flags, (('/LAR/LArPileup/LArPileupShape<key>LArShape32</key>', 'LAR_ONL', 'LArShape32MC'),
24  ('/LAR/LArPileup/LArPileupAverage','LAR_ONL','LArMinBiasAverageMC')) ))
25  else:
26  result.merge(addFolderList(flags, (('/LAR/ElecCalibOfl/LArPileupShape<key>LArShape32</key>','LAR_OFL','LArShape32MC'),
27  ('/LAR/ElecCalibOfl/LArPileupAverage','LAR_OFL','LArMinBiasAverageMC')) ))
28 
29  LArMinBiasAverageSymAlg=CompFactory.getComp("LArSymConditionsAlg<LArMinBiasAverageMC,LArMinBiasAverageSym>")
30  result.addCondAlgo(LArMinBiasAverageSymAlg("LArPileUpAvgSymCondAlg",ReadKey="LArPileupAverage",WriteKey="LArPileupAverageSym"))
31 
32  LArShapeSymAlg=CompFactory.getComp("LArSymConditionsAlg<LArShape32MC,LArShape32Sym>")
33  result.addCondAlgo(LArShapeSymAlg("LArPileUpShapeSymCondAlg",ReadKey="LArShape32",WriteKey="LArShape32Sym"))
34 
35  ShapeKey = 'LArShape32Sym'
36 
37  from LArConfiguration.LArElecCalibDBConfig import LArElecCalibDBCfg
38  result.merge (LArElecCalibDBCfg (flags, ['OFC']))
39  else:
40  from LArRecUtils.LArADC2MeVCondAlgConfig import LArADC2MeVCondAlgCfg
41  from LArRecUtils.LArRecUtilsConfig import LArOFCCondAlgCfg, LArAutoCorrTotalCondAlgCfg
42 
43  result.merge (LArADC2MeVCondAlgCfg (flags))
44  result.merge (LArOFCCondAlgCfg (flags))
45  result.merge (LArAutoCorrTotalCondAlgCfg (flags))
46 
47  result.merge(addFolderList(flags, (('/LAR/ElecCalibMC/Shape','LAR_OFL','LArShape32MC'),
48  ('/LAR/ElecCalibMC/LArPileupAverage', 'LAR_OFL', 'LArMinBiasAverageMC')) ))
49 
50  LArMinBiasAverageSymAlg=CompFactory.getComp("LArSymConditionsAlg<LArMinBiasAverageMC,LArMinBiasAverageSym>")
51  result.addCondAlgo(LArMinBiasAverageSymAlg("LArPileUpAvgSymCondAlg",ReadKey="LArPileupAverage",WriteKey="LArPileupAverageSym"))
52 
53  ShapeKey = 'LArShapeSym'
54 
55 
56  CaloBCIDCoeffsCondAlg = CompFactory.CaloBCIDCoeffsCondAlg # CaloRec
57  alg = CaloBCIDCoeffsCondAlg ('CaloBCIDCoeffsCondAlg',
58  MCSymKey = 'LArMCSym',
59  OFCKey = 'LArOFC',
60  ShapeKey = ShapeKey,
61  MinBiasAvgKey = 'LArPileupAverageSym',
62  OutputCoeffsKey = 'CaloBCIDCoeffs')
63  result.addCondAlgo (alg)
64 
65  return result
66 
67 
68 if __name__ == "__main__":
69  from AthenaConfiguration.AllConfigFlags import initConfigFlags
70  from AthenaConfiguration.TestDefaults import defaultGeometryTags, defaultTestFiles
71 
72  only = ['CaloBCIDCoeffsCondAlg',
73  'LArPileUpAvgSymCondAlg',
74  'LArPileUpShapeSymCondAlg']
75 
76  print ('--- data')
77  flags1 = initConfigFlags()
78  flags1.Input.Files = defaultTestFiles.RAW_RUN2
79  flags1.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
80  flags1.lock()
81  acc1 = CaloBCIDCoeffsCondAlgCfg (flags1)
82  acc1.printConfig(summariseProps=True, onlyComponents=only)
83  print ('IOVDbSvc:', acc1.getService('IOVDbSvc').Folders)
84  acc1.wasMerged()
85 
86  print ('--- mc')
87  flags2 = initConfigFlags()
88  flags2.Input.Files = defaultTestFiles.ESD
89  flags2.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
90  flags2.lock()
91  acc2 = CaloBCIDCoeffsCondAlgCfg (flags2)
92  acc2.printConfig(summariseProps=True, onlyComponents=only)
93  print ('IOVDbSvc:', acc2.getService('IOVDbSvc').Folders)
94  acc2.wasMerged()
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.IOVDbSvcConfig.addFolderList
def addFolderList(flags, listOfFolderInfoTuple, extensible=False, db=None, modifiers='')
Definition: IOVDbSvcConfig.py:90
python.CaloBCIDCoeffsCondAlgConfig.CaloBCIDCoeffsCondAlgCfg
def CaloBCIDCoeffsCondAlgCfg(flags)
Definition: CaloBCIDCoeffsCondAlgConfig.py:12
python.LArElecCalibDBConfig.LArShapeSymAlg
LArShapeSymAlg
Definition: LArElecCalibDBConfig.py:19
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.LArElecCalibDBConfig.LArMinBiasAverageSymAlg
LArMinBiasAverageSymAlg
Definition: LArElecCalibDBConfig.py:12