5 if __name__ ==
'__main__':
11 from AthenaCommon.Logging
import logging
12 local_log = logging.getLogger(
'run_gep')
14 error = local_log.error
17 p = argparse.ArgumentParser()
18 p.add_argument(
'-i',
'--input',
21 help=
'Key of the input from TrigValInputs to be used, default=%(default)s')
22 p.add_argument(
'-e',
'--execute',
24 help=
'After building the configuration, also process a few events')
25 p.add_argument(
'-n',
'--nevents',
29 help=
'Number of events to process if --execute is used, default=%(default)s')
30 p.add_argument(
'-g',
'--gepInput',
34 help=
'use input files previously used for GEP jobs')
35 p.add_argument(
'-f',
'--gepInputRun3',
37 help=
'use Run3 (with jFexJetRoI) input file')
39 p.add_argument(
'-c',
'--clusterAlgs',
41 help=
'commma separated list of stategies for GepClusterAlg: [WFS, Calo420]')
43 p.add_argument(
'-j',
'--jetAlgs',
45 help=
'commma separated list of stategies for GepJetAlg:[Cone, ModAntikT]')
49 clusterAlgNames = args.clusterAlgs.split(
',')
50 jetAlgNames = args.jetAlgs.split(
',')
51 info(
'GEP clusterAlgs: ' +
str(clusterAlgNames))
52 info(
'GEP jetAlgs: ' +
str(jetAlgNames))
57 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
58 from TrigValTools.TrigValSteering
import Input
60 assert not (args.gepInput
and args.gepInputRun3)
66 "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecExRecoTest/mc20e_13TeV/"
67 "valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.ESD.e4993_s3227_r12689/myESD.pool.root")
68 flags.Input.Files = [ifile]
69 elif args.gepInputRun3:
75 ifile =
'/afs/cern.ch/work/m/martyniu/public/forPeter/RDO/tmp.RDO'
76 flags.Input.Files = [ifile]
78 flags.Input.Files = Input.get_input(args.input).paths
80 if not flags.Input.isMC:
81 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
82 flags.GeoModel.AtlasVersion = defaultGeometryTags.autoconfigure(flags)
84 info(
'Command line args: ' +
str(args))
86 flags.Output.AODFileName =
'AOD.pool.root'
87 flags.Common.isOnline =
not flags.Input.isMC
88 flags.Exec.MaxEvents = args.nevents
89 flags.Concurrency.NumThreads = 1
90 flags.Concurrency.NumConcurrentEvents = 1
91 flags.Scheduler.ShowDataDeps =
True
92 flags.Scheduler.CheckDependencies =
True
93 flags.Scheduler.ShowDataFlow =
True
94 flags.Trigger.EDMVersion = 3
95 flags.Trigger.doLVL1 =
True
96 flags.Trigger.enableL1CaloPhase1 =
True
99 from AthenaConfiguration.DetectorConfigFlags
import setupDetectorFlags
108 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
111 from AthenaConfiguration.Enums
import Format
112 if flags.Input.Format == Format.POOL:
113 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
116 from TriggerJobOpts.TriggerByteStreamConfig
import ByteStreamReadCfg
119 from TrigConfigSvc.TrigConfigSvcCfg
import L1ConfigSvcCfg, generateL1Menu, createL1PrescalesFileFromMenu
124 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
126 'xAOD::eFexEMRoIContainer#L1_eEMRoI',
'xAOD::eFexEMRoIAuxContainer#L1_eEMRoIAux.',
127 'xAOD::eFexTauRoIContainer#L1_eTauRoI',
'xAOD::eFexTauRoIAuxContainer#L1_eTauRoIAux.',
128 'xAOD::jFexTauRoIContainer#L1_jFexTauRoI',
'xAOD::jFexTauRoIAuxContainer#L1_jFexTauRoIAux.',
129 'xAOD::jFexSRJetRoIContainer#L1_jFexSRJetRoI',
'xAOD::jFexSRJetRoIAuxContainer#L1_jFexSRJetRoIAux.',
130 'xAOD::jFexLRJetRoIContainer#L1_jFexLRJetRoI',
'xAOD::jFexLRJetRoIAuxContainer#L1_jFexLRJetRoIAux.',
131 'xAOD::jFexMETRoIContainer#L1_jFexMETRoI',
'xAOD::jFexMETRoIAuxContainer#L1_jFexMETRoIAux.',
132 'xAOD::jFexSumETRoIContainer#L1_jFexSumETRoI',
'xAOD::jFexSumETRoIAuxContainer#L1_jFexSumETRoIAux.',
133 'xAOD::gFexJetRoIContainer#L1_gFexSRJetRoI',
'xAOD::gFexJetRoIAuxContainer#L1_gFexSRJetRoIAux.',
134 'xAOD::gFexJetRoIContainer#L1_gFexLRJetRoI',
'xAOD::gFexJetRoIAuxContainer#L1_gFexLRJetRoIAux.',
135 'xAOD::gFexJetRoIContainer#L1_gFexRhoRoI',
'xAOD::gFexJetRoIAuxContainer#L1_gFexRhoRoIAux.',
136 'xAOD::gFexGlobalRoIContainer#L1_gScalarEJwoj',
'xAOD::gFexGlobalRoIAuxContainer#L1_gScalarEJwojAux.',
137 'xAOD::gFexGlobalRoIContainer#L1_gMETComponentsJwoj',
'xAOD::gFexGlobalRoIAuxContainer#L1_gMETComponentsJwojAux.',
138 'xAOD::gFexGlobalRoIContainer#L1_gMHTComponentsJwoj',
'xAOD::gFexGlobalRoIAuxContainer#L1_gMHTComponentsJwojAux.',
139 'xAOD::gFexGlobalRoIContainer#L1_gMSTComponentsJwoj',
'xAOD::gFexGlobalRoIAuxContainer#L1_gMSTComponentsJwojAux.',
140 'xAOD::gFexGlobalRoIContainer#L1_gMETComponentsNoiseCut',
'xAOD::gFexGlobalRoIAuxContainer#L1_gMETComponentsNoiseCutAux.',
141 'xAOD::gFexGlobalRoIContainer#L1_gMETComponentsRms',
'xAOD::gFexGlobalRoIAuxContainer#L1_gMETComponentsRmsAux.',
142 'xAOD::gFexGlobalRoIContainer#L1_gScalarENoiseCut',
'xAOD::gFexGlobalRoIAuxContainer#L1_gScalarENoiseCutAux.',
143 'xAOD::gFexGlobalRoIContainer#L1_gScalarERms',
'xAOD::gFexGlobalRoIAuxContainer#L1_gScalarERmsAux.',
151 from L1CaloFEXSim.L1CaloFEXSimCfg
import L1CaloFEXSimCfg
155 from CaloRec.CaloCellMakerConfig
import CaloCellMakerCfg
161 from CaloRec.CaloTopoClusterConfig
import CaloTopoClusterCfg
163 acc.merge(calo_acc420)
176 doLCCalib = flags.Calo.TopoCluster.doTopoClusterLocalCalib
177 clustersname =
'CaloCalTopoClusters422' if doLCCalib
else 'CaloTopoClusters422'
179 clustersname=clustersname)
182 for comp
in cfg.getSequence().Members:
183 if comp.name ==
'CaloCalTopoClusters422Maker':
188 if not hasattr(alg,
'ClusterMakerTools'):
191 for tool
in alg.ClusterMakerTools:
192 if tool.name ==
'TopoMaker':
193 assert tool.CellThresholdOnEorAbsEinSigma == 0
194 tool.CellThresholdOnEorAbsEinSigma = 2.0
200 if not hasattr(alg,
'ClusterCorrectionTools'):
203 for tool
in alg.ClusterCorrectionTools:
205 if tool.name ==
'CaloClusterSnapshot':
206 assert tool.OutputName ==
'CaloTopoClusters'
208 tool.OutputName =
'CaloCalTopoClusters422Snap'
210 tool.OutputName =
'CaloTopoClusters422Snap'
218 error(
'no 422 cluster alg')
224 acc.merge(calo_acc422)
227 gepAlgs_output_level = DEBUG
229 from TrigGepPerf.GepClusterTimingAlgConfig
import GepClusterTimingAlgCfg
231 OutputLevel=gepAlgs_output_level))
240 from TrigGepPerf.GepPi0AlgConfig
import GepPi0AlgCfg
245 caloCellsProducer=
"caloCellsFromCaloCells",
246 OutputLevel=gepAlgs_output_level))
249 known_cluster_algs = [
'WFS',
'Calo420',
'Calo422']
250 for a
in clusterAlgNames:
251 assert a
in known_cluster_algs
253 known_jet_algs = [
'Cone',
'ModAntikT']
254 for a
in jetAlgNames:
255 assert a
in known_jet_algs
261 caloclustercolls = {(
'Calo420',
False) :
'CaloTopoClusters',
262 (
'Calo420',
True) :
'CaloCalTopoClusters',
263 (
'Calo422',
False) :
'CaloTopoClusters422',
264 (
'Calo422',
True) :
'CaloCalTopoClusters422'}
267 for cluster_alg
in clusterAlgNames:
268 caloClustersKey = caloclustercolls.get((cluster_alg, doLCCalib),
None)
269 if caloClustersKey
is None:
270 from TrigGepPerf.GepClusteringAlgConfig
import GepClusteringAlgCfg
273 NumberOfEnergyBits = 6
274 ValueOfLeastSignificantBit = 10
277 gepEnergyEncodingScheme =
str(NumberOfEnergyBits)+
"-"+
str(ValueOfLeastSignificantBit)+
"-"+
str(ValueG)
279 caloClustersKey=
'GEP'+cluster_alg+
'Clusters'
282 TopoClAlg=cluster_alg,
283 outputCaloClustersKey=caloClustersKey,
284 GEPEnergyEncodingScheme = gepEnergyEncodingScheme,
285 HardwareStyleEnergyEncoding =
True,
286 TruncationOfOverflowingFEBs =
True,
287 OutputLevel=gepAlgs_output_level)
290 info(
'gepclustering_cfg dump:')
291 gepclustering_cfg.printConfig(withDetails=
True,
294 acc.merge(gepclustering_cfg)
299 puSuppressionAlgs = [
'']
301 for puSuppressionAlg
in puSuppressionAlgs:
303 tcLabel = cluster_alg + puSuppressionAlg
305 for jetAlg
in jetAlgNames:
307 from TrigGepPerf.GepJetAlgConfig
import GepJetAlgCfg
308 alg_name=
'Gep'+cluster_alg + jetAlg +
'JetAlg'
313 caloClustersKey=caloClustersKey,
314 outputJetsKey=
'GEP' + cluster_alg + jetAlg +
'Jets',
315 OutputLevel=gepAlgs_output_level))
317 info(
'\nGepJetAlg properties dump\n')
318 info(
str(acc.getEventAlgo(alg_name)._properties))
320 from TrigGepPerf.GepMETAlgConfig
import GepMETAlgCfg
321 alg_name=
'GepMET'+ cluster_alg +
'Alg'
325 caloClustersKey=caloClustersKey,
326 outputMETKey=
'GEP'+ cluster_alg +
'MET',
327 OutputLevel=gepAlgs_output_level))
330 from TrigGepPerf.GepMETPufitAlgConfig
import GepMETPufitAlgCfg
331 alg_name=
'GepMET' + cluster_alg +
'PufitAlg'
335 caloClustersKey=caloClustersKey,
336 outputMETPufitKey=
'GEP'+ cluster_alg +
'METPufit',
337 OutputLevel=gepAlgs_output_level))
341 with open(
"L1Sim.pkl",
"wb")
as f: