def hltHighPTLowMultiplicity_Streamer( self, name, props):
        from Hlt1Lines.Hlt1GECs import Hlt1GECUnit
        from HltTracking.HltPVs import PV3D
        from Configurables import LoKi__HltUnit as HltUnit
        from HltLine.HltLine import bindMembers
        props['name'] = name

        algos = []

        gec = props["GEC"]
        algos.append( Hlt1GECUnit( props["GEC"] ) )

        algos.append( PV3D('Hlt1') )

        LowMultUnit = HltUnit(
            "Hlt1%(name)sLowMultStreamer" % props,
            Preambulo = self.hltLowMultiplicity_Preambulo( 'CalibHighPTLowMultTrksU1' ),
            Code = """
              TrackCandidates
              >>  FitTrack
              >>  tee  ( monitor( TC_SIZE    , 'nFit' , LoKi.Monitoring.ContextSvc ) )
              >>  tee  ( monitor( TC_SIZE < %(MaxTr)s , 'nTrksLT' , LoKi.Monitoring.ContextSvc ) )
              >>  (TC_SIZE < %(MaxTr)s)
              """ % props
            )
        algos.append( LowMultUnit )

        TrackSelUnit = HltUnit(
            "Hlt1%(name)sTrackSelStreamer" % props,
            Preambulo = self.hltLowMultiplicity_Preambulo( 'CalibHighPTLowMultTrksU2' ),
            Code = """
              TrackCandidates
              >>  FitTrack
              >>  tee  ( monitor( TC_SIZE > 0, '# pass TrackFit', LoKi.Monitoring.ContextSvc ) )
              >>  tee  ( monitor( TC_SIZE    , 'nFit' , LoKi.Monitoring.ContextSvc ) )
              >>  ( ( TrPT  > %(PT)s ) &
                    ( TrP   > %(P)s ) &
                    ( TrCHI2PDOF < %(TrChi2)s ) )
              >>  tee  ( monitor( TC_SIZE > 0, '# pass P/PT/TrackChi2', LoKi.Monitoring.ContextSvc ) )
              >>  tee  ( monitor( TC_SIZE    , 'nP/PT/Chi2' , LoKi.Monitoring.ContextSvc ) )
              >>  tee  ( monitor( TC_SIZE    , 'nFit' , LoKi.Monitoring.ContextSvc ) )
              >>  SINK( 'Hlt1%(name)sDecision' )
              >>  (TC_SIZE > %(MinTr)s)
              """ % props
          )
        algos.append( TrackSelUnit )

        #return [ Hlt1GECUnit( props[ 'GEC' ] ), PV3D('Hlt1'), self.hltLowMultiplicity_Streamer( name, props)[0], hltHighPTLowMultiplicity_Unit ]
        return bindMembers( "Hlt1%(name)sAlgos" % props, algos ).setOutputSelection( "Hlt1%(name)sDecision" )
예제 #2
0
    def singleTrackElectron_streamer(self, properties):
        from Configurables import LoKi__HltUnit as HltUnit
        from Hlt1Lines.Hlt1GECs import Hlt1GECUnit
        #properties[ 'CaloCandidates' ] = 'CaloCandidates'
        properties['CaloCandidates'] = 'TrackElectronCandidates'

        from Configurables import LoKi__HltUnit as HltUnit
        from HltTracking.Hlt1Tracking import L0CaloCandidates
        caloUnit = HltUnit('Hlt1%(name)sL0CaloStreamer' % properties,
                           Preambulo=[L0CaloCandidates(properties['name'])],
                           Code="""
            L0CaloCandidates
            >>  TC_CUT( LoKi.L0.L0CaloCut( 0, %(L0ElectronThreshold)s ), 0 )
            >>  tee  ( monitor( TC_SIZE > 0, '# pass L0CaloCut', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE    , 'nCaloCandidates' , LoKi.Monitoring.ContextSvc ) )
            >>  SINK( '%(CaloCandidates)s' )
            >> ~TC_EMPTY
            """ % properties)

        trackUnit = HltUnit(
            'Hlt1%(name)sTrackStreamer' % properties,
            ##OutputLevel = 1 ,
            Preambulo=self.singleElectron_preambulo(properties),
            Code="""
            TrackCandidates
            >>  ( ( TrIDC('isVelo') > %(Velo_NHits)s ) & ( TrNVELOMISS < %(Velo_Qcut)s )   \
                & ( Tr_HLTMIP ( 'PV3D' ) > %(IP)s * mm) )  
            >>  (TrTNORMIDC > %(TrNTHits)s ) 
            >>  tee  ( monitor( TC_SIZE > 0, '# pass forward', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE , 'nForward' , LoKi.Monitoring.ContextSvc ) )
            >>  ( ( TrPT > %(PT)s * MeV ) & ( TrP  > %(P)s  * MeV ) )
            >>  FitTrack
            >>  tee  ( monitor( TC_SIZE > 0, '# pass fit', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE , 'nFitted' , LoKi.Monitoring.ContextSvc ) )
            >>  ( ( TrCHI2PDOF < %(TrChi2)s )\
                & ( Tr_HLTMIPCHI2 ( 'PV3D' ) > %(IPChi2)s ) ) 
            >>  FilterVeloL0Calo
            >>  tee  ( monitor( TC_SIZE > 0, '# pass match', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE    , 'nMatched' , LoKi.Monitoring.ContextSvc ) )
            >>  SINK( 'Hlt1%(name)sDecision' )
            >> ~TC_EMPTY
            """ % properties)
        from HltTracking.HltPVs import PV3D
        return [
            Hlt1GECUnit(properties['GEC']),
            self.getCaloUnit(properties),
            PV3D('Hlt1'), trackUnit
        ]
예제 #3
0
    def Gamma_Unit(self, props):

        from HltTracking.Hlt1Tracking import L0CaloCandidates

        Gamma_Preambulo = [L0CaloCandidates('Photon')]

        Gamma_LineCode = """
    L0CaloCandidates
    >>  tee  ( monitor( TC_SIZE > 0, '# pass CaloCandidates', LoKi.Monitoring.ContextSvc ) )
    >>  tee  ( monitor( TC_SIZE    , 'nCaloCandidates' , LoKi.Monitoring.ContextSvc ) )
    >>  TC_L0CALOTOPARTICLES( 'gamma',  '', (PT>%(GAMMA_PT_MIN)s*MeV) )
    >>  tee ( monitor( TC_SIZE > 0, '# pass ToPhotons', LoKi.Monitoring.ContextSvc ) )
    >>  tee ( monitor( TC_SIZE    , 'nPhotons',         LoKi.Monitoring.ContextSvc ) )
    >>  SINK ('Hlt1B2PhiGamma_Photons')
    >>  ~TC_EMPTY
    """ % props

        from Configurables import LoKi__HltUnit as HltUnit

        hlt1CalibTrackingLine_GammaUnit = HltUnit(
            'Hlt1CalibTrackingGammaUnit',
            #OutputLevel = 1,
            Monitor=True,
            Preambulo=Gamma_Preambulo,
            Code=Gamma_LineCode)

        return hlt1CalibTrackingLine_GammaUnit
예제 #4
0
    def singleElectron_streamer(self, properties):
        from Configurables import LoKi__HltUnit as HltUnit
        from Hlt1Lines.Hlt1GECs import Hlt1GECUnit
        properties['CaloCandidates'] = 'CaloCandidates'

        trackUnit = HltUnit(
            'Hlt1%(name)sTrackStreamer' % properties,
            ##OutputLevel = 1 ,
            Preambulo=self.singleElectron_preambulo(properties),
            Code="""
            TrackCandidates
            >>  FilterVeloL0Calo
            >>  ( ( TrIDC('isVelo') > %(Velo_NHits)s ) & ( TrNVELOMISS < %(Velo_Qcut)s ) )
            >>  tee  ( monitor( TC_SIZE > 0, '# pass match', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE    , 'nMatched' , LoKi.Monitoring.ContextSvc ) )
            >>  (TrTNORMIDC > %(TrNTHits)s ) 
            >>  tee  ( monitor( TC_SIZE > 0, '# pass forward', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE , 'nForward' , LoKi.Monitoring.ContextSvc ) )
            >>  ( ( TrPT > %(PT)s * MeV ) & ( TrP  > %(P)s  * MeV ) )
            >>  FitTrack
            >>  tee  ( monitor( TC_SIZE > 0, '# pass fit', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE , 'nFitted' , LoKi.Monitoring.ContextSvc ) )
            >>  ( ( TrCHI2PDOF < %(TrChi2)s ) )
            >>  SINK( 'Hlt1%(name)sDecision' )
            >> ~TC_EMPTY
            """ % properties)
        return [
            Hlt1GECUnit(properties['GEC']),
            self.getCaloUnit(properties), trackUnit
        ]
예제 #5
0
    def protoParticleUnit(self):
        selection = 'Hlt1ProtoParticles'
        props = self.getProps().copy()
        props.update({'selection': selection})
        code = """
        TrackCandidates
        >>  FitTrack
        >>  ( ( TrPT > %(PT)s * MeV ) & \
              ( TrP  > %(P)s  * MeV ) )
        >>  tee  ( monitor( TC_SIZE > 0, '# pass TrackFit', LoKi.Monitoring.ContextSvc ) )
        >>  tee  ( monitor( TC_SIZE    , 'nFit' , LoKi.Monitoring.ContextSvc ) )
        >>  ( TrCHI2PDOF < %(TrackChi2DOF)s )
        >>  tee  ( monitor( TC_SIZE > 0, '# pass TrackChi2', LoKi.Monitoring.ContextSvc ) )
        >>  tee  ( monitor( TC_SIZE    , 'nChi2' , LoKi.Monitoring.ContextSvc ) )
        >>  TC_TOPROTOPARTICLES( '' )
        >>  SINK(  '%(selection)s' )
        >>  ~TC_EMPTY
        """ % props

        from Configurables import LoKi__HltUnit as HltUnit
        from HltTracking.Hlt1Tracking import TrackCandidatesAlgos
        from HltTracking.Hlt1Tracking import (TrackCandidates, FitTrack)
        preambulo = [TrackCandidates('SharedParticles'), FitTrack]
        protoUnit = HltUnit(
            'Hlt1ProtoParticleUnit',
            #OutputLevel = 1,
            Monitor=True,
            Preambulo=preambulo,
            Code=code)

        from HltLine.HltLine import bindMembers
        bm = bindMembers(None,
                         [TrackCandidatesAlgos('SharedParticles'), protoUnit
                          ]).setOutputSelection(selection)
        return bm
예제 #6
0
 def _create_line_selection(self, lineName):
     decname = 'Hlt1{}Decision'.format(lineName)
     source = 'Hlt1/Vertex/' + lineName + (
         'Split' if self.getProp("SplitVertices") else '')
     code = "VSOURCE('{}') >> VX_SINK('{}') >> ~VEMPTY".format(
         source, decname)
     return HltUnit(decname, Code=code)
예제 #7
0
    def oneTrackStreamer(self, name, props, inputParticles):
        from copy import deepcopy
        props = deepcopy(props)
        props['input'] = inputParticles.outputSelection()
        props['name'] = name

        from Configurables import LoKi__HltUnit as HltUnit
        unit = HltUnit('Hlt1%sUnit' % name,
                       PVSelection="PV3D",
                       Monitor=True,
                       Code="""
            SELECTION('%(input)s')
            >> (TRCHI2DOF < %(TrChi2)s)
            >> (((PT > %(MaxPT)s) &
                 (BPVIPCHI2() > %(MinIPChi2)s)) |
                ( in_range( %(MinPT)s, PT, %(MaxPT)s) &
                 (log(BPVIPCHI2()) > (%(Param1)s / ((PT / GeV - %(Param2)s) ** 2)  + 
                                     (%(Param3)s / %(MaxPT)s) * (%(MaxPT)s   - PT) +
                                     math.log(%(MinIPChi2)s)))))
            >> SINK('Hlt1%(name)sDecision')
            >> ~TC_EMPTY
            """ % props,
                       Preambulo=self.mvaPreambulo())

        from Hlt1Lines.Hlt1GECs import Hlt1GECUnit
        from HltTracking.HltPVs import PV3D
        return [Hlt1GECUnit(props['GEC']), PV3D('Hlt1'), inputParticles, unit]
예제 #8
0
    def muonUnit(self):
        selection = 'Hlt1SharedMuons'
        props = self.getProps().copy()
        props.update({'selection': selection})

        code = """
        TrackCandidates
        >>  tee ( monitor( TC_SIZE > 0, '# pass IsMuon', LoKi.Monitoring.ContextSvc ) )
        >>  FitTrack
        >>  ( ( TrPT > %(PT)s * MeV ) & \
              ( TrP  > %(P)s  * MeV ) )
        >>  IsMuon
        >>  tee ( monitor( TC_SIZE > 0, '# pass Cuts', LoKi.Monitoring.ContextSvc ) )
        >>  tee ( monitor( TC_SIZE > 0, '# pass IsMuon', LoKi.Monitoring.ContextSvc ) )
        >>  TC_TOPROTOPARTICLES( '' )
        >>  TC_TOPARTICLES( 'mu+', '', ALL )
        >>  tee ( monitor( TC_SIZE > 0, '# pass ToMuons', LoKi.Monitoring.ContextSvc ) )
        >>  tee ( monitor( TC_SIZE    , 'nMuons',         LoKi.Monitoring.ContextSvc ) )
        >>  SINK(  '%(selection)s' )
        >>  ~TC_EMPTY
        """ % props

        from Configurables import LoKi__HltUnit as HltUnit
        from HltTracking.Hlt1Tracking import (TrackCandidates, IsMuon,
                                              FitTrack)
        muonUnit = HltUnit(
            'Hlt1SharedMuonUnit',
            Preambulo=[TrackCandidates('SharedMuons'), IsMuon, FitTrack],
            Monitor=True,
            Code=code)

        from HltLine.HltLine import bindMembers
        bm = bindMembers(None, [muonUnit]).setOutputSelection(selection)
        return bm
예제 #9
0
    def hlt1TrackBlock_Streamer(self, name, props):
        from Hlt1Lines.Hlt1GECs import Hlt1GECUnit
        from Configurables import LoKi__HltUnit as HltUnit
        props['name'] = name

        lineCode = """
        TrackCandidates
        >>  FitTrack
        >>  tee  ( monitor( TC_SIZE > 0, '# pass TrackFit', LoKi.Monitoring.ContextSvc ) )
        >>  tee  ( monitor( TC_SIZE    , 'nFit' , LoKi.Monitoring.ContextSvc ) )
        >>  ( ( TrIDC('isVelo') > %(Velo_NHits)s ) & \
              ( TrTNORMIDC > %(TrNTHits)s ) & \
              ( TrNVELOMISS < %(Velo_Qcut)s ) )
        >>  tee  ( monitor( TC_SIZE > 0, '# pass track quality', LoKi.Monitoring.ContextSvc ) )
        >>  tee  ( monitor( TC_SIZE    , 'nTrQ' , LoKi.Monitoring.ContextSvc ) )
        >>  ( ( TrPT > %(PT)s * MeV ) & \
              ( TrP  > %(P)s  * MeV ) )
        >>  tee  ( monitor( TC_SIZE > 0, '# pass P/PT', LoKi.Monitoring.ContextSvc ) )
        >>  tee  ( monitor( TC_SIZE    , 'nP' , LoKi.Monitoring.ContextSvc ) )
        >>  ( ( TrCHI2PDOF < %(TrChi2)s ) & \
              ( Tr_HLTMIPCHI2 ( 'PV3D' ) > %(IPChi2)s ) )
        >>  tee  ( monitor( TC_SIZE > 0, '# pass TrackChi2/IPChi2', LoKi.Monitoring.ContextSvc ) )
        >>  tee  ( monitor( TC_SIZE    , 'nChi2' , LoKi.Monitoring.ContextSvc ) )
        >> SINK( 'Hlt1%(name)sDecision' )
        >> ~TC_EMPTY
        """ % props
        preambulo, trackingAlgos = self.hlt1Track_Preambulo(name)
        hlt1TrackBlock_Unit = HltUnit('Hlt1' + name + 'Unit',
                                      Preambulo=preambulo,
                                      Code=lineCode)
        from HltTracking.HltPVs import PV3D
        return [
            Hlt1GECUnit(props['GEC']),
            PV3D('Hlt1'), trackingAlgos, hlt1TrackBlock_Unit
        ]
예제 #10
0
    def hlt1B2GammaGammaLine_Streamer(self, name, props) :
        from Configurables import LoKi__HltUnit as HltUnit
        props['name'] = name

        DiPhotonUnitLineCode = """
        L0CaloCandidates
        >>  tee  ( monitor( TC_SIZE > 0, '# pass CaloCandidates', LoKi.Monitoring.ContextSvc ) )
        >>  tee  ( monitor( TC_SIZE    , 'nCaloCandidates' , LoKi.Monitoring.ContextSvc ) )
        >>  TC_HLT1DIPHOTONMAKER( 'B_s0',  '', %(GAMMA_PT_MIN)s, %(B_SUMPT_MIN)s, %(B_MASS_MIN)s, %(B_MASS_MAX)s, %(B_PT_MIN)s )
        >>  tee ( monitor( TC_SIZE > 0, '# pass DiPhoton', LoKi.Monitoring.ContextSvc ) )
        >>  tee ( monitor( TC_SIZE    , 'nDiPhotons',         LoKi.Monitoring.ContextSvc ) )
        >>  SINK ('Hlt1B2GammaGammaDecision')
        >>  ~TC_EMPTY
        """ % props

        from Hlt1Lines.Hlt1GECs import Hlt1GECUnit
        from Configurables import LoKi__HltUnit as HltUnit
        from HltTracking.HltPVs import PV3D

        hlt1B2GammaGammaLine_DiPhotonUnit = HltUnit('Hlt1%sDiPhotonUnit' % name,
                                                    #OutputLevel=1,
                                                    Monitor=True,
                                                    Preambulo=self.hlt1B2GammaGammaLine_Preambulo(props),
                                                    Code=DiPhotonUnitLineCode)


        return [Hlt1GECUnit('Loose'),
                PV3D('Hlt1'),
                hlt1B2GammaGammaLine_DiPhotonUnit]
예제 #11
0
 def DiProton_streamer( self ):
     from Configurables import LoKi__HltUnit as HltUnit
     DiProton_unit = HltUnit(
         'DiProtonStreamer',
         ##OutputLevel = 1 ,
         Preambulo = self.DiProton_preambulo(),
         Code = """
         TrackCandidates
         >>  FitTrack
         >>  ( (TrPT> %(DiProton_PT)s *MeV) & (TrP> %(DiProton_P)s *MeV) & ((TrPT/TrP)>%(DiProton_theta)s) & ( TrCHI2PDOF < %(DiProton_TrChi2)s ) )
         >>  tee  ( monitor( TC_SIZE > 0, '# pass PT', LoKi.Monitoring.ContextSvc ) )
         >>  tee  ( monitor( TC_SIZE , 'nPT' , LoKi.Monitoring.ContextSvc ) )               
         >>  MakeDiProtons
         >>  tee  ( monitor( TC_SIZE > 0, '# pass vertex', LoKi.Monitoring.ContextSvc ) )
         >>  tee  ( monitor( TC_SIZE , 'nVertices' , LoKi.Monitoring.ContextSvc ) )
         >>  ( RV_MASS ( 'p+', 'p~-' ) > %(DiProton_MassMin)s * MeV )
         >>  tee  ( monitor( TC_SIZE > 0, '# pass mass min', LoKi.Monitoring.ContextSvc ) )
         >>  tee  ( monitor( TC_SIZE , 'massMin' , LoKi.Monitoring.ContextSvc ) )   
         >>  ( RV_MASS ( 'p+', 'p~-' ) < %(DiProton_MassMax)s * MeV )
         >>  tee  ( monitor( TC_SIZE > 0, '# pass mass max', LoKi.Monitoring.ContextSvc ) )
         >>  tee  ( monitor( TC_SIZE , 'massMax' , LoKi.Monitoring.ContextSvc ) )
         >>  JpsiPTCut
         >>  tee  ( monitor( TC_SIZE > 0, '# pass JpsiPT', LoKi.Monitoring.ContextSvc ) )
         >>  tee  ( monitor( TC_SIZE , 'JpsiPT' , LoKi.Monitoring.ContextSvc ) )           
         >>  SINK( 'Hlt1DiProtonDecision' )
         >> ~TC_EMPTY
         """ % self.getProps()
         )
     return DiProton_unit
 def hltRICHMirrorBlock_Streamer( self, name, props ) :
     from Hlt1Lines.Hlt1GECs import Hlt1GECUnit
     from Configurables import LoKi__HltUnit as HltUnit
     props['name'] = name
     props['PhiCuts'] = ' | '.join(('in_range(%3.2f, TrPHI, %3.2f)' % box for box in props['Phis']))
     lineCode = """
     TrackCandidates
     >>  FitTrack
     >>  tee  ( monitor( TC_SIZE > 0, '# pass TrackFit', LoKi.Monitoring.ContextSvc ) )
     >>  tee  ( monitor( TC_SIZE    , 'nFit' , LoKi.Monitoring.ContextSvc ) )
     >>  ( ( TrPT  > %(PT)s ) &
           ( TrP   > %(P)s ) &
           ( TrCHI2PDOF < %(TrChi2)s ) )
     >>  tee  ( monitor( TC_SIZE > 0, '# pass P/PT/TrackChi2', LoKi.Monitoring.ContextSvc ) )
     >>  tee  ( monitor( TC_SIZE    , 'nP/PT/Chi2' , LoKi.Monitoring.ContextSvc ) )
     >>  ( ( in_range(%(MinETA)s, TrETA, %(MaxETA)s) ) &
           ( %(PhiCuts)s ) )
     >>  tee  ( monitor( TC_SIZE > 0, '# pass P/PT/ETA/PHI', LoKi.Monitoring.ContextSvc ) )
     >>  tee  ( monitor( TC_SIZE    , '      nP/PT/ETA/PHI', LoKi.Monitoring.ContextSvc ) )
     >>  SINK( 'Hlt1%(name)sDecision' )
     >>  (TC_SIZE > %(MinTr)s)
     """ % props
     hltRICHMirrorBlock_Unit = HltUnit(
         'Hlt1'+name+'Unit',
         Preambulo = self.hltRICHMirror_Preambulo( name ),
         Code = lineCode
     )
     from HltTracking.HltPVs import PV3D
     return [ Hlt1GECUnit( props[ 'GEC' ] ), PV3D('Hlt1'), hltRICHMirrorBlock_Unit ]
예제 #13
0
    def IncPhi_Unit(self, props):

        IncPhi_Preambulo = [
            "from LoKiPhys.decorators import PT, IPCHI2, MINTREE"
        ]

        IncPhi_LineCode = """
    SELECTION( 'Hlt1CalibTrackingKKs' )
    >>  ( ( in_range( PDGM('phi(1020)') - %(PhiMassWin)s * MeV , M , PDGM('phi(1020)') + %(PhiMassWin)s * MeV ) ) & ( PT > %(PhiPT)s * MeV ) & (MINTREE(BPVIPCHI2(),(ISBASIC & HASTRACK))>%(PhiIPCHI2)s) & (VFASPF(VCHI2/VDOF)<%(CombVCHI2DOF)s) )
    >>  tee ( monitor( TC_SIZE > 0, '# pass IncPhi', LoKi.Monitoring.ContextSvc ) )
    >>  tee ( monitor( TC_SIZE, 'nIncPhis',          LoKi.Monitoring.ContextSvc ) )
    >>  SINK ('Hlt1IncPhiDecision')
    >>  ~TC_EMPTY
    """ % props

        from Hlt1Lines.Hlt1GECs import Hlt1GECUnit
        from Configurables import LoKi__HltUnit as HltUnit
        from HltTracking.HltPVs import PV3D

        hlt1CalibTrackingLine_IncPhiUnit = HltUnit(
            'Hlt1CalibTrackingIncPhiUnit',
            PVSelection="PV3D",
            #OutputLevel = 1,
            Monitor=True,
            Preambulo=IncPhi_Preambulo,
            Code=IncPhi_LineCode)

        return hlt1CalibTrackingLine_IncPhiUnit
예제 #14
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]
예제 #15
0
def Hlt1GECUnit(gec='Loose', accept=True):
    from Configurables import LoKi__HltUnit as HltUnit
    mode = {True: 'Accept', False: 'Reject'}[accept]
    code = """
        GEC%s%s
        """ % (mode, gec)
    return HltUnit("GEC%sUnit" % gec,
                   Preambulo=[Hlt1GECStreamer(gec, accept)],
                   Code=code)
예제 #16
0
    def _create_global_selections(self):
        tes_to_sel = "VSOURCE('{}') >> VX_SINK('{}') >> ~VEMPTY"
        sel_names = self.getProp("GlobalSelectionNames")

        storePVs = HltUnit('CreateBeamGasPVSelection',
                           Code=tes_to_sel.format(
                               self.getProp("VertexContName"),
                               sel_names["PV"]))
        algs = [storePVs]

        if self.getProp("SplitVertices"):
            storeSVs = HltUnit('CreateBeamGasSplitSelection',
                               Code=tes_to_sel.format(
                                   self.getProp("SplitVertexContName"),
                                   sel_names["Split"]))
            algs.append(storeSVs)

        return algs
예제 #17
0
    def multiDiMuon_streamer(self, properties):
        """
        MultiDiMuon streamer starts from VeloTTCandidates but uses ComplementForward
        accessing directly long tracks if the velo segment was already upgraded.
        IsMuon is used for Long tracks, MatchVeloTTMuon for VeloTT and Velo ones.
        """
        from Hlt1Lines.Hlt1GECs import Hlt1GECUnit
        from Configurables import LoKi__HltUnit as HltUnit
        from HltTracking.HltPVs import PV3D

        # Check that MuID is among the known tools
        if properties["MuID"] not in ["IsMuon", "IsMuonTight"]:
            raise KeyError(
                "MuID key is %(MuID)s which is not 'IsMuon' nor 'IsMuonTight', this is NOT OK."
                % properties)

        unit = HltUnit(
            'Hlt1%(name)sStreamer' % properties,
            ##OutputLevel = 1 ,
            Preambulo=self.diMuon_preambulo(properties),
            Code="""
            VeloTTCandidates
            >>  MatchVeloTTMuon
            >>  tee  ( monitor( TC_SIZE > 0, '# MatchMuon', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE , 'nMatched' , LoKi.Monitoring.ContextSvc ) )
            >>  ComplementForward
            >>  tee  ( monitor( TC_SIZE > 0, '# Complement', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE , 'nComp' , LoKi.Monitoring.ContextSvc ) )
            >>  FitTrack
            >>  tee  ( monitor( TC_SIZE > 0, '# pass fit', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE , 'nFitted' , LoKi.Monitoring.ContextSvc ) )
            >>  ( ( TrPT > %(PT)s * MeV ) & ( TrP  > %(P)s  * MeV ) )
            >>  tee  ( monitor( TC_SIZE , 'n after P/PT' , LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE > 0, '# pass P/PT', LoKi.Monitoring.ContextSvc ) )
            >>  ( ( TrCHI2PDOF < %(TrChi2)s ) & ( Tr_HLTMIPCHI2( 'PV3D' ) > %(IPChi2)s ) )
            >>  tee  ( monitor( TC_SIZE , 'n after Tr/IPChi2' , LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE > 0, '# pass Tr/IPChi2', LoKi.Monitoring.ContextSvc ) )
            >>  %(MuID)s
            >>  tee  ( monitor( TC_SIZE > 0, '# pass IsMuon', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE , 'nIsMuon' , LoKi.Monitoring.ContextSvc ) )
            >>  MakeDiMuons
            >>  tee  ( monitor( TC_SIZE > 0, '# pass vertex', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE , 'nVertices' , LoKi.Monitoring.ContextSvc ) )
            >>  ( RV_MASS ( 'mu+' , 'mu-' ) > %(M)s * MeV )
            >>  ( ( QProd == -1 ) | ( RV_MASS ( 'mu+' , 'mu-' ) > %(MSS)s * MeV ) )
            >>  tee  ( monitor( TC_SIZE > 0, '# pass mass', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE , 'nDiMuons' , LoKi.Monitoring.ContextSvc ) )
            >>  SINK( 'Hlt1%(name)sDecision' )
            >>  TC_SIZE > %(NMinDiMu)s
            """ % properties)
        gec = properties['GEC']

        return [
            Hlt1GECUnit(gec),
            PV3D('Hlt1'),
            self.optionalHPT_tracking(properties['name']), unit
        ]
예제 #18
0
    def KK_Unit(self, props):

        # KK is special because need to also make phis out of it in various ways
        # lifetime and vertex cuts get put in later where relevant

        props[
            'KaonCuts'] = """( (PT>%(ParticlePT)s) & (P>%(ParticleP)s) & (TRCHI2DOF<%(TrackCHI2DOF)s) )""" % props
        props['KKDecay'] = """'phi(1020) -> K+ K-'"""
        props['KKCombCut'] = (
            """( ( in_range( PDGM('D0')        - %(D0MassWinLoose)s  * MeV , AM , PDGM('D0')        + %(D0MassWinLoose)s  * MeV ) )  """
            +
            """| ( in_range( PDGM('phi(1020)') - %(PhiMassWinLoose)s * MeV , AM , PDGM('phi(1020)') + %(PhiMassWinLoose)s * MeV ) )   """
            +
            """| ( in_range( PDGM('B0')        - %(B0MassWinLoose)s  * MeV , AM , PDGM('B_s0')      + %(B0MassWinLoose)s  * MeV ) ) )  """
            + """& (APT>%(CombAPT)s*MeV)  """ +
            """& (AMAXCHILD(PT)>%(CombMaxDaughtPT)s*MeV)  """ +
            """& (ACUTDOCA(%(CombDOCA)s*mm,''))""") % props
        props['KKMothCut'] = (
            """( ( in_range( PDGM('D0')        - %(D0MassWin)s  * MeV , M , PDGM('D0')        + %(D0MassWin)s  * MeV ) )  """
            +
            """| ( in_range( PDGM('phi(1020)') - %(PhiMassWin)s * MeV , M , PDGM('phi(1020)') + %(PhiMassWin)s * MeV ) )  """
            +
            """| ( in_range( PDGM('B0')        - %(B0MassWin)s  * MeV , M , PDGM('B_s0')      + %(B0MassWin)s  * MeV ) ) )  """
            + """& (BPVDIRA > %(CombDIRA)s) """) % props

        KK_Preambulo = [
            "from LoKiArrayFunctors.decorators import AP, APT, ADAMASS, ACUTDOCA, DAMASS, ASUM, AMAXCHILD, PDGM, AM",
            "from LoKiPhys.decorators import PT",
            "KKCombinationConf = LoKi.Hlt1.Hlt1CombinerConf( %(KKDecay)s, %(KKCombCut)s, %(KKMothCut)s )"
            % props
        ]

        KK_LineCode = """
    TC_HLT1COMBINER( '',
                     KKCombinationConf,
                     'Hlt1SharedKaons', %(KaonCuts)s )
    >>  tee ( monitor( TC_SIZE > 0, '# pass ToKKs', LoKi.Monitoring.ContextSvc ) )
    >>  tee ( monitor( TC_SIZE    , 'nKKs',         LoKi.Monitoring.ContextSvc ) )
    >>  SINK ( 'Hlt1CalibTrackingKKs' )
    >>  ~TC_EMPTY
    """ % props

        from Configurables import LoKi__HltUnit as HltUnit
        from HltTracking.HltPVs import PV3D

        hlt1CalibTrackingLine_KKUnit = HltUnit(
            'Hlt1CalibTrackingKKUnit',
            PVSelection="PV3D",
            #OutputLevel = 1,
            Monitor=True,
            Preambulo=KK_Preambulo,
            Code=KK_LineCode)

        return hlt1CalibTrackingLine_KKUnit
예제 #19
0
    def KPi_Unit(self, props):

        props[
            'KaonCuts'] = """( (PT>%(ParticlePT)s) & (P>%(ParticleP)s) & (TRCHI2DOF<%(TrackCHI2DOF)s) )""" % props
        props[
            'PionCuts'] = """( (PT>%(ParticlePT)s) & (P>%(ParticleP)s) & (TRCHI2DOF<%(TrackCHI2DOF)s) )""" % props
        props[
            'KPiDecay'] = """'[phi(1020) -> K- pi+]cc'"""  #'strings( [ \'[phi(1020) -> K- pi+]cc\', \'phi(1020) -> K+ K-\', \'phi(1020) -> pi+ pi-\' ] )'
        props['KPiCombCut'] = (
            """( ( in_range( PDGM('D0') - %(D0MassWinLoose)s * MeV , AM , PDGM('D0')   + %(D0MassWinLoose)s * MeV ) )   """
            +
            """| ( in_range( PDGM('B0') - %(B0MassWinLoose)s * MeV , AM , PDGM('B_s0') + %(B0MassWinLoose)s * MeV ) ) ) """
            + """& (APT>%(CombAPT)s*MeV)  """ +
            """& (AMAXCHILD(PT)>%(CombMaxDaughtPT)s*MeV) """ +
            """& (ACUTDOCA(%(CombDOCA)s*mm,''))""") % props
        props['KPiMothCut'] = (
            """( ( in_range( PDGM('D0') - %(D0MassWin)s * MeV , M , PDGM('D0')   + %(D0MassWin)s * MeV ) )      """
            +
            """| ( in_range( PDGM('B0') - %(B0MassWin)s * MeV , M , PDGM('B_s0') + %(B0MassWin)s * MeV ) ) )  """
            + """& (BPVDIRA > %(CombDIRA)s)  """ +
            """& (VFASPF(VCHI2/VDOF)<%(CombVCHI2DOF)s)  """ +
            """& (BPVLTIME()>%(CombTAU)s*ps)""") % props

        KPi_Preambulo = [
            "from LoKiArrayFunctors.decorators import AP, APT, ADAMASS, ACUTDOCA, DAMASS, ASUM, AMAXCHILD, PDGM, AM",
            "from LoKiPhys.decorators import PT",
            "KPiCombinationConf = LoKi.Hlt1.Hlt1CombinerConf( %(KPiDecay)s, %(KPiCombCut)s, %(KPiMothCut)s )"
            % props
        ]

        KPi_LineCode = """
    TC_HLT1COMBINER( '',
                     KPiCombinationConf,
                     'Hlt1SharedKaons', %(KaonCuts)s ,
                     'Hlt1SharedPions', %(PionCuts)s )
    >>  tee ( monitor( TC_SIZE > 0, '# pass ToKPis', LoKi.Monitoring.ContextSvc ) )
    >>  tee ( monitor( TC_SIZE    , 'nKPis',         LoKi.Monitoring.ContextSvc ) )
    >>  SINK ( 'Hlt1CalibTrackingKPis' )
    >>  ~TC_EMPTY
    """ % props

        from Configurables import LoKi__HltUnit as HltUnit
        from HltTracking.HltPVs import PV3D

        hlt1CalibTrackingLine_KPiUnit = HltUnit(
            'Hlt1CalibTrackingKPiUnit',
            PVSelection="PV3D",
            #OutputLevel = 1,
            Monitor=True,
            Preambulo=KPi_Preambulo,
            Code=KPi_LineCode)

        return hlt1CalibTrackingLine_KPiUnit
예제 #20
0
    def diMuonDetached_streamer(self, properties):
        """
        DiMuon streamer starts from VeloTTCandidates but uses ComplementForward
        accessing directly long tracks if the velo segment was already upgraded.
        IsMuon is used for Long tracks, MatchVeloTTMuon for VeloTT and Velo ones.
        """
        from Hlt1Lines.Hlt1GECs import Hlt1GECUnit
        from Configurables import LoKi__HltUnit as HltUnit
        from HltTracking.HltPVs import PV3D
        unit = HltUnit(
            'Hlt1%(name)sStreamer' % properties,
            ##OutputLevel = 1 ,
            Preambulo=self.diMuon_preambulo(properties),
            Code="""
            VeloTTCandidates
            >>  MatchVeloTTMuon
            >>  tee  ( monitor( TC_SIZE > 0, '# MatchMuon', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE , 'nMatched' , LoKi.Monitoring.ContextSvc ) )
            >>  ComplementForward
            >>  tee  ( monitor( TC_SIZE > 0, '# Complement', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE , 'nComp' , LoKi.Monitoring.ContextSvc ) )
            >>  FitTrack
            >>  tee  ( monitor( TC_SIZE > 0, '# pass fit', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE , 'nFitted' , LoKi.Monitoring.ContextSvc ) )
            >>  ( ( TrPT > %(PT)s * MeV ) & ( TrP  > %(P)s  * MeV ) )  
            >>  tee  ( monitor( TC_SIZE , 'n after P/PT' , LoKi.Monitoring.ContextSvc ) )  
            >>  tee  ( monitor( TC_SIZE > 0, '# pass P/PT', LoKi.Monitoring.ContextSvc ) )           
            >>  ( ( TrCHI2PDOF < %(TrChi2)s ) & ( Tr_HLTMIPCHI2( 'PV3D' ) > %(IPChi2)s ) )
            >>  tee  ( monitor( TC_SIZE , 'n after Tr/IPChi2' , LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE > 0, '# pass Tr/IPChi2', LoKi.Monitoring.ContextSvc ) )
            >>  IsMuon
            >>  tee  ( monitor( TC_SIZE > 0, '# pass IsMuon', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE , 'nIsMuon' , LoKi.Monitoring.ContextSvc ) )
            >>  MakeDiMuons
            >>  tee  ( monitor( TC_SIZE > 0, '# pass vertex', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE , 'nVertices' , LoKi.Monitoring.ContextSvc ) )
            >>  ( RV_MASS ( 'mu+' , 'mu-' ) > %(M)s * MeV )
            >>  ( ( QProd == -1 ) | ( RV_MASS ( 'mu+' , 'mu-' ) > %(MSS)s * MeV ) )
            >>  tee  ( monitor( TC_SIZE > 0, '# pass mass', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE , 'nDiMuons' , LoKi.Monitoring.ContextSvc ) )
            >>  SINK( 'Hlt1%(name)sDecision' )
            >> ~TC_EMPTY
            """ % properties)
        gec = properties['GEC']

        return [
            Hlt1GECUnit(gec),
            PV3D('Hlt1'),
            self.optionalHPT_tracking(properties['name']), unit
        ]
예제 #21
0
 def getCaloUnit(self, properties):
     from Configurables import LoKi__HltUnit as HltUnit
     from HltTracking.Hlt1Tracking import L0CaloCandidates
     caloUnit = HltUnit('Hlt1%(name)sL0CaloStreamer' % properties,
                        Preambulo=[L0CaloCandidates(properties['name'])],
                        Code="""
         L0CaloCandidates
         >>  TC_CUT( LoKi.L0.L0CaloCut( 0, %(L0ElectronThreshold)s ), 0 )
         >>  tee  ( monitor( TC_SIZE > 0, '# pass L0CaloCut', LoKi.Monitoring.ContextSvc ) )
         >>  tee  ( monitor( TC_SIZE    , 'nCaloCandidates' , LoKi.Monitoring.ContextSvc ) )
         >>  SINK( '%(CaloCandidates)s' )
         >> ~TC_EMPTY
         """ % properties)
     return caloUnit
예제 #22
0
    def Kst_Unit(self, props):

        props[
            'KaonCuts'] = """( (PT>%(KstDauPT)s) & (P>%(KstDauP)s) & (TRCHI2DOF<%(KstDauCHI2DOF)s) & (BPVIPCHI2()<%(KstDauIPCHI2)s) )""" % props
        props[
            'PionCuts'] = """( (PT>%(KstDauPT)s) & (P>%(KstDauP)s) & (TRCHI2DOF<%(KstDauCHI2DOF)s) & (BPVIPCHI2()<%(KstDauIPCHI2)s) )""" % props
        props['KPiDecay'] = """'[K*(892)0 -> K+ pi-]cc'"""

        props['KPiCombCut'] = (
            """(in_range( PDGM('K*(892)0')-%(KstMassWinLoose)s*MeV,AM,PDGM('K*(892)0')+ %(KstMassWinLoose)s *MeV))"""
            + """& (APT>%(KstCombAPT)s*MeV)  """ +
            """& (AMAXCHILD(PT)>%(KstCombMaxDaughtPT)s*MeV)  """ +
            """& (ACUTDOCA(%(KstCombDOCA)s*mm,''))""") % props

        props['KPiMothCut'] = (
            """( in_range( PDGM('K*(892)0') - %(KstMassWin)s * MeV , M, PDGM('K*(892)0')+ %(KstMassWin)s * MeV))"""
        ) % props

        KPi_Preambulo = [
            "from LoKiArrayFunctors.decorators import AP, APT, ADAMASS, ACUTDOCA, DAMASS, ASUM, AMAXCHILD, PDGM, AM",
            "from LoKiPhys.decorators import PT",
            "KPiCombinationConf = LoKi.Hlt1.Hlt1CombinerConf( %(KPiDecay)s, %(KPiCombCut)s, %(KPiMothCut)s )"
            % props
        ]

        KPi_LineCode = """
    TC_HLT1COMBINER( '',
    KPiCombinationConf,
    'Hlt1SharedPions', %(PionCuts)s ,
    'Hlt1SharedKaons', %(KaonCuts)s )
    >>  tee ( monitor( TC_SIZE > 0, '# pass ToKPis', LoKi.Monitoring.ContextSvc ) )
    >>  tee ( monitor( TC_SIZE    , 'nKPis',         LoKi.Monitoring.ContextSvc ) )
    >>  SINK ( 'Hlt1BottomoniumKPis' )
    >>  ~TC_EMPTY
    """ % props

        from Configurables import LoKi__HltUnit as HltUnit
        from HltTracking.HltPVs import PV3D

        hlt1BottomoniumLine_KPiUnit = HltUnit(
            'Hlt1BottomoniumKPiUnit',
            PVSelection="PV3D",
            #OutputLevel = 1,
            Monitor=True,
            Preambulo=KPi_Preambulo,
            Code=KPi_LineCode)

        return hlt1BottomoniumLine_KPiUnit
예제 #23
0
    def __createLowMultVelo(self):
        from Configurables import LoKi__HltUnit as HltUnit
        from HltTracking.Hlt1Tracking import VeloCandidates
        from HltLine.HltLine import Hlt1Line as Line

        name = 'MicroBiasLowMultVelo'
        Line("MB" + name,
             prescale=self.prescale,
             postscale=self.postscale,
             ODIN=self.__odin(name),
             algos=[
                 HltUnit('Hlt1MB' + name + 'Unit',
                         Preambulo=[VeloCandidates(name)],
                         Code="VeloCandidates >> in_range(1, TC_SIZE, %s )" %
                         self.getProp('MaxVeloTracks'))
             ])
예제 #24
0
    def MuMu_Unit(self, properties):
        # Let's start with pions and ask ismuon first... this should be changed putting it in shared particles
        props = {}
        props[
            'MuonCuts'] = """( (PT>%(ParticlePT)s) & (P>%(ParticleP)s) & (TRCHI2DOF<%(TrackCHI2DOF)s) )""" % properties
        props['MuMuDecay'] = """'J/psi(1S) -> mu+ mu-'"""
        props['MuMuCombCut'] = (
            """( in_range( PDGM('J/psi(1S)') - %(JpsiMassWinLoose)s * MeV , AM , PDGM('J/psi(1S)')   + %(JpsiMassWinLoose)s * MeV ) )  """
            + """& (APT>%(CombAPT)s*MeV)  """ +
            """& (AMAXCHILD(PT)>%(CombMaxDaughtPT)s*MeV)  """ +
            """& (ACUTDOCA(%(CombDOCA)s*mm,'')) """) % properties
        props['MuMuMothCut'] = (
            """( in_range( PDGM('J/psi(1S)') - %(JpsiMassWin)s * MeV , M , PDGM('J/psi(1S)')   + %(JpsiMassWin)s * MeV ) )  """
            + """& (BPVDIRA > %(CombDIRA)s)  """ +
            """& (VFASPF(VCHI2/VDOF)<%(CombVCHI2DOF)s)  """ +
            """& (BPVLTIME()>%(CombTAU)s*ps)""") % properties

        MuMu_Preambulo = [
            "from LoKiArrayFunctors.decorators import AP, APT, ADAMASS, ACUTDOCA, DAMASS, ASUM, AMAXCHILD, PDGM, AM",
            "from LoKiPhys.decorators import PT",
            "MuMuCombinationConf = LoKi.Hlt1.Hlt1CombinerConf( %(MuMuDecay)s, %(MuMuCombCut)s, %(MuMuMothCut)s )"
            % props
        ]

        MuMu_LineCode = """
        TC_HLT1COMBINER( '',
        MuMuCombinationConf,
        'Hlt1SharedMuons', %(MuonCuts)s )
        >>  tee ( monitor( TC_SIZE > 0, '# pass ToMuMus', LoKi.Monitoring.ContextSvc ) )
        >>  tee ( monitor( TC_SIZE    , 'nMuMus',         LoKi.Monitoring.ContextSvc ) )
        >>  SINK ( 'Hlt1MuonsMuMus' )
        >>  ~TC_EMPTY
        """ % props

        from Configurables import LoKi__HltUnit as HltUnit
        from HltTracking.HltPVs import PV3D

        hlt1Jpsi_MuMuUnit = HltUnit(
            'Hlt1Jpsi2MuMuUnit',
            PVSelection="PV3D",
            #OutputLevel = 1,
            Monitor=True,
            Preambulo=MuMu_Preambulo,
            Code=MuMu_LineCode)

        return hlt1Jpsi_MuMuUnit
예제 #25
0
    def B2PhiGamma_Unit(self, props):

        props['PhiCuts'] = (
            "((in_range( (PDGM('phi(1020)') - %(PhiMassWinTight)s) * MeV , M , (PDGM('phi(1020)') + %(PhiMassWinTight)s) * MeV)) "
            "& (PT > %(PhiPT)s * MeV))") % props
        props['GammaCuts'] = "ALL"
        props['PhiGammaDecay'] = "'B_s0 -> phi(1020) gamma'"
        props['PhiGammaCombCut'] = (
            "(in_range(%(BsPhiGammaMassMinLoose)s * MeV, AM ,%(BsPhiGammaMassMaxLoose)s * MeV)) "
            "& (ASUM(PT) > %(B0SUMPT)s * MeV) "
            "& (APT > %(B0PT)s * MeV)") % props
        props['PhiGammaMothCut'] = (
            "((in_range( %(BsPhiGammaMassMin)s  * MeV, M ,%(BsPhiGammaMassMax)s * MeV)) "
            "& (BPVLTIME() > %(CombTAU)s * ps) "
            "& (VFASPF(VCHI2/VDOF) < %(CombVCHI2DOFLoose)s) )") % props

        B2PhiGamma_Preambulo = [
            "from LoKiArrayFunctors.decorators import AP, APT, ADAMASS, ACUTDOCA, DAMASS, ASUM, AMAXCHILD, AM, PDGM",
            "from LoKiPhys.decorators import PT",
            "B2PhiGammaCombinationConf = LoKi.Hlt1.Hlt1CombinerConf( %(PhiGammaDecay)s, %(PhiGammaCombCut)s, %(PhiGammaMothCut)s )"
            % props
        ]

        B2PhiGamma_LineCode = """
    TC_HLT1COMBINER( '',
                     B2PhiGammaCombinationConf,
                     'Hlt1LTUNBPhis',          %(PhiCuts)s   ,
                     'Hlt1B2PhiGamma_Photons', %(GammaCuts)s )
    >>  tee ( monitor( TC_SIZE > 0, '# pass ToB2PhiGammas', LoKi.Monitoring.ContextSvc ) )
    >>  tee ( monitor( TC_SIZE    , 'nB2PhiGammas',         LoKi.Monitoring.ContextSvc ) )
    >>  SINK ( 'Hlt1B2PhiGamma_LTUNBDecision' )
    >>  ~TC_EMPTY
    """ % props

        from Configurables import LoKi__HltUnit as HltUnit
        from HltTracking.HltPVs import PV3D

        hlt1CalibTrackingLine_B2PhiGammaUnit = HltUnit(
            'Hlt1CalibTrackingB2PhiGammaUnit',
            PVSelection="PV3D",
            #OutputLevel = 1,
            Monitor=True,
            Preambulo=B2PhiGamma_Preambulo,
            Code=B2PhiGamma_LineCode)

        return hlt1CalibTrackingLine_B2PhiGammaUnit
예제 #26
0
    def multiMuon_streamer(self, properties):
        """
        MultiMuon streamer starts from VeloTTCandidates but uses ComplementForward
        accessing directly long tracks if the velo segment was already upgraded.
        IsMuon is used for Long tracks, MatchVeloTTMuon for VeloTT and Velo ones.
        """
        from Hlt1Lines.Hlt1GECs import Hlt1GECUnit
        from Configurables import LoKi__HltUnit as HltUnit
        from HltTracking.HltPVs import PV3D
        unit = HltUnit(
            'Hlt1%(name)sStreamer' % properties,
            ##OutputLevel = 1 ,
            Preambulo=self.singleMuon_preambulo(properties),
            Code="""
            VeloTTCandidates
            >>  ( Tr_HLTMIP ( 'PV3D' ) > %(IP)s * mm ) 
            >>  MatchVeloTTMuon
            >>  tee  ( monitor( TC_SIZE > 0, '# MatchMuon', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE , 'nMatched' , LoKi.Monitoring.ContextSvc ) )
            >>  ComplementForward
            >>  tee  ( monitor( TC_SIZE > 0, '# Complement', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE , 'nComp' , LoKi.Monitoring.ContextSvc ) )
            >>  IsMuon
            >>  tee  ( monitor( TC_SIZE > 0, '# pass IsMuon', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE , 'nIsMuon' , LoKi.Monitoring.ContextSvc ) )
            >>  FitTrack
            >>  tee  ( monitor( TC_SIZE > 0, '# pass fit', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE , 'nFitted' , LoKi.Monitoring.ContextSvc ) )
            >>  ( ( TrPT > %(PT)s * MeV ) & ( TrP  > %(P)s  * MeV ) )
            >>  tee  ( monitor( TC_SIZE , 'n after P/PT' , LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE > 0, '# pass P/PT', LoKi.Monitoring.ContextSvc ) )
            >>  ( TrCHI2PDOF < %(TrChi2)s )
            >>  tee  ( monitor( TC_SIZE , 'n after TrChi2' , LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE > 0, '# pass TrChi2', LoKi.Monitoring.ContextSvc ) )
            >>  SINK( 'Hlt1%(name)sDecision' )
            >>  TC_SIZE > %(GT)s
            """ % properties)
        gec = properties['GEC']

        # The final sequence of algorithms
        return [
            Hlt1GECUnit(gec),
            PV3D('Hlt1'),
            self.optionalHPT_tracking(properties['name']), unit
        ]
예제 #27
0
    def twoTrackStreamer(self, name, props, inputParticles):
        from copy import deepcopy
        props = deepcopy(props)
        props['input'] = inputParticles.outputSelection()
        props['name'] = name
        preambulo = self.mvaPreambulo()
        preambulo += [
            "from LoKiArrayFunctors.decorators import APT, ACUTDOCACHI2",
            ("%(name)sCombinationConf = LoKi.Hlt1.Hlt1CombinerConf(strings(['K*(892)0 -> pi- pi+', '[K*(892)0 -> pi+ pi+]cc']),"
             + "((APT > %(V0PT)s) & (ACUTDOCACHI2(%(VxChi2)s,''))), ALL)") %
            props
        ]

        from Configurables import LoKi__HltUnit as HltUnit
        unit = HltUnit('Hlt1%sUnit' % name,
                       PVSelection="PV3D",
                       Monitor=True,
                       Preambulo=preambulo)
        tool = self.classifier(unit, name, lambda: self.twoTrackVars(name))

        props['tool'] = tool.getFullName()
        code = """
        TC_HLT1COMBINER('', %(name)sCombinationConf,
                        '%(input)s', ((PT          > %(PT)s * MeV) & \
                                      (P           > %(P)s    * MeV) & \
                                      (TRCHI2DOF   < %(TrChi2)s) & \
                                      (BPVIPCHI2() > %(IPChi2)s)))
        >> tee(monitor(TC_SIZE > 0, '# V0', LoKi.Monitoring.ContextSvc))
        >> tee(monitor(TC_SIZE    , 'nV0s', LoKi.Monitoring.ContextSvc))
        >> ( HASVERTEX & (VFASPF(VCHI2) < %(VxChi2)s)      & \
            (in_range(%(MinETA)s,  BPVETA,    %(MaxETA)s))  & \
            (in_range(%(MinMCOR)s, BPVCORRM, %(MaxMCOR)s)) & \
            (BPVDIRA           > %(MinDirA)s) & \
            (VALUE('%(tool)s') > %(Threshold)s))
        >> SINK ('Hlt1%(name)sDecision')
        >> ~TC_EMPTY
        """ % props
        unit.Code = code
        unit.PreloadTools = [tool.getFullName()]

        from Hlt1Lines.Hlt1GECs import Hlt1GECUnit
        from HltTracking.HltPVs import PV3D

        return [Hlt1GECUnit(props['GEC']), PV3D('Hlt1'), inputParticles, unit]
예제 #28
0
    def singleElectronPlusTrack_streamer(self, properties):
        from Configurables import LoKi__HltUnit as HltUnit
        from Hlt1Lines.Hlt1GECs import Hlt1GECUnit
        properties['CaloCandidates'] = 'ElectronTrackCandidates'
        #properties[ 'CaloCandidates' ] = 'CaloCandidates'

        trackUnit = HltUnit(
            'Hlt1%(name)sTrackStreamer' % properties,
            ##OutputLevel = 1 ,
            Preambulo=self.singleElectronPlusTrack_preambulo(properties),
            Code="""
            TrackCandidates
            >>  ( ( TrIDC('isVelo') > %(Velo_NHits)s ) & ( TrNVELOMISS < %(Velo_Qcut)s )   \
                & ( Tr_HLTMIP ( 'PV3D' ) > %(IP)s * mm) )  
            >>  tee  ( monitor( TC_SIZE > 0, '# pass match', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE    , 'nMatched' , LoKi.Monitoring.ContextSvc ) )
            >>  (TrTNORMIDC > %(TrNTHits)s ) 
            >>  tee  ( monitor( TC_SIZE > 0, '# pass forward', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE , 'nForward' , LoKi.Monitoring.ContextSvc ) )
            >>  ( ( TrPT > %(PT)s * MeV ) & ( TrP  > %(P)s  * MeV ) )
            >>  FitTrack
            >>  tee  ( monitor( TC_SIZE > 0, '# pass fit', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE , 'nFitted' , LoKi.Monitoring.ContextSvc ) )
            >>  ( ( TrCHI2PDOF < %(TrChi2)s )\
                & ( Tr_HLTMIPCHI2 ( 'PV3D' ) > %(IPChi2)s ) ) 
            >>  MakeVertex
            >>  tee  ( monitor( TC_SIZE > 0, '# pass vertex', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE , 'nVertices' , LoKi.Monitoring.ContextSvc ) )
            >>  ( RV_MASS ( 'e+' , 'e-' ) < %(M)s * MeV ) 
            >>  tee  ( monitor( TC_SIZE > 0, '# pass mass', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE , 'nPassedMassCut' , LoKi.Monitoring.ContextSvc ) )
            >>  ( RV_TrHAS( MatchVeloL0CaloCands ) ) 
            >>  tee  ( monitor( TC_SIZE > 0, '# has electron', LoKi.Monitoring.ContextSvc ) )
            >>  tee  ( monitor( TC_SIZE , 'nHasElectron' , LoKi.Monitoring.ContextSvc ) )
            >>  SINK( 'Hlt1%(name)sDecision' )
            >> ~TC_EMPTY
            """ % properties)
        gec = properties['GEC']
        from HltTracking.HltPVs import PV3D
        return [
            Hlt1GECUnit(gec),
            self.getCaloUnit(properties),
            PV3D('Hlt1'), trackUnit
        ]
예제 #29
0
  def pKPi_Unit( self, props ) :

    props['ProtonCuts']      = """( (PT>%(ParticlePT)s) & (P>%(ParticleP)s) & (TRCHI2DOF<%(TrackCHI2DOF)s) )""" %props 
    props['KaonCuts']        = """( (PT>%(ParticlePT)s) & (P>%(ParticleP)s) & (TRCHI2DOF<%(TrackCHI2DOF)s) )""" %props
    props['PionCuts']        = """( (PT>%(ParticlePT)s) & (P>%(ParticleP)s) & (TRCHI2DOF<%(TrackCHI2DOF)s) )""" %props
    props['pKPiDecay']       = """'[Lambda_c+ -> p+ K- pi+]cc'""" 
    props['pKPiCombCut']     = ("""( in_range( PDGM('Lambda_c+') - %(MassWinLoose)s * MeV , AM , PDGM('Lambda_c+')   + %(MassWinLoose)s * MeV ) )""" +
                                """& (AMAXCHILD(PT)>%(CombMaxDaughtPT)s*MeV) """ +
                                """& (ACUTDOCA(%(CombDOCA)s*mm,''))""") %props
    props['pKPiMothCut']     = ("""( in_range( PDGM('Lambda_c+') - %(MassWin)s * MeV , M , PDGM('Lambda_c+')   + %(MassWin)s * MeV ) )""" +
                                """& (VFASPF(VCHI2/VDOF)<%(CombVCHI2DOF)s)  """) %props

    pKPi_Preambulo = [ "from LoKiArrayFunctors.decorators import ADAMASS, ACUTDOCA, DAMASS, AMAXCHILD, PDGM, AM",
                       "from LoKiPhys.decorators import PT",
                       "pKPiCombinationConf = LoKi.Hlt1.Hlt1CombinerConf( %(pKPiDecay)s, %(pKPiCombCut)s, %(pKPiMothCut)s )" %props
                     ]

    pKPi_LineCode = """
    TC_HLT1COMBINER( '',
                     pKPiCombinationConf,
                     'Hlt1SharedProtons', %(ProtonCuts)s ,
                     'Hlt1SharedKaons', %(KaonCuts)s ,
                     'Hlt1SharedPions', %(PionCuts)s )
    >>  tee ( monitor( TC_SIZE > 0, '# pass TopKPis', LoKi.Monitoring.ContextSvc ) )
    >>  tee ( monitor( TC_SIZE    , 'npKPis',         LoKi.Monitoring.ContextSvc ) )
    >>  SINK ('Hlt1SMOGpKPiDecision')
    >>  ~TC_EMPTY
    """ %props

    from Configurables import LoKi__HltUnit as HltUnit
    #from HltTracking.HltPVs import PV3D  ## Shouldn't be required

    hlt1SMOGLine_pKPiUnit = HltUnit(
        'Hlt1SMOGpKPiUnit',
        #PVSelection = "PV3D", ## Shouldn't be required
        #OutputLevel = 1,
        Monitor = True,
        Preambulo = pKPi_Preambulo,
        Code = pKPi_LineCode
        )

    return hlt1SMOGLine_pKPiUnit
예제 #30
0
    def kaonUnit(self):
        protoUnit = self.protoParticleUnit()
        selection = 'Hlt1SharedKaons'
        props = {'selection': selection, 'input': protoUnit.outputSelection()}
        code = """
        SELECTION( '%(input)s' )
        >>  TC_TOPARTICLES( 'K+', '', ALL )
        >>  tee ( monitor( TC_SIZE > 0, '# pass ToKaons', LoKi.Monitoring.ContextSvc ) )
        >>  tee ( monitor( TC_SIZE    , 'nKaons',         LoKi.Monitoring.ContextSvc ) )
        >>  SINK(  '%(selection)s' )
        >>  ~TC_EMPTY
        """ % props

        from Configurables import LoKi__HltUnit as HltUnit
        kaonUnit = HltUnit('Hlt1SharedKaonUnit', Monitor=True, Code=code)

        from HltLine.HltLine import bindMembers
        bm = bindMembers(None,
                         [protoUnit, kaonUnit]).setOutputSelection(selection)
        return bm