Пример #1
0
    def dumpSignatureList(self, l1_items, fname):
        def dumpIt(fp, sigs, slicename):
            log.info("SignatureList %s" % sigs)
            fp.write('%sSliceFlags.signatures = [\n' % slicename)
            for s in sigs:
                fp.write("    '%s', \n" % s)
            fp.write('    ]\n')

        f = open(fname, 'w')
        f.write('Items = [\n')
        for i in l1_items:
            f.write("'%s', \n" % i)
        f.write('    ]\n')
        dumpIt(f, JetSliceFlags.signatures(), 'Jet')
        dumpIt(f, BjetSliceFlags.signatures(), 'Bjet')
        dumpIt(f, MuonSliceFlags.signatures(), 'Muon')
        dumpIt(f, BphysicsSliceFlags.signatures(), 'Bphysics')
        dumpIt(f, EgammaSliceFlags.signatures(), 'Egamma')
        dumpIt(f, METSliceFlags.signatures(), 'MET')
        dumpIt(f, TauSliceFlags.signatures(), 'Tau')
        dumpIt(f, MinBiasSliceFlags.signatures(), 'MinBias')
        dumpIt(f, HeavyIonSliceFlags.signatures(), 'HeavyIon')
        dumpIt(f, CosmicSliceFlags.signatures(), 'Cosmic')
        dumpIt(f, CalibSliceFlags.signatures(), 'Calibration')
        dumpIt(f, StreamingSliceFlags.signatures(), 'Streaming')
        dumpIt(f, MonitorSliceFlags.signatures(), 'Monitoring')
        dumpIt(f, BeamspotSliceFlags.signatures(), 'Beamspot')
        dumpIt(f, EnhancedBiasSliceFlags.signatures(), 'EnhancedBias')
        dumpIt(f, TestSliceFlags.signatures(), 'Test')
        pass
Пример #2
0
def _GetPath( cand, sel, basepath = 'RingerSelectorTools/TrigL2_20180903_v9' ):
    
    logger = logging.getLogger("TrigMultiVarHypo.GetPath")
    from TriggerMenu.egamma.EgammaSliceFlags import EgammaSliceFlags
    if EgammaSliceFlags.ringerVersion():
       basepath = EgammaSliceFlags.ringerVersion()
    logger.info('TrigMultiVarHypo version: %s', basepath)
    if not sel in _possibleSel.keys():
       raise RuntimeError( "Bad selection name: %s" % sel )
    if 'e' in cand:
       constant = basepath+'/'+ 'TrigL2CaloRingerElectron{SEL}Constants.root'.format(SEL=_possibleSel[sel])
       threshold = basepath+'/'+ 'TrigL2CaloRingerElectron{SEL}Thresholds.root'.format(SEL=_possibleSel[sel])
    elif 'g' in cand:
       constant = basepath+'/'+ 'TrigL2CaloRingerPhoton{SEL}Constants.root'.format(SEL=_possibleSel[sel])
       threshold = basepath+'/'+ 'TrigL2CaloRingerPhoton{SEL}Thresholds.root'.format(SEL=_possibleSel[sel])
    else:
       raise RuntimeError( "Bad signature %s" % cand )
    return constant, threshold
Пример #3
0
  def __init__(self):
    
    from AthenaCommon.Logging import logging
    self._logger = logging.getLogger("TrigMultiVarHypo.TrigL2CaloRingerPidConfs")

    #TODO: Use this to configurate the calib path from triggerMenu flags
    from TriggerMenu.egamma.EgammaSliceFlags import EgammaSliceFlags
    if EgammaSliceFlags.ringerVersion():
      self._basePath = EgammaSliceFlags.ringerVersion()
      self._logger.info('TrigMultiVarHypo version: %s',self._basePath)
    else:
      self._basePath = self._default_basepath
      self._logger.info('TrigMultiVarHypo version: %s (default)',self._basePath)

    # Electron files
    self._electronConstants = {
        'vloose' : 'TrigL2CaloRingerElectronVeryLooseConstants.root',
        'loose'  : 'TrigL2CaloRingerElectronLooseConstants.root',
        'medium' : 'TrigL2CaloRingerElectronMediumConstants.root',
        'tight'  : 'TrigL2CaloRingerElectronTightConstants.root',
        }
    self._electronCutDefs = {
        'vloose' : 'TrigL2CaloRingerElectronVeryLooseThresholds.root',
        'loose'  : 'TrigL2CaloRingerElectronLooseThresholds.root',
        'medium' : 'TrigL2CaloRingerElectronMediumThresholds.root',
        'tight'  : 'TrigL2CaloRingerElectronTightThresholds.root',
        }

    #TODO: photon paths for future
    self._photonConstants = {
        'vloose' : 'TrigL2CaloRingerPhotonVeryLooseConstants.root',
        'loose'  : 'TrigL2CaloRingerPhotonLooseConstants.root',
        'medium' : 'TrigL2CaloRingerPhotonMediumConstants.root',
        'tight'  : 'TrigL2CaloRingerPhotonTightConstants.root',
        }
    self._photonCutDefs = {
        'vloose' : 'TrigL2CaloRingerPhotonVeryLooseThresholds.root',
        'loose'  : 'TrigL2CaloRingerPhotonLooseThresholds.root',
        'medium' : 'TrigL2CaloRingerPhotonMediumThresholds.root',
        'tight'  : 'TrigL2CaloRingerPhotonTightThresholds.root',
        }
Пример #4
0
def configureClusterCorrections(slwAlg):
    '''Add attributes ClusterCorrectionToolsXX to egammaSwTool object'''
    if not hasattr(slwAlg, "ClusterCorrectionTools"):
        return
    from CaloClusterCorrection.CaloSwCorrections import make_CaloSwCorrections
    clusterTypes = ("ele37", "ele55")
    for cl in clusterTypes:
        clName = "CaloRunClusterCorrections" + cl
        if hasattr(slwAlg, clName):
            continue
        for tool in make_CaloSwCorrections(
                cl, version=EgammaSliceFlags.clusterCorrectionVersion()):
            slwAlg += tool
            slwAlg.ClusterCorrectionTools += [tool.getFullName()]
Пример #5
0
def configureClusterCorrections(swTool):
    '''Add attributes ClusterCorrectionToolsXX to egammaSwTool object'''
    from CaloClusterCorrection.CaloSwCorrections import  make_CaloSwCorrections, rfac, etaoff_b1, etaoff_e1, \
        etaoff_b2,etaoff_e2,phioff_b2,phioff_e2,update,time,listBadChannel
    from CaloRec.CaloRecMakers import _process_tools

    clusterTypes = dict(Ele35='ele35',
                        Ele55='ele55',
                        Ele37='ele37',
                        Gam35='gam35_unconv',
                        Gam55='gam55_unconv',
                        Gam37='gam37_unconv',
                        Econv35='gam35_conv',
                        Econv55='gam55_conv',
                        Econv37='gam37_conv')
    for attrName, clName in clusterTypes.iteritems():
        x = 'ClusterCorrectionTools' + attrName
        if not hasattr(swTool, x) or getattr(swTool, x):
            continue
        y = make_CaloSwCorrections(
            clName,
            suffix='EG',
            version=EgammaSliceFlags.clusterCorrectionVersion(),
            cells_name="")  #(egammaKeys.caloCellKey() )
        setattr(swTool, x, _process_tools(swTool, y))

    #Super cluster position only corrections
    for attrName, clName in clusterTypes.iteritems():
        n = 'ClusterCorrectionToolsSuperCluster' + attrName
        if not hasattr(swTool, n) or getattr(swTool, n):
            continue

        setattr(swTool, n,
                _process_tools(
                    swTool,
                    make_CaloSwCorrections(
                        clName,
                        suffix='EGSuperCluster',
                        corrlist=[[rfac, 'v5'], [etaoff_b1, 'v5'],
                                  [etaoff_e1, 'v5'], [etaoff_b2, 'v5'],
                                  [etaoff_e2, 'v5'], [phioff_b2, 'v5data'],
                                  [phioff_e2, 'v5data'], [update], [time],
                                  [listBadChannel]],
                        cells_name="")))  #(((egammaKeys.caloCellKey() )))
Пример #6
0
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration

__doc__ = "Tool and service factories to instantiate MVA calibration for trigger"
__author__ = "Jovan Mitrevski"

from egammaRec.Factories import ToolFactory, ServiceFactory

import logging
mlog = logging.getLogger('TrigEgammaMVACalibFactories')

from egammaMVACalib import egammaMVACalibConf
from TriggerMenu.egamma.EgammaSliceFlags import EgammaSliceFlags
mlog.info("MVA version version %s" % EgammaSliceFlags.calibMVAVersion())
mlog.info("Cluster Correction version %s" %
          EgammaSliceFlags.clusterCorrectionVersion())
EgammaSliceFlags.calibMVAVersion.set_On()

from xAODEgamma.xAODEgammaParameters import xAOD

TrigElectronMVATool = ToolFactory(egammaMVACalibConf.egammaMVACalibTool,
                                  name="TrigElectronMVATool",
                                  ParticleType=xAOD.EgammaParameters.electron,
                                  folder=EgammaSliceFlags.calibMVAVersion(),
                                  use_layer_corrected=False)

TrigPhotonMVATool = ToolFactory(
    egammaMVACalibConf.egammaMVACalibTool,
    name="TrigPhotonMVATool",
    ParticleType=xAOD.EgammaParameters.unconvertedPhoton,
    folder=EgammaSliceFlags.calibMVAVersion(),
    use_layer_corrected=False)
Пример #7
0
    def getChainsFromMenu(self):
        """
        == returns the list of chain names that are in the menu 
        """

        log.debug('Creating list of all available slice signatures flags')
        # make one big list of enabled signatures
        chains = []

        if (CombinedSliceFlags.signatures()
                or EgammaSliceFlags.signatures()) and self.doEgammaChains:
            chains += EgammaSliceFlags.signatures()
            log.debug('GenerateMenu : Electrons and Photons : %s', chains)
        else:
            self.doEgammaChains = False

        if (CombinedSliceFlags.signatures()
                or JetSliceFlags.signatures()) and self.doJetChains:
            chains += JetSliceFlags.signatures()
        else:
            self.doJetChains = False

        if (CombinedSliceFlags.signatures()
                or BjetSliceFlags.signatures()) and self.doBjetChains:
            chains += BjetSliceFlags.signatures()
        else:
            self.doBjetChains = False

        if (CombinedSliceFlags.signatures()
                or MuonSliceFlags.signatures()) and self.doMuonChains:
            chains += MuonSliceFlags.signatures()
            log.debug('GenerateMenu : Muons : %s', chains)
        else:
            self.doMuonChains = False

        if (CombinedSliceFlags.signatures()
                or BphysicsSliceFlags.signatures()) and self.doBphysicsChains:
            chains += BphysicsSliceFlags.signatures()
            log.debug('GenerateMenu : Bphysics : %s', chains)
        else:
            self.doBphysicsChains = False

        if (CombinedSliceFlags.signatures()
                or METSliceFlags.signatures()) and self.doMETChains:
            chains += METSliceFlags.signatures()
            log.debug('GenerateMenu : MET : %s', chains)
        else:
            self.doMETChains = False

        if (CombinedSliceFlags.signatures()
                or TauSliceFlags.signatures()) and self.doTauChains:
            chains += TauSliceFlags.signatures()
            log.debug('GenerateMenu : Tau : %s', chains)
        else:
            self.doTauChains = False

        if (CombinedSliceFlags.signatures()
                or MinBiasSliceFlags.signatures()) and self.doMinBiasChains:
            chains += MinBiasSliceFlags.signatures()
            log.debug('GenerateMenu : MinBias : %s', chains)
        else:
            self.doMinBiasChains = False

        if (CombinedSliceFlags.signatures()
                or HeavyIonSliceFlags.signatures()) and self.doHeavyIonChains:
            chains += HeavyIonSliceFlags.signatures()
            log.debug('GenerateMenu : HeavyIon : %s', chains)
        else:
            self.doHeavyIonChains = False

        if CosmicSliceFlags.signatures() and self.doCosmicChains:
            chains += CosmicSliceFlags.signatures()
            log.debug('GenerateMenu : Cosmic : %s', chains)
        else:
            self.doCosmicChains = False

        if CalibSliceFlags.signatures() and self.doCalibrationChains:
            chains += CalibSliceFlags.signatures()
            log.debug('GenerateMenu : Calibration : %s', chains)
        else:
            self.doCalibrationChains = False

        if StreamingSliceFlags.signatures() and self.doStreamingChains:
            chains += StreamingSliceFlags.signatures()
            log.debug('GenerateMenu : Streaming : %s', chains)
        else:
            self.doStreamingChains = False

        if MonitorSliceFlags.signatures() and self.doMonitorChains:
            chains += MonitorSliceFlags.signatures()
            log.debug('GenerateMenu : Monitor : %s', chains)
        else:
            self.doMonitorChains = False

        if BeamspotSliceFlags.signatures() and self.doBeamspotChains:
            chains += BeamspotSliceFlags.signatures()
            log.debug('GenerateMenu : Beamspot : %s', chains)
        else:
            self.doBeamspotChains = False

        if EnhancedBiasSliceFlags.signatures() and self.doEnhancedBiasChains:
            chains += EnhancedBiasSliceFlags.signatures()
            log.debug('GenerateMenu : EnhancedBias : %s', chains)
        else:
            self.doEnhancedBiasChains = False

        if TestSliceFlags.signatures() and self.doTestChains:
            chains += TestSliceFlags.signatures()
            log.debug('GenerateMenu : Test chains : %s', chains)
        else:
            self.doTestChains = False

        log.debug('Enabled before comb chains: %s', chains)
        if CombinedSliceFlags.signatures():
            chains += CombinedSliceFlags.signatures()
        else:
            self.doCombinedChains = False
        log.debug('Enabled after comb chains: %s', chains)

        log.debug('GenerateMenu : all Chains : %s', chains)
        return chains
Пример #8
0
# Include electron menus for LH and Cut-based
from ElectronPhotonSelectorTools.ElectronLikelihoodToolMapping import electronLHmenu
from ElectronPhotonSelectorTools.ElectronIsEMSelectorMapping import electronPIDmenu
from ElectronPhotonSelectorTools.PhotonIsEMSelectorMapping import photonPIDmenu
from ElectronPhotonSelectorTools.ConfiguredAsgElectronIsEMSelectors import ConfiguredAsgElectronIsEMSelector
from ElectronPhotonSelectorTools.ConfiguredAsgElectronLikelihoodTools import ConfiguredAsgElectronLikelihoodTool
from ElectronPhotonSelectorTools.ConfiguredAsgPhotonIsEMSelectors import ConfiguredAsgPhotonIsEMSelector
from ElectronPhotonSelectorTools.TrigEGammaPIDdefs import SelectionDefElectron
from ElectronPhotonSelectorTools.TrigEGammaPIDdefs import SelectionDefPhoton
from ElectronPhotonSelectorTools.TrigEGammaPIDdefs import BitDefElectron

mlog = logging.getLogger('TrigEgammaPidTools')
# Path for versioned configuration
from TriggerMenu.egamma.EgammaSliceFlags import EgammaSliceFlags
EgammaSliceFlags.pidVersion.set_On()
mlog.info("TrigEgammaPidTools version %s" % EgammaSliceFlags.pidVersion())
ConfigFilePath = EgammaSliceFlags.pidVersion()

# Dictionaries for ToolNames
ElectronToolName = {
    'vloose': 'AsgElectronIsEMVLooseSelector',
    'loose': 'AsgElectronIsEMLooseSelector',
    'medium': 'AsgElectronIsEMMediumSelector',
    'tight': 'AsgElectronIsEMTightSelector',
    'mergedtight': 'AsgElectronIsEMMergedTightSelector',
    'lhvloose': 'AsgElectronLHVLooseSelector',
    'lhloose': 'AsgElectronLHLooseSelector',
    'lhmedium': 'AsgElectronLHMediumSelector',
    'lhtight': 'AsgElectronLHTightSelector',
    'bloose': 'AsgElectronIsEMBLooseSelector',
}
Пример #9
0
    postInit=[appendtoTrigEMTrackMatchBuilder],
    broadDeltaEta=0.2,  #For offline 0.1
    broadDeltaPhi=0.2,  #For offline 0.15
    useScoring=False,
    SecondPassRescale=False,
    ExtrapolationTool=TrigEMExtrapolationTools)

TrigEMShowerBuilder = EMShowerBuilder.copyPublic(
    name="TrigEgammaShowerBuilder",
    CellsName="",
    Print=True,
)

from TriggerMenu.egamma.EgammaSliceFlags import EgammaSliceFlags

mlog.info("MVA version version %s", EgammaSliceFlags.calibMVAVersion())
mlog.info("Cluster Correction version %s",
          EgammaSliceFlags.clusterCorrectionVersion())
EgammaSliceFlags.calibMVAVersion.set_On()

from TrigCaloRec.TrigCaloRecConf import TrigCaloClusterMaker


def configureTrigCaloClusterMonitoring(tool):
    from TrigCaloRec.TrigCaloClusterMakerMonitoring import TrigCaloClusterMakerValidationMonitoring, TrigCaloClusterMakerOnlineMonitoring, TrigCaloClusterMakerCosmicMonitoring
    from TrigTimeMonitor.TrigTimeHistToolConfig import TrigTimeHistToolConfig
    clvalidation = TrigCaloClusterMakerValidationMonitoring()
    clonline = TrigCaloClusterMakerOnlineMonitoring()
    clcosmic = TrigCaloClusterMakerCosmicMonitoring()
    cltime = TrigTimeHistToolConfig("TrigCaloClusterMaker_Time")
    tool.AthenaMonTools = [clvalidation, clonline, cltime, clcosmic]