Ejemplo n.º 1
0
    def __init__(self, Location, UseRootInTES=True, monitor=False):

        NamedObject.__init__(self, Location.replace('/', '_'))

        from Configurables import LoKi__VoidFilter as VoidFilter

        _alg = VoidFilter('SelFilter' + self.name())

        if not monitor:
            _alg.Code = """
            0<CONTAINS('%s',%s)
            """ % (Location, UseRootInTES)
        else:
            _alg.Preambulo += [
                "from LoKiCore.functions import monitor",
                "from LoKiCore.math      import max as lmax",
            ]
            ## create monitored functor
            _alg.Code = """
            0< monitor ( lmax ( CONTAINS('%s',%s), FZERO ) ,'# %s', 0 )
            """ % (Location, UseRootInTES, Location)

        SelectionBase.__init__(self,
                               algorithm=_alg,
                               outputLocation=Location,
                               requiredSelections=[])
Ejemplo n.º 2
0
    def streamer( self ):
        props = self.getProps()

        ## VoidFilter to cut on the number of Velo tracks.
        from Configurables import LoKi__VoidFilter as VoidFilter
        from HltTracking.HltSharedTracking import MinimalVelo
        props['Velo'] = MinimalVelo.outputSelection()
        code = "in_range( %(MinNVelo)s, CONTAINS('%(Velo)s'), %(MaxNVelo)s ) "% props
        veloFilter = VoidFilter('Hlt1LowMultNVeloFilter', Code = code)

        ## Streamer
        from Configurables import LoKi__HltUnit as HltUnit
        unit = HltUnit(
            'Hlt1LowMultStreamer',
            ##OutputLevel = 1 ,
            Preambulo = self.preambulo(),
            Code = """
            TrackCandidates
            >>  FitTrack
            >>  tee  ( monitor( TC_SIZE > 0, '# pass TrackFit', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE    , 'nFit' , LoKi.Monitoring.ContextSvc ) ) 
            >>  ( ( TrPT > %(PT)s * MeV ) & ( TrP  > %(P)s * MeV ) )
            >>  tee  ( monitor( TC_SIZE > 0, '# pass PT', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE , 'nPT' , LoKi.Monitoring.ContextSvc ) )               
            >>  ( TrCHI2PDOF < %(TrChi2)s )
            >>  SINK('Hlt1LowMultDecision')
            >> ~TC_EMPTY
            """ % props
            )
        return [veloFilter, unit]
Ejemplo n.º 3
0
 def __writerFilter(self, requirement):
     from Configurables import LoKi__VoidFilter as VoidFilter
     if requirement:
         code = ' & '.join(["ALG_EXECUTED('%s') & ALG_PASSED('%s')" % (i, i) for i in requirement])
     else:
         code = "LoKi.Constant('void', 'bool')(True)"
     return VoidFilter(HltOutputConf.__writer_filter_name__, Code = code,
                       Preambulo = ['from LoKiHlt.algorithms import ALG_EXECUTED, ALG_PASSED'])
Ejemplo n.º 4
0
 def __routingBitsForFlaggingMode(self):
     # The EndSequence always runs and the HLT2 routing bits writer needs the
     # HLT2 DecReports, so we need to check that HLT2 at least ran.
     from Configurables import LoKi__VoidFilter as VoidFilter
     hlt2Filter = VoidFilter("RoutingBitsHlt2Filter",
                              Preambulo = ['from LoKiHlt.algorithms import ALG_EXECUTED'],
                              Code = "ALG_EXECUTED('Hlt2')")
     rbWriter = self.__hlt2RoutingBitsWriter('')
     return GaudiSequencer("Hlt2RoutingBitsSequence", Members = [hlt2Filter, rbWriter])
Ejemplo n.º 5
0
    def streamer_MaxVeloCut( self, name ):
        props = self.getProps()

        ## VoidFilter to cut on the number of Velo tracks.
        from Configurables import LoKi__VoidFilter as VoidFilter
        from HltTracking.HltSharedTracking import MinimalVelo
        props['Velo'] = MinimalVelo.outputSelection()
        code = "in_range( 0, CONTAINS('%(Velo)s'), %(MaxVeloCut_MaxVelo)s ) "% props
        veloFilter = VoidFilter('Hlt1'+name+'Decision', Code = code)
        return [veloFilter]
Ejemplo n.º 6
0
    def __create_parasitic_line__(self):
        ''' Function to create the Parasitic line for bb crossings. Algorithms:
            1) Check if Velo tracks have already been reconstructed
            2) Run the proto-vertexing algorithm (excluding the lumi region)
            3) Run Full Fast Velo tracking (the same instance as in the non-parasitic lines)
            4) PV3D (the same instance as in the non-parasitic lines)
            5) Filter the produced vertices
        '''

        nameParts = ['BeamGasCrossing', 'Parasitic']
        nameKey = nameParts[1]
        lineName = nameParts[0] + nameKey

        ### Get the L0 Rate Limit
        L0RateLimit = self.getProp('L0RateLimit')[nameKey] if (
            nameKey in self.getProp('L0RateLimit').keys()) else None

        ### Create the L0DU and ODIN filters
        l0du = self.getProp('L0Filter')['BB']
        odin = "(ODIN_BXTYP == LHCb.ODIN.BeamCrossing)"

        ### Algorithm to check for existing Velo tracks
        from HltTracking.HltSharedTracking import MinimalVelo
        from Configurables import LoKi__VoidFilter as VoidFilter
        algCheckTracks = VoidFilter('Hlt1BeamGasCheckVeloTracks',
                                    Code="CONTAINS('%s') > 0" %
                                    MinimalVelo.outputSelection())

        ### ProtoVertexing algorithm
        algProtoVertex = self._create_proto_vertex_alg(
            lineName, MinimalVelo.outputSelection())

        gec_algs = self._get_GEC()
        main_algs = self._create_main_algos(lineName)

        return Hlt1Line(lineName,
                        priority=200,
                        prescale=self.prescale,
                        ODIN=odin,
                        L0DU='scale({}, RATE({}))'.format(l0du, L0RateLimit)
                        if L0RateLimit else l0du,
                        algos=gec_algs +
                        [DecodeVELO, algCheckTracks, algProtoVertex] +
                        main_algs,
                        postscale=self.postscale,
                        Turbo=self.getProp("Turbo"))

        return TheLine
Ejemplo n.º 7
0
def globalEventCutFilter(name, 
	                 MaxTrSIZE = None 
	                 ) :
  
  if MaxTrSIZE == None : return None
  
  _code = ""
  from Configurables import LoKi__VoidFilter as VoidFilter
  from Configurables import LoKi__Hybrid__CoreFactory as CoreFactory
  modules = CoreFactory('CoreFactory').Modules
  for i in ['LoKiTracks.decorators']:
     if i not in modules : modules.append(i)
  if MaxTrSIZE != None : _code += "TrSOURCE('Rec/Track/Best') >> (TrSIZE < %(MaxTrSIZE)s )" % locals()
  globalFilter= VoidFilter(name)
  globalFilter.Code = _code
  
  return globalFilter
Ejemplo n.º 8
0
def globalEventCutFilter(name, MaxTrSIZE=None):

    if MaxTrSIZE == None: return None

    _code = ""
    from Configurables import LoKi__VoidFilter as VoidFilter
    from Configurables import LoKi__Hybrid__CoreFactory as CoreFactory
    modules = CoreFactory('CoreFactory').Modules
    for i in ['LoKiTracks.decorators']:
        if i not in modules: modules.append(i)
    if MaxTrSIZE != None:
        _code += "(recSummaryTrack(LHCb.RecSummary.nLongTracks, TrLONG) < %(MaxTrSIZE)s )" % locals(
        )

    globalFilter = VoidFilter(name)
    globalFilter.Code = _code

    return globalFilter
Ejemplo n.º 9
0
    def __init__(self, name, Code, RequiredSelection):

        UniquelyNamedObject.__init__(self, name)
        ClonableObject.__init__(self, locals())
        checkName(self.name())

        _code = Code.replace('<Location>',
                             "'" + RequiredSelection.outputLocation() + "'")
        _code = _code.replace('\"\'',
                              '\'').replace('\'\"',
                                            '\'').replace('\'\'', '\'')

        from Configurables import LoKi__VoidFilter as VoidFilter
        _alg = VoidFilter(self.name(), Code=_code)

        SelectionBase.__init__(
            self,
            algorithm=_alg,
            outputLocation=RequiredSelection.outputLocation(),
            requiredSelections=[RequiredSelection])