Esempio n. 1
0
def addDecorator():
    '''
  Add the track particle decoration algorithm to the top sequence. 
  The algorithm is to be run on RAW/RDO since it depends on full hit information
  which is generally not available at later stages. The decorations added by this
  algorithm are used by InDetPhysValMonitoring tool.
  '''

    decorators = []

    decorators.append(InDetPhysValDecoratorAlg.InDetPhysValDecoratorAlg())

    from InDetPhysValMonitoring.InDetPhysValJobProperties import InDetPhysValFlags
    InDetPhysValFlags.init()
    if InDetPhysValFlags.doValidateGSFTracks():
        # cannot add the decorator for GSF tracks at this moment because the egamma algorithm has not been
        # constructed yet.
        # so this does not work: decorators.append( InDetPhysValDecoratorAlg.InDetPhysValDecoratorAlgGSF() )
        # Can only schedule a user algorithm :
        from RecExConfig.RecFlags import rec
        rec.UserExecs += [
            'from InDetPhysValMonitoring.InDetPhysValDecoration import addGSFTrackDecoratorAlg;addGSFTrackDecoratorAlg();'
        ]

    # from  InDetRecExample.InDetJobProperties import InDetFlags
    from InDetRecExample.InDetKeys import InDetKeys
    # for backward compatibility check whether DBM has been added already
    if InDetPhysValFlags.doValidateDBMTracks() and hasattr(
            InDetKeys, 'DBMTrackParticles'):
        # and InDetFlags.doDBM()
        decorators.append(
            InDetPhysValDecoratorAlg.InDetPhysValDecoratorAlgDBM())

    _addDecorators(decorators)
Esempio n. 2
0
def addExtraMonitoring():
    '''
  IF monitoring is wished for GSF or DBM TrackParticles find the monitoring manager and 
  add the corresponding monitoring tools.
  '''
    # hack to add monitors for DBM and GSF
    # the job option fragment which adds the InDetPhysValMonitoringTool for the default tracks
    # will call this method, so can abuse this method to also add the monitoring tools for DBM and GSF tracks
    try:
        from InDetPhysValMonitoring.InDetPhysValJobProperties import InDetPhysValFlags
        # flags are at this stage already initialised, so do not need to  InDetPhysValFlags.init()
        if InDetPhysValFlags.doValidateGSFTracks(
        ) or InDetPhysValFlags.doValidateDBMTracks(
        ) or InDetPhysValFlags.doValidateTightPrimaryTracks():
            mon_index = findMonMan()
            if mon_index != None:
                from AthenaCommon.AlgSequence import AlgSequence
                topSequence = AlgSequence()
                mon_manager = topSequence.getChildren()[mon_index]
                from InDetPhysValMonitoring.InDetPhysValMonitoringTool import InDetPhysValMonitoringTool

    except ImportError:
        import sys, traceback
        exc_type, exc_value, exc_traceback = sys.exc_info()
        print "*** print_tb:"
        traceback.print_tb(exc_traceback, limit=1, file=sys.stdout)
        print "*** print_exception:"
        traceback.print_exception(exc_type,
                                  exc_value,
                                  exc_traceback,
                                  limit=2,
                                  file=sys.stdout)
        print "*** print_exc:"
        traceback.print_exc()
        raise
Esempio n. 3
0
import InDetPhysValMonitoring.InDetPhysValDecoration
decoration = InDetPhysValMonitoring.InDetPhysValDecoration.addDecoratorIfNeeded()

# add ID physics validation monitoring tool

from InDetPhysValMonitoring.InDetPhysValJobProperties import InDetPhysValFlags
import InDetPhysValMonitoring.InDetPhysValMonitoringTool as InDetPhysValMonitoringTool

mons=[ (True                                             , InDetPhysValMonitoringTool.getInDetPhysValMonitoringTool),
       (InDetPhysValFlags.doValidateLooseTracks()        , InDetPhysValMonitoringTool.getInDetPhysValMonitoringToolLoose),
       (InDetPhysValFlags.doValidateTightPrimaryTracks() , InDetPhysValMonitoringTool.getInDetPhysValMonitoringToolTightPrimary),
       (InDetPhysValFlags.doValidateDBMTracks()          , InDetPhysValMonitoringTool.getInDetPhysValMonitoringToolDBM),
       (InDetPhysValFlags.doValidateGSFTracks()          , InDetPhysValMonitoringTool.getInDetPhysValMonitoringToolGSF)
     ]

for enabled, creator in mons :
    if enabled :
        monMan.AthenaMonTools += [ creator() ]


from InDetPhysValMonitoring.InDetPhysValMonitoringTool import getInDetPhysValMonitoringTool
from  InDetPhysValMonitoring.InDetPhysValJobProperties import InDetPhysValFlags
from  InDetPhysValMonitoring.ConfigUtils import extractCollectionPrefix
for col in InDetPhysValFlags.validateExtraTrackCollections() :
    prefix=extractCollectionPrefix(col)
    monMan.AthenaMonTools += [ getInDetPhysValMonitoringTool(name                       = 'InDetPhysValMonitoringTool'+prefix,
                                                             SubFolder                  = prefix+'Tracks/',
                                                             TrackParticleContainerName = prefix+'TrackParticles') ]
Esempio n. 4
0
import InDetPhysValMonitoring.InDetPhysValDecoration
decoration = InDetPhysValMonitoring.InDetPhysValDecoration.addDecoratorIfNeeded(
)

# add ID physics validation monitoring tool

from InDetPhysValMonitoring.InDetPhysValMonitoringTool import InDetPhysValMonitoringTool
from InDetPhysValMonitoring.InDetPhysValJobProperties import InDetPhysValFlags

indet_mon_tool = InDetPhysValMonitoringTool.InDetPhysValMonitoringTool()
ToolSvc += [indet_mon_tool]
monMan.AthenaMonTools += [indet_mon_tool]

if InDetPhysValFlags.doValidateDBMTracks():
    indet_mon_tool_DBM = InDetPhysValMonitoringTool.InDetPhysValMonitoringToolDBM(
    )
    ToolSvc += [indet_mon_tool_DBM]
    monMan.AthenaMonTools += [indet_mon_tool_DBM]

if InDetPhysValFlags.doValidateGSFTracks():
    indet_mon_tool_GSF = InDetPhysValMonitoringTool.InDetPhysValMonitoringToolGSF(
    )
    ToolSvc += [indet_mon_tool_GSF]
    monMan.AthenaMonTools += [indet_mon_tool_GSF]

if InDetPhysValFlags.doValidateLooseTracks():
    indet_mon_tool_Loose = InDetPhysValMonitoringTool.InDetPhysValMonitoringToolLoose(
    )
    ToolSvc += [indet_mon_tool_Loose]
    monMan.AthenaMonTools += [indet_mon_tool_Loose]