예제 #1
0
def checkDoElectronIdentification():
    """ Return true if it can doElectronIdentification. Raise if it was
  expected to build electrons and it won't be possible. Return false if not
  asked to run electron identification."""
    if caloRingerFlags.doElectronIdentification():
        if not caloRingerFlags.buildElectronCaloRings():
            if not ( inputAvailable(outputCaloRingsType(), outputElectronCaloRingsKey())       or \
                     inputAvailable(outputCaloRingsType(), outputElectronCaloAsymRingsKey()) ) or \
               not ( inputAvailable(outputRingSetType(),   outputElectronRingSetsKey())        or \
                     inputAvailable(outputRingSetType(),   outputElectronAsymRingSetsKey()) ):

                mlog.warning((
                    "Requested to do Electron identification using "
                    "Ringer discrimination, but one or more of the Ringer needed "
                    "discrimination inputs are not available. We will request to "
                    "build ElectronCaloRings using default configuration."))
                # In this case, the input file does not have CaloRings, we need to build them:
                caloRingerFlags.buildElectronCaloRings = True
                if not checkBuildElectronCaloRings():
                    mlog.error(
                        ("Couldn't add ElectronCaloRings reconstruction to "
                         "joboptions."))
                    raise RuntimeError(
                        "Can't add ElectronCaloRings to reconstruction.")
            else:
                mlog.verbose(
                    "All Electron identification discrimination input "
                    "available in the file.")
        else:
            mlog.verbose(
                ("It will be used the ElectronCaloRings build within this "
                 "reconstruction to make the classification."))
        return True
    else:
        return False
예제 #2
0
def getCaloRingerElectronSelectorsBuilder():
    "Return the Electron Selectors"
    if caloRingerFlags.doElectronIdentification():
        from CaloRingerTools.CaloRingerSelectorsBuilders import CaloRingerElectronSelectorsBuilder
        return CaloRingerElectronSelectorsBuilder().getAllSelectorHandles()
    else:
        return PublicToolHandleArray([])
예제 #3
0
def getCaloRingerInputReaderTools():
    """ Returns a list with the CaloRinger tools to get the input objects to be
  decorated and pass them to their CaloRingerTools"""

    inputReaders = []

    try:
        if checkBuildElectronCaloRings() or checkDoElectronIdentification():
            from CaloRingerTools.CaloRingerInputReaderFactories \
                import CaloRingerElectronsReaderTool
            inputReaders.append(CaloRingerElectronsReaderTool())
            mlog.verbose("Added Ringer Electrons reader successfully.")
    except Exception:
        if caloRingerFlags.buildElectronCaloRings():
            mlog.error(("It won't be possible to build ElectronCaloRings!"
                        " Switching it off!"))
            caloRingerFlags.buildElectronCaloRings = False
        if caloRingerFlags.doElectronIdentification():
            mlog.error(("It won't be possible to do Electron identification!"
                        " Switching it off!"))
            caloRingerFlags.doElectronIdentification = False
        treatException("Could not set up Ringer Electrons reader!")

    try:
        if checkBuildPhotonCaloRings() or checkDoPhotonIdentification():
            from CaloRingerTools.CaloRingerInputReaderFactories \
                import CaloRingerPhotonsReaderTool
            inputReaders.append(CaloRingerPhotonsReaderTool())
            mlog.verbose("Added Ringer Photon reader successfully.")
    except Exception:
        if caloRingerFlags.buildPhotonCaloRings():
            mlog.error(("It won't be possible to build PhotonCaloRings!"
                        " Switching it off!"))
            caloRingerFlags.buildPhotonCaloRings = False
        if caloRingerFlags.doPhotonIdentification():
            mlog.error(
                ("It won't be possible to build do Photon identification!"
                 " Switching it off!"))
            caloRingerFlags.doPhotonIdentification = False
        treatException("Could not set up CaloRingerAlgorithm for Photons!")

    return inputReaders