def MakeSubtractionTool(shapeKey, moment_name='', momentOnly=False, **kwargs): from HIJetRec.HIJetRecConf import HIJetConstituentSubtractionTool suffix = shapeKey if momentOnly: suffix += '_' + moment_name if 'modulator' in kwargs.keys(): mod_tool = kwargs['modulator'] else: mod_tool = GetNullModulator() subtr = HIJetConstituentSubtractionTool("HICS_" + suffix) subtr.EventShapeKey = shapeKey subtr.Modulator = mod_tool subtr.MomentName = 'JetSubtractedScale%sMomentum' % moment_name subtr.SetMomentOnly = momentOnly subtr.ApplyOriginCorrection = HIJetFlags.ApplyOriginCorrection() subtr.Subtractor = GetSubtractorTool(**kwargs) jtm.add(subtr) return subtr
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
output_cluster_key=cluster_key_eGamma_deep, modulator=modulator1, map_tool=theMapTool, CalculateMoments=True, useClusters=False, apply_origin_correction=False) #Cluster subtraction for jets ApplySubtractionToClusters( event_shape_key=HIJetFlags.IteratedEventShapeKey(), cluster_key=cluster_key_eGamma_deep, output_cluster_key=cluster_key_final_deep, modulator=modulator1, map_tool=theMapTool, CalculateMoments=False, useClusters=True, apply_origin_correction=HIJetFlags.ApplyOriginCorrection()) #put subtraction tool at the FRONT of the jet modifiers list hi_tools = [subtr1, subtr2] hi_tools += GetFlowMomentTools(iter1.OutputEventShapeKey, iter1.ModulationEventShapeKey) hi_tools += [ GetConstituentsModifierTool( name="HIJetConstituentModifierTool", cluster_key=cluster_key_final_deep, apply_origin_correction=HIJetFlags.ApplyOriginCorrection()) ] ### #subtracted algorithms #make main jets from unsubtr collections w/ same R, add modifiers for subtraction
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 'output_cluster_key' in kwargs.keys(): output_cluster_key = kwargs['output_cluster_key'] else: cluster_key = cluster_key + ".deepCopy" if 'modulator' in kwargs.keys(): mod_tool = kwargs['modulator'] else: mod_tool = GetNullModulator() if 'map_tool' in kwargs.keys(): map_tool = kwargs['map_tool'] else: from HIEventUtils.HIEventUtilsConf import HIEventShapeMapTool map_tool = HIEventShapeMapTool() if 'update_only' in kwargs.keys(): update_only = kwargs['update_only'] else: update_only = False if 'apply_origin_correction' in kwargs.keys(): apply_origin_correction = kwargs['apply_origin_correction'] else: apply_origin_correction = HIJetFlags.ApplyOriginCorrection() do_cluster_moments = False if 'CalculateMoments' in kwargs.keys(): do_cluster_moments = kwargs['CalculateMoments'] HIClusterSubtraction = CompFactory.HIClusterSubtraction toolName = 'HIClusterSubtraction' if 'name' in kwargs.keys(): toolName = kwargs['name'] theAlg = HIClusterSubtraction(toolName) theAlg.ClusterKey = cluster_key theAlg.OutClusterKey = output_cluster_key theAlg.EventShapeKey = event_shape_key theAlg.Subtractor = GetSubtractorTool(**kwargs) theAlg.Modulator = mod_tool theAlg.UpdateOnly = update_only theAlg.SetMoments = do_cluster_moments theAlg.ApplyOriginCorrection = apply_origin_correction theAlg.EventShapeMapTool = map_tool if do_cluster_moments: CaloClusterMomentsMaker = CompFactory.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]