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]')
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]')
68 clusterAlgNames = args.clusterAlgs.split(
',')
69 jetAlgNames = args.jetAlgs.split(
',')
70 enable_topo_tower = args.enableTopoTower
71 enable_tc_tower = args.enableTCTower
72 enable_cell_tower = args.enableCellTower
73 cellCollectionName = args.cellCollection
74 info(
'GEP clusterAlgs: ' +
str(clusterAlgNames))
75 info(
'GEP jetAlgs: ' +
str(jetAlgNames))
78 info(f
'GEP TopoTower enabled: {"Yes" if enable_topo_tower else "No"}')
79 info(f
'GEP TCTower enabled: {"Yes" if enable_tc_tower else "No"}')
80 info(f
'GEP CellTower enabled: {"Yes" if enable_cell_tower else "No"}')
83 info(f
'GEP CellTower collection: {cellCollectionName}')
88 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
89 from TrigValTools.TrigValSteering
import Input
91 assert not (args.gepInput
and args.gepInputRun3)
97 "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecExRecoTest/mc20e_13TeV/"
98 "valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.ESD.e4993_s3227_r12689/myESD.pool.root")
99 flags.Input.Files = [ifile]
100 elif args.gepInputRun3:
106 ifile =
'/afs/cern.ch/work/m/martyniu/public/forPeter/RDO/tmp.RDO'
107 flags.Input.Files = [ifile]
109 flags.Input.Files = Input.get_input(args.input).paths
111 if not flags.Input.isMC:
112 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
113 flags.GeoModel.AtlasVersion = defaultGeometryTags.autoconfigure(flags)
115 info(
'Command line args: ' +
str(args))
117 flags.Output.AODFileName =
'AOD.pool.root'
118 flags.Common.isOnline =
not flags.Input.isMC
119 flags.Exec.MaxEvents = args.nevents
120 flags.Concurrency.NumThreads = 1
121 flags.Concurrency.NumConcurrentEvents = 1
122 flags.Scheduler.ShowDataDeps =
True
123 flags.Scheduler.CheckDependencies =
True
124 flags.Scheduler.ShowDataFlow =
True
125 flags.Trigger.EDMVersion = 3
126 flags.Trigger.doLVL1 =
True
127 flags.Trigger.enableL1CaloPhase1 =
True
130 from AthenaConfiguration.DetectorConfigFlags
import setupDetectorFlags
139 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
142 from AthenaConfiguration.Enums
import Format
143 if flags.Input.Format == Format.POOL:
144 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
147 from TriggerJobOpts.TriggerByteStreamConfig
import ByteStreamReadCfg
150 from TrigConfigSvc.TrigConfigSvcCfg
import L1ConfigSvcCfg, generateL1Menu, createL1PrescalesFileFromMenu
155 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
157 'xAOD::eFexEMRoIContainer#L1_eEMRoI',
'xAOD::eFexEMRoIAuxContainer#L1_eEMRoIAux.',
158 'xAOD::eFexTauRoIContainer#L1_eTauRoI',
'xAOD::eFexTauRoIAuxContainer#L1_eTauRoIAux.',
159 'xAOD::jFexTauRoIContainer#L1_jFexTauRoI',
'xAOD::jFexTauRoIAuxContainer#L1_jFexTauRoIAux.',
160 'xAOD::jFexSRJetRoIContainer#L1_jFexSRJetRoI',
'xAOD::jFexSRJetRoIAuxContainer#L1_jFexSRJetRoIAux.',
161 'xAOD::jFexLRJetRoIContainer#L1_jFexLRJetRoI',
'xAOD::jFexLRJetRoIAuxContainer#L1_jFexLRJetRoIAux.',
162 'xAOD::jFexMETRoIContainer#L1_jFexMETRoI',
'xAOD::jFexMETRoIAuxContainer#L1_jFexMETRoIAux.',
163 'xAOD::jFexSumETRoIContainer#L1_jFexSumETRoI',
'xAOD::jFexSumETRoIAuxContainer#L1_jFexSumETRoIAux.',
164 'xAOD::gFexJetRoIContainer#L1_gFexSRJetRoI',
'xAOD::gFexJetRoIAuxContainer#L1_gFexSRJetRoIAux.',
165 'xAOD::gFexJetRoIContainer#L1_gFexLRJetRoI',
'xAOD::gFexJetRoIAuxContainer#L1_gFexLRJetRoIAux.',
166 'xAOD::gFexJetRoIContainer#L1_gFexRhoRoI',
'xAOD::gFexJetRoIAuxContainer#L1_gFexRhoRoIAux.',
167 'xAOD::gFexGlobalRoIContainer#L1_gScalarEJwoj',
'xAOD::gFexGlobalRoIAuxContainer#L1_gScalarEJwojAux.',
168 'xAOD::gFexGlobalRoIContainer#L1_gMETComponentsJwoj',
'xAOD::gFexGlobalRoIAuxContainer#L1_gMETComponentsJwojAux.',
169 'xAOD::gFexGlobalRoIContainer#L1_gMHTComponentsJwoj',
'xAOD::gFexGlobalRoIAuxContainer#L1_gMHTComponentsJwojAux.',
170 'xAOD::gFexGlobalRoIContainer#L1_gMSTComponentsJwoj',
'xAOD::gFexGlobalRoIAuxContainer#L1_gMSTComponentsJwojAux.',
171 'xAOD::gFexGlobalRoIContainer#L1_gMETComponentsNoiseCut',
'xAOD::gFexGlobalRoIAuxContainer#L1_gMETComponentsNoiseCutAux.',
172 'xAOD::gFexGlobalRoIContainer#L1_gMETComponentsRms',
'xAOD::gFexGlobalRoIAuxContainer#L1_gMETComponentsRmsAux.',
173 'xAOD::gFexGlobalRoIContainer#L1_gScalarENoiseCut',
'xAOD::gFexGlobalRoIAuxContainer#L1_gScalarENoiseCutAux.',
174 'xAOD::gFexGlobalRoIContainer#L1_gScalarERms',
'xAOD::gFexGlobalRoIAuxContainer#L1_gScalarERmsAux.',
182 from L1CaloFEXSim.L1CaloFEXSimCfg
import L1CaloFEXSimCfg
186 from CaloRec.CaloCellMakerConfig
import CaloCellMakerCfg
192 from CaloRec.CaloTopoClusterConfig
import CaloTopoClusterCfg
194 acc.merge(calo_acc420)
207 doLCCalib = flags.Calo.TopoCluster.doTopoClusterLocalCalib
208 clustersname =
'CaloCalTopoClusters422' if doLCCalib
else 'CaloTopoClusters422'
210 clustersname=clustersname)
213 for comp
in cfg.getSequence().Members:
214 if comp.name ==
'CaloCalTopoClusters422Maker':
219 if not hasattr(alg,
'ClusterMakerTools'):
222 for tool
in alg.ClusterMakerTools:
223 if tool.name ==
'TopoMaker':
224 assert tool.CellThresholdOnEorAbsEinSigma == 0
225 tool.CellThresholdOnEorAbsEinSigma = 2.0
231 if not hasattr(alg,
'ClusterCorrectionTools'):
234 for tool
in alg.ClusterCorrectionTools:
236 if tool.name ==
'CaloClusterSnapshot':
237 assert tool.OutputName ==
'CaloTopoClusters'
239 tool.OutputName =
'CaloCalTopoClusters422Snap'
241 tool.OutputName =
'CaloTopoClusters422Snap'
249 error(
'no 422 cluster alg')
255 acc.merge(calo_acc422)
258 gepAlgs_output_level = DEBUG
260 from TrigGepPerf.GepClusterTimingAlgConfig
import GepClusterTimingAlgCfg
262 OutputLevel=gepAlgs_output_level))
274 NumberOfEnergyBits = 6
275 ValueOfLeastSignificantBit = 10
278 gepEnergyEncodingScheme =
str(NumberOfEnergyBits)+
"-"+
str(ValueOfLeastSignificantBit)+
"-"+
str(ValueG)
280 from TrigGepPerf.GepCellsHandlerAlgConfig
import GepCellsHandlerAlgCfg
284 outputGepCellsKey=
"GepCells",
285 GEPEnergyEncodingScheme = gepEnergyEncodingScheme,
286 HardwareStyleEnergyEncoding =
True,
287 TruncationOfOverflowingFEBs =
True,
288 OutputLevel=gepAlgs_output_level)
290 info(
'gepclustering_cfg dump:')
291 gepcellhandler_cfg.printConfig(withDetails=
True,
294 acc.merge(gepcellhandler_cfg)
296 from TrigGepPerf.GepPi0AlgConfig
import GepPi0AlgCfg
301 caloCellsProducer=
"caloCellsFromCaloCells",
302 OutputLevel=gepAlgs_output_level))
305 known_cluster_algs = [
'WFS',
'Calo420',
'Calo422']
306 for a
in clusterAlgNames:
307 assert a
in known_cluster_algs
309 known_jet_algs = [
'Cone',
'ModAntikT']
310 for a
in jetAlgNames:
311 assert a
in known_jet_algs
317 caloclustercolls = {(
'Calo420',
False) :
'CaloTopoClusters',
318 (
'Calo420',
True) :
'CaloCalTopoClusters',
319 (
'Calo422',
False) :
'CaloTopoClusters422',
320 (
'Calo422',
True) :
'CaloCalTopoClusters422'}
323 from TrigGepPerf.GepCellTowerAlgConfig
import GepCellTowerAlgCfg
325 if enable_cell_tower:
326 cell_tower_key =
'GEPCellTower'
327 alg_name =
'GepCellTowerAlg'
332 outputCellTowerKey=cell_tower_key,
333 gepCellMapKey=cellCollectionName,
334 OutputLevel=gepAlgs_output_level)
336 info(
'Configuring GepCellTowerAlg')
337 gep_cell_tower_cfg.printConfig(withDetails=
True, summariseProps=
True)
340 acc.merge(gep_cell_tower_cfg)
342 for cluster_alg
in clusterAlgNames:
343 caloClustersKey = caloclustercolls.get((cluster_alg, doLCCalib),
None)
344 if caloClustersKey
is None:
345 from TrigGepPerf.GepClusteringAlgConfig
import GepClusteringAlgCfg
347 caloClustersKey=
'GEP'+cluster_alg+
'Clusters'
350 TopoClAlg=cluster_alg,
351 gepCellMapKey=
"GepCells",
352 outputCaloClustersKey=caloClustersKey,
353 OutputLevel=gepAlgs_output_level)
356 info(
'gepclustering_cfg dump:')
357 gepclustering_cfg.printConfig(withDetails=
True,
360 acc.merge(gepclustering_cfg)
362 if enable_topo_tower:
363 from TrigGepPerf.GepTopoTowerAlgConfig
import GepTopoTowerAlgCfg
364 alg_name=
'GepTopoTower'+ cluster_alg +
'Alg'
368 caloClustersKey=caloClustersKey,
369 outputCaloClustersKey=
'GEP'+ cluster_alg +
'TopoTower',
370 gepCellMapKey=
"GepCells",
371 OutputLevel=gepAlgs_output_level))
374 from TrigGepPerf.GepTCTowerAlgConfig
import GepTCTowerAlgCfg
375 alg_name=
'GepTCTower'+ cluster_alg +
'Alg'
379 caloClustersKey=caloClustersKey,
380 outputCaloClustersKey=
'GEP'+ cluster_alg +
'TCTower',
381 OutputLevel=gepAlgs_output_level))
383 puSuppressionAlgs = [
'']
385 for puSuppressionAlg
in puSuppressionAlgs:
387 tcLabel = cluster_alg + puSuppressionAlg
389 for jetAlg
in jetAlgNames:
391 from TrigGepPerf.GepJetAlgConfig
import GepJetAlgCfg
392 alg_name=
'Gep'+cluster_alg + jetAlg +
'JetAlg'
397 caloClustersKey=caloClustersKey,
398 outputJetsKey=
'GEP' + cluster_alg + jetAlg +
'Jets',
399 OutputLevel=gepAlgs_output_level))
401 info(
'\nGepJetAlg properties dump\n')
402 info(
str(acc.getEventAlgo(alg_name)._properties))
405 if enable_topo_tower:
406 topoTowerKey =
'GEP' + cluster_alg +
'TopoTower'
407 ttalg_name =
'Gep' + cluster_alg +
'TopoTower' + jetAlg +
'JetAlg'
412 caloClustersKey=topoTowerKey,
413 outputJetsKey=
'GEP' + cluster_alg +
'TopoTower' + jetAlg +
'Jets',
414 OutputLevel=gepAlgs_output_level))
416 info(
'\nGepJetAlg properties dump for TopoTowers\n')
417 info(
str(acc.getEventAlgo(ttalg_name)._properties))
421 tcTowerKey =
'GEP' + cluster_alg +
'TCTower'
422 tctalg_name =
'Gep' + cluster_alg +
'TCTower' + jetAlg +
'JetAlg'
427 caloClustersKey=tcTowerKey,
428 outputJetsKey=
'GEP' + cluster_alg +
'TCTower' + jetAlg +
'Jets',
429 OutputLevel=gepAlgs_output_level))
431 info(
'\nGepJetAlg properties dump for TCTowers\n')
432 info(
str(acc.getEventAlgo(tctalg_name)._properties))
435 if enable_cell_tower:
436 ctalg_name =
'GepCellTower' + jetAlg +
'JetAlg'
441 caloClustersKey=cell_tower_key,
442 outputJetsKey=
'GEPCellTower' + jetAlg +
'Jets',
443 OutputLevel=gepAlgs_output_level))
445 info(
'\nGepJetAlg properties dump for CellTower\n')
446 info(
str(acc.getEventAlgo(ctalg_name)._properties))
448 from TrigGepPerf.GepMETAlgConfig
import GepMETAlgCfg
449 alg_name=
'GepMET'+ cluster_alg +
'Alg'
453 caloClustersKey=caloClustersKey,
454 outputMETKey=
'GEP'+ cluster_alg +
'MET',
455 OutputLevel=gepAlgs_output_level))
458 if enable_topo_tower:
459 topoTowerMETKey =
'GEP' + cluster_alg +
'TopoTower'
460 ttMETalg_name =
'GepMET' + cluster_alg +
'TopoTower' +
'Alg'
464 caloClustersKey=topoTowerMETKey,
465 outputMETKey=
'GEP' + cluster_alg +
'TopoTower' +
'MET',
466 OutputLevel=gepAlgs_output_level))
470 tcTowerMETKey =
'GEP' + cluster_alg +
'TCTower'
471 tctMETalg_name =
'GepMET' + cluster_alg +
'TCTower' +
'Alg'
475 caloClustersKey=tcTowerMETKey,
476 outputMETKey=
'GEP' + cluster_alg +
'TCTower' +
'MET',
477 OutputLevel=gepAlgs_output_level))
480 if enable_cell_tower:
481 ctMETalg_name =
'GepMETCellTowerAlg'
485 caloClustersKey=cell_tower_key,
486 outputMETKey=
'GEPCellTowerMET',
487 OutputLevel=gepAlgs_output_level))
489 from TrigGepPerf.GepMETPufitAlgConfig
import GepMETPufitAlgCfg
490 alg_name=
'GepMET' + cluster_alg +
'PufitAlg'
494 caloClustersKey=caloClustersKey,
495 outputMETPufitKey=
'GEP'+ cluster_alg +
'METPufit',
496 OutputLevel=gepAlgs_output_level))
498 if enable_topo_tower:
499 ttPufitMETalg_name =
'GepMET' + cluster_alg +
'TopoTower' +
'PufitAlg'
502 name=ttPufitMETalg_name,
503 caloClustersKey=topoTowerMETKey,
504 outputMETKey=
'GEP' + cluster_alg +
'TopoTower' +
'METPufit',
505 OutputLevel=gepAlgs_output_level))
508 tctPufitMETalg_name =
'GepMET' + cluster_alg +
'TCTower' +
'PufitAlg'
511 name=tctPufitMETalg_name,
512 caloClustersKey=tcTowerMETKey,
513 outputMETKey=
'GEP' + cluster_alg +
'TCTower' +
'METPufit',
514 OutputLevel=gepAlgs_output_level))
516 if enable_cell_tower:
517 ctPufitMETalg_name =
'GepMETCellTowerPufitAlg'
520 name=ctPufitMETalg_name,
521 caloClustersKey=cell_tower_key,
522 outputMETKey=
'GEPCellTowerMETPufit',
523 OutputLevel=gepAlgs_output_level))
528 with open(
"L1Sim.pkl",
"wb")
as f: