375def getMuonFlowElementAssocAlgorithm(inputFlags, algName="", **kwargs):
376
377 kwargs.setdefault("neutral_FE_cont_name", "")
378 kwargs.setdefault("charged_FE_cont_name", "")
379 kwargs.setdefault("LinkNeutralFEClusters", True)
380 kwargs.setdefault("doTCC", False)
381 kwargs.setdefault("useGlobal", False)
382
383 useMuonTopoClusters = False
384 from AthenaConfiguration.Enums import ProductionStep
385
386
387 if inputFlags.Common.ProductionStep in [ProductionStep.Derivation] or inputFlags.DQ.Environment == "AOD":
388 useMuonTopoClusters = True
389
390
391 PFMuonFlowElementLinkerAlgorithmFactory=CompFactory.PFMuonFlowElementAssoc
392 if not algName:
393 algName="PFMuonFlowElementAssoc"
394 PFMuonFlowElementLinkerAlgorithm=PFMuonFlowElementLinkerAlgorithmFactory(algName)
395
396
397
398
399
400 if kwargs['neutral_FE_cont_name']:
401
402 PFMuonFlowElementLinkerAlgorithm.JetEtMissNeutralFlowElementContainer = kwargs['neutral_FE_cont_name']
403
404
405 if kwargs['charged_FE_cont_name']:
406 PFMuonFlowElementLinkerAlgorithm.JetEtMissChargedFlowElementContainer = kwargs['charged_FE_cont_name']
407
408 PFMuonFlowElementLinkerAlgorithm.LinkNeutralFEClusters = kwargs['LinkNeutralFEClusters']
409 PFMuonFlowElementLinkerAlgorithm.useMuonTopoClusters = useMuonTopoClusters
410
411
412
413
414 if kwargs['doTCC']:
415
416
417 service_key=""
418 PFMuonFlowElementLinkerAlgorithm.MuonContainer=service_key+"Muons"
419 PFMuonFlowElementLinkerAlgorithm.JetEtMissChargedFlowElementContainer=service_key+"TrackCaloClustersCharged"
420 PFMuonFlowElementLinkerAlgorithm.JetEtMissNeutralFlowElementContainer=service_key+"TrackCaloClustersNeutral"
421
422
423
424
425 PFMuonFlowElementLinkerAlgorithm.MuonContainer_chargedFELinks="chargedTCCLinks"
426 PFMuonFlowElementLinkerAlgorithm.MuonContainer_neutralFELinks="neutralTCCLinks"
427 PFMuonFlowElementLinkerAlgorithm.JetETMissNeutralFlowElementContainer_FE_MuonLinks="TCC_MuonLinks"
428 PFMuonFlowElementLinkerAlgorithm.JetETMissChargedFlowElements_FE_MuonLinks="TCC_MuonLinks"
429 PFMuonFlowElementLinkerAlgorithm.FlowElementContainer_ChargedFE_ennergy_matched_muon="TCC_efrac_matched_muon"
430
431 PFMuonFlowElementLinkerAlgorithm.FlowElementContainer_nMatchedMuons="TCC_nMatchedMuons"
432 PFMuonFlowElementLinkerAlgorithm.FlowElementContainer_FE_efrac_matched_muon="TCC_efrac_matched_muon"
433
434 PFMuonFlowElementLinkerAlgorithm.MuonContainer_muon_efrac_matched_FE="muon_efrac_matched_TCC"
435
436 PFMuonFlowElementLinkerAlgorithm.MuonContainer_ClusterInfo_deltaR="deltaR_muon_clus_TCCalg"
437
438 if kwargs['useGlobal']:
439 PFMuonFlowElementLinkerAlgorithm.JetEtMissChargedFlowElementContainer="GlobalChargedParticleFlowObjects"
440 PFMuonFlowElementLinkerAlgorithm.JetEtMissNeutralFlowElementContainer="GlobalNeutralParticleFlowObjects"
441
442 PFMuonFlowElementLinkerAlgorithm.MuonContainer_chargedFELinks="chargedGlobalFELinks"
443 PFMuonFlowElementLinkerAlgorithm.MuonContainer_neutralFELinks="neutralGlobalFELinks"
444
445 PFMuonFlowElementLinkerAlgorithm.JetETMissNeutralFlowElementContainer_FE_MuonLinks="GlobalFE_MuonLinks"
446 PFMuonFlowElementLinkerAlgorithm.JetETMissChargedFlowElements_FE_MuonLinks="GlobalFE_MuonLinks"
447 PFMuonFlowElementLinkerAlgorithm.FlowElementContainer_ChargedFE_ennergy_matched_muon="GlobalFE_efrac_matched_muon"
448
449 PFMuonFlowElementLinkerAlgorithm.FlowElementContainer_nMatchedMuons="GlobalFE_nMatchedMuons"
450 PFMuonFlowElementLinkerAlgorithm.FlowElementContainer_FE_efrac_matched_muon="GlobalFE_efrac_matched_muon"
451
452 PFMuonFlowElementLinkerAlgorithm.MuonContainer_muon_efrac_matched_FE="muon_efrac_matched_GlobalFE"
453
454 PFMuonFlowElementLinkerAlgorithm.MuonContainer_ClusterInfo_deltaR="deltaR_muon_clus_GlobalFEalg"
455
456 if kwargs['LinkNeutralFEClusters'] and not useMuonTopoClusters:
457
458
459 PFMuonFlowElementLinkerAlgorithm.ExtraInputs.add(('CaloCellContainer', inputFlags.Egamma.Keys.Input.CaloCells))
460
461 if kwargs['LinkNeutralFEClusters']:
462 if kwargs['doTCC']:
463
464
465 from AthenaCommon.Logging import logging
466 msg=logging.getLogger("PFCfg.py::getMuonFlowElementAssocAlgorithm")
467 msg.error("Neutral FE from AOD configured to be linked with Muon. This link will fail due to missing CaloCells in the AOD")
468 msg.info("Terminating job")
469 exit(0)
470
471
472 return PFMuonFlowElementLinkerAlgorithm
473