예제 #1
0
    def configure(self):
        mlog = logging.getLogger('egammaTrackSlimmer.py::configure:')
        mlog.info('entering')

        try:
            from egammaRec.egammaRecConf import egammaTrackSlimmer
            theEgammaTrackSlimmer = egammaTrackSlimmer(
                "egammaTrackSlimmer",
                InputElectronContainerName=egammaKeys.outputElectronKey(),
                InputPhotonContainerName=egammaKeys.outputPhotonKey(),
                TrackParticleContainerName=egammaKeys.outputTrackParticleKey(),
                VertexContainerName=egammaKeys.outputConversionKey(),
                doThinning=True)
            print theEgammaTrackSlimmer
        except Exception:
            mlog.error("could not get handle to egammaTrackSlimmer")
            print traceback.format_exc()
            return False

        # add to topsequence
        mlog.info("now adding to topSequence")
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        topSequence += theEgammaTrackSlimmer

        return True
def getGainDecorations(obj,
                       collections=[
                           egammaKeys.outputElectronKey(),
                           egammaKeys.outputPhotonKey()
                       ],
                       info=["E", "nCells"]):
    """getGainDecorations( obj, collections=["Electrons", "Photons"] ) -> 
  Return a list with the 'ExtraContent' to be added to the decorations to save the gain
  information per layer"""
    return ["{part}.{info}".format(part=part, info=info) for part in collections \
      for info in getGainLayerNames(obj) ]
예제 #3
0
    def configure(self):
        mlog = logging.getLogger ('egammaGetter.py::configure:')
        mlog.info('entering')        

        if doSuperclusters() : 
          egammaBuilder = AlgFactory(egammaRecConf.topoEgammaBuilder, name = 'egamma',
                                     # Keys
                                     ElectronOutputName = egammaKeys.outputElectronKey(),
                                     PhotonOutputName = egammaKeys.outputPhotonKey(),                                     
                                     #Super Cluster Tools
                                     TopoClusterCopier = egammaTopoClusterCopier,
                                     electronSuperClusterBuilder = electronSuperClusterBuilder,
                                     photonSuperClusterBuilder = photonSuperClusterBuilder,
                                     InputTopoClusterContainerName = egammaRecFlags.egammaTopoClusterCollection(),                                           
                                     # Builder tools
                                     BremCollectionBuilderTool = EMBremCollectionBuilder,
                                     TrackMatchBuilderTool = EMTrackMatchBuilder,
                                     VertexBuilder = EMVertexBuilder if doConversions() else None,
                                     ConversionBuilderTool = EMConversionBuilder if doConversions() else None,
                                     AmbiguityTool = EGammaAmbiguityTool,                                     
                                     # Decoration tools
                                     egammaTools = FcnWrapper(egammaDecorationTools),
                                     ElectronTools = FcnWrapper(electronDecorationTools),
                                     PhotonTools = FcnWrapper(photonDecorationTools),                                     
                                     # Flags and other properties
                                     # Track matching depending if ID is on/off
                                     doTrackMatching = DetFlags.detdescr.ID_on(),
                                     # conversions building/matching depending if ID is on/off
                                     doVertexCollection=doConversions(),
                                     doConversions = doConversions()
                                     )
        else : 
          egammaBuilder = AlgFactory(egammaRecConf.egammaBuilder, name = 'egamma',
                                     # Keys
                                     ElectronOutputName = egammaKeys.outputElectronKey(),
                                     PhotonOutputName = egammaKeys.outputPhotonKey(),
                                     TopoSeededClusterContainerName = getTopoSeededCollectionName(),                                     
                                     # Builder tools
                                     BremCollectionBuilderTool = EMBremCollectionBuilder,
                                     TrackMatchBuilderTool = EMTrackMatchBuilder,
                                     VertexBuilder = EMVertexBuilder if doConversions() else None,
                                     ConversionBuilderTool = EMConversionBuilder if doConversions() else None,
                                     AmbiguityTool = EGammaAmbiguityTool,                                     
                                     # Decoration tools
                                     egammaTools = FcnWrapper(egammaDecorationTools),
                                     ElectronTools = FcnWrapper(electronDecorationTools),
                                     PhotonTools = FcnWrapper(photonDecorationTools),                                     
                                     # Flags and other properties
                                     # Track matching depending if ID is on/off
                                     doTrackMatching = DetFlags.detdescr.ID_on(),
                                     # conversions building/matching depending if ID is on/off
                                     doVertexCollection=doConversions(),
                                     doConversions = doConversions(),
                                     #
                                     clusterEnergyCut = 10*MeV,
                                     doTopoSeededPhotons = egammaRecFlags.doTopoCaloSeeded()
                                     )          

        # configure egamma here:
        try:
            self._egammaBuilderHandle = egammaBuilder()
        except Exception:
            mlog.error("could not get handle to egamma")
            import traceback
            print traceback.format_exc()
            return False
        
        print self._egammaBuilderHandle
        return True
예제 #4
0
#-------------------------

egammaSwTool = ToolFactory(egammaToolsConf.egammaSwTool,
                           postInit=[configureClusterCorrections])

from egammaMVACalib import egammaMVACalibConf
egammaMVATool = ToolFactory(
    egammaMVACalibConf.egammaMVATool,
    folder=jobproperties.egammaRecFlags.calibMVAVersion())

EMClusterTool = ToolFactory(
    egammaToolsConf.EMClusterTool,
    OutputClusterContainerName=egammaKeys.outputClusterKey(),
    OutputTopoSeededClusterContainerName=egammaKeys.outputTopoSeededClusterKey(
    ),
    ElectronContainerName=egammaKeys.outputElectronKey(),
    PhotonContainerName=egammaKeys.outputPhotonKey(),
    ClusterCorrectionToolName=FullNameWrapper(egammaSwTool),
    doSuperCluster=jobproperties.egammaRecFlags.doSuperclusters(),
    MVACalibTool=egammaMVATool)

egammaCheckEnergyDepositTool = ToolFactory(
    egammaToolsConf.egammaCheckEnergyDepositTool,
    UseThrFmax=True,
    ThrF0max=0.9,
    ThrF1max=0.8,
    ThrF2max=0.98,
    ThrF3max=0.8)

from EMBremCollectionBuilder import egammaBremCollectionBuilder
from egammaTrackTools.egammaTrackToolsFactories import EMExtrapolationTools
# Declares a GainDecorator factory. To add it to your decoration:
# from DerivationFrameworkCalo.DerivationFrameworkCaloFactories import GainDecorator, getExtraContent
# GainDecoratorTool = GainDecorator()
# MySlimmingHelper.ExtraVariables.extend( getGainDecorations(GainDecoratorTool) )

# Currently it adds:
# ['Electrons.E_Lr0_HiG', 'Electrons.E_Lr0_MedG', 'Electrons.E_Lr0_LowG', 'Electrons.E_Lr1_HiG', 'Electrons.E_Lr1_MedG', 'Electrons.E_Lr1_LowG', 'Electrons.E_Lr2_HiG', 'Electrons.E_Lr2_MedG', 'Electrons.E_Lr2_LowG', 'Electrons.E_Lr3_HiG', 'Electrons.E_Lr3_MedG', 'Electrons.E_Lr3_LowG', 'Electrons.nCells_Lr0_HiG', 'Electrons.nCells_Lr0_MedG', 'Electrons.nCells_Lr0_LowG', 'Electrons.nCells_Lr1_HiG', 'Electrons.nCells_Lr1_MedG', 'Electrons.nCells_Lr1_LowG', 'Electrons.nCells_Lr2_HiG', 'Electrons.nCells_Lr2_MedG', 'Electrons.nCells_Lr2_LowG', 'Electrons.nCells_Lr3_HiG', 'Electrons.nCells_Lr3_MedG', 'Electrons.nCells_Lr3_LowG', 'Photons.E_Lr0_HiG', 'Photons.E_Lr0_MedG', 'Photons.E_Lr0_LowG', 'Photons.E_Lr1_HiG', 'Photons.E_Lr1_MedG', 'Photons.E_Lr1_LowG', 'Photons.E_Lr2_HiG', 'Photons.E_Lr2_MedG', 'Photons.E_Lr2_LowG', 'Photons.E_Lr3_HiG', 'Photons.E_Lr3_MedG', 'Photons.E_Lr3_LowG', 'Photons.nCells_Lr0_HiG', 'Photons.nCells_Lr0_MedG', 'Photons.nCells_Lr0_LowG', 'Photons.nCells_Lr1_HiG', 'Photons.nCells_Lr1_MedG', 'Photons.nCells_Lr1_LowG', 'Photons.nCells_Lr2_HiG', 'Photons.nCells_Lr2_MedG', 'Photons.nCells_Lr2_LowG', 'Photons.nCells_Lr3_HiG', 'Photons.nCells_Lr3_MedG', 'Photons.nCells_Lr3_LowG']

from egammaRec.Factories import ToolFactory, getPropertyValue
from egammaRec import egammaKeys
from DerivationFrameworkCalo.DerivationFrameworkCaloConf import DerivationFramework__GainDecorator, DerivationFramework__ClusterEnergyPerLayerDecorator
from CaloClusterCorrection.CaloClusterCorrectionConf import CaloFillRectangularCluster as CFRC
from GaudiKernel.Constants import DEBUG

GainDecorator = ToolFactory(DerivationFramework__GainDecorator,
                            SGKey_electrons=egammaKeys.outputElectronKey(),
                            SGKey_photons=egammaKeys.outputPhotonKey(),
                            OutputLevel=DEBUG)

# Define defaults for CaloFillRectangularCluster and ClusterEnergyPerLayerDecorator
# will be overridden later depending on the number of cells neta X nphi
CaloFillRectangularCluster = ToolFactory(CFRC,
                                         cells_name=egammaKeys.caloCellKey(),
                                         fill_cluster=True)

ClusterEnergyPerLayerDecorator = ToolFactory(
    DerivationFramework__ClusterEnergyPerLayerDecorator,
    CaloFillRectangularTool=CaloFillRectangularCluster,
    SGKey_electrons=egammaKeys.outputElectronKey(),
    SGKey_photons=egammaKeys.outputPhotonKey(),
    SGKey_caloCells=egammaKeys.caloCellKey())
예제 #6
0
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration

__doc__ = """ToolFactory to instantiate the
two supercluster builders with default configuration"""
__author__ = "Jovan Mitrevski"

from egammaAlgs import egammaAlgsConf
from egammaRec.Factories import AlgFactory
from egammaRec import egammaKeys

from egammaTools.egammaToolsFactories import EGammaAmbiguityTool

topoEgammaBuilder = AlgFactory(
    egammaAlgsConf.topoEgammaBuilder,
    name='topoEgammaBuilder',
    SuperElectronRecCollectionName=egammaKeys.ElectronSuperRecKey(),
    SuperPhotonRecCollectionName=egammaKeys.PhotonSuperRecKey(),
    ElectronOutputName=egammaKeys.outputElectronKey(),
    PhotonOutputName=egammaKeys.outputPhotonKey(),
    AmbiguityTool=EGammaAmbiguityTool)