本文整理汇总了Python中Configurables.DaVinci类的典型用法代码示例。如果您正苦于以下问题:Python DaVinci类的具体用法?Python DaVinci怎么用?Python DaVinci使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DaVinci类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: configure
def configure(year, mc):
"""General configuration of DaVinci options.
Keyword arguments:
year -- One of lc2pxx.config.years
mc -- True if booking MC ntuples, else false
"""
dv = DaVinci()
# Output ntuple name
dv.TupleFile = "DVntuple.root"
# Process all events
dv.EvtMax = -1
# Print status every 1000 events
dv.PrintFreq = 1000
# Number of events to skip at the beginning of each file
dv.SkipEvents = 0
dv.DataType = str(year)
dv.Simulation = mc
# Collision streams for Charm are on microDST, and in MC
if not mc:
dv.InputType = "MDST"
# See "Question about microDST and RootInTES" in lhcb-davinci
dv.RootInTES = "/Event/Charm"
# Add a GetIntegratedLuminosity/LumiTuple TTree to output, but not in MC
dv.Lumi = not mc
示例2: configure_DATA
def configure_DATA(datafiles,
catalogs,
castor,
params):
logger.info('Configure DATA')
the_year = params['Year']
from Configurables import CondDB
CondDB(LatestGlobalTagByDataType=the_year)
from Configurables import DaVinci
dv = DaVinci(Lumi=True,
#
HistogramFile='B_Histos.root',
TupleFile='B.root'
)
from Configurables import TrackScaleState
state_scale = TrackScaleState('StateScale')
dv.UserAlgorithms = [state_scale]
logger.info('Momentum scaling is applied!')
return configure_COMMON(datafiles, catalogs, castor, params)
示例3: DaVinci
from Configurables import DaVinci
from Configurables import Velo__VeloIPResolutionMonitorNT as IPMoni
dv = DaVinci()
dv.DataType = '2015'
dv.DDDBtag = 'dddb-20150526'
dv.CondDBtag = 'cond-20150625'
#dv.EvtMax = 100
ipMoni = IPMoni('VeloIPResolutionMonitor')
ipMoni.CheckIDs = True
dv.UserAlgorithms = [ipMoni]
dv.TupleFile = 'IPTuple.root'
示例4: configure
def configure(datafiles, catalogs=[], params={}, castor=False):
"""
Configure the job
"""
from Configurables import DaVinci ## needed for job configuration
## get the builder
from StrippingSelections.StrippingPsiXForBandQ import PsiX_BQ_Conf as PSIX
## for MC it is better to exclude PID/DLL/PROBNN cuts
builder_configuration = {
# 'PionCut' : """
# ( PT > 200 * MeV ) &
'PionCut' : """
( CLONEDIST > 5000 ) &
"""
# ( TRGHOSTPROB < 0.5 ) &
# ( TRCHI2DOF < 4 ) &
# in_range ( 2 , ETA , 5 ) &
# in_range ( 3.2 * GeV , P , 150 * GeV ) &
# HASRICH &
# ( PROBNNpi > 0.1 )
#( MIPCHI2DV() > 4 )
,
# ( PT > 200 * MeV ) &
'KaonCut' : """
( CLONEDIST > 5000 ) &
( TRGHOSTPROB < 0.5 ) &
( TRCHI2DOF < 4 ) &
in_range ( 2 , ETA , 5 ) &
in_range ( 3.2 * GeV , P , 150 * GeV ) &
HASRICH &
( PROBNNk > 0.1 )
"""
# ( MIPCHI2DV() > 4 )
}
def _kaons_ ( self ) :
"""
Kaons for B -> psi X lines
"""
from GaudiConfUtils.ConfigurableGenerators import FilterDesktop
## from StandardParticles import StdAllLooseKaons as inpts
from StandardParticles import StdNoPIDsKaons as inpts
##
return self.make_selection (
'Kaon' ,
FilterDesktop ,
[ inpts ] ,
Code = self['KaonCut'] ,
)
def _pions_ ( self ) :
"""
Pions for B -> psi X lines
"""
from GaudiConfUtils.ConfigurableGenerators import FilterDesktop
## from StandardParticles import StdAllLoosePions as inpts
from StandardParticles import StdNoPIDsPions as inpts
##
return self.make_selection (
'Pion' ,
FilterDesktop ,
[ inpts ] ,
Code = self['PionCut'] ,
)
jpsi_name = 'FullDSTDiMuonJpsi2MuMuDetachedLine'
psi2_name = 'FullDSTDiMuonPsi2MuMuDetachedLine'
from PhysSelPython.Wrappers import AutomaticData
jpsi = AutomaticData ( '/Event/AllStreams/Phys/%s/Particles' % jpsi_name )
psi2s = AutomaticData ( '/Event/AllStreams/Phys/%s/Particles' % psi2_name )
#
## merged selectoon for J/psi & psi'
#
from PhysSelPython.Wrappers import MergedSelection
psis = MergedSelection (
'SelDetachedPsisForBandQ' ,
RequiredSelections = [ jpsi ]
)
def _psi_ ( self ) :
"""
psi(') -> mu+ mu-
"""
return psis
PSIX.pions = _pions_
PSIX.kaons = _kaons_
PSIX.psi = _psi_
## use builder
builder = PSIX ( 'PsiX' , builder_configuration )
#.........这里部分代码省略.........
示例5: configure
def configure(datafiles,
catalogs=[],
castor=False,
params={}):
"""
Job configuration
"""
## needed for job configuration
from Configurables import DaVinci
the_year = "2011"
from BenderTools.Parser import hasInFile
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, 'Collision13'):
the_year = '2013'
elif hasInFile(datafiles, 'Stripping17'):
the_year = '2011'
elif hasInFile(datafiles, 'Stripping13'):
the_year = '2011'
elif hasInFile(datafiles, 'Stripping15'):
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)
rootInTES = '/Event/PSIX'
# Read only fired events to speed up
from PhysConf.Filters import LoKi_Filters
fltrs = LoKi_Filters(
VOID_Code="""
0.5 < CONTAINS('/Event/PSIX/Phys/SelB&B/Particles' )
"""
)
dv = DaVinci(
DataType=the_year,
InputType='MDST',
RootInTES=rootInTES,
Simulation=False,
PrintFreq=1000,
EvtMax=-1,
#
HistogramFile='BB_Histos.root',
TupleFile='BB.root',
#
Lumi=True,
#
)
dv.UserAlgorithms = ['BB']
from Configurables import CondDB
CondDB(LatestGlobalTagByDataType=the_year)
from BenderTools.Utils import silence
silence()
#
# come back to Bender
#
setData(datafiles, catalogs, castor)
#
# start Gaudi
#
gaudi = appMgr()
alg = BB(
'BB',
RootInTES=rootInTES,
Inputs=['Phys/SelB&B/Particles']
)
return SUCCESS
示例6: TupleToolTISTOS
#tuple.TupleToolTrigger.Verbose = True
tuple.addTool( TupleToolTISTOS() )
tuple.TupleToolTISTOS.VerboseL0 = True
tuple.TupleToolTISTOS.VerboseHlt1 = True
tuple.TupleToolTISTOS.VerboseHlt2 = True
tuple.TupleToolTISTOS.Verbose = True
tuple.TupleToolTISTOS.TriggerList = triggerList
return tuple
################
# Configure DaVinci
################
from Configurables import DaVinci, L0Conf
dv = DaVinci()
dv.DataType = '2012'
dv.EvtMax = -1
for line_info in line_infos:
print line_info
tuple = makeDecayTreeTuple( line_info[0], line_info[1], line_info[2], line_info[3] )
dv.UserAlgorithms += [ tuple ]
dv.Simulation = False
#from Configurables import CondDB
#CondDB(UseOracle = True)
DaVinci().DDDBtag = "dddb-20120831"
DaVinci().CondDBtag = "cond-20121211"
DaVinci().EnableUnpack = ['Stripping','Reconstruction']
dv.Lumi = True
示例7: EventNodeKiller
the_year = "2011"
## the_year = "2012"
from Configurables import EventNodeKiller
killer = EventNodeKiller("KillpRec")
killer.Nodes += ['/Event/pRec']
from Configurables import DaVinci
dv = DaVinci(
EventPreFilters=fltrs.filters('Filters'),
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__:
示例8: configure
def configure(datafiles,
catalogs=[],
castor=False,
params={}):
"""
Job configuration
"""
## needed for job configuration
from Configurables import DaVinci
the_year = "2011"
from BenderTools.Parser import hasInFile
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, 'Collision13'):
the_year = '2013'
elif hasInFile(datafiles, 'Stripping17'):
the_year = '2011'
elif hasInFile(datafiles, 'Stripping13'):
the_year = '2011'
elif hasInFile(datafiles, 'Stripping15'):
the_year = '2011'
elif hasInFile(datafiles, 'Stripping19'):
the_year = '2012'
elif hasInFile(datafiles, 'Stripping20r1'):
the_year = '2011'
elif hasInFile(datafiles, 'Stripping20r1p1'):
the_year = '2011'
elif hasInFile(datafiles, 'Stripping20r0p1'):
the_year = '2012'
elif hasInFile(datafiles, 'MC11'):
the_year = '2011'
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)
W_Location = '/Event/AllStreams/Phys/WMuLine/Particles'
from PhysSelPython.Wrappers import AutomaticData
W_Strip = AutomaticData(Location=W_Location)
EW_preambulo = [
"pion_cuts = in_range ( 300 * MeV , PT , 10 * GeV ) & ( CLONEDIST > 5000 ) & ( TRCHI2DOF < 5 ) & ( TRGHOSTPROB < 0.5 ) & ( PERR2/P2 < 0.05**2 ) ",
"ptCone_ = SUMCONE ( 0.25 , PT , '/Event/Phys/StdAllLoosePions/Particles' )",
"ptCone_2 = SUMCONE ( 0.25 , PT , '/Event/Phys/StdAllLoosePions/Particles' , pion_cuts )",
"etCone_ = SUMCONE ( 0.25 , PT , '/Event/Phys/StdLooseAllPhotons/Particles' )",
"ptCone = SINFO ( 55001 , ptCone_ , True ) ",
"ptCone2 = SINFO ( 55003 , ptCone_2 , True ) ",
"etCone = SINFO ( 55002 , etCone_ , True ) ",
]
# ========================================================================
# good W
# ========================================================================
from GaudiConfUtils.ConfigurableGenerators import FilterDesktop
gW = FilterDesktop(
Preambulo=EW_preambulo,
Code="""
in_range ( 15 * GeV , PT , 100 * GeV ) &
( -1e+10 * GeV < ptCone ) &
( -1e+10 * GeV < ptCone2 ) &
( -1e+10 * GeV < etCone )
"""
)
from PhysSelPython.Wrappers import Selection
W_Data = Selection(
'W',
Algorithm=gW,
RequiredSelections=[W_Strip]
)
from PhysSelPython.Wrappers import SelectionSequence
seq = SelectionSequence("Wseq", TopSelection=W_Data)
# counters
from Configurables import LoKi__CounterAlg as CounterAlg
cnt = CounterAlg(
'CharmEWCounters',
Location="Counters/CharmEW",
Preambulo=[
"from LoKiPhys.decorators import *",
"from LoKiCore.functions import *",
"pion_cuts = in_range ( 300 * MeV , PT , 120 * GeV ) & ( CLONEDIST > 5000 ) & ( TRCHI2DOF < 5 ) ",
"gamma_cuts = in_range ( 300 * MeV , PT , 10 * GeV ) ",
#.........这里部分代码省略.........
示例9: HLT_PASS_RE
STRIP_Code=" HLT_PASS_RE('Stripping.*(D0|Dh|D2|Ds|Lc|Lambdac)*.*') "
# , VOID_Code = " SKIP ( 50 ) "
)
the_year = "2011"
## the_year = "2012"
fltrs = fltrs.filters('Filters')
fltrs.reverse()
from Configurables import DaVinci
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 * '*'
示例10: stripping_line_name
'Hlt2TopoMu3BodyBBDT',
'Hlt2TopoMu4BodyBBDT',
'Hlt2TopoE2BodyBBDT',
'Hlt2TopoE3BodyBBDT',
'Hlt2TopoE4BodyBBDT',
'Hlt2TopoRad2BodyBBDT',
'Hlt2TopoRad2plus1BodyBBDT',
'Hlt2IncPhi',
'Hlt2IncPhiSidebands']))
args = argparser.parse_args()
linename = stripping_line_name('Pi', args.baryon)
strippingList = [stripping_line_name(bachelor, baryon) for bachelor in 'Pi', 'K' for baryon in 'Lc', 'Xic']
dv = DaVinci()
dv.TupleFile = 'DVTuples.root'
dv.HistogramFile = 'DVHistos.root'
dv.Lumi = True
dv.configure_data_opts(get_data_opts(args.datafile))
# Substitute PID of the head if it's Xib -> Xic as it's labelled as
# Lb -> Xic in the stripping.
aliases = ['X_b0', 'X_c', 'p', 'K', 'pi', 'bachelorPi']
linesettings, lineseq = \
dv.add_line_tuple_sequence(get_line_settings(linename, args.version),
L0List = args.L0List.split(),
HLT1List = args.HLT1List.split(),
HLT2List = args.HLT2List.split(),
strippingList = strippingList,
aliases = aliases,
示例11: ApplicationMgr
reports = evt[loc + "/DecReports"]
dec = "%sDecision" % decision
rep = reports.decReport(dec)
if rep and rep.decision():
found = True
break
if found:
break
return n
# Configure all the unpacking, algorithms, tags and input files
appConf = ApplicationMgr()
appConf.ExtSvc += ["ToolSvc", "DataOnDemandSvc", LoKiSvc()]
dv = DaVinci()
dv.DataType = "2012"
# disable for older versions of DV
# generally it seems in older versions of DV
# this whole script 'breaks' at places
# raising exceptions and yet works ...
dre = DecodeRawEvent()
dre.DataOnDemand = True
lhcbApp = LHCbApp()
lhcbApp.Simulation = True
CondDB().Upgrade = False
# don't really need tags for looking around
# LHCbApp().DDDBtag = ...
# LHCbApp().CondDBtag = ...
示例12: configure
def configure(datafiles,
catalogs=[],
castor=False,
params={}):
"""
Job configuration
"""
## needed for job configuration
from Configurables import DaVinci
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)
rootInTES = '/Event/Charm'
from PhysConf.Filters import LoKi_Filters
fltrs = LoKi_Filters(
STRIP_Code="""
HLT_PASS_RE ( 'Stripping.*Xicc.*ForPromptCharm.*' )
"""
)
davinci = DaVinci(
DataType=the_year,
EventPreFilters=fltrs.filters('Filters'),
InputType='MDST',
RootInTES=rootInTES,
Simulation=False,
PrintFreq=1000,
EvtMax=-1,
#
HistogramFile='Xic_Histos.root',
TupleFile='Xic.root',
#
Lumi=True,
#
)
from BenderTools.Utils import silence
silence()
from Configurables import TrackScaleState
state_scale = TrackScaleState(
'StateScale',
)
davinci.UserAlgorithms = [state_scale, 'Xi1', 'Xi2']
from Configurables import CondDB
CondDB(LatestGlobalTagByDataType=the_year)
#
# come back to Bender
#
setData(datafiles, catalogs, castor)
#
# start Gaudi
#
gaudi = appMgr()
#
alg1 = Xicc(
'Xi1', # Algorithm name ,
RootInTES=rootInTES,
Inputs=['Phys/Xicc+ForPromptCharm/Particles']
)
#.........这里部分代码省略.........
示例13: IOHelper
#'/lhcb/LHCb/Collision12/DIMUON.DST/00020198/0001/00020198_00016402_1.dimuon.dst',
#'/lhcb/LHCb/Collision12/DIMUON.DST/00020198/0001/00020198_00014253_1.dimuon.dst',
#'/lhcb/LHCb/Collision12/DIMUON.DST/00020198/0001/00020198_00014185_1.dimuon.dst'
]
input = s20
#
## Input data
from GaudiConf import IOHelper
PFN = 'PFN:root://eoslhcb.cern.ch//eos/lhcb/grid/prod'
ioh = IOHelper()
ioh.inputFiles ( [ PFN + i for i in input ] )
from Configurables import DaVinci
davinci = DaVinci()
##davinci.EvtMax = 100000
davinci.PrintFreq = 100
davinci.EvtMax = 10000
## davinci.EvtMax = 1000
# davinci.PrintFreq = 1
# davinci.SkipEvents = 37890
# davinci.EvtMax = 20
# davinci.PrintFreq = 100
# davinci.SkipEvents = 1
示例14: configure
#.........这里部分代码省略.........
in_range ( 5.9 * GeV , AM , 6.6 * GeV )
""" ,
#
MotherCut="""
( chi2vx < 16 ) &
( ctau > 50 * micrometer )
""" ,
ParticleCombiners={'': 'LoKi::VertexFitter'},
ReFitPVs=True
)
#
Bc_1p = Selection(
'Psi1Pi',
Algorithm=bc_pi,
RequiredSelections=[jpsi, pions]
)
from PhysSelPython.Wrappers import SelectionSequence
Bc_1PI = SelectionSequence("PSIPi", TopSelection=Bc_1p)
Bc_3PI = SelectionSequence("PSI3Pi", TopSelection=Bc_3p)
Bc_Ds = SelectionSequence("PSIDs", TopSelection=BDs_sel)
# Read only fired events to speed up
from PhysConf.Filters import LoKi_Filters
fltrs = LoKi_Filters(
STRIP_Code="HLT_PASS_RE('Stripping.*DiMuonJpsi2MuMuDeta.*')",
VOID_Code="""
0.5 < CONTAINS('%s')
""" % jpsi_location
)
# =====================================================================
from Configurables import DaVinci # needed for job configuration
the_year = '2011'
davinci = DaVinci(
EventPreFilters=fltrs.filters('FilterMC'),
DataType=the_year,
InputType='DST',
Simulation=True,
PrintFreq=1000,
EvtMax=-1,
#
HistogramFile='BcMC_Histos.root',
TupleFile='BcMC.root',
## HistogramFile = 'BcMC1pi_Histos.root' ,
## TupleFile = 'BcMC1pi.root' ,
#
# for Ds
#DDDBtag = 'MC2011-20120727' ,
#CondDBtag = 'MC2011-20120727-vc-mu100' ,
#
# for pi
# DDDBtag = 'MC11-20111102' ,
# CondDBtag = 'sim-20111111-vc-md100' ,
#
## Lumi = True ,
#
)
from Configurables import GaudiSequencer
seqDs = GaudiSequencer(
'DS',
Members=[Bc_Ds . sequence(),
示例15: get_streams
streams = get_streams(strippingVersion)
dtt = DecayTreeTuple('Dst2010ToD0ToKpipiTuple', Inputs = ['/Event/AllStreams/Phys/D2hhPromptDst2D2RSLine/Particles'], Decay = '[D*(2010)+ -> (D0 -> K- pi+) pi+]CC')
ttmc = dtt.addTupleTool('TupleToolMCTruth')
ttmc.ToolList += ['MCTupleToolPrompt']
ttmc.ToolList += ['MCTupleToolHierarchy']
dtt.ToolList += ['TupleToolMCTruth',
#'TupleToolGeneration'
'TupleToolMCBackgroundInfo'
]
dtfVars = {
# Index 0 for CHILDFUN meas the particle itself, so 1 is the D0.
"DTF_M_D0_BPVIPCHI2" : "DTF_FUN(CHILDFUN(BPVIPCHI2(), 1), False, 'D0')"
}
decayDesc = dtt.Decay.replace('^', '')
dtt.addBranches({'Dst' : decayDesc})
dstLoKiTuple = LoKi__Hybrid__TupleTool('DstLoKiTuple')
dstLoKiTuple.Variables = dtfVars
dtt.Dst.ToolList += [ "LoKi::Hybrid::TupleTool/DstLoKiTuple" ]
dtt.Dst.addTool(dstLoKiTuple)
dtt.Dst.InheritTools = True
dv = DaVinci('DaVinci', DataType = '2011', TupleFile = 'DVTuples.root', HistogramFile = 'DVHistos.root', UserAlgorithms = [dtt], Lumi = True, DDDBtag = 'Sim08-20130503', CondDBtag = 'Sim08-20130503-vc-md100', Simulation = True)
FileCatalog().Catalogs = ["xmlcatalog_file:/afs/cern.ch/work/m/malexand//charm/2011/data/mc/pool_xml_catalog.xml"]
dv.EvtMax = 1000