ATLAS Offline Software
LArRecUtilsConfig.py
Go to the documentation of this file.
1 """ComponentAccumulator configuration utilities for LArRecUtils
2 
3 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
4 """
5 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory import CompFactory
7 from AthenaCommon.Logging import logging
8 from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg
9 from LArConfiguration.LArElecCalibDBConfig import LArElecCalibDBCfg
10 
11 
12 def LArMCSymCondAlgCfg(flags, name="LArMCSymCondAlg", **kwargs):
13  """Return ComponentAccumulator with configured LArMCSymCondAlg"""
14  acc = ComponentAccumulator()
15  kwargs.setdefault("ReadKey", "LArOnOffIdMap")
16  acc.addCondAlgo(CompFactory.LArMCSymCondAlg(name, **kwargs))
17  return acc
18 
19 
20 def LArAutoCorrNoiseCondAlgCfg(flags, name="LArAutoCorrNoiseCondAlg", **kwargs):
21  """Return ComponentAccumulator with configured LArAutoCorrNoiseCondAlg"""
22 
23  LArAutoCorrNoiseCondAlg=CompFactory.LArAutoCorrNoiseCondAlg
24  # The LArAutoCorrNoiseCondAlgCfg needs the cabling, the sym-object and the AutoCorr
25  acc = LArOnOffIdMappingCfg(flags)
26  acc.merge(LArMCSymCondAlgCfg(flags))
27  acc.merge(LArElecCalibDBCfg(flags,["AutoCorr",]))
28  kwargs.setdefault("nSampl", flags.LAr.ROD.nSamples)
29  acc.addCondAlgo(LArAutoCorrNoiseCondAlg(name, **kwargs))
30  return acc
31 
32 
33 def LArOFCCondAlgCfg (flags, name = 'LArOFCCondAlg', **kwargs):
34 
35  mlog = logging.getLogger ('LArOFCCondAlgCfg')
36  mlog.info(" entering LArOFCCondAlgCfg")
37 
38  kwargs.setdefault ('isMC', True)
39  kwargs.setdefault ('firstSample', flags.LAr.ROD.FirstSample)
40  kwargs.setdefault ('useHighestGainAutoCorr', flags.LAr.ROD.UseHighestGainAutoCorr)
41  kwargs.setdefault('Nminbias',flags.LAr.ROD.NumberOfCollisions)
42  mlog.info("Setup LArOFCCOndAlg Nminbias %f ", flags.LAr.ROD.NumberOfCollisions)
43  #The LArPileUpTool needs: Calbling, Shape, Noise, Pedestal and the (total) AutoCorr
44  acc = LArOnOffIdMappingCfg(flags)
45  requiredConditons=["Shape","Noise","Pedestal"]
46  acc.merge(LArElecCalibDBCfg(flags,requiredConditons))
47  acc.merge(LArAutoCorrTotalCondAlgCfg(flags))
48  LArOFCCondAlg=CompFactory.LArOFCCondAlg
49  acc.addCondAlgo (LArOFCCondAlg (name, **kwargs))
50  return acc
51 
52 
53 def LArOFCSCCondAlgCfg (flags, name = 'LArOFCSCCondAlg', **kwargs):
54 
55  mlog = logging.getLogger ('LArOFCSCCondAlgCfg')
56  mlog.info(" entering LArOFCSCCondAlgCfg")
57 
58  kwargs.setdefault ('isMC', True)
59  kwargs.setdefault ('isSuperCell', True)
60  kwargs.setdefault ('firstSample', flags.LAr.ROD.FirstSample)
61  kwargs.setdefault ('useHighestGainAutoCorr', flags.LAr.ROD.UseHighestGainAutoCorr)
62 
63  from LArCabling.LArCablingConfig import LArOnOffIdMappingSCCfg
64  acc = LArOnOffIdMappingSCCfg(flags)
65  kwargs.setdefault("LArOnOffIdMappingObjKey", 'LArOnOffIdMapSC') # Provided by LArOnOffMappingAlgSC
66  requiredConditions=["ShapeSC","PedestalSC","NoiseSC"]
67  from LArConfiguration.LArElecCalibDBConfig import LArElecCalibDBMCSCCfg
68  acc.merge(LArElecCalibDBMCSCCfg(flags,requiredConditions))
69  kwargs.setdefault("LArShapeObjKey", 'LArShapeSC') # Provided by LArFlatConditionsAlg<LArShapeSC>
70  kwargs.setdefault("LArNoiseObjKey", 'LArNoiseSC') # Provided by LArFlatConditionsAlg<LArNoiseSC>
71  kwargs.setdefault("LArPedestalObjKey", 'LArPedestalSC') # Provided by LArFlatConditionsAlg<LArPedestalSC>
72 
73  acc.merge(LArAutoCorrTotalSCCondAlgCfg(flags))
74  kwargs.setdefault("LArAutoCorrTotalObjKey", 'LArAutoCorrTotalSC') # Provided by LArAutoCorrTotalSCCondAlg
75  kwargs.setdefault("LArOFCObjKey", 'LArOFCSC') # Output
76 
77  kwargs.setdefault('Nminbias',flags.LAr.ROD.NumberOfCollisions)
78  mlog.info("Setup LArOFCSCCOndAlg Nminbias %f ", flags.LAr.ROD.NumberOfCollisions)
79 
80  acc.addCondAlgo (CompFactory.LArOFCCondAlg (name, **kwargs))
81  return acc
82 
83 
84 def LArAutoCorrTotalCondAlgCfg (flags, name = 'LArAutoCorrTotalCondAlg', **kwargs):
85  mlog = logging.getLogger ('LArAutoCorrTotalCondAlgCfg')
86  mlog.info(" entering LArAutoCorrTotalCondAlgCfg")
87  from AthenaCommon.SystemOfUnits import ns
88 
89  kwargs.setdefault('Nsamples', flags.LAr.ROD.nSamples)
90  kwargs.setdefault('firstSample',flags.LAr.ROD.FirstSample)
91  mlog.info("Nsamples %d",flags.LAr.ROD.nSamples)
92  mlog.info("firstSample %d",flags.LAr.ROD.FirstSample)
93  deltaBunch = int(flags.Beam.BunchSpacing/( 25.*ns)+0.5)
94  mlog.info("DeltaBunch %d " , deltaBunch)
95  kwargs.setdefault('deltaBunch',deltaBunch)
96 
97  if flags.LAr.ROD.NumberOfCollisions <= 0:
98  kwargs.setdefault("NoPileUp", True)
99  mlog.info(" no pileup noise in LArAutoCorrTotal ")
100  else:
101  kwargs.setdefault("NoPileUp", False)
102 
103  #The LArAutoCorrTotalAlg needs cabling and
104  #Shape, AutoCorr, Noise, Pedestal, fSampl and MinBias
105  acc = LArOnOffIdMappingCfg(flags)
106  requiredConditons=["Shape","AutoCorr","Noise","Pedestal","fSampl","MinBias"]
107  acc.merge(LArElecCalibDBCfg(flags,requiredConditons))
108  LArAutoCorrTotalCondAlg=CompFactory.LArAutoCorrTotalCondAlg
109  acc.addCondAlgo (LArAutoCorrTotalCondAlg (name, **kwargs))
110  return acc
111 
112 
113 def LArAutoCorrTotalSCCondAlgCfg (flags, name = 'LArAutoCorrTotalSCCondAlg', **kwargs):
114  mlog = logging.getLogger ('LArAutoCorrTotalSCCondAlgCfg')
115  mlog.info(" entering LArAutoCorrTotalSCCondAlgCfg")
116  from AthenaCommon.SystemOfUnits import ns
117 
118  acc = LArOnOffIdMappingCfg(flags)
119  kwargs.setdefault("LArOnOffIdMappingObjKey", 'LArOnOffIdMapSC') # Provided by LArOnOffMappingAlgSC
120 
121  from LArRecUtils.LArADC2MeVSCCondAlgConfig import LArADC2MeVSCCondAlgCfg
122  acc.merge(LArADC2MeVSCCondAlgCfg(flags))
123  kwargs.setdefault("LArADC2MeVObjKey", 'LArADC2MeVSC') # Provided by LArADC2MeVSCCondAlg
124 
125  requiredConditons=["ShapeSC","AutoCorrSC","NoiseSC","PedestalSC","fSamplSC","MinBiasSC"]
126  from LArConfiguration.LArElecCalibDBConfig import LArElecCalibDBMCSCCfg
127  acc.merge(LArElecCalibDBMCSCCfg(flags,requiredConditons))
128  kwargs.setdefault("LArShapeObjKey", 'LArShapeSC') # Provided by LArFlatConditionsAlg<LArShapeSC>
129  kwargs.setdefault("LArAutoCorrObjKey", 'LArAutoCorrSC')# Provided by LArFlatConditionsAlg<LArAutoCorrSC>
130  kwargs.setdefault("LArNoiseObjKey", 'LArNoiseSC') # Provided by LArFlatConditionsAlg<LArNoiseSC>
131  kwargs.setdefault("LArPedestalObjKey", 'LArPedestalSC') # Provided by LArFlatConditionsAlg<LArPedestalSC>
132  kwargs.setdefault("LArfSamplObjKey", 'LArfSamplSC') # Provided by LArFlatConditionsAlg<LArfSamplSC>
133  kwargs.setdefault("LArMinBiasObjKey", 'LArMinBiasSC') # Provided by LArFlatConditionsAlg<LArMinBiasSC>
134 
135  kwargs.setdefault("LArAutoCorrTotalObjKey", 'LArAutoCorrTotalSC') # Output
136 
137  kwargs.setdefault("isSuperCell", True)
138  kwargs.setdefault('Nsamples', flags.LAr.ROD.nSamples)
139  kwargs.setdefault('firstSample',flags.LAr.ROD.FirstSample)
140  mlog.info("Nsamples %d",flags.LAr.ROD.nSamples)
141  mlog.info("firstSample %d",flags.LAr.ROD.FirstSample)
142  deltaBunch = int(flags.Beam.BunchSpacing/( 25.*ns)+0.5)
143  mlog.info("DeltaBunch %d " , deltaBunch)
144  kwargs.setdefault('deltaBunch',deltaBunch)
145 
146 
147  if flags.LAr.ROD.NumberOfCollisions <= 0:
148  kwargs.setdefault("NoPileUp", True)
149  mlog.info(" no pileup noise in LArAutoCorrTotal ")
150  else:
151  kwargs.setdefault("NoPileUp", False)
152 
153  LArAutoCorrTotalCondAlg=CompFactory.LArAutoCorrTotalCondAlg
154  acc.addCondAlgo (LArAutoCorrTotalCondAlg (name, **kwargs))
155  return acc
156 
157 
158 def LArRoIMapCondAlgCfg (flags, name = 'LArRoIMapCondAlg', **kwargs):
159  acc = ComponentAccumulator()
160 
161  from LArCabling.LArCablingConfig import LArFebRodMappingCfg, LArOnOffIdMappingCfg
162  acc.merge (LArFebRodMappingCfg (flags))
163  acc.merge (LArOnOffIdMappingCfg (flags))
164 
165  from CaloConditions.CaloConditionsConfig import LArTTCellMapCfg, CaloTTIdMapCfg
166  acc.merge(LArTTCellMapCfg(flags))
167  acc.merge(CaloTTIdMapCfg(flags))
168 
169  CaloTriggerTowerService = CompFactory.CaloTriggerTowerService # CaloTriggerTool
170  kwargs.setdefault ('TriggerTowerSvc', CaloTriggerTowerService())
171 
172  LArRoIMapCondAlg = CompFactory.LArRoIMapCondAlg
173  acc.addCondAlgo (LArRoIMapCondAlg (name, **kwargs))
174  return acc
175 
176 
177 if __name__ == "__main__":
178  from AthenaConfiguration.AllConfigFlags import initConfigFlags
179  from AthenaConfiguration.TestDefaults import defaultTestFiles
180 
181  print ('--- LArOFCCondAlg 1')
182  flags1 = initConfigFlags()
183  flags1.LAr.ROD.NumberOfCollisions=0
184  flags1.Input.Files = defaultTestFiles.RDO_RUN2
185  flags1.lock()
186  acc1 = LArOFCCondAlgCfg (flags1)
187  acc1.printCondAlgs(summariseProps=True)
188  acc1.wasMerged()
189 
190  print ('--- LArAutoCorrTotalCondAlg')
191  flags4 = initConfigFlags()
192  flags4.LAr.ROD.NumberOfCollisions=0
193  flags4.Input.Files = defaultTestFiles.RDO_RUN2
194  flags4.LAr.ROD.nSamples = 32
195  flags4.lock()
196  acc4 = LArAutoCorrTotalCondAlgCfg (flags4)
197  acc4.printCondAlgs(summariseProps=True)
198  acc4.wasMerged()
199 
200  print ('--- LArRoIMapCondAlg')
201  flags5 = initConfigFlags()
202  flags5.LAr.ROD.NumberOfCollisions=0
203  flags5.Input.Files = defaultTestFiles.RDO_RUN2
204  flags5.lock()
205  acc5 = LArRoIMapCondAlgCfg (flags5)
206  acc5.printCondAlgs(summariseProps=True)
207  acc5.wasMerged()
python.LArElecCalibDBConfig.LArElecCalibDBCfg
def LArElecCalibDBCfg(flags, condObjs)
Definition: LArElecCalibDBConfig.py:47
python.LArRecUtilsConfig.LArOFCCondAlgCfg
def LArOFCCondAlgCfg(flags, name='LArOFCCondAlg', **kwargs)
Definition: LArRecUtilsConfig.py:33
python.LArADC2MeVSCCondAlgConfig.LArADC2MeVSCCondAlgCfg
def LArADC2MeVSCCondAlgCfg(flags)
Definition: LArADC2MeVSCCondAlgConfig.py:6
SystemOfUnits
python.LArElecCalibDBConfig.LArElecCalibDBMCSCCfg
def LArElecCalibDBMCSCCfg(flags, folders, detdb="LAR_OFL")
Definition: LArElecCalibDBConfig.py:241
LArCablingConfig.LArOnOffIdMappingSCCfg
def LArOnOffIdMappingSCCfg(configFlags)
Definition: LArCablingConfig.py:65
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.LArRecUtilsConfig.LArOFCSCCondAlgCfg
def LArOFCSCCondAlgCfg(flags, name='LArOFCSCCondAlg', **kwargs)
Definition: LArRecUtilsConfig.py:53
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
CaloTriggerTowerService
Tool providing the mapping of the online and offline TriggerTower identifiers as well as the TT-cells...
Definition: CaloTriggerTowerService.h:46
python.LArRecUtilsConfig.LArMCSymCondAlgCfg
def LArMCSymCondAlgCfg(flags, name="LArMCSymCondAlg", **kwargs)
Definition: LArRecUtilsConfig.py:12
python.LArRecUtilsConfig.LArAutoCorrTotalSCCondAlgCfg
def LArAutoCorrTotalSCCondAlgCfg(flags, name='LArAutoCorrTotalSCCondAlg', **kwargs)
Definition: LArRecUtilsConfig.py:113
python.CaloConditionsConfig.LArTTCellMapCfg
def LArTTCellMapCfg(flags)
Definition: CaloConditionsConfig.py:17
LArCablingConfig.LArOnOffIdMappingCfg
def LArOnOffIdMappingCfg(configFlags)
Definition: LArCablingConfig.py:62
python.LArRecUtilsConfig.LArAutoCorrNoiseCondAlgCfg
def LArAutoCorrNoiseCondAlgCfg(flags, name="LArAutoCorrNoiseCondAlg", **kwargs)
Definition: LArRecUtilsConfig.py:20
python.LArRecUtilsConfig.LArAutoCorrTotalCondAlgCfg
def LArAutoCorrTotalCondAlgCfg(flags, name='LArAutoCorrTotalCondAlg', **kwargs)
Definition: LArRecUtilsConfig.py:84
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
LArAutoCorrNoiseCondAlg
Definition: LArAutoCorrNoiseCondAlg.h:22
python.CaloConditionsConfig.CaloTTIdMapCfg
def CaloTTIdMapCfg(flags)
Definition: CaloConditionsConfig.py:31
python.LArRecUtilsConfig.LArRoIMapCondAlgCfg
def LArRoIMapCondAlgCfg(flags, name='LArRoIMapCondAlg', **kwargs)
Definition: LArRecUtilsConfig.py:158