ATLAS Offline Software
LArRawChannelBuilderAlgConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 from AthenaConfiguration.ComponentFactory import CompFactory
3 from AthenaConfiguration.Enums import LHCPeriod, ProductionStep
4 from LArRecUtils.LArADC2MeVCondAlgConfig import LArADC2MeVCondAlgCfg
5 from LArConfiguration.LArElecCalibDBConfig import LArElecCalibDBCfg
6 from LArRecUtils.LArRecUtilsConfig import LArOFCCondAlgCfg
7 from LArConfiguration.LArConfigFlags import RawChannelSource
8 
9 def LArRawChannelBuilderAlgCfg(flags, **kwargs):
10 
11  acc = LArADC2MeVCondAlgCfg(flags)
12 
13  kwargs.setdefault("name", "LArRawChannelBuilder")
14  kwargs.setdefault("firstSample", flags.LAr.ROD.nPreceedingSamples if flags.LAr.ROD.nPreceedingSamples!=0 else flags.LAr.ROD.FirstSample)
15  obj = "AthenaAttributeList"
16  dspkey = 'Run2DSPThresholdsKey'
17  from IOVDbSvc.IOVDbSvcConfig import addFolders
18  if flags.Input.isMC:
19  # need OFC configuration, which includes appropriate ElecCalibDb
20  acc.merge(LArOFCCondAlgCfg(flags))
21  kwargs.setdefault("LArRawChannelKey", "LArRawChannels")
22  kwargs.setdefault("ShapeKey", "LArShapeSym")
23  if flags.GeoModel.Run is LHCPeriod.Run1: # back to flat threshold
24  kwargs.setdefault("useDB", False)
25  dspkey = ''
26  else:
27  fld="/LAR/NoiseOfl/DSPThresholds"
28  sgkey=fld
29  dbString="OFLP200"
30  dbInstance="LAR_OFL"
31  acc.merge(addFolders(flags,fld, dbInstance, className=obj, db=dbString))
32 
33  if flags.Common.ProductionStep in [ProductionStep.PileUpPresampling, ProductionStep.PileUpPretracking]:
34  kwargs.setdefault("LArDigitKey", flags.Overlay.BkgPrefix + "LArDigitContainer_MC")
35  else:
36  kwargs.setdefault("LArDigitKey", "LArDigitContainer_MC")
37  else:
38  acc.merge(LArElecCalibDBCfg(flags,("OFC","Shape","Pedestal")))
39  if flags.Overlay.DataOverlay:
40  kwargs.setdefault("LArDigitKey", "LArDigitContainer_MC")
41  kwargs.setdefault("LArRawChannelKey", "LArRawChannels")
42  else:
43  kwargs.setdefault("LArRawChannelKey", "LArRawChannels_FromDigits")
44  if 'COMP200' in flags.IOVDb.DatabaseInstance:
45  fld='/LAR/Configuration/DSPThreshold/Thresholds'
46  obj='LArDSPThresholdsComplete'
47  dspkey = 'Run1DSPThresholdsKey'
48  sgkey='LArDSPThresholds'
49  dbString = 'COMP200'
50  else:
51  fld="/LAR/Configuration/DSPThresholdFlat/Thresholds"
52  sgkey=fld
53  dbString="CONDBR2"
54  dbInstance="LAR_ONL"
55  acc.merge(addFolders(flags,fld, dbInstance, className=obj, db=dbString))
56 
57  if len (dspkey) > 0:
58  kwargs.setdefault(dspkey, sgkey)
59 
60  if flags.LAr.ROD.forceIter or flags.LAr.RawChannelSource is RawChannelSource.Calculated:
61  # iterative OFC procedure
62  kwargs.setdefault('minSample',2)
63  kwargs.setdefault('maxSample',12)
64  kwargs.setdefault('minADCforIterInSigma',4)
65  kwargs.setdefault('minADCforIter',15)
66  kwargs.setdefault('defaultPhase',12)
67  nominalPeakSample=2
68  from LArConditionsCommon.LArRunFormat import getLArFormatForRun
69  larformat=getLArFormatForRun(flags.Input.RunNumbers[0],connstring="COOLONL_LAR/"+flags.IOVDb.DatabaseInstance)
70  if larformat is not None:
71  nominalPeakSample = larformat.firstSample()
72  else:
73  print("WARNING: larformat not found, use nominalPeakSample = 2")
74  nominalPeakSample = 2
75  if (nominalPeakSample > 1) :
76  kwargs.setdefault('DefaultShiftTimeSample',nominalPeakSample-2)
77  else :
78  kwargs.setdefault('DefaultShiftTimeSample',0)
79 
80  acc.addEventAlgo(CompFactory.LArRawChannelBuilderIterAlg(**kwargs))
81  else:
82  #fixed OFC, as in DSP
83  acc.addEventAlgo(CompFactory.LArRawChannelBuilderAlg(**kwargs))
84 
85  return acc
86 
87 
88 if __name__=="__main__":
89 
90  from AthenaConfiguration.AllConfigFlags import initConfigFlags
91  from AthenaCommon.Logging import log
92  from AthenaCommon.Constants import DEBUG
93  log.setLevel(DEBUG)
94 
95  from AthenaConfiguration.TestDefaults import defaultConditionsTags, defaultGeometryTags, defaultTestFiles
96  flags = initConfigFlags()
97  flags.Input.Files = defaultTestFiles.RAW_RUN2
98  flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
99  flags.IOVDb.GlobalTag = defaultConditionsTags.RUN2_DATA
100  # in case of testing iterative OFC:
101  #flags.Input.Files = ['/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecJobTransformTests/data15_1beam/data15_1beam.00260466.physics_L1Calo.merge.RAW._lb1380._SFO-ALL._0001.1']
102  flags.Input.isMC = False
103  flags.Detector.GeometryTile = False
104  flags.lock()
105 
106 
107  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
108  from LArByteStream.LArRawDataReadingConfig import LArRawDataReadingCfg
109 
110  acc=MainServicesCfg(flags)
111  acc.merge(LArRawDataReadingCfg(flags))
112  acc.merge(LArRawChannelBuilderAlgCfg(flags))
113 
114  DumpLArRawChannels=CompFactory.DumpLArRawChannels
115  acc.addEventAlgo(DumpLArRawChannels(LArRawChannelContainerName="LArRawChannels_FromDigits",),sequenceName="AthAlgSeq")
116 
117  acc.run(3)
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.LArADC2MeVCondAlgConfig.LArADC2MeVCondAlgCfg
def LArADC2MeVCondAlgCfg(flags)
Definition: LArADC2MeVCondAlgConfig.py:6
python.LArRawChannelBuilderAlgConfig.LArRawChannelBuilderAlgCfg
def LArRawChannelBuilderAlgCfg(flags, **kwargs)
Definition: LArRawChannelBuilderAlgConfig.py:9
LArRunFormat
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:252
Constants
some useful constants -------------------------------------------------—
python.IOVDbSvcConfig.addFolders
def addFolders(flags, folderStrings, detDb=None, className=None, extensible=False, tag=None, db=None, modifiers='')
Definition: IOVDbSvcConfig.py:72
python.LArRawDataReadingConfig.LArRawDataReadingCfg
def LArRawDataReadingCfg(configFlags, **kwargs)
Definition: LArRawDataReadingConfig.py:10
python.LArRunFormat.getLArFormatForRun
def getLArFormatForRun(run, quiet=False, connstring="COOLONL_LAR/CONDBR2")
Definition: LArRunFormat.py:58
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
Muon::print
std::string print(const MuPatSegment &)
Definition: MuonTrackSteering.cxx:28
DumpLArRawChannels
Definition: DumpLArRawChannels.h:22