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