예제 #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)
예제 #2
0
def addDecoratorIfNeeded():
    '''
    Run the InDet decoration algorithm if it has not been ran yet.
   '''

    if not canAddDecorator():
        print 'DEBUG addDecoratorIfNeeded ? Stage is too early or too late for running the decoration. Needs reconstructed tracks. Try again during next stage ?'
        return

    meta_data = getMetaData()
    if len(meta_data) == 0:
        # decoration has not been ran
        addDecorator()

    # if DBM or GSF tracks need to be monitored schedule addExtraMonitoring as user algorithm, so that
    # the monitoring manager exists already.
    from InDetPhysValMonitoring.InDetPhysValJobProperties import InDetPhysValFlags
    InDetPhysValFlags.init()