ATLAS Offline Software
L1CaloRampMaker.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 import glob, sys
4 from AthenaConfiguration.AllConfigFlags import initConfigFlags
5 from AthenaConfiguration.ComponentFactory import CompFactory
6 from TileConfiguration.TileConfigFlags import TileRunType
7 
16 
17 
18 
19 # ===============================================================
20 # main()
21 # ===============================================================
22 def main():
23  from optparse import OptionParser
24  parser = OptionParser(usage = "usage: %prog arguments", version="%prog")
25  parser.add_option("-i","--InputFiles", dest="InputFiles", help="Input raw data (default: %default)")
26  parser.add_option("-l","--doLAr", dest="doLAr", action="store_true", help="Do L1Calo+LAr calibration(default: %default)")
27  parser.add_option("-t","--doTile", dest="doTile", action="store_true", help="Do L1Calo+Tile calibration(default: %default)")
28  parser.set_defaults(InputFiles="/eos/atlas/atlastier0/rucio/data22_calib/calibration_L1CaloEnergyScan/00429494/data22_calib.00429494.calibration_L1CaloEnergyScan.daq.RAW/*", doLAr=False, doTile=False)
29  (options,args) = parser.parse_args()
30 
31  flags = initConfigFlags()
32  flags.Input.Files = glob.glob(options.InputFiles)
33  from AthenaConfiguration.TestDefaults import defaultGeometryTags
34  flags.GeoModel.AtlasVersion = defaultGeometryTags.autoconfigure(flags)
35 
36 
37  flags.Exec.MaxEvents = -1
38  flags.Detector.EnableCalo = True
39  flags.Trigger.enableL1CaloLegacy = True
40  flags.Calo.Cell.doPileupOffsetBCIDCorr=False
41  flags.LAr.doBadFebMasking = False
42  flags.LAr.doHVCorr = False
43  flags.LAr.OFCShapeFolder="4samples1phase"
44  from LArConfiguration.LArConfigFlags import RawChannelSource
45  flags.LAr.RawChannelSource = RawChannelSource.Calculated
46  flags.Tile.doOverflowFit=True
47  flags.Tile.doOptATLAS=True
48  flags.Tile.RunType=TileRunType.PHY
49  flags.Tile.BestPhaseFromCOOL=True
50  flags.Tile.useDCS=False
51  flags.Tile.TimeMaxForAmpCorrection=25
52  flags.Tile.TimeMinForAmpCorrection=-25
53  flags.IOVDb.DBConnection = "sqlite://;schema=energyscanresults.sqlite;dbname=L1CALO"
54  flags.IOVDb.GlobalTag = 'CONDBR2-BLKPA-2022-02'
55 
56 
57  flags.lock()
58 
59  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
60  from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg
61  from TrigT1ResultByteStream.TrigT1ResultByteStreamConfig import L1TriggerByteStreamDecoderCfg
62  from TrigT1CaloByteStream.LVL1CaloRun2ByteStreamConfig import LVL1CaloRun2ReadBSCfg
63 
64  acc = MainServicesCfg(flags)
65  acc.merge( ByteStreamReadCfg(flags) )
66  acc.merge( LVL1CaloRun2ReadBSCfg(flags))
67 
68 
69  from TrigT1CaloCalibUtils.CaloRecoCalibConfig import CaloRecoCalibCfg
70  acc.merge(CaloRecoCalibCfg(flags))
71  acc.getEventAlgo('CaloCellMaker').CaloCellMakerToolNames['TileCellBuilder'].mergeChannels=False
72 
73 
74  from LArCabling.LArCablingConfig import LArFebRodMappingCfg, LArCalibIdMappingCfg
75  acc.merge(LArFebRodMappingCfg(flags))
76  acc.merge(LArCalibIdMappingCfg(flags))
77  from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg
78  acc.merge(LArOnOffIdMappingCfg(flags))
79 
80  from CaloConditions.CaloConditionsConfig import CaloTriggerTowerCfg
81  acc.merge(CaloTriggerTowerCfg(flags))
82 
83 
84  LArADC2MeVCondAlg = CompFactory.LArADC2MeVCondAlg()
85  LArADC2MeVCondAlg.LArHVScaleCorrKey=""
86  acc.addCondAlgo(LArADC2MeVCondAlg, 'AthAlgSeq')
87 
88 
89 
90 
91  # OFC values
92  from IOVDbSvc.IOVDbSvcConfig import addFolders
93  acc.merge(addFolders(flags,"/LAR/ElecCalibOfl/OFC/CaliWave",detDb="LAR_OFL",className="LArOFCComplete",tag="LARElecCalibOflOFCCaliWave-RUN2-UPD3-00"))
94  iovdbsvc=acc.getService("IOVDbSvc")
95  for i in range(0,len(iovdbsvc.Folders)):
96  if (iovdbsvc.Folders[i].find("/LAR/ElecCalibOfl/OFC/PhysWave/RTM/4samples1phase")>=0):
97  del iovdbsvc.Folders[i]
98  break
99  from IOVDbSvc.IOVDbSvcConfig import addOverride
100  acc.merge(addOverride(flags, "/LAR/ElecCalibOfl/OFC/PhysWave/RTM/4samples1phase","LARElecCalibOflOFCPhysWaveRTM4samples1phase-RUN2-UPD3-00"))
101  acc.merge(addOverride(flags,"/LAR/ElecCalibOfl/Shape/RTM/4samples1phase","LARElecCalibOflShapeRTM4samples1phase-RUN2-UPD3-00"))
102  acc.getService("PoolSvc").ReadCatalog+=['file:PoolCat_comcond_castor.xml', 'prfile:poolcond/PoolCat_comcond_castor.xml', 'apcfile:poolcond/PoolCat_comcond_castor.xml']
103 
104 
105  from TrigT1CaloCondSvc.L1CaloCondConfig import L1CaloCondAlgCfg
106  acc.merge(L1CaloCondAlgCfg(flags))
107 
108 
109  decorator = CompFactory.LVL1.L1CaloTriggerTowerDecoratorAlg()
110  decorator.TriggerTowerTools = CompFactory.LVL1.L1CaloxAODOfflineTriggerTowerTools()
111  decorator.DecorName_caloCellEnergy = "CaloCellEnergy"
112  decorator.DecorName_caloCellET = "CaloCellET"
113  acc.addEventAlgo(decorator, 'AthAlgSeq')
114 
115  from AthenaCommon.Constants import DEBUG, INFO
116  RampMaker = CompFactory.L1CaloRampMaker()
117  RampMaker.L1TriggerTowerToolRun3 = CompFactory.LVL1.L1TriggerTowerToolRun3()
118  RampMaker.DoTile = options.doTile
119  RampMaker.DoLAr = options.doLAr
120  RampMaker.EventsPerEnergyStep = 200
121  RampMaker.NumberOfEnergySteps = 11
122  RampMaker.IsGain1 = True
123  RampMaker.CheckProvenance = True
124  RampMaker.TileSaturationCut = 255.
125  RampMaker.OutputLevel = INFO
126  # special region 1.3 < |eta| < 1.5, saturation on tile side.
127  RampMaker.SpecialChannelRange = { 0x6130f02 : 150, 0x7100003 : 150, 0x7180f03 : 150, 0x7180303 : 150, 0x7100200 : 150,
128  0x6130601 : 150, 0x6130302 : 150, 0x61f0303 : 150, 0x71c0e00 : 150, 0x71c0a00 : 150, 0x7180501 : 150, 0x6130003 : 150, 0x7140d01 : 150,
129  0x7140600 : 150, 0x7100d00 : 150, 0x6170900 : 150, 0x61b0901 : 150, 0x7180002 : 150, 0x7140c03 : 150, 0x6170901 : 150, 0x6130702 : 150,
130  0x7180a00 : 150, 0x61b0403 : 150, 0x6130e00 : 150, 0x7180601 : 150, 0x61f0200 : 150, 0x6130002 : 150, 0x61b0601 : 150, 0x71c0e01 : 150,
131  0x7100900 : 150, 0x7100901 : 150, 0x7100501 : 150, 0x6170100 : 150, 0x7140802 : 150, 0x7140003 : 150, 0x7140803 : 150, 0x7180c02 : 150,
132  0x7100f02 : 150, 0x61b0b03 : 150, 0x6170302 : 150, 0x6170303 : 150, 0x7180703 : 150, 0x6170b02 : 150, 0x71c0402 : 150, 0x61f0803 : 150,
133  0x6170b03 : 150, 0x6130101 : 150, 0x71c0601 : 150, 0x7140702 : 150, 0x61f0500 : 150, 0x71c0403 : 150, 0x71c0501 : 150, 0x7140e00 : 150,
134  0x7140703 : 150, 0x7140402 : 150, 0x61f0501 : 150, 0x7140403 : 150, 0x61b0402 : 150, 0x7140e01 : 150, 0x6130703 : 150, 0x7180302 : 150,
135  0x61b0a00 : 150, 0x61b0f02 : 150, 0x61b0f03 : 150, 0x7180100 : 150, 0x61b0303 : 150, 0x61f0e01 : 150, 0x71c0b03 : 150, 0x6130d00 : 150,
136  0x7180101 : 150, 0x7100c03 : 150, 0x61b0a01 : 150, 0x6170802 : 150, 0x7100d01 : 150, 0x6130500 : 150, 0x7100403 : 150, 0x6130d01 : 150,
137  0x7180702 : 150, 0x6170601 : 150, 0x61f0302 : 150, 0x71c0302 : 150, 0x61f0a01 : 150, 0x7180d00 : 150, 0x6130901 : 150, 0x7180d01 : 150,
138  0x71c0303 : 150, 0x61f0901 : 150, 0x7140d00 : 150, 0x71c0a01 : 150, 0x7180c03 : 150, 0x6170c03 : 150, 0x6130201 : 150, 0x61b0702 : 150,
139  0x71c0b02 : 150, 0x7100b02 : 150, 0x71c0600 : 150, 0x61f0600 : 150, 0x7140901 : 150, 0x61f0f02 : 150, 0x6170702 : 150, 0x6130803 : 150,
140  0x6170403 : 150, 0x6170e00 : 150, 0x7180803 : 150, 0x6170703 : 150, 0x71c0c02 : 150, 0x7140f02 : 150, 0x71c0c03 : 150, 0x7100500 : 150,
141  0x7140f03 : 150, 0x6130e01 : 150, 0x61b0b02 : 150, 0x6130c02 : 150, 0x6170101 : 150, 0x7100302 : 150, 0x61b0100 : 150, 0x7180003 : 150,
142  0x7140501 : 150, 0x7100a00 : 150, 0x6130c03 : 150, 0x71c0900 : 150, 0x7100303 : 150, 0x6170002 : 150, 0x61b0101 : 150, 0x7180802 : 150,
143  0x7100b03 : 150, 0x61f0402 : 150, 0x61f0403 : 150, 0x61f0f03 : 150, 0x7180e00 : 150, 0x7100a01 : 150, 0x7100201 : 150, 0x6130402 : 150,
144  0x71c0101 : 150, 0x6170d01 : 150, 0x7140c02 : 150, 0x61f0a00 : 150, 0x6130403 : 150, 0x61b0c03 : 150, 0x6170d00 : 150, 0x71c0702 : 150,
145  0x6130a01 : 150, 0x71c0d01 : 150, 0x6170c02 : 150, 0x61b0803 : 150, 0x7100600 : 150, 0x6170500 : 150, 0x61f0201 : 150, 0x6130600 : 150,
146  0x61b0002 : 150, 0x7180900 : 150, 0x6170501 : 150, 0x7180901 : 150, 0x61b0003 : 150, 0x6130a00 : 150, 0x61f0900 : 150, 0x6170803 : 150,
147  0x7140303 : 150, 0x7140100 : 150, 0x71c0200 : 150, 0x7180f02 : 150, 0x7140500 : 150, 0x71c0201 : 150, 0x6170003 : 150, 0x6130200 : 150,
148  0x7140601 : 150, 0x6170e01 : 150, 0x61f0b02 : 150, 0x61f0b03 : 150, 0x71c0f02 : 150, 0x61b0e00 : 150, 0x61b0703 : 150, 0x71c0002 : 150,
149  0x61b0e01 : 150, 0x7140a01 : 150, 0x6130b02 : 150, 0x71c0802 : 150, 0x7140b02 : 150, 0x71c0803 : 150, 0x7100100 : 150, 0x61f0100 : 150,
150  0x61b0900 : 150, 0x7140b03 : 150, 0x71c0003 : 150, 0x6130f03 : 150, 0x7100101 : 150, 0x7140a00 : 150, 0x7140200 : 150, 0x7140201 : 150,
151  0x61f0702 : 150, 0x7100802 : 150, 0x61b0d00 : 150, 0x61b0600 : 150, 0x61b0d01 : 150, 0x7180402 : 150, 0x61f0c02 : 150, 0x61f0c03 : 150,
152  0x7100703 : 150, 0x61f0002 : 150, 0x6130900 : 150, 0x71c0703 : 150, 0x7180a01 : 150, 0x7180e01 : 150, 0x61f0601 : 150, 0x7140002 : 150,
153  0x61f0802 : 150, 0x7100002 : 150, 0x7100c02 : 150, 0x7100f03 : 150, 0x61b0200 : 150, 0x6130100 : 150, 0x6170f02 : 150, 0x6170200 : 150,
154  0x61b0201 : 150, 0x6170f03 : 150, 0x6170600 : 150, 0x6130501 : 150, 0x7140900 : 150, 0x61b0501 : 150, 0x71c0901 : 150, 0x7100702 : 150,
155  0x61b0500 : 150, 0x7100803 : 150, 0x7180403 : 150, 0x61b0802 : 150, 0x71c0d00 : 150, 0x6130b03 : 150, 0x6130303 : 150, 0x6170201 : 150,
156  0x7180600 : 150, 0x61f0003 : 150, 0x7100e01 : 150, 0x7180500 : 150, 0x71c0f03 : 150, 0x6170a00 : 150, 0x61b0c02 : 150, 0x61f0101 : 150,
157  0x6170402 : 150, 0x7100402 : 150, 0x6130802 : 150, 0x7100e00 : 150, 0x7140302 : 150, 0x61f0e00 : 150, 0x7180b02 : 150, 0x7180b03 : 150,
158  0x71c0500 : 150, 0x7140101 : 150, 0x6170a01 : 150, 0x7180200 : 150, 0x7180201 : 150, 0x61b0302 : 150, 0x61f0703 : 150, 0x71c0100 : 150,
159  0x7100601 : 150, 0x61f0d00 : 150, 0x61f0d01 : 150,
160  # saturating channels
161  0x7120203 : 100
162  }
163 
164 
165  acc.addEventAlgo(RampMaker, 'AthAlgSeq')
166 
167 
168  L1CaloCalib = CompFactory.L1CaloLinearCalibration()
169  acc.addEventAlgo(L1CaloCalib, 'AthAlgSeq')
170 
171  from RegistrationServices.OutputConditionsAlgConfig import OutputConditionsAlgCfg
172  conditionStream = OutputConditionsAlgCfg(flags, "L1CaloRampDataContainer", outputFile="L1CaloRampData.pool.root", WriteIOV = False)
173  acc.merge(conditionStream)
174 
175 
176 
177  outputCondAlgCA = OutputConditionsAlgCfg(flags, "EnergyScanResultOutput", outputFile="dummy.root", WriteIOV = True, ObjectList = ["CondAttrListCollection#/TRIGGER/L1Calo/V1/Results/EnergyScanResults","AthenaAttributeList#/TRIGGER/L1Calo/V1/Results/EnergyScanRunInfo"])
178  acc.merge(outputCondAlgCA)
179 
180 
181 
182  L1CaloDumpRampData = CompFactory.L1CaloDumpRampData(RootStreamName="RAMPDATA")
183  acc.addEventAlgo(L1CaloDumpRampData, 'AthAlgSeq')
184 
185 
186  histSvc = CompFactory.THistSvc( Output = ["AANT DATAFILE='output.root' OPT='RECREATE'"] )
187  histSvc.Output += ["RAMPDATA DATAFILE='graphs.root' OPT='RECREATE'"]
188  acc.addService(histSvc)
189 
190 
191 
192 
193  sys.exit(acc.run().isFailure())
194 
195 
196 
197 # ===============================================================
198 # __main__
199 # ===============================================================
200 if __name__ == '__main__':
201  main()
python.CaloConditionsConfig.CaloTriggerTowerCfg
def CaloTriggerTowerCfg(flags)
Definition: CaloConditionsConfig.py:8
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
L1CaloRampMaker.main
def main()
Example for run TILE/LAr + L1Calo calibration.
Definition: L1CaloRampMaker.py:22
OutputConditionsAlgConfig.OutputConditionsAlgCfg
def OutputConditionsAlgCfg(flags, name="OutputConditionsAlg", outputFile='condobjs.root', **kwargs)
Definition: OutputConditionsAlgConfig.py:5
CaloRecoCalibConfig.CaloRecoCalibCfg
def CaloRecoCalibCfg(configFlags)
Definition: CaloRecoCalibConfig.py:3
python.ByteStreamConfig.ByteStreamReadCfg
def ByteStreamReadCfg(flags, type_names=None)
Definition: Event/ByteStreamCnvSvc/python/ByteStreamConfig.py:25
LArCablingConfig.LArFebRodMappingCfg
def LArFebRodMappingCfg(configFlags)
Definition: LArCablingConfig.py:80
LVL1CaloRun2ByteStreamConfig.LVL1CaloRun2ReadBSCfg
def LVL1CaloRun2ReadBSCfg(flags, forRoIBResultToxAOD=False)
Definition: LVL1CaloRun2ByteStreamConfig.py:121
L1CaloCondConfig.L1CaloCondAlgCfg
def L1CaloCondAlgCfg(flags, readTest=False, Physics=True, Calib1=True, Calib2=True)
Definition: L1CaloCondConfig.py:45
python.IOVDbSvcConfig.addOverride
def addOverride(flags, folder, tag, db=None)
Definition: IOVDbSvcConfig.py:224
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:256
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
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
LArCablingConfig.LArOnOffIdMappingCfg
def LArOnOffIdMappingCfg(configFlags)
Definition: LArCablingConfig.py:62
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
LArCablingConfig.LArCalibIdMappingCfg
def LArCalibIdMappingCfg(configFlags)
Definition: LArCablingConfig.py:83