The following example shows how to use python configurables to configure a DaVinci job that performs a Bs->J/psi(mumu)phi(KK) selection. It needs some more work to put more information into the nTuple. Run the script using

$ SetupProject DaVinci
$ gaudirun.py JpsiPhiSelection_gaudi.py

Here is the options file:

# $Id: $

#__author__ = 'Greig A Cowan'
#__date__ = ''
#__version__ = 0.1

#'''B_s -> J/psi(mumu) phi(KK) '''

import GaudiPython
from GaudiPython import gbl
from Gaudi.Configuration import *
from Configurables import ( PhysDesktop,
                            CombineParticles,
                            RecursivePlotTool,
                            DecayTreeTuple,
                            TupleToolDecay,
                            LoKi__Hybrid__FilterCriterion,
                            LoKi__Hybrid__TupleTool,
                            TupleToolP2VV)

outputLevel = INFO

##
## Configuration
##
importOptions('$DAVINCIROOT/options/DaVinciCommon.opts')
importOptions("$DAVINCIROOT/options/DaVinciReco.opts")
importOptions('$STDOPTS/RootHist.opts')
#importOptions('$COMMONPARTICLESROOT/options/StandardMuons.opts')
#importOptions('$COMMONPARTICLESROOT/options/StandardKaons.opts')
#importOptions('$FLAVOURTAGGINGROOT/options/BTaggingTool.opts')
#importOptions('$HLTSYSROOT/options/L0.opts')
#importOptions('$HLTSYSROOT/options/Hlt.opts')
#importOptions("$HLTSYSROOT/options/HltReco.opts")
#importOptions("$HLTSYSROOT/options/HltSelections.opts")
# Need this when running over stripped or reprocessed data
importOptions( "$DAVINCIROOT/options/DaVinciMainSeqFixes.opts")

##
## ApplicationMgr is the python configurable of the Appliction manager
## Configuration has to happen before instantiating the Application manager
##
appMgrConf = ApplicationMgr( OutputLevel = outputLevel, AppName = 'ex1')
appMgrConf.HistogramPersistency = 'ROOT'
appMgrConf.EvtMax = -1
HistogramPersistencySvc().OutputFile = 'greig_plots.root'
NTupleSvc().Output = ["FILE1 DATAFILE='Bs2JpsiPhi_ntuple.root' TYP='ROOT' OPT='NEW'"]

##
## J/psi -> mu mu
##
Jpsi2MuMu = CombineParticles('Jpsi2MuMu')
Jpsi2MuMu.addTool( PhysDesktop( OutputLevel = outputLevel ),
                   name = "PhysDesktop" )
Jpsi2MuMu.PhysDesktop.InputLocations = [ 'Phys/StdLooseMuons' ]
Jpsi2MuMu.DecayDescriptor = 'J/psi(1S) -> mu+ mu-'

Jpsi2MuMu.addTool( LoKi__Hybrid__FilterCriterion(), name = 'DaughtersCut')
Jpsi2MuMu.addTool( LoKi__Hybrid__FilterCriterion(), name = 'CombinationCut')
Jpsi2MuMu.addTool( LoKi__Hybrid__FilterCriterion(), name = 'MotherCut')

Jpsi2MuMu.DaughtersCuts = {"mu+" : "(PT>700)", "mu-" : "(PT>700)"}
Jpsi2MuMu.CombinationCut = "ADAMASS('J/psi(1S)')<85"
Jpsi2MuMu.MotherCut = "(VFASPF(VCHI2/VDOF)<6)"

##
## phi -> K K
##
Phi2KK = CombineParticles('Phi2KK')
Phi2KK.addTool( PhysDesktop( OutputLevel = outputLevel ),
                name = "PhysDesktop" )

Phi2KK.PhysDesktop.InputLocations = [ 'Phys/StdLooseKaons' ]
Phi2KK.DecayDescriptor = 'phi(1020) -> K+ K-'

Phi2KK.addTool( LoKi__Hybrid__FilterCriterion(), name = 'DaughtersCut')
Phi2KK.addTool( LoKi__Hybrid__FilterCriterion(), name = 'CombinationCut')
Phi2KK.addTool( LoKi__Hybrid__FilterCriterion(), name = 'MotherCut')

#Phi2KK.DaugtherCuts.Code = "((PT>400) & (P>1200))" # P cut shouldn't be used
# as you increase PT you bias sensitivity to phi_s, R_t and DG. Gbar OK
Phi2KK.DaughtersCuts = {
    "K+": "(PT>700)",
    "K-" : "(PT>700)"
    }
Phi2KK.CombinationCut = "ADAMASS('phi(1020)')<28"
# Forming vertex for phi difficult due to light K being collinear
Phi2KK.MotherCut = "((VFASPF(VCHI2/VDOF)<40))" #look into this.

##
## B_s -> J/psi phi
##
Bs2JpsiPhi = CombineParticles('Bs2JpsiPhi')
Bs2JpsiPhi.addTool( PhysDesktop( OutputLevel = outputLevel ),
                    name = "PhysDesktop" )
Bs2JpsiPhi.PhysDesktop.InputLocations = [ 'Phys/Phi2KK', 'Phys/Jpsi2MuMu' ]
Bs2JpsiPhi.DecayDescriptor = 'B_s0 -> phi(1020) J/psi(1S)'

Bs2JpsiPhi.addTool( LoKi__Hybrid__FilterCriterion(), name = 'DaughterCut')
Bs2JpsiPhi.addTool( LoKi__Hybrid__FilterCriterion(), name = 'CombinationCut')
Bs2JpsiPhi.addTool( LoKi__Hybrid__FilterCriterion(), name = 'MotherCut')


#Bs2JpsiPhi.DaugtherCuts.Code = "((ABSID=='K+') & (MIPCHI2DV(PRIMARY)>9)) | ((ABSID=='mu-') & (PT>1000))"
Bs2JpsiPhi.DaughtersCuts = {
    "J/psi(1S)" : "TRUE",
    "phi(1020)" : "TRUE"
    }
# This is tight. 500 is loose.
Bs2JpsiPhi.CombinationCut = "ADAMASS('B_s0')<50" # 500 if looking for BK
Bs2JpsiPhi.MotherCut = "(MIPCHI2DV(PRIMARY)<22.5)"

Bs2JpsiPhi.OutputLevel = INFO

##
## DecayTreeTuple
##
BsTuple = DecayTreeTuple( 'BsTuple')
BsTuple.OutputLevel = outputLevel
BsTuple.addTool( PhysDesktop(), name='PhysDesktop')
BsTuple.PhysDesktop.InputLocations=['Phys/Bs2JpsiPhi',
                                    'Phys/Phi2KK',
                                    'Phys/Jpsi2MuMu' ]
# Adding in the cc doubles the number of Bs candidates
BsTuple.Decay = '[B_s0 -> (^phi(1020) => ^K+ ^K-) (^J/psi(1S) => ^mu+ ^mu-)]cc'

LoKiTool = LoKi__Hybrid__TupleTool( 'LoKiTool')
LoKiTool.Variables = {
   "MASS" : "M/GeV",
   "P" : "P/GeV",
   "PT" : "PT/GeV",
   "TRCHI2" : "TRCHI2",
   "ABSID" : "ABSID",
   "ID" : "ID",
}
BsTuple.addTool( LoKiTool, name = 'LoKiTool')
BsTuple.ToolList = [ 'LoKi::Hybrid::TupleTool/LoKiTool']

BsTuple.Branches = {
    'muon' : '[B_s0 -> (phi(1020) => K+ K-) (J/psi(1S) => ^mu+ ^mu-)]cc',
    'kaon_plus' : '[B_s0 -> (phi(1020) => ^K+ K-) (J/psi(1S) => mu+ mu-)]cc',
    'kaon_minus' : '[B_s0 -> (phi(1020) => K+ ^K-) (J/psi(1S) => mu+ mu-)]cc',
    'phi'  : '[B_s0 -> (^phi(1020) => K+ K-) (J/psi(1S) => mu+ mu-)]cc',
    'J/psi': '[B_s0 -> (phi(1020) => K+ K-) (^J/psi(1S) => mu+ mu-)]cc',
    'Bs': '[B_s0]cc : [B_s0 -> (phi(1020) => K+ K-) (J/psi(1S) => mu+ mu-)]cc'}

BsTuple.addTool( TupleToolDecay, name = 'kaon_plus')
BsTuple.addTool( TupleToolDecay, name = 'kaon_minus')
BsTuple.addTool( TupleToolDecay, name = 'Bs')


KaonPlusLoKiTool = LoKi__Hybrid__TupleTool( 'KaonPlusLoKiTool')
KaonPlusLoKiTool.Variables = {
   "PIDK_PIDpi" : "PIDK-PIDpi",
   "PIDpi_PIDK" : "PIDpi-PIDK"
}
BsTuple.kaon_plus.addTool( KaonPlusLoKiTool, name='KaonPlusLoKiTool')
BsTuple.kaon_plus.ToolList = [ 'LoKi::Hybrid::TupleTool/KaonPlusLoKiTool']

KaonMinusLoKiTool = LoKi__Hybrid__TupleTool( 'KaonMinusLoKiTool')
KaonMinusLoKiTool.Variables = {
   "PIDK_PIDpi" : "PIDK-PIDpi",
   "PIDpi_PIDK" : "PIDpi-PIDK"
}
BsTuple.kaon_minus.addTool( KaonMinusLoKiTool, name='KaonMinusLoKiTool')
BsTuple.kaon_minus.ToolList = [ 'LoKi::Hybrid::TupleTool/KaonMinusLoKiTool']

BsLoKiTool = LoKi__Hybrid__TupleTool( 'BsLoKiTool')
BsLoKiTool.Variables = {
   "VCHI2" : "VFASPF(VCHI2)",
   "BPVVDCHI2" : "BPVVDCHI2",
   "DIRA" : "BPVDIRA",
   "MIPCHI2_PRIMARY" : "MIPCHI2DV(PRIMARY)",
   "BPVLTIME_ps" : "BPVLTIME()*1000",
   "BPVLTFITCHI2" : "BPVLTFITCHI2()",
   "BPVLTCHI2" : "BPVLTCHI2()",
}
TupleToolP2VV = TupleToolP2VV( 'TupleToolP2VV')
TupleToolP2VV.Calculator = 'Bs2JpsiPhiAngleCalculator'
#TupleToolP2VV.OutputLevel = DEBUG

BsTuple.Bs.addTool( BsLoKiTool, name='BsLoKiTool')
BsTuple.Bs.addTool( TupleToolP2VV, name='TupleToolP2VV')
BsTuple.Bs.ToolList = [ 'TupleToolP2VV',
                        'TupleToolMCBackgroundInfo',
                        'LoKi::Hybrid::TupleTool/BsLoKiTool']

EventSelector().Input = [
    "DATAFILE='PFN:/Disk/lochnagar0/lhcb/DC06/00001868_00001083_5.dst' TYP='POOL_ROOTTREE' OPT='READ'"
    "DATAFILE='PFN:/Disk/lochnagar0/lhcb/DC06/00001868_00001416_5.dst' TYP='POOL_ROOTTREE' OPT='READ'"]
EventSelector().PrintFreq = 50

##
## Let's make an algorithm sequence
##
mySeq = GaudiSequencer("MySeq")
appMgrConf.TopAlg.append( mySeq)

mySeq.Members.append( Jpsi2MuMu) # Add the algorithms to be run
mySeq.Members.append( Phi2KK)
mySeq.Members.append( Bs2JpsiPhi)
mySeq.IgnoreFilterPassed = True ## get all Phis
mySeq.IgnoreFilterPassed = False ## sequencer
mySeq.Members.append( BsTuple)

-- GreigCowan - 15 May 2008

Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r6 - 2008-09-22 - GreigCowan
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback