def toolNeuralNetworkToHistoToolNN(name, useBTagFlagsDefaults=True, **options):
    """Sets up a NeuralNetworkToHistoToolNN tool and returns it.

    The following options have BTaggingFlags defaults:

    OutputLevel                         default: BTaggingFlags.OutputLevel

    input:             name: The name of the tool (should be unique).
      useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified.
                  **options: Python dictionary with options for the tool.
    output: The actual tool, which can then by added to ToolSvc via ToolSvc += output."""
    if useBTagFlagsDefaults:
        defaults = {'OutputLevel': BTaggingFlags.OutputLevel}
        for option in defaults:
            options.setdefault(option, defaults[option])
    options['name'] = name
    from TrkNeuralNetworkUtils.TrkNeuralNetworkUtilsConf import Trk__NeuralNetworkToHistoTool
    return Trk__NeuralNetworkToHistoTool(**options)
Пример #2
0
if hasattr(ToolSvc, 'InDetRotCreator'):
    egRotCreator = ToolSvc.InDetRotCreator
else:
    #Setup e/gamma offline RotCreator if one is not present
    if InDetFlags.doPixelClusterSplitting(
    ) and InDetFlags.pixelClusterSplittingType() == 'NeuralNet':
        # --- temp: read calib file
        from AthenaCommon.AppMgr import ServiceMgr as svcMgr
        if not hasattr(svcMgr, 'THistSvc'):
            from GaudiSvc.GaudiSvcConf import THistSvc
            svcMgr += THistSvc()

        # --- neutral network tools
        import sys, os
        from TrkNeuralNetworkUtils.TrkNeuralNetworkUtilsConf import Trk__NeuralNetworkToHistoTool
        egNeuralNetworkToHistoTool = Trk__NeuralNetworkToHistoTool(
            name="egNeuralNetworkToHistoTool")
        ToolSvc += egNeuralNetworkToHistoTool

        #--- new NN factor
        # COOL binding
        from IOVDbSvc.CondDB import conddb
        conddb.addFolder("PIXEL_OFL",
                         "/PIXEL/PixelClustering/PixelClusNNCalib")
        # --- Select the necessary settings when running on run 1 data/MC
        # --- since a correction is needed to fix biases when running on new run 2 compatible calibation
        from SiClusterizationTool.SiClusterizationToolConf import InDet__NnClusterizationFactory

        if not "R2" in globalflags.DetDescrVersion(
        ) and not "IBL3D25" in globalflags.DetDescrVersion():
            egNnClusterizationFactory = InDet__NnClusterizationFactory(
                name="egNnClusterizationFactory",
useNNcombinedWithIP3D=False
from AthenaCommon.AppMgr import ToolSvc

from JetTagTools.JetTagToolsConf import Analysis__JetFitterNtupleWriter
JetFitterNtupleWriterNN = Analysis__JetFitterNtupleWriter( name = "JetFitterNtupleWriterNN",
                                                           OutputLevel = BTaggingFlags.OutputLevel)

ToolSvc += JetFitterNtupleWriterNN
if BTaggingFlags.OutputLevel < 3:
  print JetFitterNtupleWriterNN   


from TrkNeuralNetworkUtils.TrkNeuralNetworkUtilsConf import Trk__NeuralNetworkToHistoTool
NeuralNetworkToHistoNNTool = Trk__NeuralNetworkToHistoTool ( name = "NeuralNetworkToHistoToolNN",
                                                             OutputLevel = BTaggingFlags.OutputLevel)
                                                                      
ToolSvc += NeuralNetworkToHistoNNTool
if BTaggingFlags.OutputLevel < 3:
  print NeuralNetworkToHistoNNTool


from JetTagTools.JetTagToolsConf import Analysis__JetFitterNNTool
JetFitterNNTool = Analysis__JetFitterNNTool( name = "JetFitterNNTool",
                                      	     CalibrationDirectory="JetFitter",
				             CalibrationSubDirectory="NeuralNetwork",
                                             OutputLevel = BTaggingFlags.OutputLevel,
                                             NeuralNetworkToHistoTool = NeuralNetworkToHistoNNTool,
                                             useCombinedIPNN = useNNcombinedWithIP3D,
                                             usePtCorrectedMass = True,
					     calibrationTool=BTagCalibrationBrokerTool
                                             )