ATLAS Offline Software
LArConfigFlags.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.AthConfigFlags import AthConfigFlags
4 from AthenaConfiguration.Enums import FlagEnum
5 from AthenaCommon.Logging import logging
6 
7 class RawChannelSource(FlagEnum):
8  Input="Input" # read from the input-file, bytestream or RDO
9  Calculated="Calculated" #re-computed by the offline LArRawChannelBuilder
10  Both="Both" # overwrite the digits computed
11 
12 
14  lcf=AthConfigFlags()
15 
16  lcf.addFlag("LAr.doAlign",lambda prevFlags : prevFlags.GeoModel.Layout=="atlas")
17  lcf.addFlag("LAr.doHVCorr",lambda prevFlags : not prevFlags.Input.isMC)
18  lcf.addFlag("LAr.doCellEmMisCalib",lambda prevFlags : prevFlags.Input.isMC)
19 
20  lcf.addFlag("LAr.RawChannelSource", _determineRawChannelSource, type=RawChannelSource)
21 
22  lcf.addFlag("LAr.doCellNoiseMasking",True)
23  lcf.addFlag("LAr.doCellSporadicNoiseMasking",True)
24  lcf.addFlag("LAr.doBadFebMasking",lambda prevFlags : not prevFlags.Input.isMC)
25 
26  # Include MC shape folder
27  lcf.addFlag("LAr.UseMCShape", True)
28  # Name of sqlite file containing Electronic Calibration values
29  lcf.addFlag("LAr.ElecCalibSqlite", "")
30  # Load Electronic Calibration constants
31  lcf.addFlag("LAr.LoadElecCalib", True)
32  # Folder name for Optimal Filtering coefficients (empty means default)
33  lcf.addFlag("LAr.OFCShapeFolder", "")
34  # Load conditions with this `run-number' string
35  lcf.addFlag("LAr.ForceIOVRunNumber", "")
36  # Include Shape folder
37  lcf.addFlag("LAr.UseShape", True)
38  # DataBase server string
39  lcf.addFlag("LAr.DBConnection", "")
40 
41  # Number of collisions to optimize OFC for pileup
42  lcf.addFlag("LAr.ROD.NumberOfCollisions",0)
43  # Number of samples in LAr digitization + ROD emulation
44  lcf.addFlag("LAr.ROD.nSamples", 5)
45  # Index of first sample in LAr digitization + ROD emulation
46  lcf.addFlag("LAr.ROD.FirstSample", 0)
47  # Number of preceeding samples (necessary for phase 2 simulation)
48  lcf.addFlag("LAr.ROD.nPreceedingSamples", 0)
49  # Force using the highest gain autocorrelation function
50  # when doing OFC optimization
51  lcf.addFlag("LAr.ROD.UseHighestGainAutoCorr", False)
52  # Flag not to use pileup noise neither average constrain in EMB and EMEC-OW,
53  # and both pileup noise and average constrain everywhere else
54  lcf.addFlag("LAr.ROD.DoOFCMixedOptimization", False)
55 
57  lcf.addFlag("LAr.ROD.UseDelta", 0)
58  # Force using the iterative OFC procedure
59  lcf.addFlag("LAr.ROD.forceIter",False)
60  # NN based energy reconstruction
61  lcf.addFlag("LAr.ROD.NNRawChannelBuilding", False)
62  lcf.addFlag("LAr.ROD.nnJson", "")
63  lcf.addFlag("LAr.ROD.nnOutputNode", "")
64  lcf.addFlag("LAr.ROD.nnInputNode", "")
65  # default LArRawSC container
66  lcf.addFlag("LAr.LATOME.DTInfoForL1","SC_ET_ID")
67  # storing SC CaloCellContainer with bcid'ed energies
68  lcf.addFlag("LAr.DT.storeET_ID",False)
69  lcf.addFlag("LAr.DT.ET_IDKey","SCell")
70  lcf.addFlag("LAr.DT.doSCMasking",True)
71  # storing SC CaloCellContainers +-1 around bcid'ed energies
72  lcf.addFlag("LAr.DT.storeET_additional",False)
73  lcf.addFlag("LAr.DT.ET_PlusKey","SCellPlus")
74  lcf.addFlag("LAr.DT.ET_MinusKey","SCellMinus")
75 
76 
78  lcf.addFlag("LAr.NoisyRO.CellQuality", 4000)
79  # Number of channels above quality cut
80  lcf.addFlag("LAr.NoisyRO.BadChanPerFEB", 30)
81  # Number of Bad FEBs per partition cut
82  lcf.addFlag("LAr.NoisyRO.BadFEBCut", 5)
83  # Number of channels to declare MNB-Loose
84  lcf.addFlag("LAr.NoisyRO.MNBLooseCut", 5)
85  # Number of channels to declare MNB-Tight
86  lcf.addFlag("LAr.NoisyRO.MNBTightCut", 17)
87  # Number of channels to declare MNB-Tight wir PS veto
88  lcf.addFlag("LAr.NoisyRO.MNBTight_PsVetoCut", [13,3])
89 
90  return lcf
91 
92 
93 _lArRunInfo=None
94 
95 def _getLArRunInfo(prevFlags):
96  log = logging.getLogger('LArConfigFlags.getLArRunInfo')
97  global _lArRunInfo #Cache of lar run info
98  if _lArRunInfo is None:
99  from LArConditionsCommon.LArRunFormat import getLArFormatForRun
100  runnbr=prevFlags.Input.RunNumbers[0] #If more than one run, assume config for first run is valid for all runs
101  dbStr="COOLONL_LAR/"+prevFlags.IOVDb.DatabaseInstance
102  _lArRunInfo=getLArFormatForRun(run=runnbr,connstring=dbStr)
103  log.info("Got LArRunInfo for run %d",runnbr)
104  return _lArRunInfo
105 
106 
108  log = logging.getLogger('LArConfigFlags.determineRawChannelSource')
109  if prevFlags.Input.isMC or prevFlags.Overlay.DataOverlay:
110  return RawChannelSource.Input
111 
112  lri=_getLArRunInfo(prevFlags)
113  #runType: 0=RawData, 1=RawDataResult, 2=Result
114  if lri is None or lri.runType is None:
115  log.warning("WARNING do not have LArRunInfo !")
116  return RawChannelSource.Both
117  log.info("runType %d",lri.runType())
118  if (lri.runType()==0):
119  return RawChannelSource.Calculated #Have only digits in bytestream
120  elif (lri.runType()==1 or lri.runType()==2):
121  return RawChannelSource.Both #Have both, digits and raw-channels in bytestream
122  else:
123  log.warning("Unknown LAr run type %i",lri.runType())
124  return RawChannelSource.Both
python.LArConfigFlags._getLArRunInfo
def _getLArRunInfo(prevFlags)
Definition: LArConfigFlags.py:95
LArRunFormat
python.LArConfigFlags.RawChannelSource
Definition: LArConfigFlags.py:7
python.LArConfigFlags.createLArConfigFlags
def createLArConfigFlags()
Definition: LArConfigFlags.py:13
python.LArRunFormat.getLArFormatForRun
def getLArFormatForRun(run, quiet=False, connstring="COOLONL_LAR/CONDBR2")
Definition: LArRunFormat.py:58
python.LArConfigFlags._determineRawChannelSource
def _determineRawChannelSource(prevFlags)
Definition: LArConfigFlags.py:107