Ejemplo n.º 1
0
def configureMicroDSTwriter(name, prefix, sequences):
    # Configure the dst writers for the output
    pack = True

    microDSTwriterInput = MultiSelectionSequence(name, Sequences=sequences)

    # Configuration of MicroDST
    # per-event an per-line selective writing of the raw event is active (selectiveRawEvent=True)
    mdstStreamConf = stripMicroDSTStreamConf(
        pack=pack)  #, selectiveRawEvent = False)
    mdstElements = stripMicroDSTElements(pack=pack)

    # Configuration of SelDSTWriter
    # per-event an per-line selective writing of the raw event is active (selectiveRawEvent=True)
    SelDSTWriterElements = {'default': mdstElements}
    SelDSTWriterConf = {'default': mdstStreamConf}
    #  SelDSTWriterConf = {'default': stripCalibMicroDSTStreamConf(pack=pack, selectiveRawEvent=False)}

    dstWriter = SelDSTWriter("MyDSTWriter",
                             StreamConf=SelDSTWriterConf,
                             MicroDSTElements=SelDSTWriterElements,
                             OutputFileSuffix=prefix,
                             SelectionSequences=[microDSTwriterInput])

    from Configurables import StoreExplorerAlg
    return [microDSTwriterInput.sequence(), dstWriter.sequence()]
Ejemplo n.º 2
0
def test_call_important_methods():
    sel00 = AutomaticData(Location='Phys/Sel00/Particles')
    sel01 = AutomaticData(Location='Phys/Sel01/Particles')
    seq00 = SelectionSequence('Seq00y', TopSelection=sel00)
    seq01 = SelectionSequence('Seq01y', TopSelection=sel01)
    seq = MultiSelectionSequence('MultiSeq00y', Sequences=[seq00, seq01])
    assert seq.outputLocations() == [
        'Phys/Sel00/Particles', 'Phys/Sel01/Particles'
    ]
    algs = seq.algorithms()
    seq = seq.sequence()
Ejemplo n.º 3
0
def test_instantiate_multi_sequencer():
    sel00 = AutomaticData(Location='Phys/Sel00')
    sel01 = AutomaticData(Location='Phys/Sel01')
    alg00 = MockConfGenerator()
    alg01 = MockConfGenerator()
    sel00 = Selection('100011', Algorithm=alg00, RequiredSelections=[sel00])
    sel01 = Selection('100012', Algorithm=alg01, RequiredSelections=[sel01])
    seq00 = SelectionSequence('Seq000', TopSelection=sel00)
    seq01 = SelectionSequence('Seq001', TopSelection=sel01)
    seq = MultiSelectionSequence('MultiSeq00z', Sequences=[seq00, seq01])
Ejemplo n.º 4
0
    a = s.algorithm()
    a.ParticleCombiners = {'': 'LoKi::VertexFitter:PUBLIC'}
    #
    a.MaxCandidates = 2000
    a.StopAtMaxCandidates = True
    a.StopIncidentType = 'ExceedsCombinatoricsLimit'
    #
from PhysSelPython.Wrappers import MultiSelectionSequence
from PhysSelPython.Wrappers import SelectionSequence
psi_x = MultiSelectionSequence(
    "PSIX",
    Sequences=[
        ## channels with chic
        #
        SelectionSequence('B2CHICK', psix0.b2chicK()),
        SelectionSequence('B2CHICKK', psix0.b2chicKK()),
        SelectionSequence('B2CHICKPi', psix0.b2chicKpi()),
        SelectionSequence('B2CHICKPiPi', psix0.b2chicKpipi()),
        SelectionSequence('B2CHICPiPi', psix0.b2chicpipi()),
        #
        SelectionSequence('BC2CHICPi', psix0.bc2chicpi()),
        SelectionSequence('Lb2CHICPi', psix0.lb2chicpK()),
    ])

###################### DAVINCI SETTINGS ############################################
DaVinci().SkipEvents = 0  #1945
DaVinci().PrintFreq = 10000
DaVinci().EvtMax = EVTMAX
DaVinci().TupleFile = "DVTuples1.root"
DaVinci().HistogramFile = 'DVHistos.root'
DaVinci().InputType = "DST"
DaVinci().Simulation = True
Ejemplo n.º 5
0
def configure ( inputdata        ,    ## the list of input files  
                catalogs = []    ,    ## xml-catalogs (filled by GRID)
                castor   = False ,    ## use the direct access to castor/EOS ? 
                params   = {}    ) :

    from PhysSelPython.Wrappers import AutomaticData
    jpsi_name = 'FullDSTDiMuonJpsi2MuMuDetachedLine'
    psi2_name = 'FullDSTDiMuonPsi2MuMuDetachedLine'
    jpsi  = AutomaticData ( '/Event/AllStreams/Phys/%s/Particles' % jpsi_name ) 
    psi2s = AutomaticData ( '/Event/AllStreams/Phys/%s/Particles' % psi2_name )
    
    from PhysSelPython.Wrappers import MergedSelection
    psis = MergedSelection (
    		'SelDetachedPsisForBandQ' ,  
    		RequiredSelections = [ jpsi , psi2s ] 
    )

    from StrippingSelections.StrippingPsiXForBandQ import PsiX_BQ_Conf    as PsiX
    from StrippingSelections.StrippingPsiX0        import PsiX0Conf       as PsiX0 

    def _psi_ ( self ) :
        """
        psi(') -> mu+ mu- 
        """
        return psis

    PsiX0 . psi = _psi_
    PsiX  . psi = _psi_

    logger.warning ( "Redefine PsiX .psi" )

    psix   = PsiX   ( 'PsiX'  , {} )
    psix0  = PsiX0  ( 'PsiX0' , {} )
    for s in ( psix.psi_pi       () ,
           psix.psi_K        () ,
           #
           psix.psi_2pi      () ,
           psix.psi_2K       () ,
           psix.psi_2Kpi     () ,
           ## 
           psix.psi_3pi      () ,
           psix.psi_3K       () ,
           psix.psi_3Kpi     () ,
           ##
           psix.psi_4pi      () ,
           psix.psi_4Kpi     () ,
           psix.psi_4K       () ,
           ##
           psix.psi_5pi      () ,
           psix.psi_5K       () ,
           psix.psi_5Kpi     () ,
           ##
           psix.psi_6pi      () ,
           psix.psi_6Kpi     () ,
           ##
           psix.psi_7pi      () ,
           psix.psi_7Kpi     () ,
           ##
           # Lb 
           psix.psi_pK       () ,
           psix.psi_ppi      () ,
           psix.psi_pKpipi   () ,
           ##
           # 2protons 
           psix.psi_pp       () ,
           psix.psi_pppi     () ,
           psix.psi_ppK      () ,
           psix.psi_pppipi   () ,
           psix.psi_ppKpipi  () ,
           psix.psi_pppipipi () ,
           ##
           ) :
      a = s.algorithm ()
      a.ParticleCombiners = { '' : 'LoKi::VertexFitter:PUBLIC' }
      #
      a.MaxCandidates          = 2000
      a.StopAtMaxCandidates    = True 
      a.StopIncidentType       = 'ExceedsCombinatoricsLimit'
      # 
    from PhysSelPython.Wrappers import MultiSelectionSequence
    from PhysSelPython.Wrappers import      SelectionSequence    
    psi_x = MultiSelectionSequence (
        "PSIX"      ,
        Sequences = [
        ## channels with chic
        # 
        SelectionSequence ( 'B2CHICK'     , psix0 . b2chicK     () ) ,
        SelectionSequence ( 'B2CHICKK'    , psix0 . b2chicKK    () ) ,
        SelectionSequence ( 'B2CHICKPi'   , psix0 . b2chicKpi   () ) ,
        SelectionSequence ( 'B2CHICKPiPi' , psix0 . b2chicKpipi () ) ,
        SelectionSequence ( 'B2CHICPiPi'  , psix0 . b2chicpipi  () ) ,
        #
        SelectionSequence ( 'BC2CHICPi'   , psix0 . bc2chicpi    () ) ,
        SelectionSequence ( 'Lb2CHICPi'   , psix0 . lb2chicpK    () ) ,
        ]
    )

    ## import DaVinci 
    from Configurables import DaVinci
    ## delegate the actual configuration to DaVinci
    dv = DaVinci ( DataType      = '2011'        ,
                   InputType     = 'DST'         ,
		   Simulation	 = True		 ,
		   Lumi		 = False	 ,
                   TupleFile     = 'Tuples.root'   ## IMPORTANT 
                   )
    
    ## add the name of Bender algorithm into User sequence sequence 
    alg_name = 'HistosAndTuples'
    dv.UserAlgorithms += [ psi_x.sequence(), 'TrackScaleState', alg_name ]

    
    ## define the input data
    setData  ( inputdata , catalogs , castor )
    
    ## get/create application manager
    gaudi = appMgr() 
    
    ## (1) create the algorithm with given name 
    alg = HistosAndTuples (
        alg_name ,
        Inputs    = [ 'Phys/SelB2ChicPiPiForPsiX0/Particles' ]
        )
             
    return SUCCESS 
Ejemplo n.º 6
0
def ConfigureDaVinci():
    config = Swimming()
    from Configurables import DaVinci
    from StrippingConf.Configuration import StrippingConf
    from Configurables import ProcStatusCheck
    from Configurables import EventNodeKiller, GaudiSequencer
    from PhysSelPython.Wrappers import (AutomaticData, SelectionSequence,
                                        MultiSelectionSequence)

    # Get the stripping line
    from StrippingSettings.Utils import lineBuilderConfiguration
    strippingFile = None
    if config.getProp('StrippingFile') != 'none':
        strippingFile = config.getProp('StrippingFile')
    else:
        strippingFile = config.getProp('StrippingLineGroup')
    myconfig = lineBuilderConfiguration(config.getProp('StrippingVersion'),
                                        config.getProp('StrippingLineGroup'))
    import StrippingArchive
    mylineconf = getattr(
        __import__(
            'StrippingArchive.' +
            config.getProp('StrippingVersion') + '.Stripping' + strippingFile,
            globals(), locals(), [myconfig["BUILDERTYPE"]], -1),
        myconfig["BUILDERTYPE"])
    mylinedict = myconfig["CONFIG"]
    substitutions = config.getProp('StrippingConfigSubstitutions')
    print "mylinedict before substitutions:", mylinedict
    print "stripping config substitutions:", substitutions
    mylinedict.update(substitutions)
    print "mylineconf:", mylineconf
    print "mylinedict after substitutions:", mylinedict

    from StrippingConf.StrippingStream import StrippingStream
    stream = StrippingStream(config.getProp('StrippingStream') + "Swimming")
    allLines = mylineconf(config.getProp('StrippingLineGroup'),
                          mylinedict).lines()
    lines = []
    #lineNames = [l.split('/')[-1] for l in config.getProp('StripCands').keys()]
    lineNames = config.getProp('StrippingLines')
    print "lineNames:", lineNames
    for l in allLines:
        for lineName in lineNames:
            if l.outputLocation().find(lineName) != -1:
                lines.append(l)
                print l.outputLocation()
    stream.appendLines(lines)

    # Define the stream
    filterBadEvents = ProcStatusCheck()
    sc = StrippingConf(Streams=[stream],
                       MaxCandidates=2000,
                       AcceptBadEvents=False,
                       BadEventSelection=filterBadEvents)

    # Define the node killer, and make sure to kill everything corresponding to
    # the stream which we want to swim
    outputs = []
    from Configurables import Swimming__PVReFitter as ReFitter
    for l in lines:
        for f in l.filterMembers():
            if hasattr(f, 'ReFitPVs') and f.ReFitPVs:
                if not config.getProp('RefitPVs'):
                    log.warning('RefitPVs is not set, but stripping line applies refitting. Refitted ' + \
                                'PVs will be used for turning-point lifetime calculations.')
                    config.setProp('RefitPVs', True)
                t = f.PVReFitters['']
                f.PVReFitters = {'': 'Swimming::PVReFitter/PVReFitter'}
                f.addTool(ReFitter, 'PVReFitter')
                f.PVReFitter.PVReFitter = t
            elif not hasattr(f, 'Output'):
                continue
            # Remove the last item so we get everything (Particle, relations,
            # decayVertices, etc...
            o = '/'.join(f.Output.split('/')[:-1])
            outputs.append(o)
    print "Outputs are", outputs
    mykiller = EventNodeKiller("killStripping")
    # Some default nodes which we will want to kill in all cases
    nodestokill = outputs + ['Strip', '/Event/Rec/Vertex/Primary']
    mykiller.Nodes = nodestokill
    deathstar = GaudiSequencer("killStrippingSeq")
    deathstar.Members = [mykiller]

    # Configure DaVinci
    DaVinci().InputType = config.getProp('InputType')
    DaVinci().DataType = config.getProp('DataType')
    DaVinci().Simulation = config.getProp('Simulation')
    DaVinci().DDDBtag = config.getProp('DDDBtag')
    DaVinci().CondDBtag = config.getProp('CondDBtag')
    try:
        DaVinci().Persistency = config.getProp('Persistency')
    except AttributeError:
        print "DaVinci doesn't have a Persistency attribute to set"

    # The sequence for the swimming has to be configured
    # by hand inserting the node killer before it
    DaVinci().appendToMainSequence([deathstar])
    DaVinci().appendToMainSequence([sc.sequence()])

    # Since the name of the output file is configured in two places in DaVinci,
    # do some splitting.
    splitName = config.getProp('OutputFile').split(os.path.extsep)
    seqName = ''
    prefix = ''
    if len(splitName) <= 2:
        seqName = splitName[0]
        print "Warning, an output filename in three parts was specified. This does not work well, " + \
              " so 'Swimming.' will be prefixed."
        prefix = 'Swimming'
    else:
        prefix = splitName[0]
        seqName = os.path.extsep.join(splitName[1:-1])

    dstWriter = None
    print config.getProp('OutputType')

    # Offline candidate selection sequences
    sequences = []
    offCands = config.getProp('OffCands').keys()
    for i, cands in enumerate(offCands):
        data = AutomaticData(Location=cands + "/Particles")
        offSeq = SelectionSequence("OfflineCandidates_%d" % i,
                                   TopSelection=data)
        sequences.append(offSeq)

    # selection sequence for offline candidates
    muCands = config.getProp('MuDSTCands')
    for i, cands in enumerate(muCands):
        # Add extra selections for additional MuDSTCands
        data = AutomaticData(Location=cands + "/Particles")
        seq = SelectionSequence("MuDSTCands_%d" % i, TopSelection=data)
        sequences.append(seq)

    selectionSeq = MultiSelectionSequence(seqName, Sequences=sequences)

    if config.getProp('OutputType') == 'MDST':
        pack = False
        isMC = config.getProp("Simulation")
        SwimmingConf = config.getProp('MicroDSTStreamConf')
        SwimmingElements = config.getProp('MicroDSTElements')
        if SwimmingConf == False:
            from DSTWriters.Configuration import stripMicroDSTStreamConf
            SwimmingConf = stripMicroDSTStreamConf(pack=pack, isMC=isMC)
        if len(SwimmingElements) == 0:
            from DSTWriters.Configuration import stripMicroDSTElements
            from DSTWriters.microdstelements import CloneSwimmingReports, CloneParticleTrees, CloneTPRelations
            mdstElements = stripMicroDSTElements(pack=pack, isMC=isMC)
            SwimmingElements = [CloneSwimmingReports()]
            for element in mdstElements:
                SwimmingElements += [element]
                if type(element) == CloneParticleTrees:
                    SwimmingElements += [CloneTPRelations("P2TPRelations")]

        streamConf = {'default': SwimmingConf}
        elementsConf = {'default': SwimmingElements}
        try:
            from DSTWriters.__dev__.Configuration import MicroDSTWriter
        except:
            from DSTWriters.Configuration import MicroDSTWriter
        dstWriter = MicroDSTWriter('MicroDST',
                                   StreamConf=streamConf,
                                   MicroDSTElements=elementsConf,
                                   WriteFSR=config.getProp('WriteFSR'),
                                   OutputFileSuffix=prefix,
                                   SelectionSequences=[selectionSeq])
    elif config.getProp('OutputType') == 'DST':
        try:
            from DSTWriters.__dev__.streamconf import OutputStreamConf
            from DSTWriters.__dev__.Configuration import SelDSTWriter
        except ImportError:
            from DSTWriters.streamconf import OutputStreamConf
            from DSTWriters.Configuration import SelDSTWriter

        streamConf = OutputStreamConf(streamType = InputCopyStream,
                                      fileExtension = '.dst',
                                      extraItems = [config.getProp('SwimmingPrefix') + '/Reports#1'] +\
                                      list(set([l + '/P2TPRelations#1' for l in config.getProp('OffCands').values()])))
        SelDSTWriterElements = {'default': []}
        SelDSTWriterConf = {'default': streamConf}
        dstWriter = SelDSTWriter('FullDST',
                                 StreamConf=SelDSTWriterConf,
                                 MicroDSTElements=SelDSTWriterElements,
                                 WriteFSR=config.getProp('WriteFSR'),
                                 OutputFileSuffix=prefix,
                                 SelectionSequences=[selectionSeq])

    DaVinci().appendToMainSequence([dstWriter.sequence()])
Ejemplo n.º 7
0
def configure ( inputdata        ,    ## the list of input files  
                catalogs = []    ,    ## xml-catalogs (filled by GRID)
                castor   = False ,    ## use the direct access to castor/EOS ? 
                params   = {}    ) :

    from PhysSelPython.Wrappers import AutomaticData
    jpsi_name = 'FullDSTDiMuonJpsi2MuMuDetachedLine'
    psi2_name = 'FullDSTDiMuonPsi2MuMuDetachedLine'
    jpsi  = AutomaticData ( '/Event/AllStreams/Phys/%s/Particles' % jpsi_name ) 
    psi2s = AutomaticData ( '/Event/AllStreams/Phys/%s/Particles' % psi2_name )
    
    from PhysSelPython.Wrappers import MergedSelection
    psis = MergedSelection (
    		'SelDetachedPsisForBandQ' ,  
    		RequiredSelections = [ jpsi , psi2s ] 
    )

    from StrippingSelections.StrippingPsiXForBandQ import PsiX_BQ_Conf    as PsiX
    from StrippingSelections.StrippingPsiX0        import PsiX0Conf       as PsiX0 

    def _psi_ ( self ) :
        """
        psi(') -> mu+ mu- 
        """
        return psis

    PsiX0 . psi = _psi_
    PsiX  . psi = _psi_

    logger.warning ( "Redefine PsiX .psi" )

    psix   = PsiX   ( 'PsiX'  , {} )
    psix0  = PsiX0  ( 'PsiX0' , {} )
    for s in ( psix.psi_pi       () ,
           psix.psi_K        () ,
           #
           psix.psi_2pi      () ,
           psix.psi_2K       () ,
           psix.psi_2Kpi     () ,
           ## 
           psix.psi_3pi      () ,
           psix.psi_3K       () ,
           psix.psi_3Kpi     () ,
           ##
           psix.psi_4pi      () ,
           psix.psi_4Kpi     () ,
           psix.psi_4K       () ,
           ##
           psix.psi_5pi      () ,
           psix.psi_5K       () ,
           psix.psi_5Kpi     () ,
           ##
           psix.psi_6pi      () ,
           psix.psi_6Kpi     () ,
           ##
           psix.psi_7pi      () ,
           psix.psi_7Kpi     () ,
           ##
           # Lb 
           psix.psi_pK       () ,
           psix.psi_ppi      () ,
           psix.psi_pKpipi   () ,
           ##
           # 2protons 
           psix.psi_pp       () ,
           psix.psi_pppi     () ,
           psix.psi_ppK      () ,
           psix.psi_pppipi   () ,
           psix.psi_ppKpipi  () ,
           psix.psi_pppipipi () ,
           ##
           ) :
      a = s.algorithm ()
      a.ParticleCombiners = { '' : 'LoKi::VertexFitter:PUBLIC' }
      #
      a.MaxCandidates          = 2000
      a.StopAtMaxCandidates    = True 
      a.StopIncidentType       = 'ExceedsCombinatoricsLimit'
      # 
    from PhysSelPython.Wrappers import MultiSelectionSequence
    from PhysSelPython.Wrappers import      SelectionSequence    
    psi_x = MultiSelectionSequence (
        "PSIX"      ,
        Sequences = [
        ## channels with chic
        # 
        SelectionSequence ( 'B2CHICK'     , psix0 . b2chicK     () ) ,
        SelectionSequence ( 'B2CHICKK'    , psix0 . b2chicKK    () ) ,
        SelectionSequence ( 'B2CHICKPi'   , psix0 . b2chicKpi   () ) ,
        SelectionSequence ( 'B2CHICKPiPi' , psix0 . b2chicKpipi () ) ,
        SelectionSequence ( 'B2CHICPiPi'  , psix0 . b2chicpipi  () ) ,
        #
        SelectionSequence ( 'BC2CHICPi'   , psix0 . bc2chicpi    () ) ,
        SelectionSequence ( 'Lb2CHICPi'   , psix0 . lb2chicpK    () ) ,
        ]
    )

    ## import DaVinci 
    from Configurables import DaVinci
    ## delegate the actual configuration to DaVinci
    dv = DaVinci ( DataType      = '2012'        ,
                   InputType     = 'DST'         ,
		   Simulation	 = True		 ,
		   Lumi		 = False	 ,
                   TupleFile     = 'Tuples.root'   ## IMPORTANT 
                   )
    
    ## add the name of Bender algorithm into User sequence sequence 
    alg_name = 'HistosAndTuples'
    dv.UserAlgorithms += [ psi_x.sequence(), 'TrackScaleState', alg_name ]

    
    ## define the input data
    setData  ( inputdata , catalogs , castor )
    
    ## get/create application manager
    gaudi = appMgr() 
    
    ## (1) create the algorithm with given name 
    alg = HistosAndTuples (
        alg_name ,
        Inputs    = [ 'Phys/SelB2ChicPiPiForPsiX0/Particles' ]
        )
             
    return SUCCESS 
Ejemplo n.º 8
0
from Configurables import DaVinci, MicroDSTWriter

from PhysSelPython.Wrappers import AutomaticData, SelectionSequence, MultiSelectionSequence

pions = SelectionSequence('SeqPions',
                          TopSelection = AutomaticData('Bob',Location = 'Phys/StdTightPions') )
muons = SelectionSequence('SeqMuons',
                          TopSelection = AutomaticData(Location = 'Phys/StdTightMuons') )
kaons =  SelectionSequence('SeqKaons',
                          TopSelection = AutomaticData(Location = 'Phys/StdTightKaons') )

jpsi =  SelectionSequence('SeqJpsi',
                          TopSelection = AutomaticData(Location = 'Phys/StdLooseJpsi2MuMu'))

#multiSeq = MultiSelectionSequence('Cocktail', Sequences = [pions, muons, kaons, jpsi])
multiSeqA = MultiSelectionSequence('CocktailA', Sequences = [kaons, pions])
multiSeqB = MultiSelectionSequence('CocktailB', Sequences = [muons, pions])
multiSeqC = MultiSelectionSequence('CocktailB', Sequences = [jpsi, pions])

conf = MicroDSTWriter("MicroDST0")
conf.OutputFileSuffix = "TestCrossover"
conf.CopyProtoParticles = False
#conf.SelectionSequences = [multiSeqA, multiSeqB]
conf.SelectionSequences = [pions, pions.clone('SeqPions2'), pions.clone('SeqPions3')]
#conf.SelectionSequences = [pions, muons, kaons, jpsi]
conf.CopyL0DUReport = False
conf.CopyHltDecReports = False
conf.CopyMCTruth = False
conf.CopyBTags = False
microDST0Seq = conf.sequence()
Ejemplo n.º 9
0
        psix.psi_pppipi(),
        psix.psi_ppKpipi(),
        psix.psi_pppipipi(),
):
    a = s.algorithm()
    a.ParticleCombiners = {'': 'LoKi::VertexFitter:PUBLIC'}
    #
    a.MaxCandidates = 2000
    a.StopAtMaxCandidates = True
    a.StopIncidentType = 'ExceedsCombinatoricsLimit'
    #
from PhysSelPython.Wrappers import MultiSelectionSequence
from PhysSelPython.Wrappers import SelectionSequence
psi_x = MultiSelectionSequence("PSIX",
                               Sequences=[
                                   SelectionSequence('Lb2PSIPK',
                                                     psix.psi_pK()),
                               ])

###################### DAVINCI SETTINGS ############################################
DaVinci().SkipEvents = 0  #1945
DaVinci().PrintFreq = 10000
DaVinci().EvtMax = EVTMAX
DaVinci().TupleFile = "DVTuples1.root"
DaVinci().HistogramFile = 'DVHistos.root'
DaVinci().InputType = "DST"
DaVinci().Simulation = True
DaVinci().Lumi = False
DaVinci().DataType = "2012"
CondDB(LatestGlobalTagByDataType='2012')
Ejemplo n.º 10
0
    a.ParticleCombiners = { '' : 'LoKi::VertexFitter:PUBLIC' }
    #
    a.MaxCandidates          = 2000
    a.StopAtMaxCandidates    = True
    a.StopIncidentType       = 'ExceedsCombinatoricsLimit'
    #
from PhysSelPython.Wrappers import MultiSelectionSequence
from PhysSelPython.Wrappers import      SelectionSequence
psi_x = MultiSelectionSequence (
        "PSIX"      ,
        Sequences = [
        ## channels with chic
        #
        SelectionSequence ( 'B2CHICK'     , psix0 . b2chicK     () ) ,
        SelectionSequence ( 'B2CHICKK'    , psix0 . b2chicKK    () ) ,
        SelectionSequence ( 'B2CHICKPi'   , psix0 . b2chicKpi   () ) ,
        SelectionSequence ( 'B2CHICKPiPi' , psix0 . b2chicKpipi () ) ,
        SelectionSequence ( 'B2CHICPiPi'  , psix0 . b2chicpipi  () ) ,
        #
        SelectionSequence ( 'BC2CHICPi'   , psix0 . bc2chicpi    () ) ,
        SelectionSequence ( 'Lb2CHICPi'   , psix0 . lb2chicpK    () ) ,
        ]
    )


###################### DAVINCI SETTINGS ############################################
DaVinci().SkipEvents = 0  #1945
DaVinci().PrintFreq = 10000
DaVinci().EvtMax = EVTMAX
DaVinci().TupleFile = "DVTuples1.root"
DaVinci().HistogramFile = 'DVHistos.root'
from Configurables import DaVinci, MicroDSTWriter
from StrippingConf.Configuration import StrippingConf
from PhysSelPython.Wrappers import AutomaticData, SelectionSequence, MultiSelectionSequence
from StrippingSelections.StreamDimuon import stream
streamLocations = [
    stream.name() + '/' + loc for loc in stream.outputLocations()
]
print 'Will copy particles from'
selections = []
for loc in streamLocations:
    print loc
    sel = AutomaticData(Location=loc)
    selections.append(
        SelectionSequence('StripSeq' + sel.name(), TopSelection=sel))

multiSeq = MultiSelectionSequence('DiMuonSeq', Sequences=selections)

dstWriter = MicroDSTWriter("MyDSTWriter",
                           SelectionSequences=[multiSeq],
                           OutputPrefix='MicroDST',
                           OutputFileSuffix='TestDiMuon2',
                           CopyL0DUReport=False,
                           CopyHltDecReports=False,
                           CopyMCTruth=True,
                           CopyBTags=False)

from Configurables import P2MCRelatorAlg, CopyParticle2MCRelations
P2MCRelatorAlg('P2MCRel_DiMuonSeq').OutputLevel = 1
CopyParticle2MCRelations('CopyP2MCRel_DiMuonSeq').OutputLevel = 1

dv = DaVinci()
Ejemplo n.º 12
0
def test_multi_sequencer_sequences():
    _sel00 = AutomaticData(Location='Phys/Sel00')
    _sel01 = AutomaticData(Location='Phys/Sel01')
    _sel02 = AutomaticData(Location='Phys/Sel02')
    _sel03 = AutomaticData(Location='Phys/Sel03')

    sel00_01 = Selection('0000110',
                         Algorithm=MockConfGenerator(),
                         RequiredSelections=[_sel00, _sel01])
    sel02_03 = Selection('0000111',
                         Algorithm=MockConfGenerator(),
                         RequiredSelections=[_sel02, _sel03])
    selA = Selection('000112A',
                     Algorithm=MockConfGenerator(),
                     RequiredSelections=[sel00_01, sel02_03])

    _sel04 = AutomaticData(Location='Phys/Sel04')
    _sel05 = AutomaticData(Location='Phys/Sel05')
    _sel06 = AutomaticData(Location='Phys/Sel06')
    _sel07 = AutomaticData(Location='Phys/Sel07')
    sel04_05 = Selection('0000112',
                         Algorithm=MockConfGenerator(),
                         RequiredSelections=[_sel04, _sel05])
    sel06_07 = Selection('0000113',
                         Algorithm=MockConfGenerator(),
                         RequiredSelections=[_sel06, _sel07])
    selB = Selection('000112B',
                     Algorithm=MockConfGenerator(),
                     RequiredSelections=[sel04_05, sel06_07])

    presel0 = MockConfGenerator()
    presel1 = MockConfGenerator()
    presel2 = MockConfGenerator()
    presel3 = MockConfGenerator()

    postsel0 = MockConfGenerator()
    postsel1 = MockConfGenerator()
    postsel2 = MockConfGenerator()
    postsel3 = MockConfGenerator()

    preselsA = [presel0, presel1]
    postselsA = [postsel0, postsel1]
    preselsB = [presel2, presel3]
    postselsB = [postsel2, postsel3]

    seqA = SelectionSequence('Seq0002A',
                             TopSelection=selA,
                             EventPreSelector=preselsA,
                             PostSelectionAlgs=postselsA)
    seqB = SelectionSequence('Seq0002B',
                             TopSelection=selB,
                             EventPreSelector=preselsB,
                             PostSelectionAlgs=postselsB)

    multiSeq = MultiSelectionSequence('MultiSeqAB',
                                      Sequences=[seqA, seqB],
                                      sequencerType=DummySequencer)

    assert multiSeq.outputLocations() == [
        selA.outputLocation(), selB.outputLocation()
    ]

    print 'algos in seqA', len(seqA.algorithms())
    print 'algos in seqB', len(seqB.algorithms())

    seqAlgos = multiSeq.sequence().Members
    seqAlgosA = seqAlgos[0].Members
    seqAlgosB = seqAlgos[1].Members
    assert len(seqAlgos) == len(multiSeq._sequences)
    assert len(multiSeq.algorithms()) == len(seqAlgosA) + len(seqAlgosB)

    ref_algosA = [
        presel0, presel1,
        _sel00.algorithm(),
        _sel01.algorithm(),
        _sel02.algorithm(),
        _sel03.algorithm(),
        sel02_03.algorithm(),
        sel00_01.algorithm(),
        selA.algorithm(), postsel0, postsel1
    ]

    ref_algosB = [
        presel2, presel3,
        _sel04.algorithm(),
        _sel05.algorithm(),
        _sel06.algorithm(),
        _sel07.algorithm(),
        sel06_07.algorithm(),
        sel04_05.algorithm(),
        selB.algorithm(), postsel2, postsel3
    ]

    assert len(seqAlgos) == 2

    assert preselsA == seqAlgosA[:len(preselsA)]
    assert preselsB == seqAlgosB[:len(preselsB)]
    # selA must be just before postsels
    assert selA.algorithm() == ref_algosA[len(ref_algosA) -
                                          (len(postselsA) + 1)]
    assert postselsA == seqAlgosA[len(ref_algosA) - len(postselsA):]
    assert postselsB == seqAlgosB[len(ref_algosB) - len(postselsB):]
    # selB must be just before postsels
    assert selB.algorithm() == ref_algosB[len(ref_algosB) -
                                          (len(postselsB) + 1)]

    # order doesn't matter
    for sel in [sel04_05, sel06_07]:
        assert sel.algorithm() in ref_algosB[len(preselsB):len(ref_algosB) -
                                             len(postselsB)]
    for sel in [sel00_01, sel02_03]:
        assert sel.algorithm() in ref_algosA[len(preselsA):len(ref_algosA) -
                                             len(postselsA)]
Ejemplo n.º 13
0
def test_instantiate_dataondemand_multi_sequencer():
    sel00 = AutomaticData(Location='Phys/Sel00')
    sel01 = AutomaticData(Location='Phys/Sel01')
    seq00 = SelectionSequence('Seq00x', TopSelection=sel00)
    seq01 = SelectionSequence('Seq01x', TopSelection=sel01)
    seq = MultiSelectionSequence('MultiSeq00x', Sequences=[seq00, seq01])
pionSeq = SelectionSequence('SeqPions', TopSelection = pions )
muonSeq = SelectionSequence('SeqMuons', TopSelection = muons )

kaonSeq =  SelectionSequence('SeqKaons', TopSelection = kaons)
jpsiSeq =  SelectionSequence('SeqJpsi', TopSelection = jpsis )

mergeSeq = SelectionSequence('SeqMerge', TopSelection = allSelection )

#mergeSeq.algorithm().OutputLevel=1

mergeAlg = getConfigurable("MergeAll")
mergeAlg.OutputLevel=1
mergeAlg.ForceP2PVBuild = True

multiSeq = MultiSelectionSequence('CocktailB', Sequences = [kaonSeq, pionSeq, muonSeq, jpsiSeq, mergeSeq])

conf = MicroDSTWriter("MicroDST0", 
                      OutputFileSuffix = "Test4",
                      SelectionSequences = [multiSeq])

#selDST0Seq = conf.sequence()

dv = DaVinci()
dv.DataType = '2010'
dv.InputType = 'SDST'
dv.EvtMax = -1
dv.UserAlgorithms = [conf.sequence()]
EventSelector().Input = ["DATAFILE='PFN:castor:/castor/cern.ch/user/c/cattanem/testFiles/Brunel-v37r1-069857_0000000006-1000ev.sdst' TYP='POOL_ROOTTREE' OPT='READ'"]
FileCatalog().Catalogs =['xmlcatalog_file:TestSDSTCatalog.xml']
Ejemplo n.º 15
0
# =============================================================================
psi_x0 = MultiSelectionSequence (
    "PSIX0",
    Sequences = [
    #
    SelectionSequence ( 'ETA'           , psix0 . b2eta       () ) ,
    SelectionSequence ( 'ETAPRIME'      , psix0 . b2etap      () ) ,
    SelectionSequence ( 'OMEGA'         , psix0 . b2omega     () ) ,
    #
    SelectionSequence ( 'KETA'          , psix0 . b2Keta      () ) ,
    SelectionSequence ( 'KETAPRIME'     , psix0 . b2Ketap     () ) ,
    SelectionSequence ( 'KOMEGA'        , psix0 . b2Komega    () ) ,
    #
    SelectionSequence ( 'KKETA'         , psix0 . b2KKeta     () ) ,
    SelectionSequence ( 'KKETAPRIME'    , psix0 . b2KKetap    () ) ,
    SelectionSequence ( 'KKOMEGA'       , psix0 . b2KKomega   () ) ,
    #
    SelectionSequence ( 'PIETA'         , psix0 . b2pieta     () ) ,
    SelectionSequence ( 'PIETAPRIME'    , psix0 . b2pietap    () ) ,
    SelectionSequence ( 'PIOMEGA'       , psix0 . b2piomega   () ) ,
    #
    SelectionSequence ( 'PIPIETA'       , psix0 . b2pipieta   () ) ,
    SelectionSequence ( 'PIPIETAPRIME'  , psix0 . b2pipietap  () ) ,
    SelectionSequence ( 'PIPIOMEGA'     , psix0 . b2pipiomega () ) ,
    #
    SelectionSequence ( 'KPIETA'        , psix0 . b2Kpieta    () ) ,
    SelectionSequence ( 'KPIETAPRIME'   , psix0 . b2Kpietap   () ) ,
    SelectionSequence ( 'KPIOMEGA'      , psix0 . b2Kpiomega  () ) ,
    #
    ] 
    )