Exemplo 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=[])
Exemplo n.º 2
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
Exemplo n.º 3
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
Exemplo n.º 4
0
    def __apply_configuration__(self):

        from HltLine.HltDecodeRaw import DecodeOT
        from HltLine.HltLine import Hlt1Line
        from Configurables import HltCosmicsOT
        from Hlt1Lines.Hlt1GECs import Hlt1GECUnit

        from HltTracking.HltSharedTracking import MinimalVelo, HltHPTTracking
        from HltLine.HltLine import Hlt1Member
        from HltLine.HltLine import Hlt1Line
        from HltLine.HltDecodeRaw import DecodeVELO
        from Configurables import LoKi__VoidFilter
        from HltTracking.HltPVs import PV3D
        from Hlt1Lines.Hlt1GECs import Hlt1GECUnit

        fltr_veloHits = self.__filterVeloHits("HighVeloMult",
                                              self.getProp("MinVeloHits"),
                                              self.getProp("MaxVeloHits"))
        fltr_veloHits_PV = self.__filterVeloHits(
            "HighVeloMultSinglePV", self.getProp("MinVeloHits_PV"),
            self.getProp("MaxVeloHits"))

        pvReco = PV3D('Hlt1')
        fltr_nPVs =  LoKi__VoidFilter ( 'HighVeloMultSinglePV_NPVsFilter'
                                        , Code = " CONTAINS('%(pvLoc)s')==%(nPVs)s " \
                                        % {"pvLoc" : pvReco.output, "nPVs": self.getProp("nPVs")})

        Hlt1Line(
            'HighVeloMult',
            prescale=self.prescale,
            postscale=self.postscale,
            ODIN=self.getProp('ODIN'),
            algos=[
                Hlt1GECUnit(
                    'Activity'
                )  # cut on a minimum of hits in the tracking detectors
                ,
                fltr_veloHits  # select high velo multiplicity events
            ])

        Hlt1Line(
            'HighVeloMultSinglePV',
            prescale=self.prescale,
            postscale=self.postscale,
            ODIN=self.getProp('ODIN'),
            algos=[
                Hlt1GECUnit(
                    'Activity'
                )  # cut on a minimum of hits in the tracking detectors
                ,
                pvReco  # Reconstruct PVs
                ,
                fltr_nPVs  # Filter on exactly 1 PV
                ,
                fltr_veloHits_PV  # select high velo multiplicity events
            ])
Exemplo n.º 5
0
 def _2topo( self, name): 
     from Configurables import DoubleTopoTool as DT
     code = "ACCEPT('DoubleTopoTool/"+name+"_DoubleTopoLine_DT')"
     alg = LoKi__VoidFilter(name+'_DoubleTopoLineFilter',Code=code)
     sel = EventSelection(name+'_DoubleTopoEventSel',Algorithm=alg)
     dt = DT(name+'_DoubleTopoLine_DT')
     dt.minAngle = self.__confdict__["my2TOPO"]["ANGLE_MIN"]
     dt.minMass = self.__confdict__["my2TOPO"]["M_MIN"]
     dt.minDPhi = self.__confdict__["my2TOPO"]["DPHI_MIN"]
     return sel
def filterDZ(name, DZAnyPV, MySelection):

    return EventSelection(
        #
        LoKi__VoidFilter(
            name + 'filterDZ',
            Code=" ( minMyZ - minPVZ ) < %(DZAnyPV)s*mm " % locals(),
            Preambulo=[
                "from LoKiPhys.decorators import *",
                "minMyZ = SOURCE('%s') >> min_value( VFASPF(VZ) )" %
                (MySelection.outputLocation()),
                "minPVZ = VSOURCE('Rec/Vertex/Primary') >> min_value(VZ) "
            ]))
Exemplo n.º 7
0
    def __apply_configuration__(self):

        from HltLine.HltDecodeRaw import DecodeOT
        from HltLine.HltLine import Hlt1Line as Line
        from Configurables import HltCosmicsOT
        from Hlt1Lines.Hlt1GECs import Hlt1GECUnit

        Line('ActivitySPD',
             prescale=self.prescale,
             postscale=self.postscale,
             L0DU="( L0_DATA('Spd(Mult)') > %(pA_SpdMult)s )" %
             self.getProps(),
             algos=[])

        Line('ActivityTracking',
             prescale=self.prescale,
             postscale=self.postscale,
             algos=[Hlt1GECUnit('Activity')])

        from HltTracking.HltSharedTracking import MinimalVelo as microBiasVelo
        from HltLine.HltLine import Hlt1Member as Member
        from HltLine.HltLine import Hlt1Line as Line
        from HltLine.HltDecodeRaw import DecodeVELO
        from Configurables import LoKi__VoidFilter

        fltr = LoKi__VoidFilter(
            'velohits',
            Preambulo=[
                'from LoKiPhys.decorators import *',
                'from LoKiCore.functions import *'
            ],
            Code=
            " in_range( 5999 , CONTAINS('Raw/Velo/LiteClusters') , %(nVeloLowMultMicroBias)s ) "
            % self.getProps())

        Line(
            'ActivityVelo',
            prescale=self.prescale,
            postscale=self.postscale,
            #       L0DU = "( L0_DATA('Spd(Mult)') < %(pA_LowMultSpd)s )" % self.getProps(),
            ODIN='jbit( ODIN_EVTTYP,2 )',
            algos=[
                DecodeVELO, fltr, microBiasVelo,
                Member('Hlt::TrackFilter',
                       'All',
                       Code=['TrALL'],
                       InputSelection='TES:%s' %
                       microBiasVelo.outputSelection(),
                       OutputSelection='%Decision')
            ])
Exemplo n.º 8
0
 def __filterVeloHits(self, name, minVeloHits, maxVeloHits):
     from Configurables import LoKi__VoidFilter
     fltr_veloHits = LoKi__VoidFilter(
         "Hlt1" + name + "Decision",
         Preambulo=[
             'from LoKiPhys.decorators import *',
             'from LoKiCore.functions import *'
         ],
         Code=
         "in_range( %(MinVeloHits)s , CONTAINS('Raw/Velo/LiteClusters') , %(MaxVeloHits)s )"
         % {
             "MinVeloHits": minVeloHits,
             "MaxVeloHits": maxVeloHits
         })
     return fltr_veloHits
Exemplo n.º 9
0
    def _create_main_algos(self, lineName):
        split = self.getProp('SplitVertices')

        algs = []

        algs.extend(self._create_reco_algos())

        if self.getProp('CreateGlobalSelection'):
            algs.append(self._create_global_selections())

        # vertex filtering code
        predicate = self._pv_filter_predicate(lineName)  # the actual cuts
        code = "VSOURCE('{}', {})".format(self.getProp("VertexContName"),
                                          predicate)

        if not split:
            code += " >> ~VEMPTY"
            filter_alg = LoKi__VoidFilter(
                'Hlt1{}Decision'.format(lineName),
                Preambulo=[
                    'from LoKiPhys.decorators import *',
                    'from LoKiCore.functions import *'
                ],
                Code=code)
        else:
            code += " >> RV_SINKTES('{}') >> ~VEMPTY".format('Hlt1/Vertex/' +
                                                             lineName)
            filter_alg = HltUnit('Hlt1{}Filter'.format(lineName),
                                 Preambulo=[
                                     'from LoKiPhys.decorators import *',
                                     'from LoKiCore.functions import *'
                                 ],
                                 Code=code)
        algs.append(filter_alg)

        if split:
            algs.append(self._create_pvsplit(lineName))
            algs.append(self._create_line_selection(lineName))

        return algs
Exemplo n.º 10
0
    def applyConf(self):

        # Configure dependency on Reco conf
        self.recoConf()

        # DataType specific tweaks
        self.dataTypeTweaks()

        # Online mode ?
        if self.getProp("OnlineMode"): self.setupOnlineMode()

        ## Sanity checks
        self.sanityChecks()

        # Sequence to add mintors to
        sequence = self.getProp("MoniSequencer")
        sequence.IgnoreFilterPassed = True

        # Set context
        sequence.Context = self.getProp("Context")

        # Suppress errors from Linker
        msgSvc = getConfigurable("MessageSvc")
        msgSvc.setFatal += [
            "LinkedTo::MC/Rich/Hits2MCRichOpticalPhotons",
            "LinkedTo::MC/Particles2MCRichTracks"
        ]

        # Event filters
        filter = self.getProp("EventFilter")
        if filter != "":
            from Configurables import LoKi__VoidFilter
            rFilter = LoKi__VoidFilter('RichMoniEventFilter', Code=filter)
            sequence.Members += [rFilter]

        # Event selection ?
        if self.isPropertySet("EventCuts"):
            from Configurables import Rich__Rec__EventSelectionAlg
            evtSel = Rich__Rec__EventSelectionAlg("RichMoniEventSel")
            sequence.Members += [evtSel]
            for name, cut in self.getProp("EventCuts").iteritems():
                evtSel.setProp("Min" + name, cut[0])
                evtSel.setProp("Max" + name, cut[1])

        # Do we need MC access or not
        if not self.getProp("WithMC"):
            nullMCtools = [
                "Rich::MC::NULLMCTruthTool/RichMCTruthTool",
                "Rich::Rec::MC::NULLMCTruthTool/RichRecMCTruthTool"
            ]
            self.toolRegistry().Tools += nullMCtools

        # The list of monitors to run
        monitors = self.getHistoOptions("Monitors")

        # Some monitoring of raw information
        rawSeq = self.newSeq(sequence, "RichRawMoni")
        rawSeq.IgnoreFilterPassed = True

        if "L1SizeMonitoring" in monitors:

            detailedPlots = self.getProp("Histograms") == "Expert"

            # Data Sizes - all events
            from Configurables import Rich__DAQ__RawDataSize
            dataSize = self.createMonitor(Rich__DAQ__RawDataSize,
                                          "RichRawDataSize")
            dataSize.FillDetailedHPDPlots = detailedPlots
            dataSize.FillDetailedL1IngressPlots = detailedPlots
            rawSeq.Members += [dataSize]

            # Data size plots, L0 unbiased events
            if not self.getProp("Simulation"):
                from Configurables import GaudiSequencer
                lSeq = self.newSeq(rawSeq, "RichRawDataSizeL0Seq")
                lSeq.ReturnOK = True
                dataSizeL0 = self.createMonitor(Rich__DAQ__RawDataSize,
                                                "RichRawDataSizeL0")
                dataSizeL0.FillDetailedHPDPlots = detailedPlots
                dataSizeL0.FillDetailedL1IngressPlots = detailedPlots
                lSeq.Members = self.l0Filters() + [dataSizeL0]

        if "DBConsistencyCheck" in monitors:

            # Data base consistency
            from Configurables import Rich__DAQ__DataDBCheck
            dbCheck = self.createMonitor(Rich__DAQ__DataDBCheck,
                                         "RichRawDataDBCheck")
            rawSeq.Members += [dbCheck]

        if "HotPixelFinder" in monitors:

            # Hot pixel finder
            from Configurables import Rich__HPDAnalysisAlg
            hotpix = self.createMonitor(Rich__HPDAnalysisAlg, "RichHotPixels")
            hotpix.HPDAnalysisTools = ["RichHotPixelFinder"]
            rawSeq.Members += [hotpix]

        if "DataDecodingErrors" in monitors:

            # Decoding error summaries
            from Configurables import Rich__DAQ__DataDecodingErrorMoni
            daqErrs = self.createMonitor(Rich__DAQ__DataDecodingErrorMoni,
                                         "RichDecodingErrors")
            rawSeq.Members += [daqErrs]

        # ODIN
        if "ODIN" in monitors:
            self.odinMoni(self.newSeq(sequence, "RichODINMoni"))

        # RICH data monitoring
        if "PixelMonitoring" in monitors:
            self.pixelPerf(self.newSeq(sequence, "RichPixelMoni"))

        # Track monitoring
        if "TrackMonitoring" in monitors:
            self.trackMoni(self.newSeq(sequence, "RichTrackMoni"))

        # Reconstruction monitoring
        if "PhotonMonitoring" in monitors:
            self.recPerf(self.newSeq(sequence, "RichRecoMoni"), tkCuts="None")
            self.recPerf(self.newSeq(sequence, "RichRecoMoniTight"),
                         tkCuts="Tight")
            #self.recPerf(self.newSeq(sequence,"RichRecoMoniTightUnambig"),
            #             tkCuts="Tight",photCuts="UnambPhots")

        # Aerogel specific monitoring
        if "AerogelMonitoring" in monitors:
            self.aeroMoni(self.newSeq(sequence, "RichAeroMoni"))

        # PID Performance
        if "PidMonitoring" in monitors:
            self.pidPerf(self.newSeq(sequence, "RichPIDMoni"), False,
                         "RiPIDMon")
            #self.pidPerf(self.newSeq(sequence,"RichPIDMoniDLL"),True,"RiPIDMonDLL")

        # Trackless rings angles
        if "TracklessRingAngles" in monitors:
            types = self.recoConf().TracklessRingAlgs
            for type in types:
                self.ringsMoni(
                    type,
                    self.newSeq(sequence,
                                "Rich" + type + "TracklessRingsMoni"))

        # Trackless rings peak search
        if "TracklessRingPeakSearch" in monitors:
            types = self.recoConf().TracklessRingAlgs
            for type in types:
                self.ringsPeakSearch(
                    type,
                    self.newSeq(sequence,
                                "Rich" + type + "TracklessRingsPeaks"))

        # Alignment monitor
        if "AlignmentMonitoring" in monitors:
            conf = self.alignmentConf()
            self.setOtherProps(
                conf, ["Histograms", "Context", "NTupleProduce", "WithMC"])
            conf.AlignmentSequencer = self.newSeq(sequence,
                                                  "RichMirrAlignMoni")

        # HPD IFB
        if "HPDIFBMonitoring" in monitors:
            self.ionfeedbackMoni(self.newSeq(sequence, "RichHPDIonFeedback"))

        # HPD Image shifts
        if "HPDImageShifts" in monitors:
            self.hpdImageShifts(self.newSeq(sequence, "RichHPDImageShifts"))

        # Expert Monitoring
        self.expertMonitoring(sequence)
Exemplo n.º 11
0
    def __init__(self, moduleName, config):

        LineBuilder.__init__(self, moduleName, config)

        # pre-filter inputs
        uppions = filterInputs('PiUP', [StdNoPIDsUpPions], config['UPSTREAM'])
        pions = filterInputs('Pi', [StdAllNoPIDsPions], config['ALL'])
        kaons = filterInputs('K', [StdAllNoPIDsKaons], config['ALL'])
        protons = filterInputs('P', [StdAllNoPIDsProtons], config['ALL'])
        ks_dd = filterInputs('KS0_DD', [dataOnDemand("StdLooseKsDD")],
                             config['KS0'])
        ks_ll = filterInputs('KS0_LL', [dataOnDemand("StdLooseKsLL")],
                             config['KS0'])
        ks = {"DD": [ks_dd], "LL": [ks_ll]}
        lambda0_dd = filterInputs('Lambda0_DD',
                                  [dataOnDemand("StdLooseLambdaDD")],
                                  config['Lambda0'])
        lambda0_ll = filterInputs('Lambda0_LL',
                                  [dataOnDemand("StdLooseLambdaLL")],
                                  config['Lambda0'])
        lambda0 = {"DD": [lambda0_dd], "LL": [lambda0_ll]}
        pi0_merged = filterPi0s('Merged', [StdLooseMergedPi0], config['Pi0'])
        pi0_resolved = filterPi0s('Resolved', [StdLooseResolvedPi0],
                                  config['Pi0'])
        pi0 = {"Merged": [pi0_merged], "Resolved": [pi0_resolved]}
        pcut = 'P > %s' % config['Pi0']['FROM_B_P_MIN']
        pi0_fromB_merged = filterSelection('Pi0FromBMerged', pcut,
                                           [pi0_merged])
        pi0_fromB_resolved = filterSelection('Pi0FromBResolved', pcut,
                                             [pi0_resolved])
        pi0_fromB = {
            'Merged': [pi0_fromB_merged],
            'Resolved': [pi0_fromB_resolved]
        }
        muons = filterInputs('MU', [StdLooseMuons],
                             config['ALL'])  # make muons (for D -> phi mu nu)

        # pre-filter hard inputs (these could have been used in HLT2)
        topoPions = topoInputs('Pi', [pions])
        topoKaons = topoInputs('K', [kaons])
        topoProtons = topoInputs('P', [protons])

        # make D->X, etc. inputs
        d = DBuilder(pions, kaons, ks, pi0, uppions, muons, config['D2X'],
                     config['PID'])
        dst = DstarBuilder(d, pions, pi0, config['Dstar'], config['PID'])

        # X -> hh
        hh = HHBuilder(pions, kaons, protons, ks, pi0_fromB, config['HH'],
                       config['PID'])

        # X -> hhh
        hhh = HHHBuilder(pions, kaons, protons, config['HHH'], config['PID'])

        # Lc -> X
        lc = LcBuilder(pions, kaons, protons, config['D2X'], config['PID'])
        xicc = XiccBuilder(lc, pions, config['D2X'])

        # make B->DX
        b2dx = B2DXBuilder(d, dst, topoPions, topoKaons, ks, pi0_fromB, hh,
                           hhh, config['B2X'])
        self._makeLines(b2dx.lines, config)

        # Lb -> X
        lb2x = Lb2XBuilder(lc, xicc, d, hh, topoPions, topoKaons, topoProtons,
                           pions, kaons, hhh, dst, lambda0, config['B2X'])
        self._makeLines(lb2x.lines, config)

        # Unbiased lines
        ltub = LTUnbiasedBuilder(d, config['B2X'])
        self._makeLines(ltub.lines, config)

        # UP D* lines
        for line in b2dx.lines:
            for sel in line.selections:
                if sel.name().find('WS') > 0: continue
                dstar_sel = makeB2DstarX(sel, uppions, config['B2X'])
                self._makeLine(ProtoLine([dstar_sel], line.pre), config)

        # Double Topo line
        from Configurables import DoubleTopoTool as DT
        code = "ACCEPT('DoubleTopoTool/DoubleTopoLine_DT')"
        alg = LoKi__VoidFilter('DoubleTopoLineFilter', Code=code)
        sel = EventSelection('DoubleTopoEventSel', Algorithm=alg)
        dt = DT('DoubleTopoLine_DT')
        dt.minAngle = config['2TOPO']['ANGLE_MIN']
        dt.minMass = config['2TOPO']['M_MIN']
        dt.minDPhi = config['2TOPO']['DPHI_MIN']
        hlt = "HLT_PASS_RE('Hlt2Topo.*Decision')"
        sline = StrippingLine('DoubleTopoLine', 1.0, selection=sel, HLT=hlt)
        self.registerLine(sline)

        # pseudo double topo line
        sline = StrippingLine('PseudoDoubleTopoLine',
                              1.0,
                              selection=makeDoubleTopo(topoKaons,
                                                       config['BB']),
                              HLT=hlt)
        self.registerLine(sline)

        # B->D0X inclusive line
        cuts = "(PT > %d*MeV) & (ADMASS('D0') < 25*MeV) & (MIPCHI2DV(PRIMARY)>%d)" \
               % (config['D0INC']['PT_MIN'],config['D0INC']['IPCHI2_MIN'])
        sel = filterSelection('D02KPIPIDMTIGHT', cuts, d.kpi_pid_tight)
        sel = tosSelection(sel, {'Hlt2Topo2BodyBBDTDecision%TOS': 0})
        hlt = "HLT_PASS_RE('Hlt2Topo2BodyBBDTDecision')"
        sline = StrippingLine('D02HHTopoTOSLine', 1.0, selection=sel, HLT=hlt)
        self.registerLine(sline)
Exemplo n.º 12
0
    def __init__(self, name, config):

        LineBuilder.__init__(self, name, config)

        self._myname = name

        # High pT Topo line
        from Configurables import HighPtTopoTool as HighpTDT
        code = "ACCEPT('HighPtTopoTool/HighPtTopoLine_DT_40000')"
        alg = LoKi__VoidFilter('HighPtTopoLineFilter_40000', Code=code)
        sel = EventSelection('HighPtTopoEventSel_40000', Algorithm=alg)
        dt = HighpTDT('HighPtTopoLine_DT_40000')
        dt.minpT = config['pT']
        hlt = "HLT_PASS_RE('Hlt2Topo.*Decision')"
        sline = StrippingLine(name + '%(pT)s' % config,
                              prescale=config['HighPtTopo40000_Prescale'],
                              postscale=config['HighPtTopo_Postscale'],
                              selection=sel,
                              HLT=hlt)
        self.registerLine(sline)

        # High pT Topo line
        from Configurables import HighPtTopoTool as HighpTDT
        code = "ACCEPT('HighPtTopoTool/HighPtTopoLine_DT_20000')"
        alg = LoKi__VoidFilter('HighPtTopoLineFilter_20000', Code=code)
        sel = EventSelection('HighPtTopoEventSel_20000', Algorithm=alg)
        dt = HighpTDT('HighPtTopoLine_DT_20000')
        dt.minpT = config['pT20']
        hlt = "HLT_PASS_RE('Hlt2Topo.*Decision')"
        sline = StrippingLine(name + '%(pT20)s' % config,
                              prescale=config['HighPtTopo20000_Prescale'],
                              postscale=config['HighPtTopo_Postscale'],
                              selection=sel,
                              HLT=hlt)
        self.registerLine(sline)

        # High pT Topo line
        from Configurables import HighPtTopoTool as HighpTDT
        code = "ACCEPT('HighPtTopoTool/HighPtTopoLine_DT_10000')"
        alg = LoKi__VoidFilter('HighPtTopoLineFilter_10000', Code=code)
        sel = EventSelection('HighPtTopoEventSel_10000', Algorithm=alg)
        dt = HighpTDT('HighPtTopoLine_DT_10000')
        dt.minpT = config['pT10']
        hlt = "HLT_PASS_RE('Hlt2Topo.*Decision')"
        sline = StrippingLine(name + '%(pT10)s' % config,
                              prescale=config['HighPtTopo10000_Prescale'],
                              postscale=config['HighPtTopo_Postscale'],
                              selection=sel,
                              HLT=hlt)
        self.registerLine(sline)

        # High pT Topo line
        from Configurables import HighPtTopoTool as HighpTDT
        code = "ACCEPT('HighPtTopoTool/HighPtTopoLine_DT_1000')"
        alg = LoKi__VoidFilter('HighPtTopoLineFilter_1000', Code=code)
        sel = EventSelection('HighPtTopoEventSel_1000', Algorithm=alg)
        dt = HighpTDT('HighPtTopoLine_DT_1000')
        dt.minpT = config['pT1']
        hlt = "HLT_PASS_RE('Hlt2Topo.*Decision')"
        sline = StrippingLine(name + '%(pT1)s' % config,
                              prescale=config['HighPtTopo1000_Prescale'],
                              postscale=config['HighPtTopo_Postscale'],
                              selection=sel,
                              HLT=hlt)
        self.registerLine(sline)

        from Configurables import HighPtTopoTool as HighpTDT
        code = "ACCEPT('HighPtTopoTool/HighPtTopoLine_DT_20000_Cone55')"
        alg = LoKi__VoidFilter('HighPtTopoLineFilter_20000_Cone55', Code=code)
        sel = EventSelection('HighPtTopoEventSel_20000_Cone55', Algorithm=alg)
        dt = HighpTDT('HighPtTopoLine_DT_20000_Cone55')
        dt.minconepT = config['pTcone']
        dt.conesize = config['conesize']
        dt.minpT = config['pT20']
        hlt = "HLT_PASS_RE('Hlt2Topo.*Decision')"
        sline = StrippingLine(
            name + '%(pT20)s_Cone55' % config,
            prescale=config['HighPtTopo20000_Cone55_Prescale'],
            postscale=config['HighPtTopo_Postscale'],
            selection=sel,
            HLT=hlt)
        self.registerLine(sline)
Exemplo n.º 13
0
    def filters(self, name, **kwargs):
        """
        construct the list of filters

        >>> fltrs = LoKi_Filters ( ... )
        >>> lst   = fltrs.filters ( 'MySeq' , MeasureTime = True )
        
        >>> seq.Members += lst
        
        """
        _seq = []

        if self.__MC_Code:
            #
            from Configurables import LoKi__MCFilter
            _mc = LoKi__MCFilter(name + '_MC', Code=self.__MC_Code)
            if self.__MC_Preambulo: _mc.Preambulo = self.__MC_Preambulo
            if self.__MC_Location: _mc.Location = self.__MC_Location
            _seq += [_mc]

        if self.__GEN_Code:
            #
            from Configurables import LoKi__GenFilter
            _gen = LoKi__GenFilter(name + '_GEN', Code=self.__GEN_Code)
            if self.__GEN_Preambulo: _gen.Preambulo = self.__GEN_Preambulo
            if self.__GEN_Location: _gen.Location = self.__GEN_Location
            _seq += [_gen]

        if self.__ODIN_Code:
            #
            from Configurables import LoKi__ODINFilter
            _odin = LoKi__ODINFilter(name + '_ODIN', Code=self.__ODIN_Code)
            if self.__ODIN_Preambulo: _odin.Preambulo = self.__ODIN_Preambulo
            if self.__ODIN_Location: _odin.Location = self.__ODIN_Location
            _seq += [_odin]

        if self.__L0DU_Code:
            #
            from Configurables import LoKi__L0Filter
            _l0du = LoKi__L0Filter(name + '_L0DU', Code=self.__L0DU_Code)
            if self.__L0DU_Preambulo: _l0du.Preambulo = self.__L0DU_Preambulo
            if self.__L0DU_Location: _l0du.Location = self.__L0DU_Location
            _seq += [_l0du]

        if self.__HLT_Code:
            #
            if 0 <= self.__HLT_Code.upper().find(
                    'HLT1') and not self.__HLT1_Code:
                if 0 > self.__HLT_Code.upper().find('HLT2'):
                    self.__HLT1_Code = self.__HLT_Code
                    self.__HLT1_Preambulo = self.__HLT_Preambulo
                    log.warning(
                        'LoKi_Filters: Obsolete property HLT_Code is replaced with HLT1_Code'
                    )
            elif 0 <= self.__HLT_Code.upper().find(
                    'HLT2') and not self.__HLT2_Code:
                if 0 > self.__HLT_Code.upper().find('HLT1'):
                    self.__HLT2_Code = self.__HLT_Code
                    self.__HLT2_Preambulo = self.__HLT_Preambulo
                    log.warning(
                        'LoKi_Filters: Obsolete property HLT_Code is replaced with HLT2_Code'
                    )
            else:
                log.error(
                    'LoKi_Filters: Specification of HLT_Code does not allow traslation to HLT(1/2)_Code'
                )
                from Configurables import LoKi__HDRFilter
                _hlt = LoKi__HDRFilter(name + '_HLT', Code=self.__HLT_Code)
                if self.__HLT_Preambulo: _hlt.Preambulo = self.__HLT_Preambulo
                if self.__HLT_Location: _hlt.Location = self.__HLT_Location
                _seq += [_hlt]

        if self.__HLT1_Code:
            #
            from Configurables import LoKi__HDRFilter
            _hlt = LoKi__HDRFilter(name + '_HLT1', Code=self.__HLT1_Code)
            if self.__HLT1_Preambulo: _hlt.Preambulo = self.__HLT1_Preambulo
            if self.__HLT1_Location: _hlt.Location = self.__HLT1_Location
            _seq += [_hlt]

        if self.__HLT2_Code:
            #
            from Configurables import LoKi__HDRFilter
            _hlt = LoKi__HDRFilter(name + '_HLT2', Code=self.__HLT2_Code)
            if self.__HLT2_Preambulo: _hlt.Preambulo = self.__HLT2_Preambulo
            if self.__HLT2_Location: _hlt.Location = self.__HLT2_Location
            _seq += [_hlt]

        if self.__STRIP_Code:
            #
            from Configurables import LoKi__HDRFilter
            _strip = LoKi__HDRFilter(name + '_STRIP',
                                     Code=self.__STRIP_Code,
                                     Location='/Event/Strip/Phys/DecReports')
            if self.__STRIP_Preambulo: _strip.Location = self.__STRIP_Preambulo
            if self.__STRIP_Location: _strip.Location = self.__STRIP_Location
            _seq += [_strip]

        if self.__VOID_Code:

            from Configurables import LoKi__VoidFilter
            _void = LoKi__VoidFilter(name + '_VOID', Code=self.__VOID_Code)
            if self.__VOID_Preambulo: _void.Preambulo = self.__VOID_Preambulo
            _seq += [_void]

        ## Propagate the remaing properties
        args = deepcopy(self.__kwargs)
        args.update(kwargs)

        _used = []
        for key in args:
            for a in _seq:
                if hasattr(a, key):
                    setattr(a, key, args[key])
                    _used.append(key)

        for key in _used:
            args.pop(key, None)
        if args:
            log.error("LoKiFilters: Unable propagate properties: %s " %
                      args.keys())

        return _seq
Exemplo n.º 14
0
    def __init__(self, moduleName, config) :
        
        LineBuilder.__init__(self, moduleName, config)

        # pre-filter inputs
        pions = filterInputs('Pi',[StdAllNoPIDsPions],config['ALL'])
        kaons = filterInputs('K',[StdAllNoPIDsKaons],config['ALL'])
        protons = filterInputs('P',[StdAllNoPIDsProtons],config['ALL'])
        ks_dd = filterInputs('KS0_DD',[dataOnDemand("StdLooseKsDD")],
                                       config['KS0']) 
        ks_ll = filterInputs('KS0_LL',[dataOnDemand("StdLooseKsLL")],
                             config['KS0'])
        ks = {"DD":[ks_dd],"LL":[ks_ll]}
        pi0_merged   = filterPi0s('Merged',[StdLooseMergedPi0],config['Pi0'])
        pi0_resolved = filterPi0s('Resolved',[StdLooseResolvedPi0],
                                  config['Pi0'])
        pi0 = {"Merged":[pi0_merged],"Resolved":[pi0_resolved]}
        pcut = 'P > %s' % config['Pi0']['FROM_B_P_MIN']
        pi0_fromB_merged = filterSelection('Pi0FromBMerged',pcut,[pi0_merged])
        pi0_fromB_resolved = filterSelection('Pi0FromBResolved',pcut,
                                             [pi0_resolved])
        pi0_fromB = {'Merged':[pi0_fromB_merged],
                     'Resolved':[pi0_fromB_resolved]}
        
        # pre-filter hard inputs (these could have been used in HLT2)
        topoPions = topoInputs('Pi',[pions])
        topoKaons = topoInputs('K',[kaons])
        topoProtons = topoInputs('P',[protons])
        
        # make D->X, etc. inputs
        d = DBuilder(pions,ks,pi0,config['D2X'],config['PID'])
        dst = DstarBuilder(d,pions,pi0,config['Dstar'],config['PID'])

        # X -> hh
        hh = HHBuilder(pions,kaons,protons,ks,pi0_fromB,config['HH'],
                       config['PID'])

        # X -> hhh
        hhh = HHHBuilder(pions,kaons,protons,config['HHH'])

        # Lc -> X
        lc = LcBuilder(pions,kaons,protons,config['D2X'],config['PID'])

        # make B->DX
        b2dx = B2DXBuilder(d,dst,topoPions,topoKaons,ks,pi0_fromB,hh,hhh,
                           config['B2X'])
        self._makeLines(b2dx.lines,config)

        # Lb -> X
        lb2x = Lb2XBuilder(lc,d,hh,topoPions,topoKaons,topoProtons,hhh,dst,
                           config['B2X'])
        self._makeLines(lb2x.lines,config)

        # Unbiased lines
        ltub = LTUnbiasedBuilder(d,config['B2X'])
        self._makeLines(ltub.lines,config)

        # Double Topo line
        from Configurables import DoubleTopoTool as DT
        code = "ACCEPT('DoubleTopoTool/DoubleTopoLine_DT')"
        alg = LoKi__VoidFilter('DoubleTopoLineFilter',Code=code)
        sel = EventSelection('DoubleTopoEventSel',Algorithm=alg)
        dt = DT('DoubleTopoLine_DT')
        dt.minAngle = 2/57.
        dt.minMass = 19000
        hlt = "HLT_PASS_RE('Hlt2Topo.*Decision')"
        sline = StrippingLine('DoubleTopoLine',1.0,selection=sel,HLT=hlt)
        self.registerLine(sline)

        # High pT Topo line
        from Configurables import HighPtTopoTool as HighpTDT
        code = "ACCEPT('HighPtTopoTool/HighPtTopoLine_DT_40000')"
        alg = LoKi__VoidFilter('HighPtTopoLineFilter_40000',Code=code)
        sel = EventSelection('HighPtTopoEventSel_40000',Algorithm=alg)
        dt = HighpTDT('HighPtTopoLine_DT_40000')
        dt.minpT = 40000
        hlt = "HLT_PASS_RE('Hlt2Topo.*Decision')"
        sline = StrippingLine('HighPtTopoLine_40000',1.0,selection=sel,HLT=hlt)
        self.registerLine(sline)

        from Configurables import HighPtTopoTool as HighpTDT
        code = "ACCEPT('HighPtTopoTool/HighPtTopoLine_DT_20000')"
        alg = LoKi__VoidFilter('HighPtTopoLineFilter_20000',Code=code)
        sel = EventSelection('HighPtTopoEventSel_20000',Algorithm=alg)
        dt = HighpTDT('HighPtTopoLine_DT_20000')
        dt.minpT = 20000
        hlt = "HLT_PASS_RE('Hlt2Topo.*Decision')"
        sline = StrippingLine('HighPtTopoLine_20000',0.1,selection=sel,HLT=hlt)
        self.registerLine(sline)
Exemplo n.º 15
0
    def __init__( self, name, config ) :

        LineBuilder.__init__( self, name, config )


        # High pT Topo line
        code = "ACCEPT('HighPtTopoTool/HighPtTopoLine_DT_40000')"
        alg = LoKi__VoidFilter('HighPtTopoLineFilter_40000',Code=code)
        sel = EventSelection('HighPtTopoEventSel_40000',Algorithm=alg)
        dt = HighpTDT('HighPtTopoLine_DT_40000')
        dt.minpT = config['pT']

        # Split HLT configuration
        config_split_HLT(dt)
        
        sline = StrippingLine(name+'%(pT)s'%config,
                              prescale  = config[ 'HighPtTopo40000_Prescale' ],
                              postscale = config[ 'HighPtTopo_Postscale' ],
                              selection=sel,
                              HLT2=config['HLT2'])
        self.registerLine(sline)


        # High pT Topo line
        code = "ACCEPT('HighPtTopoTool/HighPtTopoLine_DT_20000')"
        alg = LoKi__VoidFilter('HighPtTopoLineFilter_20000',Code=code)
        sel = EventSelection('HighPtTopoEventSel_20000',Algorithm=alg)
        dt = HighpTDT('HighPtTopoLine_DT_20000')
        dt.minpT = config['pT20']

        # Split HLT configuration
        config_split_HLT(dt)

        sline = StrippingLine(name+'%(pT20)s'%config,
                              prescale  = config[ 'HighPtTopo20000_Prescale' ],
                              postscale = config[ 'HighPtTopo_Postscale' ],
                              selection=sel,
                              HLT2=config['HLT2'])
        self.registerLine(sline)


        # High pT Topo line
        code = "ACCEPT('HighPtTopoTool/HighPtTopoLine_DT_10000')"
        alg = LoKi__VoidFilter('HighPtTopoLineFilter_10000',Code=code)
        sel = EventSelection('HighPtTopoEventSel_10000',Algorithm=alg)
        dt = HighpTDT('HighPtTopoLine_DT_10000')
        dt.minpT = config['pT10']

        # Split HLT configuration
        config_split_HLT(dt)

        sline = StrippingLine(name+'%(pT10)s'%config,
                              prescale  = config[ 'HighPtTopo10000_Prescale' ],
                              postscale = config[ 'HighPtTopo_Postscale' ],
                              selection=sel,
                              HLT2=config['HLT2'])
        self.registerLine(sline)


        # High pT Topo line
        code = "ACCEPT('HighPtTopoTool/HighPtTopoLine_DT_1000')"
        alg = LoKi__VoidFilter('HighPtTopoLineFilter_1000',Code=code)
        sel = EventSelection('HighPtTopoEventSel_1000',Algorithm=alg)
        dt = HighpTDT('HighPtTopoLine_DT_1000')
        dt.minpT = config['pT1']

        # Split HLT configuration
        config_split_HLT(dt)

        sline = StrippingLine(name+'%(pT1)s'%config,
                              prescale  = config[ 'HighPtTopo1000_Prescale' ],
                              postscale = config[ 'HighPtTopo_Postscale' ],
                              selection=sel,
                              HLT2=config['HLT2'])
        self.registerLine(sline)


        code = "ACCEPT('HighPtTopoTool/HighPtTopoLine_DT_20000_Cone55')"
        alg = LoKi__VoidFilter('HighPtTopoLineFilter_20000_Cone55',Code=code)
        sel = EventSelection('HighPtTopoEventSel_20000_Cone55',Algorithm=alg)
        dt = HighpTDT('HighPtTopoLine_DT_20000_Cone55')
        dt.minconepT = config['pTcone']
        dt.conesize = config['conesize']
        dt.minpT = config['pT20']

        # Split HLT configuration
        config_split_HLT(dt)

        sline = StrippingLine(name+'%(pT20)s_Cone55'%config,
                              prescale  = config[ 'HighPtTopo20000_Cone55_Prescale' ],
                              postscale = config[ 'HighPtTopo_Postscale' ],
                              selection=sel,
                              HLT2=config['HLT2'])
        self.registerLine(sline)
Exemplo n.º 16
0
    def __init__( self, name, config ) :

        LineBuilder.__init__( self, name, config )


        # High pT Topo line
        code = "ACCEPT('HighPtTopoTool/HighPtTopoLine_DT_40000')"
        alg = LoKi__VoidFilter('HighPtTopoLineFilter_40000',Code=code)
        sel = EventSelection('HighPtTopoEventSel_40000',Algorithm=alg)
        dt = HighPtTopoTool('HighPtTopoLine_DT_40000')
        dt.minpT = config['pT']
        ## Available after Phys/TopologicalTools v1r1+
        ## Conditional can be removed afterward (hasattr doesn't work here)
        if 'hltdecision' in dir(dt):
          dt.hltdecision = config['HLT2']  

        # Split HLT configuration
        config_split_HLT(dt)
        
        sline = StrippingLine(name+'%(pT)i'%config,
                              prescale  = config[ 'HighPtTopo40000_Prescale' ],
                              postscale = config[ 'HighPtTopo_Postscale' ],
                              selection=sel,
                              HLT2="HLT_PASS_RE('%s')"%config['HLT2'])
        self.registerLine(sline)


        # High pT Topo line
        code = "ACCEPT('HighPtTopoTool/HighPtTopoLine_DT_20000')"
        alg = LoKi__VoidFilter('HighPtTopoLineFilter_20000',Code=code)
        sel = EventSelection('HighPtTopoEventSel_20000',Algorithm=alg)
        dt = HighPtTopoTool('HighPtTopoLine_DT_20000')
        dt.minpT = config['pT20']
        ## Available after Phys/TopologicalTools v1r1+
        ## Conditional can be removed afterward (hasattr doesn't work here)
        if 'hltdecision' in dir(dt):
          dt.hltdecision = config['HLT2']  

        # Split HLT configuration
        config_split_HLT(dt)

        sline = StrippingLine(name+'%(pT20)i'%config,
                              prescale  = config[ 'HighPtTopo20000_Prescale' ],
                              postscale = config[ 'HighPtTopo_Postscale' ],
                              selection=sel,
                              HLT2="HLT_PASS_RE('%s')"%config['HLT2'])
        self.registerLine(sline)


        # High pT Topo line
        code = "ACCEPT('HighPtTopoTool/HighPtTopoLine_DT_10000')"
        alg = LoKi__VoidFilter('HighPtTopoLineFilter_10000',Code=code)
        sel = EventSelection('HighPtTopoEventSel_10000',Algorithm=alg)
        dt = HighPtTopoTool('HighPtTopoLine_DT_10000')
        dt.minpT = config['pT10']
        ## Available after Phys/TopologicalTools v1r1+
        ## Conditional can be removed afterward (hasattr doesn't work here)
        if 'hltdecision' in dir(dt):
          dt.hltdecision = config['HLT2']  

        # Split HLT configuration
        config_split_HLT(dt)

        sline = StrippingLine(name+'%(pT10)i'%config,
                              prescale  = config[ 'HighPtTopo10000_Prescale' ],
                              postscale = config[ 'HighPtTopo_Postscale' ],
                              selection=sel,
                              HLT2="HLT_PASS_RE('%s')"%config['HLT2'])
        self.registerLine(sline)


        # High pT Topo line
        code = "ACCEPT('HighPtTopoTool/HighPtTopoLine_DT_1000')"
        alg = LoKi__VoidFilter('HighPtTopoLineFilter_1000',Code=code)
        sel = EventSelection('HighPtTopoEventSel_1000',Algorithm=alg)
        dt = HighPtTopoTool('HighPtTopoLine_DT_1000')
        dt.minpT = config['pT1']
        ## Available after Phys/TopologicalTools v1r1+
        ## Conditional can be removed afterward (hasattr doesn't work here)
        if 'hltdecision' in dir(dt):
          dt.hltdecision = config['HLT2']  

        # Split HLT configuration
        config_split_HLT(dt)

        sline = StrippingLine(name+'%(pT1)i'%config,
                              prescale  = config[ 'HighPtTopo1000_Prescale' ],
                              postscale = config[ 'HighPtTopo_Postscale' ],
                              selection=sel,
                              HLT2="HLT_PASS_RE('%s')"%config['HLT2'])
        self.registerLine(sline)


        code = "ACCEPT('HighPtTopoTool/HighPtTopoLine_DT_20000_Cone55')"
        alg = LoKi__VoidFilter('HighPtTopoLineFilter_20000_Cone55',Code=code)
        sel = EventSelection('HighPtTopoEventSel_20000_Cone55',Algorithm=alg)
        dt = HighPtTopoTool('HighPtTopoLine_DT_20000_Cone55')
        dt.minconepT = config['pTcone']
        dt.conesize = config['conesize']
        dt.minpT = config['pT20']
        ## Available after Phys/TopologicalTools v1r1+
        ## Conditional can be removed afterward (hasattr doesn't work here)
        if 'hltdecision' in dir(dt):
          dt.hltdecision = config['HLT2']  


        # Split HLT configuration
        config_split_HLT(dt)

        sline = StrippingLine(name+'%(pT20)i_Cone55'%config,
                              prescale  = config[ 'HighPtTopo20000_Cone55_Prescale' ],
                              postscale = config[ 'HighPtTopo_Postscale' ],
                              selection=sel,
                              HLT2="HLT_PASS_RE('%s')"%config['HLT2'])
        self.registerLine(sline)