Exemple #1
0
def getConstitFourMomTool_copy():
    cfourmom = CompFactory.JetConstitFourMomTool(
        "constitfourmom_copy",
        JetScaleNames=["DetectorEtaPhi"],
        AltConstitColls=[""],
        AltConstitScales=[0],
        AltJetScales=["JetConstitScaleMomentum"])
    return cfourmom
Exemple #2
0
def getConstitFourMomTool(jetdef):
    ### Not ideal, but because CaloCluster.Scale is an internal class
    ### it makes the dict load really slow.
    ### So just copy the enum to a dict...
    ### Defined in Event/xAOD/xAODCaloEvent/versions/CaloCluster_v1.h
    CaloClusterStates = {
        "UNKNOWN": -1,
        "UNCALIBRATED": 0,
        "CALIBRATED": 1,
        "ALTCALIBRATED": 2,
        "NSTATES": 3
    }

    ### Workaround for inability of Gaudi to parse single-element tuple
    try:
        import GaudiPython.Bindings as GPB
        _old_setattr = GPB.iProperty.__setattr__

        def _new_setattr(self, name, value):
            if type(value) == tuple:
                value = list(value)
            return _old_setattr(self, name, value)

        GPB.iProperty.__setattr__ = _new_setattr
    except Exception:
        pass
    ###
    cfourmom = CompFactory.JetConstitFourMomTool("constitfourmom_{0}".format(
        jetdef.basename))
    if "LCTopo" in jetdef.basename or "EMTopo" in jetdef.basename:
        cfourmom.JetScaleNames = ["DetectorEtaPhi"]
        if "HLT_" in jetdef.inputdef.inputname:
            cfourmom.AltConstitColls = [""]
            cfourmom.AltConstitScales = [0]
            cfourmom.AltJetScales = ["JetConstitScaleMomentum"]
        else:
            cfourmom.AltConstitColls = ["CaloCalTopoClusters"]
            cfourmom.AltConstitScales = [CaloClusterStates["CALIBRATED"]]
            cfourmom.AltJetScales = [""]
    # Drop the LC-calibrated four-mom for EMTopo jets as we only wanted it as a possibility
    # in MET CST calculations but never used it
    elif "EMPFlow" in jetdef.basename:
        cfourmom.JetScaleNames = ["DetectorEtaPhi"]
        cfourmom.AltConstitColls = [""]
        cfourmom.AltConstitScales = [0]
        cfourmom.AltJetScales = ["JetConstitScaleMomentum"]

    return cfourmom