471def getMuonFlowElementAssocAlgorithm(inputFlags, algName="", **kwargs):
472
473 kwargs.setdefault("neutral_FE_cont_name", "")
474 kwargs.setdefault("charged_FE_cont_name", "")
475 kwargs.setdefault("LinkNeutralFEClusters", True)
476 kwargs.setdefault("doTCC", False)
477 kwargs.setdefault("useGlobal", False)
478
479 useMuonTopoClusters = False
480 from AthenaConfiguration.Enums import ProductionStep
481
482
483 if inputFlags.Common.ProductionStep in [ProductionStep.Derivation] or inputFlags.DQ.Environment == "AOD":
484 useMuonTopoClusters = True
485
486
487 PFMuonFlowElementLinkerAlgorithmFactory=CompFactory.PFMuonFlowElementAssoc
488 if not algName:
489 algName="PFMuonFlowElementAssoc"
490 PFMuonFlowElementLinkerAlgorithm=PFMuonFlowElementLinkerAlgorithmFactory(algName)
491
492
493
494
495
496 if kwargs['neutral_FE_cont_name']:
497
498 PFMuonFlowElementLinkerAlgorithm.JetEtMissNeutralFlowElementContainer = kwargs['neutral_FE_cont_name']
499
500
501 if kwargs['charged_FE_cont_name']:
502 PFMuonFlowElementLinkerAlgorithm.JetEtMissChargedFlowElementContainer = kwargs['charged_FE_cont_name']
503
504 PFMuonFlowElementLinkerAlgorithm.LinkNeutralFEClusters = kwargs['LinkNeutralFEClusters']
505 PFMuonFlowElementLinkerAlgorithm.useMuonTopoClusters = useMuonTopoClusters
506
507
508
509
510 if kwargs['doTCC']:
511
512
513 service_key=""
514 PFMuonFlowElementLinkerAlgorithm.MuonContainer=service_key+"Muons"
515 PFMuonFlowElementLinkerAlgorithm.JetEtMissChargedFlowElementContainer=service_key+"TrackCaloClustersCharged"
516 PFMuonFlowElementLinkerAlgorithm.JetEtMissNeutralFlowElementContainer=service_key+"TrackCaloClustersNeutral"
517
518
519
520
521 PFMuonFlowElementLinkerAlgorithm.MuonContainer_chargedFELinks="chargedTCCLinks"
522 PFMuonFlowElementLinkerAlgorithm.MuonContainer_neutralFELinks="neutralTCCLinks"
523 PFMuonFlowElementLinkerAlgorithm.JetETMissNeutralFlowElementContainer_FE_MuonLinks="TCC_MuonLinks"
524 PFMuonFlowElementLinkerAlgorithm.JetETMissChargedFlowElements_FE_MuonLinks="TCC_MuonLinks"
525 PFMuonFlowElementLinkerAlgorithm.FlowElementContainer_ChargedFE_ennergy_matched_muon="TCC_efrac_matched_muon"
526
527 PFMuonFlowElementLinkerAlgorithm.FlowElementContainer_nMatchedMuons="TCC_nMatchedMuons"
528 PFMuonFlowElementLinkerAlgorithm.FlowElementContainer_FE_efrac_matched_muon="TCC_efrac_matched_muon"
529
530 PFMuonFlowElementLinkerAlgorithm.MuonContainer_muon_efrac_matched_FE="muon_efrac_matched_TCC"
531
532 PFMuonFlowElementLinkerAlgorithm.MuonContainer_ClusterInfo_deltaR="deltaR_muon_clus_TCCalg"
533
534 if kwargs['useGlobal']:
535 PFMuonFlowElementLinkerAlgorithm.JetEtMissChargedFlowElementContainer="GlobalChargedParticleFlowObjects"
536 PFMuonFlowElementLinkerAlgorithm.JetEtMissNeutralFlowElementContainer="GlobalNeutralParticleFlowObjects"
537
538 PFMuonFlowElementLinkerAlgorithm.MuonContainer_chargedFELinks="chargedGlobalFELinks"
539 PFMuonFlowElementLinkerAlgorithm.MuonContainer_neutralFELinks="neutralGlobalFELinks"
540
541 PFMuonFlowElementLinkerAlgorithm.JetETMissNeutralFlowElementContainer_FE_MuonLinks="GlobalFE_MuonLinks"
542 PFMuonFlowElementLinkerAlgorithm.JetETMissChargedFlowElements_FE_MuonLinks="GlobalFE_MuonLinks"
543 PFMuonFlowElementLinkerAlgorithm.FlowElementContainer_ChargedFE_ennergy_matched_muon="GlobalFE_efrac_matched_muon"
544
545 PFMuonFlowElementLinkerAlgorithm.FlowElementContainer_nMatchedMuons="GlobalFE_nMatchedMuons"
546 PFMuonFlowElementLinkerAlgorithm.FlowElementContainer_FE_efrac_matched_muon="GlobalFE_efrac_matched_muon"
547
548 PFMuonFlowElementLinkerAlgorithm.MuonContainer_muon_efrac_matched_FE="muon_efrac_matched_GlobalFE"
549
550 PFMuonFlowElementLinkerAlgorithm.MuonContainer_ClusterInfo_deltaR="deltaR_muon_clus_GlobalFEalg"
551
552 if kwargs['LinkNeutralFEClusters'] and not useMuonTopoClusters:
553
554
555 PFMuonFlowElementLinkerAlgorithm.ExtraInputs.add(('CaloCellContainer', inputFlags.Egamma.Keys.Input.CaloCells))
556
557 if kwargs['LinkNeutralFEClusters']:
558 if kwargs['doTCC']:
559
560
561 from AthenaCommon.Logging import logging
562 msg=logging.getLogger("PFCfg.py::getMuonFlowElementAssocAlgorithm")
563 msg.error("Neutral FE from AOD configured to be linked with Muon. This link will fail due to missing CaloCells in the AOD")
564 msg.info("Terminating job")
565 exit(0)
566
567
568 return PFMuonFlowElementLinkerAlgorithm
569