コード例 #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()]
コード例 #2
0
from Configurables import StrippingReport

sr = StrippingReport(Selections=sc.selections())

from Configurables import AlgorithmCorrelationsAlg

ac = AlgorithmCorrelationsAlg(Algorithms=list(set(sc.selections())))

DaVinci().HistogramFile = 'DV_stripping_histos_sels.root'
DaVinci().EvtMax = 100000
DaVinci().PrintFreq = 1000
DaVinci().appendToMainSequence([sc.sequence()])
DaVinci().appendToMainSequence([sr])
#DaVinci().appendToMainSequence( [ ac ] )
DaVinci().appendToMainSequence([dstWriter.sequence()])
DaVinci().ProductionType = "Stripping"
DaVinci().DataType = "2015"
DaVinci().InputType = "RDST"

# change the column size of timing table
from Configurables import TimingAuditor, SequencerTimerTool

TimingAuditor().addTool(SequencerTimerTool, name="TIMER")
TimingAuditor().TIMER.NameSize = 60

MessageSvc().Format = "% F%60W%S%7W%R%T %0W%M"

# database
DaVinci().DDDBtag = "dddb-20150724"
DaVinci().CondDBtag = "cond-20150828"
コード例 #3
0
###################### DAVINCI SETTINGS ############################################
DaVinci().SkipEvents = 0  #1945
DaVinci().PrintFreq = 10000
DaVinci().EvtMax = EVTMAX
DaVinci().TupleFile = "DVTuples1.root"
DaVinci().HistogramFile = 'DVHistos.root'
DaVinci().RootInTES = rootInTES
DaVinci().InputType = "MDST"
DaVinci().Simulation = False
DaVinci().Lumi = True
DaVinci().DataType = "2011"
CondDB(LatestGlobalTagByDataType='2011')

if False:  # Add the DST writing algorithms
    DaVinci().appendToMainSequence([dstWriter.sequence(), printTree])

if True:  # Add the ntuple writing algorithms
    DaVinci().UserAlgorithms = [tuple_B2Kmumu]
if MODE == 'MC':
    DaVinci().Simulation = True
    DaVinci().Lumi = False
    DaVinci().UserAlgorithms += [mctuple_B2Kmumu]

if OUTPUTLEVEL == DEBUG:
    DaVinci().MoniSequence += [mctree]

from Configurables import DaVinciInit
DaVinciInit().OutputLevel = OUTPUTLEVEL

if MODE != "MC":
コード例 #4
0
ファイル: WriteCharmY.py プロジェクト: bmcharek/Bu2JpsiKKpi
##the_year = '2012'
the_year = '2011'

from Configurables import DaVinci
davinci = DaVinci(
    #
    DataType=the_year,  # ATTENTION !!
    #
    EventPreFilters=fltrs.filters('Filters'),
    InputType="DST",
    EvtMax=-1,
    PrintFreq=10000,
    Lumi=True,
)

davinci.appendToMainSequence([uDstWriter.sequence()])

from Configurables import CondDB
CondDB(LatestGlobalTagByDataType=the_year)  # ATTENTION !!


# TEST data sample

# input = [
# '/lhcb/LHCb/Collision12/DIMUON.DST/00020198/0001/00020198_00012742_1.dimuon.dst',
# '/lhcb/LHCb/Collision12/DIMUON.DST/00020198/0001/00020198_00018390_1.dimuon.dst',
# '/lhcb/LHCb/Collision12/DIMUON.DST/00020198/0001/00020198_00016364_1.dimuon.dst',
# '/lhcb/LHCb/Collision12/DIMUON.DST/00020198/0001/00020198_00015767_1.dimuon.dst',
# '/lhcb/LHCb/Collision12/DIMUON.DST/00020198/0002/00020198_00020410_1.dimuon.dst',
# '/lhcb/LHCb/Collision12/DIMUON.DST/00020198/0000/00020198_00007306_1.dimuon.dst',
# '/lhcb/LHCb/Collision12/DIMUON.DST/00020198/0001/00020198_00014550_1.dimuon.dst',
コード例 #5
0
ファイル: DV_B2Kll_2012.py プロジェクト: kgizdov/lhcb
                          )

###################### DAVINCI SETTINGS ############################################
DaVinci().SkipEvents = 0  #1945
DaVinci().PrintFreq = 1000
DaVinci().EvtMax = EVTMAX
DaVinci().TupleFile = "DVTuples1.root"
DaVinci().HistogramFile = 'DVHistos.root'
DaVinci().InputType = "DST"
DaVinci().Simulation = False
DaVinci().Lumi = True
DaVinci().DataType = "2012"
CondDB( LatestGlobalTagByDataType = '2012' )

if False: # Add the DST writing algorithms
    DaVinci().appendToMainSequence( [ dstWriter.sequence(), printTree ] )

if True: # Add the ntuple writing algorithms
    DaVinci().UserAlgorithms = [
                tuple_B2Kmumu
            ]
    if MODE == 'MC':
        DaVinci().Simulation = True
        DaVinci().Lumi = False
        DaVinci().UserAlgorithms += [
                mctuple_B2Kmumu
            ]

if OUTPUTLEVEL == DEBUG:
    DaVinci().MoniSequence += [ mctree ]
コード例 #6
0
sc = StrippingConf(
    Streams=[MyStream],
    MaxCandidates=2000,
    AcceptBadEvents=False,
    BadEventSelection=filterBadEvents,
    HDRLocation='NonexistingPlaceholder',
)

#
# Configuration of SelDSTWriter
#
SelDSTWriterElements = {
    'default': stripDSTElements(),
}

SelDSTWriterConf = {
    'default': stripDSTStreamConf(),
}

dstWriter = SelDSTWriter("MyDSTWriter",
                         StreamConf=SelDSTWriterConf,
                         OutputFileSuffix='TAGGING',
                         SelectionSequences=sc.activeStreams())

# DaVinci Config
DaVinci().appendToMainSequence([
    sc.sequence(),
    dstWriter.sequence(),
])
コード例 #7
0
ファイル: WriteMCBcT.py プロジェクト: bmcharek/Bu2JpsiKKpi
def configure(datafiles,
              catalogs=[],
              castor=False,
              params={}):
    """
    Job configuration 
    """

    logger.info("start: params: %s " % params)
    from BenderTools.Parser import hasInFile

    the_year = "2011"

    if params:
        the_year = params['Year']
        logger.info('Year is set from params to be %s ' % the_year)
    else:
        if hasInFile(datafiles, 'Collision11'):
            the_year = '2011'
        elif hasInFile(datafiles, 'Collision12'):
            the_year = '2012'
        elif hasInFile(datafiles, 'Stripping17'):
            the_year = '2011'
        elif hasInFile(datafiles, 'Stripping13'):
            the_year = '2011'
        elif hasInFile(datafiles, 'Stripping15'):
            the_year = '2011'
        elif hasInFile(datafiles, 'Stripping17'):
            the_year = '2011'
        elif hasInFile(datafiles, 'Stripping19'):
            the_year = '2012'
        logger.info('Year is set from files  to be %s ' % the_year)

    #
    # check
    #
    if '2011' == the_year and hasInFile(datafiles, 'Collision12'):
        raise AttributeError, 'Invalid Year %s ' % the_year
    if '2012' == the_year and hasInFile(datafiles, 'Collision11'):
        raise AttributeError, 'Invalid Year %s ' % the_year

    logger.info('Use the Year = %s ' % the_year)

    #
    # dimuon locations in DIMUON.DST
    #
    Jpsi_det_location = '/Event/AllStreams/Phys/FullDSTDiMuonJpsi2MuMuDetachedLine/Particles'
    Jpsi_unb_location = '/Event/AllStreams/Phys/FullDSTDiMuonJpsi2MuMuTOSLine/Particles'

    if hasInFile(datafiles, '/MC/MC11a/'):
        Jpsi_unb_location = '/Event/AllStreams/Phys/FullDSTDiMuonJpsi2MuMuLine/Particles'
        logger.warning('Rename ``unbised line'' to be %s ' %
                       Jpsi_unb_location)

    from PhysSelPython.Wrappers import AutomaticData
    jpsi_det = AutomaticData(Location=Jpsi_det_location)
    jpsi_unb = AutomaticData(Location=Jpsi_unb_location)

    # pions :
    from GaudiConfUtils.ConfigurableGenerators import FilterDesktop
    alg_pions = FilterDesktop(
        #
        Preambulo=["from LoKiPhysMC.decorators import mcMatch"],
        Code="""
        ( PT > 500  * MeV      ) & 
        ( CLONEDIST   > 5000   ) & 
        ( TRGHOSTPROB < 0.5    ) &
        ( TRCHI2DOF   < 4      ) & 
        in_range ( 2 , ETA , 5 ) &
        HASRICH                  
        & mcMatch( '[B_c+  =>  ( J/psi(1S) => mu+ mu- ) ^pi+ ]CC' , 1 )
        """ ,
    )

    ## ( PROBNNpi > 0.10      )

    from PhysSelPython.Wrappers import Selection
    from StandardParticles import StdAllLoosePions
    pions = Selection(
        "ThePions",
        Algorithm=alg_pions,
        RequiredSelections=[StdAllLoosePions]
    )

    alg_kaons = FilterDesktop(
        #
        Preambulo=["from LoKiPhysMC.decorators import mcMatch"],
        Code="""
        ( PT > 500  * MeV      ) & 
        ( CLONEDIST   > 5000   ) & 
        ( TRCHI2DOF   < 4      ) & 
        ( TRGHOSTPROB < 0.5    ) & 
        in_range ( 2 , ETA , 5 ) &
        HASRICH                  
        & mcMatch( '[B+  =>  ( J/psi(1S) => mu+ mu- ) ^K+ ]CC' , 1 )
        """
    )

    ## ( PROBNNk > 0.10       )

    from StandardParticles import StdAllLooseKaons
    kaons = Selection(
        "TheKaons",
        Algorithm=alg_kaons,
        RequiredSelections=[StdAllLooseKaons]
    )

    #
    Preambulo = [
        # shortcut for chi2 of vertex fit
        "chi2vx   = VFASPF(VCHI2)",
        # shortcut for the c*tau
        "from GaudiKernel.PhysicalConstants import c_light",
        # use the embedded cut for chi2(LifetimeFit)<16
        "ctau_25   = BPVLTIME ( 25 ) * c_light ",
        "mbc_acut  = in_range ( 6.050 * GeV , AM , 6.550 * GeV ) ",
        "mbp_acut  = in_range ( 5.100 * GeV , AM , 5.550 * GeV ) ",
        # mass-cut for beauty particles
        "mbc_cut   = in_range ( 6.100 * GeV ,  M , 6.500 * GeV ) ",
        "mbp_cut   = in_range ( 5.150 * GeV ,  M , 5.500 * GeV ) ",
        #
        "from LoKiPhysMC.decorators import mcMatch"
    ]

    # Bc :
    from GaudiConfUtils.ConfigurableGenerators import CombineParticles
    alg_bc = CombineParticles(
        DecayDescriptor="[B_c+ -> J/psi(1S) pi+ ]cc",
        DaughtersCuts={
            "J/psi(1S)": "mcMatch( '[ B_c+  =>  ^( J/psi(1S) => mu+ mu- ) pi+ ]CC' , 1 )"
        },
        Preambulo=Preambulo,
        CombinationCut=" mbc_acut ",
        MotherCut="""
        ( chi2vx < 25  ) & mbc_cut &  ( ctau_25 > %s )
        & mcMatch( '[ B_c+  => ( J/psi(1S) => mu+ mu- ) pi+ ]CC' , 1 )
        """ %  ( 40 * micrometer )
    )

    # B+ :
    alg_bu = CombineParticles(
        DecayDescriptor="[B+ -> J/psi(1S) K+ ]cc",
        DaughtersCuts={
            "J/psi(1S)": "mcMatch( '[ B+  => ^( J/psi(1S) => mu+ mu- ) K+ ]CC' , 1 )"
        },
        Preambulo=Preambulo,
        CombinationCut=" mbp_acut ",
        MotherCut="""
        ( chi2vx < 25  ) & mbp_cut &  ( ctau_25 > %s )
        & mcMatch( '[ B+  =>  ( J/psi(1S) => mu+ mu- ) K+ ]CC' , 1 )
        """ %  ( 40 * micrometer )
    )

    sel_bc_det = Selection(
        "TheBc_det",
        Algorithm=alg_bc,
        RequiredSelections=[jpsi_det, pions]
    )

    sel_bc_unb = Selection(
        "TheBc_unb",
        Algorithm=alg_bc,
        RequiredSelections=[jpsi_unb, pions]
    )

    sel_bu_det = Selection(
        "TheB_det",
        Algorithm=alg_bu,
        RequiredSelections=[jpsi_det, kaons]
    )

    sel_bu_unb = Selection(
        "TheB_unb",
        Algorithm=alg_bu,
        RequiredSelections=[jpsi_unb, kaons]
    )

    from PhysSelPython.Wrappers import SelectionSequence
    Bc_det_seq = SelectionSequence("Bc_det", TopSelection=sel_bc_det)
    Bu_det_seq = SelectionSequence("Bu_det", TopSelection=sel_bu_det)
    Bc_unb_seq = SelectionSequence("Bc_unb", TopSelection=sel_bc_unb)
    Bu_unb_seq = SelectionSequence("Bu_unb", TopSelection=sel_bu_unb)

    #
    # selection sequence
    #

    mode = params['Mode']
    mode = mode.upper()
    if 0 <= mode.find('BC') or 0 <= mode.find('PI'):
        seqs = [Bc_det_seq, Bc_unb_seq]
        # seqs = [ Bc_det_seq ]
    elif 0 <= mode.find('B+') or 0 <= mode.find('K+'):
        seqs = [Bu_det_seq, Bu_unb_seq]
        # seqs = [ Bu_det_seq ]
    else:
        raise

    from PhysSelPython.Wrappers import MultiSelectionSequence
    B_SEQ = MultiSelectionSequence(
        "B2PSI",
        Sequences=seqs,
    )

    from DSTWriters.Configuration import (SelDSTWriter,
                                          stripMicroDSTStreamConf,
                                          stripMicroDSTElements)

    # Configuration of SelDSTWriter
    SelDSTWriterConf = {
        'default': stripMicroDSTStreamConf(pack=False)}
    SelDSTWriterElements = {
        'default': stripMicroDSTElements(pack=False)}

    udstWriter = SelDSTWriter(
        "MyMicroDSTWriter",
        StreamConf=SelDSTWriterConf,
        MicroDSTElements=SelDSTWriterElements,
        OutputFileSuffix='MCBSEQ',
        SelectionSequences=[B_SEQ]
    )

    # Read only fired events to speed up
    from PhysConf.Filters import LoKi_Filters
    fltrs = LoKi_Filters(
        STRIP_Code="HLT_PASS_RE('Stripping.*DiMuonJpsi2MuMu.*')",
        VOID_Code="""
        ( 0.5 < CONTAINS('%s') ) | 
        ( 0.5 < CONTAINS('%s') ) 
        """ %  ( Jpsi_det_location , Jpsi_unb_location )
    )
    #
    fltrs_0 = LoKi_Filters(
        VOID_Code="""
        ( EXISTS ( '/Event/DAQ/RawEvent') | EXISTS('/Event/Trigger/RawEvent' ) ) 
        & EXISTS ( '/Event/Strip/Phys/DecReports')
        & ( RECSUMMARY (  0 , -1 ) >  0.5 )
        """
    )

    #
    # finally: DaVinci
    #
    ## needed for job configuration
    from Configurables import DaVinci
    davinci = DaVinci(
        EventPreFilters=fltrs_0.filters(
            'Filters0') + fltrs.filters('Filters1'),
        DataType=the_year,
        InputType='MDST',
        Simulation=True,
        PrintFreq=1000,
        EvtMax=-1,
        #
        HistogramFile='MCBc_Histos.root',
        TupleFile='MCBc.root',
        #
        DDDBtag=params['DDDB'],
        CondDBtag=params['SIMCOND'],
        #
        Lumi=False  # True ,
        #
    )

    davinci.appendToMainSequence([udstWriter.sequence()])

    #
    # come back to Bender
    #
    setData(datafiles, catalogs, castor)

    from BenderTools.Utils import silence
    silence()

    #
    gaudi = appMgr()
    #

    logger.info("end: params: %s " % params)

    return SUCCESS
コード例 #8
0
ファイル: WriteCharm2Mu.py プロジェクト: bmcharek/Bu2JpsiKKpi
    InputType='MDST',
    DataType=the_year,
    EvtMax=-1,
    Lumi=True,
    HistogramFile="DVHistos.root",
    # dbase
    # DDDBtag       = "head-20120413"  ,
    # CondDBtag     = "head-20120724"  ,
    #
    PrintFreq=1000
)
#
from Configurables import CondDB
CondDB(LatestGlobalTagByDataType=the_year)

dv.appendToMainSequence([killer] + [udstWriter.sequence()])


# =============================================================================
if '__main__' == __name__:

    print 80 * '*'
    print __doc__
    print ' Author  : ', __author__
    print ' Version : ', __version__
    print ' Date    : ', __date__
    print 80 * '*'

# Input data
## from GaudiConf import IOHelper
# IOHelper().inputFiles([
コード例 #9
0
dv = DaVinci(
    EventPreFilters=fltrs,
    InputType='DST',
    DataType=the_year,
    EvtMax=-1,
    Lumi=True,
    HistogramFile="DVHistos.root",
    #
    PrintFreq=50000
)
#
from Configurables import CondDB
CondDB(LatestGlobalTagByDataType=the_year)
#

dv.appendToMainSequence([udstWriter.sequence()])

# =============================================================================
if '__main__' == __name__:

    print 80 * '*'
    print __doc__
    print ' Author  : ', __author__
    print ' Version : ', __version__
    print ' Date    : ', __date__
    print 80 * '*'

# Input data
## from GaudiConf import IOHelper
# IOHelper().inputFiles([
# CHARM COMPLETE EVENT
コード例 #10
0
AuditorSvc().Auditors.append( ChronoAuditor("Chrono") )

from Configurables import StrippingReport
sr = StrippingReport(Selections = sc.selections())

from Configurables import AlgorithmCorrelationsAlg
ac = AlgorithmCorrelationsAlg(Algorithms = list(set(sc.selections())))

#Configure DaVinci
DaVinci().HistogramFile = 'DV_stripping_histos.root'
DaVinci().EvtMax = 10000
DaVinci().PrintFreq = 2000
DaVinci().appendToMainSequence( [ sc.sequence() ] )
DaVinci().appendToMainSequence( [ sr ] )
DaVinci().appendToMainSequence( [ ac ] )
DaVinci().appendToMainSequence( [ dstWriter.sequence() ] )
DaVinci().ProductionType = "Stripping"
DaVinci().DataType  = "2016"
DaVinci().InputType = "RDST"

# change the column size of timing table
from Configurables import TimingAuditor, SequencerTimerTool
TimingAuditor().addTool(SequencerTimerTool,name="TIMER")
TimingAuditor().TIMER.NameSize = 60

MessageSvc().Format = "% F%60W%S%7W%R%T %0W%M"

# database
DaVinci().DDDBtag   = "dddb-20150724"
DaVinci().CondDBtag = "cond-20160522"
コード例 #11
0
ファイル: BandQ.py プロジェクト: MMhaidra/lhcb-1
# The last step: DaVinci & DB 
# ==============================================================================

from Configurables import DaVinci 
davinci = DaVinci ( 
    #
    ## DataType        = the_year ,                ## ATTENTION !!
    #
    EventPreFilters = fltrs_0.filters ('Filters0') + fltrs.filters ('Filters') , 
    InputType       = "DST"    , 
    EvtMax          =    -1    ,  
    PrintFreq       =  1000    ,
    Lumi            =  True    ,  
    )

davinci.appendToMainSequence( [ uDstWriter.sequence() ] )

## from Configurables import CondDB
## CondDB ( LatestGlobalTagByDataType = the_year )  ## ATTENTION !!
    
# =============================================================================
if '__main__' == __name__ :
    
    print 100*'*'
    print __doc__
    print 100*'*'
    print ' Author  : %s ' % __author__
    print ' Version : %s ' % __version__ 
    print ' Date    : %s ' % __date__
    print 100*'*'