예제 #1
0
    def __apply_configuration__(self):
        from HltLine.HltLine import Hlt2Line
        from Configurables import HltANNSvc
        stages = self.stages()
        for (nickname, algos) in self.algorithms(stages):
            linename = 'DiMuon' + nickname if nickname != 'DiMuon' else nickname
            if "Turbo" in nickname:
                Hlt2Line(linename,
                         prescale=self.prescale,
                         algos=algos,
                         postscale=self.postscale,
                         Turbo=True,
                         PersistReco=self.getProps()['PersistReco'].get(
                             nickname, False))
            else:
                Hlt2Line(linename,
                         prescale=self.prescale,
                         algos=algos,
                         postscale=self.postscale)

            if nickname is 'JPsi':
                HltANNSvc().Hlt2SelectionID.update(
                    {"Hlt2DiMuonJPsiDecision": 50201})
            if nickname is 'JPsiTurbo':
                HltANNSvc().Hlt2SelectionID.update(
                    {'Hlt2DiMuonJPsiTurboDecision': 50212})
예제 #2
0
 def __apply_configuration__(self):
     # Set up the standard lines
     lines = {
         'Hadron': _CEPHadronLines.locallines(),
         'Muon': _CEPMuonLines.locallines(),
         'Photon': _CEPPhotonLines.locallines(),
         'Electron': _CEPElectronLines.locallines()
     }
     from HltLine.HltLine import Hlt2Line
     for l0nick, lns in lines.iteritems():
         for linename, algos in self.algorithms(lns):
             Hlt2Line(linename,
                      prescale=self.prescale,
                      L0DU=self.__l0du(l0nick),
                      HLT1=self.getProp('HLT')[l0nick],
                      algos=algos)
     # Add two additional technical lines
     Hlt2Line("NoBiasNonBeamBeam",
              prescale=self.prescale,
              HLT1=self.getProp('HLT')["TechnicalNoBias"],
              ODIN=self.getProp('Technical_ODIN')["ALL"],
              L0DU=self.getProp('Technical_L0')["NoBias"])
     Hlt2Line("LowMultTechnical_MinBias",
              prescale=self.prescale,
              HLT1=self.getProp('HLT')["TechnicalNoBias"],
              ODIN=self.getProp('Technical_ODIN')["ALL"],
              L0DU=self.getProp('Technical_L0')["MinBias"])
예제 #3
0
 def hlt2Lines(self, Hlt2):
     """
     The actual lines
     """
     from HltLine.HltLine import Hlt2Line
     #
     # check if this threshold setting has some global event cut...
     #  if so, set it, and add a line which does (prescaled) the opposite
     #
     if self.getProp('DefaultVoidFilter'):
         Hlt2Line.setDefaultVoidFilter(self.getProp('DefaultVoidFilter'))
         Hlt2Line('PileUp',
                  VoidFilter='  ~ ( %s ) ' %
                  self.getProp('DefaultVoidFilter'),
                  postscale=0.01)
     #
     # Loop over thresholds
     #
     from ThresholdUtils import setThresholds
     from functools import partial
     map(partial(setThresholds, self.getProp("ThresholdSettings")),
         _hlt2linesconfs)
     from Configurables import LoKi__HDRFilter as HDRFilter
     Hlt2Line('Global',
              priority=255,
              VoidFilter='',
              HLT1='',
              HLT2="HLT_PASS_SUBSTR('Hlt2')")
예제 #4
0
 def __apply_configuration__(self):
     """
     Hlt2 configuration
     """
     Hlt2 = Sequence("Hlt2", Context='HLT', ModeOR=True, ShortCircuit=False)
     # set Hlt2 PID
     self.configureReconstruction()
     # lines
     if self.getProp("DefaultVoidFilter"):
         from HltLine.HltLine import Hlt2Line
         Hlt2Line.setDefaultVoidFilter(self.getProp("DefaultVoidFilter"))
     self.hlt2Lines(Hlt2)
예제 #5
0
    def __apply_configuration__(self):
        for k, v in DisplVerticesLines.fillInDefaults(
                self.__slots__).iteritems():
            setattr(self, k, v)

        from Stages import (
            SingleFilter,
            #SingleDownFilter,
            DoubleFilter)

        stages = {
            "SingleVeryHighFD": [SingleFilter("SingleVeryHighFD")],
            "SingleHighFD": [SingleFilter("SingleHighFD")],
            "Single": [SingleFilter("Single")],
            "SingleHighMass": [SingleFilter("SingleHighMass")],
            "SinglePS": [SingleFilter("SinglePS")],
            "SingleLoosePS": [SingleFilter("SingleLoosePS")]
            #, "SingleDown"       : [ SingleDownFilter("SingleDown") ] ## TODO
            ,
            "Double": [DoubleFilter("Double")],
            "DoublePS": [DoubleFilter("DoublePS")]
        }

        from HltLine.HltLine import Hlt2Line
        for (nickname, lineStages) in self.algorithms(stages):
            linename = "DisplVertices{0}".format(nickname)
            Hlt2Line(linename,
                     algos=lineStages,
                     prescale=self.prescale(nickname),
                     postscale=self.postscale(nickname))
예제 #6
0
 def __apply_configuration__(self) :
   from HltLine.HltLine import Hlt2Line
   from Configurables import HltANNSvc
   stages = self.stages()
   for (nickname, algos) in self.algorithms(stages):
     linename = nickname
     Hlt2Line(linename, prescale = self.prescale, algos = algos, postscale = self.postscale)
예제 #7
0
    def __apply_configuration__(self):
        from Stages import CopyTracks, IncidentGenerator
        from Inputs import KS0_DD, KS0_LL
        stages = {
            'Forward': [CopyTracks()],
            'DebugEvent': [IncidentGenerator()],
            'ErrorEvent': [],
            'PassThrough': [],
            'MBNoBias': [],
            'Transparent': [],
            'SMOGPhysics': [],
            'Lumi': [],
            'BeamGas': [],
            'KS0_DD': [KS0_DD],
            'KS0_LL': [KS0_LL]
        }

        from HltLine.HltLine import Hlt2Line
        for name, algos in self.algorithms(stages):
            localProps = self.getProps().get(name, {})
            doturbo = False
            linename = name
            if name in self.getProps()['Turbo']:
                doturbo = True
                linename += 'Turbo'
            Hlt2Line(linename,
                     prescale=self.prescale,
                     postscale=self.postscale,
                     algos=algos,
                     HLT1=localProps.get('HLT1', None),
                     VoidFilter=localProps.get('VoidFilter', None),
                     priority=localProps.get('Priority', None),
                     Turbo=doturbo)
예제 #8
0
    def __apply_configuration__(self):

        _stages = self.stages()
        _relatedInfo = self.relatedInfo()

        ## Other line Hlt2LinesConfigurableUser, like that for the DPS lines,
        ## can call self.stages().  This can (but probably won't) happen
        ## before __slots__ is updated with the configuration.  In order to
        ## guarantee that the __slots__ are updated prior to the definition of
        ## the inclusive lines, either the dependence of this configurable and
        ## all others that call its stages() must be explicitly defined, or,
        ## as is done here, the inclusive lines are defined first and only
        ## here in __apply_configuration__ and not in stages().
        _stages.update(self.__inclHHXStages())

        from HltLine.HltLine import Hlt2Line
        for nickname, algos, relatedInfo in self.algorithms(_stages):
            doturbo = True if (nickname.find('Turbo') > -1) else False
            Hlt2Line('CharmHad' + nickname,
                     prescale=self.prescale,
                     algos=algos,
                     postscale=self.postscale,
                     Turbo=doturbo,
                     PersistReco=self.getProps()['PersistReco'].get(
                         'Hlt2CharmHad' + nickname, False),
                     RelatedInfo=relatedInfo)
            if "Dst_2D0Pi0_D02KPi_XSec" in nickname:
                HltANNSvc().Hlt2SelectionID.update(
                    {"Hlt2CharmHadDst_2D0Pi0_D02KPi_XSecTurboDecision": 57222})
예제 #9
0
    def __apply_configuration__(self):
        from Stages import (TrackGEC, KaonFilter, KS0Filter, Pi0TOSFilter,
                            Pi0Filter, Hb2XNeutralCombiner)
        from Inputs import Hlt2LooseKaons, KsLL

        filteredPi0s = Pi0Filter('FilteredPi0s', [Pi0TOSFilter()])
        filteredKaons = KaonFilter(
            'FilteredKaons', [Hlt2LooseKaons],
            self.getProp('FilteredKaons').get('TRACK_TISTOS'))
        filteredKSs = KS0Filter('FilteredKSs', [KsLL],
                                self.getProp('FilteredKSs').get('KS0_TISTOS'))

        B2Kpi0 = Hb2XNeutralCombiner('B2Kpi0', '[B+ -> K+ pi0]cc',
                                     [filteredKaons, filteredPi0s])
        B2K0pi0 = Hb2XNeutralCombiner('B2K0pi0', '[B0 -> KS0 pi0]cc',
                                      [filteredKSs, filteredPi0s])

        from HltTracking.HltPVs import PV3D
        stages = {
            'B2Kpi0': [TrackGEC(), PV3D('Hlt2'), B2Kpi0],
            'B2K0pi0': [TrackGEC(), PV3D('Hlt2'), B2K0pi0],
        }
        from HltLine.HltLine import Hlt2Line
        for (linename, algos) in self.algorithms(stages):
            Hlt2Line('B2Kpi0_' + linename,
                     algos=algos,
                     prescale=self.prescale,
                     postscale=self.postscale,
                     L0DU=self.getProp('Common').get('L0FILTER'),
                     HLT1=self.getProp(linename).get('HLT1FILTER'))
예제 #10
0
    def __apply_configuration__(self):
        from HltLine.HltLine import Hlt2Line
        stages = self.stages()

        for (nickname, algos) in self.algorithms(stages):
            Hlt2Line('Majorana' + nickname,
                     prescale=self.prescale,
                     algos=algos,
                     postscale=self.postscale)
예제 #11
0
    def __apply_configuration__(self):
        from HltLine.HltLine import Hlt2Line

        stages = self.stages()

        for (nickname, algos) in self.algorithms(stages):
            linename = 'Strange' + nickname
            if "Turbo" in nickname:
                Hlt2Line(linename,
                         prescale=self.prescale,
                         algos=algos,
                         postscale=self.postscale,
                         Turbo=True)
            else:
                Hlt2Line(linename,
                         prescale=self.prescale,
                         algos=algos,
                         postscale=self.postscale)
예제 #12
0
    def __apply_configuration__(self):
        from Stages import SelJpsiMuE
        stages = {'LFVJpsiMuETurbo': [SelJpsiMuE]}

        for name, algos in self.algorithms(stages):
            Hlt2Line(name,
                     L0DU="(L0_DATA('Spd(Mult)') < {})".format(self.getProp('SpdCut')['NSPD']),
                     prescale=self.prescale,
                     algos=algos,
                     postscale=self.postscale,
                     Turbo=True)
예제 #13
0
    def __apply_configuration__(self):
        from HltLine.HltLine import Hlt2Line

        stages = self.stages()

        for (nickname, algos) in self.algorithms(stages):
            linename = 'RareStrange' + nickname
            Hlt2Line(linename,
                     prescale=self.prescale,
                     algos=algos,
                     postscale=self.postscale)
예제 #14
0
    def __apply_configuration__(self):

        _stages = self.stages()
##        _relatedInfo = self.relatedInfo()


        from HltLine.HltLine import Hlt2Line
##        for nickname, algos, relatedInfo in self.algorithms( _stages ):
        for nickname, algos in self.algorithms( _stages ):
            doturbo = True if (nickname.find('Turbo') > -1) else False
            Hlt2Line('BHad' + nickname, prescale = self.prescale,
                     algos = algos, postscale = self.postscale, Turbo = doturbo)
예제 #15
0
    def __apply_configuration__(self):
        from HltLine.HltLine import Hlt2Line

        stages = self.stages()
        cuts = self.getProps()
        for nickname, algos in self.algorithms(stages):
            Hlt2Line('CcDiHadron' + nickname,
                     prescale=cuts[nickname].get('Prescale', 1.0),
                     L0DU=cuts[nickname].get('L0Req', None),
                     HLT1=cuts[nickname].get('Hlt1Req', None),
                     algos=algos,
                     postscale=self.postscale)
예제 #16
0
    def __apply_configuration__(self):
        from HltLine.HltLine import Hlt2Line
        from Configurables import HltANNSvc
        stages = self.stages()
        for (nickname, algos) in self.algorithms(stages):
            linename = 'SingleMuon' + nickname if nickname != 'SingleMuon' else nickname

            Hlt2Line(linename,
                     prescale=self.prescale,
                     HLT1=self.hlt_req(nickname),
                     algos=algos,
                     postscale=self.postscale)
예제 #17
0
 def __apply_configuration__(self):
     from HltLine.HltLine import Hlt2Line
     from Stages import CreatePions, JpsiReFitPVsFilter
     stages = {
         'CreateReco': [CreatePions("AllOfThem")],
         'JPsiReFitPVsTurbo': [JpsiReFitPVsFilter("JpsiReFitPVsFilter")]
     }
     for nickname, algos in self.algorithms(stages):
         if nickname is 'JPsiReFitPVsTurbo':
             HltANNSvc().Hlt2SelectionID.update(
                 {"Hlt2JPsiReFitPVsTurboDecision": 57221})
             Hlt2Line(nickname,
                      prescale=self.prescale,
                      algos=algos,
                      postscale=self.postscale,
                      Turbo=True)
         else:
             Hlt2Line(nickname,
                      priority=1,
                      prescale=self.prescale,
                      algos=algos,
                      postscale=self.postscale)
예제 #18
0
    def __apply_configuration__(self):

        stages = self.stages()
        from HltLine.HltLine import Hlt2Line
        for (nickname, algos) in self.algorithms(stages):
            linename = 'TrackEffDiMuon' + nickname + 'TurboCalib'
            Hlt2Line(linename,
                     prescale=self.prescale,
                     algos=algos,
                     postscale=self.postscale,
                     L0DU=self.getProp('Common').get('L0Filter'),
                     HLT1=self.getProp('Common').get('Hlt1Filter'),
                     Turbo=True)
        for (nickname, algos) in self.algorithms(stages):
            linename = 'TrackEffDiMuon' + nickname + 'Fullstream'
            Hlt2Line(linename,
                     prescale=self.prescale,
                     algos=algos,
                     postscale=self.postscale,
                     L0DU=self.getProp('Common').get('L0Filter'),
                     HLT1=self.getProp('Common').get('Hlt1Filter'),
                     Turbo=False)
예제 #19
0
    def __apply_configuration__(self):
        from Stages import Tau23MuCombiner, TriMuonDetachedCombiner
        stages = {
            'TriMuonTau23Mu': [Tau23MuCombiner('TriMuonTau23Mu')],
            'TriMuonDetached': [TriMuonDetachedCombiner('TriMuonDetached')]
        }

        from HltLine.HltLine import Hlt2Line
        for nickname, algos in self.algorithms(stages):
            Hlt2Line(nickname,
                     prescale=self.prescale,
                     algos=algos,
                     postscale=self.postscale)
예제 #20
0
    def __apply_configuration__(self):
        from Stages import FilteredDstD0ToKpiPionProbe
        from Stages import FilteredDstD0ToKpiKaonProbe

        stages = {'PionProbe'  : [FilteredDstD0ToKpiPionProbe],
                  'KaonProbe'  : [FilteredDstD0ToKpiKaonProbe]}

        from HltLine.HltLine import Hlt2Line
        for (nickname, algos) in self.algorithms(stages):
            Hlt2Line('TrackEff_D0ToKpi' + nickname+'Turbo', prescale = self.prescale,
                     algos = algos, postscale = self.postscale,
                     Turbo=True,
                     PersistReco=True)
예제 #21
0
 def __apply_configuration__(self):
     from HltLine.HltLine import Hlt2Line
     from Configurables import HltANNSvc
     stages = self.stages()
     for (nickname, algos) in self.algorithms(stages):
         linename = nickname
         turbo = True if (nickname.find('Turbo') > -1) else False
         persist_reco = True if (nickname.find('Turbo') > -1) else False
         Hlt2Line(linename,
                  prescale=self.prescale,
                  algos=algos,
                  Turbo=turbo,
                  PersistReco=persist_reco,
                  postscale=self.postscale)
예제 #22
0
    def __apply_configuration__(self):
        from HltLine.HltLine import Hlt2Line
        from Configurables import HltANNSvc
        lines = self.getProp('CloneLines')
        for (module, lines) in lines.iteritems():
            # Import the other module that has the stages.
            mod = importlib.import_module('Hlt2Lines.' + module + '.Lines')
            # Instantiate the configurable
            conf = getattr(mod, module + 'Lines')()
            # Loop over the line, use the configurable to get the algorithms and
            # instantiate the turbo lines.
            for line in lines:
                stages = conf.stages(line)
                algos = dict(conf.algorithms({'Turbo': stages}))
                if module is not 'Radiative':
                    Hlt2Line(module + line + 'Turbo',
                             prescale=self.prescale,
                             algos=algos['Turbo'],
                             postscale=self.postscale,
                             Turbo=True)
                else:
                    Hlt2Line(line + 'Turbo',
                             prescale=self.prescale,
                             algos=algos['Turbo'],
                             postscale=self.postscale,
                             Turbo=True)

                if module is 'DiMuon':
                    if line is 'JPsi':
                        HltANNSvc().Hlt2SelectionID.update({
                            'Hlt2' + module + line + 'Turbo' + 'Decision':
                            50212
                        })
                elif module is 'Radiative':
                    if line is 'RadiativeB2GammaGamma':
                        HltANNSvc().Hlt2SelectionID.update(
                            {'Hlt2' + line + 'Turbo' + 'Decision': 50213})
예제 #23
0
 def __apply_configuration__(self):
     from HltLine.HltLine import Hlt2Line
     for (name, algos) in self.algorithms(self.stages()):
         if 'Combos' in name: continue
         if 'Run1TopoE' in name:
             l0 = self.getProps()['Common']['RUN1_L0_ELECTRON_FILTER']
             hlt1 = self.getProps()['Common']['RUN1_HLT1_ELECTRON_FILT']
         else:
             l0 = None
             hlt1 = None
         Hlt2Line(name,
                  prescale=self.prescale,
                  algos=algos,
                  L0DU=l0,
                  HLT1=hlt1,
                  postscale=self.postscale)
예제 #24
0
    def __apply_configuration__(self):
        from Stages import SelB2HH, SelB2PiPi, SelB2KPi, SelB2KK, SelLb2PK, SelLb2PPi
        stages = {
            'B2HH': [SelB2HH],
            'B2PiPi': [SelB2PiPi],
            'B2KPi': [SelB2KPi],
            'B2KK': [SelB2KK],
            'Lb2PK': [SelLb2PK],
            'Lb2PPi': [SelLb2PPi]
        }

        from HltLine.HltLine import Hlt2Line
        for nickname, algos in self.algorithms(stages):
            Hlt2Line('B2HH_' + nickname,
                     prescale=self.prescale,
                     algos=algos,
                     postscale=self.postscale)
예제 #25
0
    def __apply_configuration__(self):
        from HltLine.HltLine import Hlt2Line
        from Stages import Photons, ParticleFlow
        from Hlt2Lines.Utilities.Hlt2Filter import Hlt2ParticleFilter

        # Instantiate filters to make the warnings about TisTos go away
        photons = Photons(self.getProp('UseFullCalo'))
        photon_filter = Hlt2ParticleFilter("Filter", "ALL", [photons])

        pf_filter = Hlt2ParticleFilter("Filter", "ALL", [ParticleFlow()])

        # Final stages of the lines
        stages = {'CaloTest': [photon_filter], 'PFTest': [pf_filter]}

        # Build the lines
        for name, algos in self.algorithms(stages):
            Hlt2Line(name,
                     prescale=self.prescale,
                     algos=algos,
                     postscale=self.postscale)
예제 #26
0
 def __apply_configuration__(self):
     props = self.getProps()
     from HltLine.HltLine import Hlt2Line
     l0_dependencies = {}
     hlt1_dependencies = {}
     stages = {}
     for line_conf in lines_to_run:
         # Get L0 dependencies
         l0_dependencies.update(line_conf.get_l0())
         # Get HLT1 dependencies
         hlt1_dependencies.update(line_conf.get_hlt1())
         # Load stages
         stages.update(line_conf.get_stages(props))
     # Build lines
     for (linename, algos) in self.algorithms(stages):
         Hlt2Line(linename,
                  L0DU=l0_dependencies.get(linename, None),
                  HLT1=hlt1_dependencies.get(linename, None),
                  algos=algos,
                  prescale=self.prescale,
                  postscale=self.postscale)
예제 #27
0
    def __apply_configuration__(self) :
        from Stages import (DiMuonZFilter,DiMuonDY1Filter,DiMuonDY2Filter,DiMuonDY3Filter,DiMuonDY4Filter,
                            SingleMuonLowPtFilter,SingleMuonHighPtFilter,SingleMuonVHighPtFilter,
                            DiElectronDYFilter,DiElectronHighMassFilter,
                            SingleElectronFilter,SingleElectronLowPtFilter,SingleElectronHighPtFilter,SingleElectronVHighPtFilter, TauTrkFilter, TauRhoCombiner, HighPTTauCombiner, SingleTauFilter)
        from Inputs import (MergedPi0s, ResolvedPi0s, BiKalmanFittedMuons, BiKalmanFittedElectrons, BiKalmanFittedPions)
        #create the taus first
        tau_trkfilter     = TauTrkFilter("TauTrkFilter", [BiKalmanFittedPions])
        tau_rhocombiner   = TauRhoCombiner("TauRhoCombiner", [tau_trkfilter])
        taus_3prong       = HighPTTauCombiner("Tau3PiCombiner",0, [tau_rhocombiner, tau_trkfilter])
        taus_2prong       = HighPTTauCombiner("TauPiPi0Combiner",1, [tau_trkfilter, MergedPi0s, ResolvedPi0s])
        singletaus_3prong = SingleTauFilter("SingleTauHighPt3Prong",0, [taus_3prong])
        singletaus_2prong = SingleTauFilter("SingleTauHighPt2Prong",1, [taus_2prong])

        stages = {'DiMuonZ'                 : [DiMuonZFilter('DiMuonZ')],
                  'DiMuonDY1'               : [DiMuonDY1Filter('DiMuonDY1')],
                  'DiMuonDY2'               : [DiMuonDY2Filter('DiMuonDY2')],
                  'DiMuonDY3'               : [DiMuonDY3Filter('DiMuonDY3')],
                  'DiMuonDY4'               : [DiMuonDY4Filter('DiMuonDY4')],
                  'SingleMuonLowPt'         : [SingleMuonLowPtFilter('SingleMuonLowPt')],
                  'SingleMuonHighPt'        : [SingleMuonHighPtFilter('SingleMuonHighPt')],
                  'SingleMuonVHighPt'       : [SingleMuonVHighPtFilter('SingleMuonVHighPt')],
                  'DiElectronDY'            : [DiElectronDYFilter('DiElectronDY')],
                  'DiElectronHighMass'      : [DiElectronHighMassFilter('DiElectronHighMass')],
                  'SingleElectron'          : [SingleElectronFilter('SingleElectron')],
                  'SingleElectronLowPt'     : [SingleElectronLowPtFilter('SingleElectronLowPt')],
                  'SingleElectronHighPt'    : [SingleElectronHighPtFilter('SingleElectronHighPt')],
                  'SingleElectronVHighPt'   : [SingleElectronVHighPtFilter('SingleElectronVHighPt')],
                  'SingleTauHighPt3Prong'   : [singletaus_3prong],
                  'SingleTauHighPt2Prong'   : [singletaus_2prong]}

        from HltLine.HltLine import Hlt2Line
        from HltLine.HltDecodeRaw import DecodeL0CALO
        for (nickname, algos) in self.algorithms(stages):
            cuts = self.getProp(nickname)
            linename = 'EW' + nickname
            Hlt2Line(linename, prescale = self.prescale,L0DU = cuts.get('L0Req', None), HLT1 = cuts.get('Hlt1Req', None), algos = algos, postscale = self.postscale)
예제 #28
0
 def __apply_configuration__(self) :
     from HltLine.HltLine import Hlt2Line
     for nickname, algos in self.algorithms(self.stages()):
         linename = 'DiElectron' + nickname if nickname != 'DiElectron' else nickname
         Hlt2Line(linename, prescale = self.prescale,
                  algos = algos, postscale = self.postscale)
예제 #29
0
    def __apply_configuration__(self):
        from Stages import DetachedLLFilter, BCombiner, JPsiMuMuPosTagged, JPsiMuMuNegTagged, \
            JPsiEEPosTagged, JPsiEENegTagged, JPsiEEL0PosTagged, JPsiEEL0NegTagged, \
            PhiMuMuPosTagged, PhiMuMuNegTagged, KSFilter, BachelorPions, SharedSoftPions, \
            LambdaFilter, Lc2KPPi, D02K3Pi, D02KPi, Lc2KPPi_Prompt, BachelorKaons, BachelorMuons, \
            JPsiPPPosTagged, JPsiPPNegTagged, UnbiasedPhiKK, PhiKKPosTagged, PhiKKNegTagged, \
            Ds2KKPi_PKTag, Ds2MuMuPi_MuPTag, Ds2MuMuPi_MuMTag
        from Inputs import KsLL, KsDD, LambdaLL, LambdaDD

        from Hlt2Lines.CharmHad.Stages import TagDecay

        ds2phipi = "[D_s+ -> phi(1020) pi+]cc"
        stagemap = {
            'Muon': {
                'DetJPsiMuMuPosTagged': [
                    DetachedLLFilter("JPsiMuMuPos",
                                     JPsiMuMuPosTagged,
                                     nickname="JPsiMuMu")
                ],
                'DetJPsiMuMuNegTagged': [
                    DetachedLLFilter("JPsiMuMuNeg",
                                     JPsiMuMuNegTagged,
                                     nickname="JPsiMuMu")
                ],
                'DetPhiMuMuPosTagged': [
                    DetachedLLFilter("PhiMuMuPos",
                                     PhiMuMuPosTagged,
                                     nickname="PhiMuMu")
                ],
                'DetPhiMuMuNegTagged': [
                    DetachedLLFilter("PhiMuMuNeg",
                                     PhiMuMuNegTagged,
                                     nickname="PhiMuMu")
                ],
                'B2KJPsiMuMuPosTagged': [
                    BCombiner("JPsiMuMuPos",
                              [JPsiMuMuPosTagged, BachelorKaons],
                              nickname="JPsiMuMu")
                ],
                'B2KJPsiMuMuNegTagged': [
                    BCombiner("JPsiMuMuNeg",
                              [JPsiMuMuNegTagged, BachelorKaons],
                              nickname="JPsiMuMu")
                ],
                'Ds2PiPhiMuMuPosTagged': [
                    BCombiner('PhiMuMuPos', [PhiMuMuPosTagged, BachelorPions],
                              nickname="PhiMuMu",
                              decay=ds2phipi)
                ],
                'Ds2PiPhiMuMuNegTagged': [
                    BCombiner('PhiMuMuNeg', [PhiMuMuNegTagged, BachelorPions],
                              nickname="PhiMuMu",
                              decay=ds2phipi)
                ],
            },
            'Electron': {
                'DetJPsiEEPosTagged': [
                    DetachedLLFilter("JPsiEEPos",
                                     JPsiEEPosTagged,
                                     nickname="JPsiEE")
                ],
                'DetJPsiEENegTagged': [
                    DetachedLLFilter("JPsiEENeg",
                                     JPsiEENegTagged,
                                     nickname="JPsiEE")
                ],
                'B2KJPsiEEPosTagged': [
                    BCombiner('JPsiEEPos', [JPsiEEPosTagged, BachelorKaons],
                              nickname="JPsiEE")
                ],
                'B2KJPsiEENegTagged': [
                    BCombiner('JPsiEENeg', [JPsiEENegTagged, BachelorKaons],
                              nickname="JPsiEE")
                ]
            },
            'ElectronFromL0': {
                'DetJPsiEEL0PosTagged': [
                    DetachedLLFilter("JPsiEEL0Pos",
                                     JPsiEEL0PosTagged,
                                     nickname="JPsiEE")
                ],
                'DetJPsiEEL0NegTagged': [
                    DetachedLLFilter("JPsiEEL0Neg",
                                     JPsiEEL0NegTagged,
                                     nickname="JPsiEE")
                ],
                'B2KJPsiEEL0PosTagged': [
                    BCombiner('JPsiEEL0Pos',
                              [JPsiEEL0PosTagged, BachelorKaons],
                              nickname="JPsiEE")
                ],
                'B2KJPsiEEL0NegTagged': [
                    BCombiner('JPsiEEL0Neg',
                              [JPsiEEL0NegTagged, BachelorKaons],
                              nickname="JPsiEE")
                ]
            },
            'Other': {
                'Ks2PiPiLL': [KSFilter('Ks2PiPiLL', KsLL)],
                'Ks2PiPiDD': [KSFilter('Ks2PiPiDD', KsDD)],
                'Lambda2PPiLL': [LambdaFilter('Lambda2PPiLL', LambdaLL)],
                'Lambda2PPiDD': [LambdaFilter('Lambda2PPiDD', LambdaDD)],
                'Lambda2PPiLLhighPT':
                [LambdaFilter('Lambda2PPiLLhighPT', LambdaLL)],
                'Lambda2PPiDDhighPT':
                [LambdaFilter('Lambda2PPiDDhighPT', LambdaDD)],
                'Lambda2PPiLLveryhighPT':
                [LambdaFilter('Lambda2PPiLLveryhighPT', LambdaLL)],
                'Lambda2PPiDDveryhighPT':
                [LambdaFilter('Lambda2PPiDDveryhighPT', LambdaDD)],
                'Lambda2PPiLLisMuon':
                [LambdaFilter('Lambda2PPiLLisMuon', LambdaLL, ismuon=True)],
                'Lambda2PPiDDisMuon':
                [LambdaFilter('Lambda2PPiDDisMuon', LambdaDD, ismuon=True)],
                'DetJPsiPPPosTagged': [
                    DetachedLLFilter("JPsiPPPos",
                                     JPsiPPPosTagged,
                                     nickname="JPsiPP")
                ],
                'DetJPsiPPNegTagged': [
                    DetachedLLFilter("JPsiPPNeg",
                                     JPsiPPNegTagged,
                                     nickname="JPsiPP")
                ],
                'B2KJPsiPPPosTagged': [
                    BCombiner('JPsiPPPos', [JPsiPPPosTagged, BachelorKaons],
                              nickname="JPsiPP")
                ],
                'B2KJPsiPPNegTagged': [
                    BCombiner('JPsiPPNeg', [JPsiPPNegTagged, BachelorKaons],
                              nickname='JPsiPP')
                ],
                'Lb2LcPi': [
                    BCombiner('Lb2LcPi', [Lc2KPPi, BachelorPions],
                              decay='[Lambda_b0 -> Lambda_c+ pi-]cc')
                ],
                'Lb2LcMuNu': [
                    BCombiner('Lb2LcMuNu', [Lc2KPPi, BachelorMuons],
                              decay='[Lambda_b0 -> Lambda_c+ mu-]cc',
                              corrm=True)
                ],
                'Lc2KPPi': [Lc2KPPi_Prompt
                            ],  # new inclusive Lc line without Sc0,++ tag.
                'Ds2KKPiSSTagged': [Ds2KKPi_PKTag],
                'Ds2MuMuPiPosTagged': [Ds2MuMuPi_MuPTag],
                'Ds2MuMuPiNegTagged': [Ds2MuMuPi_MuMTag],
                # These next two need shared=True so the Turbo versions don't re-do the combination
                'Sc02LcPi': [
                    TagDecay('PIDSc02LcPi',
                             "[Sigma_c0 -> Lambda_c+ pi-]cc",
                             inputs=[Lc2KPPi_Prompt, SharedSoftPions],
                             nickname='Sc2LcPi',
                             shared=True)
                ],
                'Scpp2LcPi': [
                    TagDecay('PIDScpp2LcPi',
                             "[Sigma_c++ -> Lambda_c+ pi+]cc",
                             inputs=[Lc2KPPi_Prompt, SharedSoftPions],
                             nickname='Sc2LcPi',
                             shared=True)
                ],
                # D0 -> K3pi noPID line
                'D02KPiPiPi': [D02K3Pi],
                'D02KPiPiPiTag': [
                    TagDecay('PIDD02KPiPiPiTag',
                             "[D*(2010)+ -> D0 pi+]cc",
                             inputs=[D02K3Pi, SharedSoftPions],
                             shared=True,
                             nickname='D02KPiPiPiTag')
                ],

                # D0 -> Kpi noPID line
                'D02KPiTag': [
                    TagDecay('PIDD02KPiTag',
                             "[D*(2010)+ -> D0 pi+]cc",
                             inputs=[D02KPi, SharedSoftPions],
                             shared=True,
                             nickname='D02KPiTag')
                ],
                'DetPhiKKUnbiased': [
                    DetachedLLFilter("PhiKKUnbiased",
                                     UnbiasedPhiKK,
                                     nickname="PhiKKUnbiased")
                ],
                'Ds2PiPhiKKUnbiased': [
                    BCombiner("PhiKKUnbiased", [UnbiasedPhiKK, BachelorPions],
                              nickname='PhiKKUnbiased',
                              decay=ds2phipi)
                ],
                'DetPhiKKPosTagged': [
                    DetachedLLFilter("PhiKKPos",
                                     PhiKKPosTagged,
                                     nickname="PhiKK")
                ],
                'DetPhiKKNegTagged': [
                    DetachedLLFilter("PhiKKNeg",
                                     PhiKKNegTagged,
                                     nickname='PhiKK')
                ],
                'Ds2PiPhiKKPosTagged': [
                    BCombiner('PhiKKPos', [PhiKKPosTagged, BachelorPions],
                              nickname="PhiKK",
                              decay=ds2phipi)
                ],
                'Ds2PiPhiKKNegTagged': [
                    BCombiner('PhiKKNeg', [PhiKKNegTagged, BachelorPions],
                              nickname="PhiKK",
                              decay=ds2phipi)
                ]
            }
        }

        from HltLine.HltLine import Hlt2Line
        for turbo in turboversions:
            for category, stages in stagemap.iteritems():
                for (nickname, algos) in self.algorithms(stages):
                    linename = 'PID' + nickname
                    l0reqdict = self.getProp("L0Req")
                    hlt1reqdict = self.getProp('Hlt1Req')
                    l0cuts = l0reqdict.get(nickname,
                                           l0reqdict.get(category, None))
                    hlt1cuts = hlt1reqdict.get(nickname,
                                               hlt1reqdict.get(category, None))
                    doturbo = (len(turbo) > 0)
                    Hlt2Line(linename + turbo,
                             prescale=self.prescale,
                             algos=algos,
                             postscale=self.postscale,
                             L0DU=l0cuts,
                             HLT1=hlt1cuts,
                             Turbo=doturbo)
            from Configurables import HltANNSvc
            HltANNSvc().Hlt2SelectionID.update({
                'Hlt2PID' + n + turbo + 'Decision': v + 200 * (len(turbo) > 0)
                for n, v in {
                    'DetJPsiMuMuPosTagged': 50020,
                    'DetJPsiMuMuNegTagged': 50021,
                    'DetPhiMuMuPosTagged': 50022,
                    'DetPhiMuMuNegTagged': 50023,
                    'B2KJPsiMuMuPosTagged': 50024,
                    'B2KJPsiMuMuNegTagged': 50025,
                    'Ds2PiPhiMuMuPosTagged': 50026,
                    'Ds2PiPhiMuMuNegTagged': 50027,
                    'Lb2LcMuNu': 50028,
                    'DetJPsiEEPosTagged': 50029,
                    'DetJPsiEENegTagged': 50030,
                    'B2KJPsiEEPosTagged': 50031,
                    'B2KJPsiEENegTagged': 50032,
                    'DetJPsiEEL0PosTagged': 50033,
                    'DetJPsiEEL0NegTagged': 50034,
                    'B2KJPsiEEL0PosTagged': 50035,
                    'B2KJPsiEEL0NegTagged': 50036,
                    'Ks2PiPiLL': 50037,
                    'Ks2PiPiDD': 50038,
                    'Lambda2PPiLL': 50039,
                    'Lambda2PPiDD': 50040,
                    'Lambda2PPiLLhighPT': 50041,
                    'Lambda2PPiDDhighPT': 50042,
                    'Lambda2PPiLLisMuon': 50043,
                    'Lambda2PPiDDisMuon': 50044,
                    'Lb2LcPi': 50045,
                    'Sc02LcPi': 50046,
                    'Scpp2LcPi': 50047,
                    'D02KPiPiPi': 50048,
                    'D02KPiPiPiTag': 50049,
                    'D02KPiTag': 50050,
                    'Lambda2PPiLLveryhighPT': 50051,
                    'Lambda2PPiDDveryhighPT': 50052,
                    'DetJPsiPPPosTagged': 50053,
                    'DetJPsiPPNegTagged': 50054,
                    'B2KJPsiPPPosTagged': 50055,
                    'B2KJPsiPPNegTagged': 50056,
                    'DetPhiKKUnbiased': 50057,
                    'Ds2PiPhiKKUnbiased': 50058,
                    'DetPhiKKPosTagged': 50059,
                    'DetPhiKKNegTagged': 50060,
                    'Ds2PiPhiKKPosTagged': 50061,
                    'Ds2PiPhiKKNegTagged': 50062,
                    'Lc2KPPi': 50063
                }.iteritems()
            })