def ApplySubtractionToClusters(**kwargs): if 'event_shape_key' in kwargs.keys(): event_shape_key = kwargs['event_shape_key'] else: from HIGlobal.HIGlobalFlags import jobproperties event_shape_key = jobproperties.HIGlobalFlags.EventShapeKey() if 'cluster_key' in kwargs.keys(): cluster_key = kwargs['cluster_key'] else: cluster_key = HIJetFlags.HIClusterKey() if 'modulator' in kwargs.keys(): mod_tool = kwargs['modulator'] else: mod_tool = GetNullModulator() from HIJetRec.HIJetRecConf import HIClusterSubtraction toolName = 'HIClusterSubtraction' if 'name' in kwargs.keys(): toolName = kwargs['name'] theAlg = HIClusterSubtraction(toolName) theAlg.ClusterKey = cluster_key theAlg.EventShapeKey = event_shape_key theAlg.Subtractor = GetSubtractorTool(**kwargs) theAlg.Modulator = mod_tool do_cluster_moments = False if 'CalculateMoments' in kwargs.keys(): do_cluster_moments = kwargs['CalculateMoments'] if do_cluster_moments: from CaloRec.CaloRecConf import CaloClusterMomentsMaker from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault theCaloNoiseTool = CaloNoiseToolDefault() from AthenaCommon.AppMgr import ToolSvc ToolSvc += theCaloNoiseTool HIClusterMoments = CaloClusterMomentsMaker("HIClusterMoments") #HIClusterMoments.MaxAxisAngle = 20*deg HIClusterMoments.CaloNoiseTool = theCaloNoiseTool HIClusterMoments.UsePileUpNoise = False HIClusterMoments.MinBadLArQuality = 4000 HIClusterMoments.MomentsNames = [ "CENTER_MAG", "LONGITUDINAL", "FIRST_ENG_DENS", "SECOND_ENG_DENS", "ENG_FRAC_EM", "ENG_FRAC_MAX", "ENG_FRAC_CORE", "ENG_BAD_CELLS", "N_BAD_CELLS", "N_BAD_CELLS_CORR", "BAD_CELLS_CORR_E", "BADLARQ_FRAC", "ENG_POS", "SIGNIFICANCE", "CELL_SIGNIFICANCE", "CELL_SIG_SAMPLING", "AVG_LAR_Q", "AVG_TILE_Q" ] from IOVDbSvc.CondDB import conddb if not conddb.isOnline: from LArRecUtils.LArHVScaleRetrieverDefault import LArHVScaleRetrieverDefault HIClusterMoments.LArHVScaleRetriever = LArHVScaleRetrieverDefault() HIClusterMoments.MomentsNames += [ "ENG_BAD_HV_CELLS", "N_BAD_HV_CELLS" ] theAlg.ClusterCorrectionTools = [HIClusterMoments] jtm.add(theAlg) jtm.jetrecs += [theAlg] jtm.HIJetRecs += [theAlg]
def HIClusterGetter(tower_key="CombinedTower", cell_key="AllCalo", cluster_key=""): """Function to equip HI cluster builder from towers and cells, adds to output AOD stream""" if cluster_key == "": cluster_key = HIJetFlags.HIClusterKey() HIClusterMaker = CompFactory.HIClusterMaker theAlg = HIClusterMaker() theAlg.InputTowerKey = tower_key theAlg.CaloCellContainerKey = cell_key theAlg.OutputContainerKey = cluster_key from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() topSequence += theAlg if HIJetFlags.WriteClusters(): AddToOutputList(HIJetFlags.HIClusterKey(), "xAOD::CaloClusterContainer") return theAlg
def AppendOutputList(HIAODItemList=[]): """Adds HIJetOutputList to the list passed in as an argument""" if HIJetFlags.WriteClusters(): AddToOutputList(HIJetFlags.HIClusterKey(), "xAOD::CaloClusterContainer") from RecExConfig.RecFlags import rec if not rec.doESD(): for R in HIJetFlags.AntiKtRValues(): AddToOutputList("AntiKt%dHIJets" % int(10 * R)) if jetFlags.useTruth(): AddToOutputList("AntiKt%dTruthJets" % int(10 * R)) AddToOutputList(HIJetFlags.TrackJetContainerName()) HIAODItemList += HIJetFlags.HIJetOutputList()
def GetConstituentsModifierTool(**kwargs): #For the cluster key, same exact logic as used for ApplySubtractionToClusters if 'cluster_key' in kwargs.keys(): cluster_key = kwargs['cluster_key'] else: cluster_key = HIJetFlags.HIClusterKey() if 'apply_origin_correction' in kwargs.keys(): apply_origin_correction = kwargs['apply_origin_correction'] else: apply_origin_correction = HIJetFlags.ApplyOriginCorrection() HIJetConstituentModifierTool = CompFactory.HIJetConstituentModifierTool toolName = 'HIJetConstituentModifierTool' if 'name' in kwargs.keys(): toolName = kwargs['name'] cmod = HIJetConstituentModifierTool(toolName) cmod.ClusterKey = cluster_key cmod.Subtractor = GetSubtractorTool(**kwargs) cmod.ApplyOriginCorrection = apply_origin_correction jtm.add(cmod) return cmod
TrackVertexAssociation = jtm.tvassoc_HI.TrackVertexAssociation, SkipNegativeEnergy = True, GhostScale = 1e-20) jtm.jvf.unlock() jtm.jvf.TrackVertexAssociation=jtm.tvassoc_HI.TrackVertexAssociation jtm.jvf.lock() jtm.trkmoms.unlock() jtm.trkmoms.TrackVertexAssociation=jtm.tvassoc_HI.TrackVertexAssociation jtm.trkmoms.TrackMinPtCuts = [int(500*Units.MeV), int(1*Units.GeV), int(2*Units.GeV), int(4*Units.GeV)] jtm.trkmoms.lock() from JetRec.JetRecConf import PseudoJetGetter ClusterKey=HIJetFlags.HIClusterKey() from HIJetRec.HIJetRecConf import HIClusterPseudoJetGetter jtm += HIClusterPseudoJetGetter("get_HI", InputContainer = ClusterKey, Label = "LCTopo", #Label = "Tower", OutputContainer = "PseudoJet" + ClusterKey, SkipNegativeEnergy = False, TreatNegativeEnergyAsGhost=True, GhostScale = 1.e-20 ) jtm += PseudoJetGetter("gakt4trackget_HI", InputContainer = HIJetFlags.TrackJetContainerName(), Label = "Ghost" + HIJetFlags.TrackJetContainerName(), SkipNegativeEnergy = True,