def getGainLayerNames(obj):
    """getGainLayerNames( obj ) -> return a list of names of the decorations added to the
  egamma object, given the GainDecorator object"""
    return [getPropertyValue(obj, "decoration_pattern").format(info=info, layer=layer, gain=gain) \
      for info in ["E", "nCells"] \
      for layer in getPropertyValue(obj, "layers") \
      for gain in getPropertyValue(obj, "gain_names").values() ]
def getClusterEnergyPerLayerDecorations(obj):
    """getClusterEnergyPerLayerDecorations( obj ) -> return a list of names of the
  decorations added to the egamma object, given the ClusterEnergyPerLayerDecorations
  object (e.g. Photons.E7x11_Lr0, ...)"""
    properties = 'SGKey_photons', 'SGKey_electrons'
    collections = filter(bool, (getPropertyValue(obj, x) for x in properties))
    return ['{part}.E{neta}x{nphi}_Lr{layer}'.format(part=part,
      neta=getPropertyValue(obj, 'neta'),
      nphi=getPropertyValue(obj, 'nphi'),
      layer=layer) \
      for layer in getPropertyValue(obj, "layers") \
      for part in collections]
Beispiel #3
0
def configureEDCorrection(tool):
  """Configure tools and algorithm for energy density correction 
     (only if doEnergyDensityCorrection = True)"""
  # Return if doEnergyDensityCorrection is false
  if not getPropertyValue(tool, 'doEnergyDensityCorrection'):
    return
  # Set OutputLevel to INFO or higher if tool has it too
  OutputLevel = min(getPropertyValue(tool, 'OutputLevel'), INFO)
  try:
    from AthenaCommon.AppMgr import ToolSvc
    from EventShapeTools.EventDensityConfig import configEventDensityTool, EventDensityAlg
    from JetRec.JetRecStandard import jtm
    tc=configEventDensityTool("EDtpIsoCentralTool", jtm.emget,
                              radius          = 0.5,
                              AbsRapidityMin  = 0.0,
                              AbsRapidityMax  = 1.5,
                              OutputContainer = "DensitytpIsoCentral",
                              OutputLevel     = OutputLevel
                              )
    ToolSvc += tc
    tf=configEventDensityTool("EDtpIsoForwardTool", jtm.emget,
                              radius          = 0.5,
                              AbsRapidityMin  = 1.5,
                              AbsRapidityMax  = 3.0,
                              OutputContainer = "DensitytpIsoForward",
                              OutputLevel     = OutputLevel
                              )
    ToolSvc += tf
  except Exception:
    print '\nERROR: could not get handle to EDEgammaXTool'
    raise
 
  # add to topsequence 
  from AthenaCommon.AlgSequence import AlgSequence
  topSequence = AlgSequence()
  if not hasattr(topSequence,'EDtpIsoCentralAlg'):
    topSequence += EventDensityAlg("EDtpIsoCentralAlg", EventDensityTool = tc)
  if not hasattr(topSequence,'EDtpIsoForwardAlg'):
    topSequence += EventDensityAlg("EDtpIsoForwardAlg", EventDensityTool = tf)
Beispiel #4
0
def configureEDCorrection(tool):
    """Configure tools and algorithm for energy density correction 
     (only if doEnergyDensityCorrection = True)"""
    # Return if doEnergyDensityCorrection is false
    if not getPropertyValue(tool, 'doEnergyDensityCorrection'):
        return
    # Set OutputLevel to INFO or higher if tool has it too
    OutputLevel = min(getPropertyValue(tool, 'OutputLevel'), INFO)
    try:
        from AthenaCommon.AppMgr import ToolSvc
        from AthenaCommon.AlgSequence import AlgSequence
        from EventShapeTools.EventDensityConfig import configEventDensityTool, EventDensityAthAlg
        from JetRec.JetRecStandard import jtm
        topSequence = AlgSequence()
        if not hasattr(topSequence, 'EDtpIsoCentralAlg'):
            tccc = configEventDensityTool(
                "EDtpIsoCentralTool",
                jtm.emget,
                radius=0.5,
                AbsRapidityMin=0.0,
                AbsRapidityMax=1.5,
                OutputContainer="TopoClusterIsoCentralEventShape",
                OutputLevel=OutputLevel)
            ToolSvc += tccc
            topSequence += EventDensityAthAlg("EDtpIsoCentralAlg",
                                              EventDensityTool=tccc)

        if not hasattr(topSequence, 'EDtpIsoForwardAlg'):
            tfcc = configEventDensityTool(
                "EDtpIsoForwardTool",
                jtm.emget,
                radius=0.5,
                AbsRapidityMin=1.5,
                AbsRapidityMax=3.0,
                OutputContainer="TopoClusterIsoForwardEventShape",
                OutputLevel=OutputLevel)
            ToolSvc += tfcc
            topSequence += EventDensityAthAlg("EDtpIsoForwardAlg",
                                              EventDensityTool=tfcc)

        if not hasattr(topSequence, 'EDtpIsoVeryForwardAlg'):
            tvfcc = configEventDensityTool(
                "EDtpIsoVeryForwardTool",
                jtm.emget,
                radius=0.5,
                AbsRapidityMin=2.5,
                AbsRapidityMax=4.5,
                OutputContainer="TopoClusterIsoVeryForwardEventShape",
                OutputLevel=OutputLevel)
            ToolSvc += tvfcc
            topSequence += EventDensityAthAlg("EDtpIsoVeryForwardAlg",
                                              EventDensityTool=tvfcc)

        if doPFlow:
            if not hasattr(topSequence, 'EDpfIsoCentralAlg'):
                tcpf = configEventDensityTool(
                    "EDpfIsoCentralTool",
                    jtm.empflowget,
                    radius=0.5,
                    AbsRapidityMin=0.0,
                    AbsRapidityMax=1.5,
                    OutputContainer="ParticleFlowIsoCentralEventShape",
                    OutputLevel=OutputLevel)
                ToolSvc += tcpf
                topSequence += EventDensityAthAlg("EDpfIsoCentralAlg",
                                                  EventDensityTool=tcpf)

            if not hasattr(topSequence, 'EDpfIsoForwardAlg'):
                tfpf = configEventDensityTool(
                    "EDpfIsoForwardTool",
                    jtm.empflowget,
                    radius=0.5,
                    AbsRapidityMin=1.5,
                    AbsRapidityMax=3.0,
                    OutputContainer="ParticleFlowIsoForwardEventShape",
                    OutputLevel=OutputLevel)
                ToolSvc += tfpf
                topSequence += EventDensityAthAlg("EDpfIsoForwardAlg",
                                                  EventDensityTool=tfpf)

            ## Try a neutral density
            if not hasattr(topSequence, 'EDnpfIsoCentralAlg'):
                tcnpf = configEventDensityTool(
                    "EDnpfIsoCentralTool",
                    jtm.emnpflowget,
                    radius=0.5,
                    AbsRapidityMin=0.0,
                    AbsRapidityMax=1.5,
                    OutputContainer="NeutralParticleFlowIsoCentralEventShape",
                    OutputLevel=OutputLevel)
                ToolSvc += tcnpf
                topSequence += EventDensityAthAlg("EDnpfIsoCentralAlg",
                                                  EventDensityTool=tcnpf)

            if not hasattr(topSequence, 'EDnpfIsoForwardAlg'):
                tfnpf = configEventDensityTool(
                    "EDnpfIsoForwardTool",
                    jtm.emnpflowget,
                    radius=0.5,
                    AbsRapidityMin=1.5,
                    AbsRapidityMax=3.0,
                    OutputContainer="NeutralParticleFlowIsoForwardEventShape",
                    OutputLevel=OutputLevel)
                ToolSvc += tfnpf
                topSequence += EventDensityAthAlg("EDnpfIsoForwardAlg",
                                                  EventDensityTool=tfnpf)

    except Exception:
        print '\nERROR: could not get handle to ED'
        raise