5if __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]')
47 p.add_argument(
'-ett',
'--enableTopoTower',
49 help=
'Enable GepTopoTower algorithm'
52 p.add_argument(
'-ect',
'--enableCellTower',
54 help=
'Enable GepCellTower algorithm'
57 p.add_argument(
'-etct',
'--enableTCTower',
59 help=
'Enable GepTCTower algorithm'
62 p.add_argument(
'-cell',
'--cellCollection',
64 help=
'commma separated list of input cell Collection for CellTower algorithm: [GepCells,CaloCells]')
66 p.add_argument(
'-pu',
'--puSupAlgs',
68 help=
'comma separated list of PU suppression algorithms: [EtaSK]')
72 clusterAlgNames = args.clusterAlgs.split(
',')
73 jetAlgNames = args.jetAlgs.split(
',')
74 enable_topo_tower = args.enableTopoTower
75 enable_tc_tower = args.enableTCTower
76 enable_cell_tower = args.enableCellTower
77 cellCollectionName = args.cellCollection
78 puSuppressionAlgNames = args.puSupAlgs.split(
',')
if args.puSupAlgs
else [
'']
79 info(
'GEP clusterAlgs: ' +
str(clusterAlgNames))
80 info(
'GEP jetAlgs: ' +
str(jetAlgNames))
81 info(
'GEP puSuppressionAlgs: ' +
str(puSuppressionAlgNames))
84 info(f
'GEP TopoTower enabled: {"Yes" if enable_topo_tower else "No"}')
85 info(f
'GEP TCTower enabled: {"Yes" if enable_tc_tower else "No"}')
86 info(f
'GEP CellTower enabled: {"Yes" if enable_cell_tower else "No"}')
89 info(f
'GEP CellTower collection: {cellCollectionName}')
94 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
95 from TrigValTools.TrigValSteering
import Input
97 assert not (args.gepInput
and args.gepInputRun3)
99 flags = initConfigFlags()
103 "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecExRecoTest/mc20e_13TeV/"
104 "valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.ESD.e4993_s3227_r12689/myESD.pool.root")
105 flags.Input.Files = [ifile]
106 elif args.gepInputRun3:
112 ifile =
'/afs/cern.ch/work/m/martyniu/public/forPeter/RDO/tmp.RDO'
113 flags.Input.Files = [ifile]
115 flags.Input.Files = Input.get_input(args.input).paths
117 if not flags.Input.isMC:
118 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
119 flags.GeoModel.AtlasVersion = defaultGeometryTags.autoconfigure(flags)
121 info(
'Command line args: ' +
str(args))
123 flags.Output.AODFileName =
'AOD.pool.root'
124 flags.Common.isOnline =
not flags.Input.isMC
125 flags.Exec.MaxEvents = args.nevents
126 flags.Concurrency.NumThreads = 1
127 flags.Concurrency.NumConcurrentEvents = 1
128 flags.Scheduler.ShowDataDeps =
True
129 flags.Scheduler.CheckDependencies =
True
130 flags.Scheduler.ShowDataFlow =
True
131 flags.Trigger.EDMVersion = 3
132 flags.Trigger.doLVL1 =
True
133 flags.Trigger.enableL1CaloPhase1 =
True
136 from AthenaConfiguration.DetectorConfigFlags
import setupDetectorFlags
137 setupDetectorFlags(flags, [
'LAr',
'Tile',
'MBTS'], toggle_geometry=
True)
145 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
146 acc = MainServicesCfg(flags)
148 from AthenaConfiguration.Enums
import Format
149 if flags.Input.Format == Format.POOL:
150 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
151 acc.merge(PoolReadCfg(flags))
153 from TriggerJobOpts.TriggerByteStreamConfig
import ByteStreamReadCfg
154 acc.merge(ByteStreamReadCfg(flags))
156 from TrigConfigSvc.TrigConfigSvcCfg
import L1ConfigSvcCfg, generateL1Menu, createL1PrescalesFileFromMenu
157 acc.merge(L1ConfigSvcCfg(flags))
158 generateL1Menu(flags)
159 createL1PrescalesFileFromMenu(flags)
161 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
163 'xAOD::eFexEMRoIContainer#L1_eEMRoI',
'xAOD::eFexEMRoIAuxContainer#L1_eEMRoIAux.',
164 'xAOD::eFexTauRoIContainer#L1_eTauRoI',
'xAOD::eFexTauRoIAuxContainer#L1_eTauRoIAux.',
165 'xAOD::jFexTauRoIContainer#L1_jFexTauRoI',
'xAOD::jFexTauRoIAuxContainer#L1_jFexTauRoIAux.',
166 'xAOD::jFexSRJetRoIContainer#L1_jFexSRJetRoI',
'xAOD::jFexSRJetRoIAuxContainer#L1_jFexSRJetRoIAux.',
167 'xAOD::jFexLRJetRoIContainer#L1_jFexLRJetRoI',
'xAOD::jFexLRJetRoIAuxContainer#L1_jFexLRJetRoIAux.',
168 'xAOD::jFexMETRoIContainer#L1_jFexMETRoI',
'xAOD::jFexMETRoIAuxContainer#L1_jFexMETRoIAux.',
169 'xAOD::jFexSumETRoIContainer#L1_jFexSumETRoI',
'xAOD::jFexSumETRoIAuxContainer#L1_jFexSumETRoIAux.',
170 'xAOD::gFexJetRoIContainer#L1_gFexSRJetRoI',
'xAOD::gFexJetRoIAuxContainer#L1_gFexSRJetRoIAux.',
171 'xAOD::gFexJetRoIContainer#L1_gFexLRJetRoI',
'xAOD::gFexJetRoIAuxContainer#L1_gFexLRJetRoIAux.',
172 'xAOD::gFexJetRoIContainer#L1_gFexRhoRoI',
'xAOD::gFexJetRoIAuxContainer#L1_gFexRhoRoIAux.',
173 'xAOD::gFexGlobalRoIContainer#L1_gScalarEJwoj',
'xAOD::gFexGlobalRoIAuxContainer#L1_gScalarEJwojAux.',
174 'xAOD::gFexGlobalRoIContainer#L1_gMETComponentsJwoj',
'xAOD::gFexGlobalRoIAuxContainer#L1_gMETComponentsJwojAux.',
175 'xAOD::gFexGlobalRoIContainer#L1_gMHTComponentsJwoj',
'xAOD::gFexGlobalRoIAuxContainer#L1_gMHTComponentsJwojAux.',
176 'xAOD::gFexGlobalRoIContainer#L1_gMSTComponentsJwoj',
'xAOD::gFexGlobalRoIAuxContainer#L1_gMSTComponentsJwojAux.',
177 'xAOD::gFexGlobalRoIContainer#L1_gMETComponentsNoiseCut',
'xAOD::gFexGlobalRoIAuxContainer#L1_gMETComponentsNoiseCutAux.',
178 'xAOD::gFexGlobalRoIContainer#L1_gMETComponentsRms',
'xAOD::gFexGlobalRoIAuxContainer#L1_gMETComponentsRmsAux.',
179 'xAOD::gFexGlobalRoIContainer#L1_gScalarENoiseCut',
'xAOD::gFexGlobalRoIAuxContainer#L1_gScalarENoiseCutAux.',
180 'xAOD::gFexGlobalRoIContainer#L1_gScalarERms',
'xAOD::gFexGlobalRoIAuxContainer#L1_gScalarERmsAux.',
182 acc.merge(OutputStreamCfg(flags,
'AOD', ItemList=FexEDMList))
188 from L1CaloFEXSim.L1CaloFEXSimCfg
import L1CaloFEXSimCfg
192 from CaloRec.CaloCellMakerConfig
import CaloCellMakerCfg
193 acc.merge(CaloCellMakerCfg(flags))
198 from CaloRec.CaloTopoClusterConfig
import CaloTopoClusterCfg
199 calo_acc420 = CaloTopoClusterCfg(flags)
200 acc.merge(calo_acc420)
213 doLCCalib = flags.Calo.TopoCluster.doTopoClusterLocalCalib
214 clustersname =
'CaloCalTopoClusters422' if doLCCalib
else 'CaloTopoClusters422'
215 calo_acc422 = CaloTopoClusterCfg(flags,
216 clustersname=clustersname)
219 for comp
in cfg.getSequence().Members:
220 if comp.name ==
'CaloCalTopoClusters422Maker':
225 if not hasattr(alg,
'ClusterMakerTools'):
228 for tool
in alg.ClusterMakerTools:
229 if tool.name ==
'TopoMaker':
230 assert tool.CellThresholdOnEorAbsEinSigma == 0
231 tool.CellThresholdOnEorAbsEinSigma = 2.0
237 if not hasattr(alg,
'ClusterCorrectionTools'):
240 for tool
in alg.ClusterCorrectionTools:
242 if tool.name ==
'CaloClusterSnapshot':
243 assert tool.OutputName ==
'CaloTopoClusters'
245 tool.OutputName =
'CaloCalTopoClusters422Snap'
247 tool.OutputName =
'CaloTopoClusters422Snap'
255 error(
'no 422 cluster alg')
261 acc.merge(calo_acc422)
264 gepAlgs_output_level = DEBUG
266 from TrigGepPerf.GepClusterTimingAlgConfig
import GepClusterTimingAlgCfg
267 acc.merge(GepClusterTimingAlgCfg(flags,
268 OutputLevel=gepAlgs_output_level))
280 NumberOfEnergyBits = 6
281 ValueOfLeastSignificantBit = 10
284 gepEnergyEncodingScheme =
str(NumberOfEnergyBits)+
"-"+
str(ValueOfLeastSignificantBit)+
"-"+
str(ValueG)
286 from TrigGepPerf.GepCellsHandlerAlgConfig
import GepCellsHandlerAlgCfg
288 gepcellhandler_cfg = GepCellsHandlerAlgCfg(
290 outputGepCellsKey=
"GepCells",
291 GEPEnergyEncodingScheme = gepEnergyEncodingScheme,
292 HardwareStyleEnergyEncoding =
True,
293 TruncationOfOverflowingFEBs =
True,
294 OutputLevel=gepAlgs_output_level)
296 info(
'gepclustering_cfg dump:')
297 gepcellhandler_cfg.printConfig(withDetails=
True,
300 acc.merge(gepcellhandler_cfg)
302 from TrigGepPerf.GepPi0AlgConfig
import GepPi0AlgCfg
305 acc.merge(GepPi0AlgCfg(flags,
307 caloCellsProducer=
"caloCellsFromCaloCells",
308 OutputLevel=gepAlgs_output_level))
311 known_cluster_algs = [
'WFS',
'Calo420',
'Calo422']
312 for a
in clusterAlgNames:
313 assert a
in known_cluster_algs
315 known_jet_algs = [
'Cone',
'ModAntikT']
316 for a
in jetAlgNames:
317 assert a
in known_jet_algs
323 caloclustercolls = {(
'Calo420',
False) :
'CaloTopoClusters',
324 (
'Calo420',
True) :
'CaloCalTopoClusters',
325 (
'Calo422',
False) :
'CaloTopoClusters422',
326 (
'Calo422',
True) :
'CaloCalTopoClusters422'}
329 from TrigGepPerf.GepCellTowerAlgConfig
import GepCellTowerAlgCfg
331 if enable_cell_tower:
332 cell_tower_key =
'GEPCellTower'
333 alg_name =
'GepCellTowerAlg'
336 gep_cell_tower_cfg = GepCellTowerAlgCfg(
338 outputCellTowerKey=cell_tower_key,
339 gepCellMapKey=cellCollectionName,
340 OutputLevel=gepAlgs_output_level)
342 info(
'Configuring GepCellTowerAlg')
343 gep_cell_tower_cfg.printConfig(withDetails=
True, summariseProps=
True)
346 acc.merge(gep_cell_tower_cfg)
348 for cluster_alg
in clusterAlgNames:
349 caloClustersKey = caloclustercolls.get((cluster_alg, doLCCalib),
None)
350 if caloClustersKey
is None:
351 from TrigGepPerf.GepClusteringAlgConfig
import GepClusteringAlgCfg
353 caloClustersKey=
'GEP'+cluster_alg+
'Clusters'
354 gepclustering_cfg = GepClusteringAlgCfg(
356 TopoClAlg=cluster_alg,
357 gepCellMapKey=
"GepCells",
358 outputCaloClustersKey=caloClustersKey,
359 OutputLevel=gepAlgs_output_level)
362 info(
'gepclustering_cfg dump:')
363 gepclustering_cfg.printConfig(withDetails=
True,
366 acc.merge(gepclustering_cfg)
368 if enable_topo_tower:
369 from TrigGepPerf.GepTopoTowerAlgConfig
import GepTopoTowerAlgCfg
370 alg_name=
'GepTopoTower'+ cluster_alg +
'Alg'
371 acc.merge(GepTopoTowerAlgCfg(
374 caloClustersKey=caloClustersKey,
375 outputCaloClustersKey=
'GEP'+ cluster_alg +
'TopoTower',
376 gepCellMapKey=
"GepCells",
377 OutputLevel=gepAlgs_output_level))
380 from TrigGepPerf.GepTCTowerAlgConfig
import GepTCTowerAlgCfg
381 alg_name=
'GepTCTower'+ cluster_alg +
'Alg'
382 acc.merge(GepTCTowerAlgCfg(
385 caloClustersKey=caloClustersKey,
386 outputCaloClustersKey=
'GEP'+ cluster_alg +
'TCTower',
387 OutputLevel=gepAlgs_output_level))
389 for puSuppressionAlg
in puSuppressionAlgNames:
391 puLabel = puSuppressionAlg
394 if puLabel ==
'EtaSK':
395 from TrigGepPerf.GepEtaSoftKillerAlgConfig
import GepEtaSoftKillerAlgCfg
397 puClustersKey =
'GEP' + cluster_alg + puLabel +
'Clusters'
398 acc.merge(GepEtaSoftKillerAlgCfg(
400 name=
'GepEtaSK' + cluster_alg +
'Alg',
401 inputClustersKey=caloClustersKey,
402 outputClustersKey=puClustersKey,
403 OutputLevel=gepAlgs_output_level))
405 if enable_topo_tower:
406 puTopoTowerKey =
'GEP' + cluster_alg + puLabel +
'TopoTower'
407 acc.merge(GepEtaSoftKillerAlgCfg(
409 name=
'GepEtaSK' + cluster_alg +
'TopoTowerAlg',
410 inputClustersKey=
'GEP' + cluster_alg +
'TopoTower',
411 outputClustersKey=puTopoTowerKey,
412 OutputLevel=gepAlgs_output_level))
415 puTcTowerKey =
'GEP' + cluster_alg + puLabel +
'TCTower'
416 acc.merge(GepEtaSoftKillerAlgCfg(
418 name=
'GepEtaSK' + cluster_alg +
'TCTowerAlg',
419 inputClustersKey=
'GEP' + cluster_alg +
'TCTower',
420 outputClustersKey=puTcTowerKey,
421 OutputLevel=gepAlgs_output_level))
423 if enable_cell_tower:
424 puCellTowerKey =
'GEP' + puLabel +
'CellTower'
425 acc.merge(GepEtaSoftKillerAlgCfg(
427 name=
'GepEtaSKCellTowerAlg',
428 inputClustersKey=cell_tower_key,
429 outputClustersKey=puCellTowerKey,
430 OutputLevel=gepAlgs_output_level))
434 puClustersKey = caloClustersKey
435 puTopoTowerKey =
'GEP' + cluster_alg +
'TopoTower'
436 puTcTowerKey =
'GEP' + cluster_alg +
'TCTower'
437 puCellTowerKey = cell_tower_key
if enable_cell_tower
else ''
439 for jetAlg
in jetAlgNames:
441 from TrigGepPerf.GepJetAlgConfig
import GepJetAlgCfg
442 alg_name=
'Gep' + cluster_alg + puLabel + jetAlg +
'JetAlg'
443 acc.merge(GepJetAlgCfg(
447 caloClustersKey=puClustersKey,
448 outputJetsKey=
'GEP' + cluster_alg + puLabel + jetAlg +
'Jets',
449 OutputLevel=gepAlgs_output_level))
451 info(
'\nGepJetAlg properties dump\n')
452 info(
str(acc.getEventAlgo(alg_name)._properties))
455 if enable_topo_tower:
456 ttalg_name =
'Gep' + cluster_alg + puLabel +
'TopoTower' + jetAlg +
'JetAlg'
457 acc.merge(GepJetAlgCfg(
461 caloClustersKey=puTopoTowerKey,
462 outputJetsKey=
'GEP' + cluster_alg + puLabel +
'TopoTower' + jetAlg +
'Jets',
463 OutputLevel=gepAlgs_output_level))
465 info(
'\nGepJetAlg properties dump for TopoTowers\n')
466 info(
str(acc.getEventAlgo(ttalg_name)._properties))
470 tctalg_name =
'Gep' + cluster_alg + puLabel +
'TCTower' + jetAlg +
'JetAlg'
471 acc.merge(GepJetAlgCfg(
475 caloClustersKey=puTcTowerKey,
476 outputJetsKey=
'GEP' + cluster_alg + puLabel +
'TCTower' + jetAlg +
'Jets',
477 OutputLevel=gepAlgs_output_level))
479 info(
'\nGepJetAlg properties dump for TCTowers\n')
480 info(
str(acc.getEventAlgo(tctalg_name)._properties))
483 if enable_cell_tower:
484 ctalg_name =
'Gep' + puLabel +
'CellTower' + jetAlg +
'JetAlg'
485 acc.merge(GepJetAlgCfg(
489 caloClustersKey=puCellTowerKey,
490 outputJetsKey=
'GEP' + puLabel +
'CellTower' + jetAlg +
'Jets',
491 OutputLevel=gepAlgs_output_level))
493 info(
'\nGepJetAlg properties dump for CellTower\n')
494 info(
str(acc.getEventAlgo(ctalg_name)._properties))
496 from TrigGepPerf.GepMETAlgConfig
import GepMETAlgCfg
497 alg_name=
'GepMET' + cluster_alg + puLabel +
'Alg'
498 acc.merge(GepMETAlgCfg(
501 caloClustersKey=puClustersKey,
502 outputMETKey=
'GEP' + cluster_alg + puLabel +
'MET',
503 OutputLevel=gepAlgs_output_level))
506 if enable_topo_tower:
507 ttMETalg_name =
'GepMET' + cluster_alg + puLabel +
'TopoTower' +
'Alg'
508 acc.merge(GepMETAlgCfg(
511 caloClustersKey=puTopoTowerKey,
512 outputMETKey=
'GEP' + cluster_alg + puLabel +
'TopoTower' +
'MET',
513 OutputLevel=gepAlgs_output_level))
517 tctMETalg_name =
'GepMET' + cluster_alg + puLabel +
'TCTower' +
'Alg'
518 acc.merge(GepMETAlgCfg(
521 caloClustersKey=puTcTowerKey,
522 outputMETKey=
'GEP' + cluster_alg + puLabel +
'TCTower' +
'MET',
523 OutputLevel=gepAlgs_output_level))
526 if enable_cell_tower:
527 ctMETalg_name =
'GepMET' + puLabel +
'CellTowerAlg'
528 acc.merge(GepMETAlgCfg(
531 caloClustersKey=puCellTowerKey,
532 outputMETKey=
'GEP' + puLabel +
'CellTowerMET',
533 OutputLevel=gepAlgs_output_level))
535 from TrigGepPerf.GepMETPufitAlgConfig
import GepMETPufitAlgCfg
536 alg_name=
'GepMET' + cluster_alg + puLabel +
'PufitAlg'
537 acc.merge(GepMETPufitAlgCfg(
540 caloClustersKey=puClustersKey,
541 outputMETPufitKey=
'GEP' + cluster_alg + puLabel +
'METPufit',
542 OutputLevel=gepAlgs_output_level))
544 if enable_topo_tower:
545 ttPufitMETalg_name =
'GepMET' + cluster_alg + puLabel +
'TopoTower' +
'PufitAlg'
546 acc.merge(GepMETPufitAlgCfg(
548 name=ttPufitMETalg_name,
549 caloClustersKey=puTopoTowerKey,
550 outputMETKey=
'GEP' + cluster_alg + puLabel +
'TopoTower' +
'METPufit',
551 OutputLevel=gepAlgs_output_level))
554 tctPufitMETalg_name =
'GepMET' + cluster_alg + puLabel +
'TCTower' +
'PufitAlg'
555 acc.merge(GepMETPufitAlgCfg(
557 name=tctPufitMETalg_name,
558 caloClustersKey=puTcTowerKey,
559 outputMETKey=
'GEP' + cluster_alg + puLabel +
'TCTower' +
'METPufit',
560 OutputLevel=gepAlgs_output_level))
562 if enable_cell_tower:
563 ctPufitMETalg_name =
'GepMET' + puLabel +
'CellTowerPufitAlg'
564 acc.merge(GepMETPufitAlgCfg(
566 name=ctPufitMETalg_name,
567 caloClustersKey=puCellTowerKey,
568 outputMETKey=
'GEP' + puLabel +
'CellTowerMETPufit',
569 OutputLevel=gepAlgs_output_level))
574 with open(
"L1Sim.pkl",
"wb")
as f: