for tup in mctuples: tup.addTool(MCTupleToolKinematic()) tup.MCTupleToolKinematic.Verbose=True tup.addTool(LoKi_Photos) tup.ToolList = [ "MCTupleToolHierarchy" , "MCTupleToolKinematic" , "LoKi::Hybrid::MCTupleTool/LoKi_Photos" # doesn't work with DaVinci v36r6 ] tup.addTool(TupleToolMCTruth, name = "TruthTool") tup.addTool(TupleToolMCBackgroundInfo, name = "BackgroundInfo") tup.ToolList += ["TupleToolMCTruth/TruthTool"] tup.ToolList += ["TupleToolMCBackgroundInfo/BackgroundInfo"] if OUTPUTLEVEL == DEBUG: from Configurables import PrintMCTree, PrintMCDecayTreeTool mctree = PrintMCTree("PrintTrue") mctree.addTool( PrintMCDecayTreeTool ) mctree.PrintMCDecayTreeTool.Information = "Name M P Px Py Pz Pt Vx Vy Vz" mctree.ParticleNames = [ "B+", "B-" ] mctree.Depth = 3 # down to the K and mu ######################################################################################################### # Now set up the DecayTreeTuples for the reconstructed particles ######################################################################################################### tupletools = [] tupletools.append("TupleToolPrimaries") tupletools.append("TupleToolKinematic") tupletools.append("TupleToolGeometry") tupletools.append("TupleToolTrackInfo") tupletools.append("TupleToolPid") tupletools.append("TupleToolRecoStats")
AcceptBadEvents = False, BadEventSelection = filterBadEvents ) DaVinci().appendToMainSequence( [ eventNodeKiller, sc.sequence() ] ) # MC Tuples addMCTuple('phi2KsKs', '[phi(1020) -> ^(KS0 -> ^pi+ ^pi-) ^(KS0 -> ^pi+ ^pi-)]CC') addMCTuple('phi2KsKl', '[phi(1020) -> ^(KS0 -> ^pi+ ^pi-) ^(KL0 -> ^pi+ ^pi-)]CC') addMCTuple('Ds_phi2KsKl', '[D_s+ -> ^(phi(1020) -> ^(KS0 -> ^pi+ ^pi-) ^(KS0 -> ^pi+ ^pi-)) ^pi+]CC') if 'minbias' in dataSample.name: addMCTuple('phi2KK', '[phi(1020) -> ^K- ^K-]CC') # addMCTuple('KsKs', '[(KS0 -> ^pi+ ^pi-)cc && (KS0 -> ^pi+ ^pi-)cc]') addMCTuple('Ks', '[KS0 -> ^pi+ ^pi-]CC') from Configurables import PrintMCTree, PrintMCDecayTreeTool mctree = PrintMCTree("PrintTruePhi") mctree.addTool(PrintMCDecayTreeTool, name = "PrintMC") mctree.PrintMC.Information = "Name" mctree.ParticleNames = [ "phi(1020)", 'KS0' ] mctree.Depth = 2 ########################################################### for strLine in [Phi2KsKs_line]: strLine.select() strLine.makeTuple() DaVinci().appendToMainSequence( [ strLine.sequence.sequence() ])
tup.addTool(MCTupleToolKinematic()) tup.MCTupleToolKinematic.Verbose = True tup.addTool(LoKi_Photos) tup.ToolList = [ "MCTupleToolHierarchy", "MCTupleToolKinematic", "LoKi::Hybrid::MCTupleTool/LoKi_Photos" # doesn't work with DaVinci v36r6 ] tup.addTool(TupleToolMCTruth, name="TruthTool") tup.addTool(TupleToolMCBackgroundInfo, name="BackgroundInfo") tup.ToolList += ["TupleToolMCTruth/TruthTool"] tup.ToolList += ["TupleToolMCBackgroundInfo/BackgroundInfo"] if OUTPUTLEVEL == DEBUG: from Configurables import PrintMCTree, PrintMCDecayTreeTool mctree = PrintMCTree("PrintTrue") mctree.addTool(PrintMCDecayTreeTool) mctree.PrintMCDecayTreeTool.Information = "Name M P Px Py Pz Pt Vx Vy Vz" mctree.ParticleNames = ["B+", "B-"] mctree.Depth = 3 # down to the K and mu ######################################################################################################### # Now set up the DecayTreeTuples for the reconstructed particles ######################################################################################################### tupletools = [] tupletools.append("TupleToolPrimaries") tupletools.append("TupleToolKinematic") tupletools.append("TupleToolGeometry") tupletools.append("TupleToolTrackInfo") tupletools.append("TupleToolPid") tupletools.append("TupleToolRecoStats")
mctuple = MCDecayTreeTuple("MCDecayTreeTuple") mctuple.Decay = decay mctuple.ToolList = [ "MCTupleToolHierarchy", "LoKi::Hybrid::MCTupleTool/LoKi_Photos" ] # Add a 'number of photons' branch #mctuple.addTupleTool("MCTupleToolReconstructed").Associate = False #mctuple.MCTupleToolReconstructed.FillPID = False mctuple.addTupleTool("MCTupleToolKinematic").Verbose = True mctuple.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Photos").Variables = { "nPhotos": "MCNINTREE(('gamma' == MCABSID))" } mctuple.addTupleTool("MCTupleToolP2VV").Calculator = 'MCBs2JpsiPhiAngleCalculator' # Print the decay tree for any particle in decay_heads printMC = PrintMCTree() printMC.ParticleNames = decay_heads # Name of the .xgen file produced by Gauss EventSelector().Input = ["DATAFILE='{0}' TYP='POOL_ROOTTREE' Opt='READ'".format(datafile) for datafile in datafiles] # Configure DaVinci DaVinci().PrintFreq = 10000 DaVinci().TupleFile = "/Disk/speyside8/lhcb/gcowan1/generation/Bs2JpsiPhi/DVntuple.root" DaVinci().Simulation = True DaVinci().Lumi = False DaVinci().DataType = str(year) #DaVinci().UserAlgorithms = [printMC, mctuple] DaVinci().UserAlgorithms = [mctuple]
for b in bad : del algs[b] dod.AlgMap = algs from Configurables import EventClockSvc, CondDB EventClockSvc ( EventTimeDecoder = "FakeEventTime" ) CondDB ( IgnoreHeartBeat = True ) appendPostConfigAction( doIt) mctl=[ 'MCTupleToolHierarchy', 'MCTupleToolKinematic', 'MCTupleToolPrimaries'] #mctl=[ 'MCTupleToolKinematic'] mct.ToolList=mctl #mctB.ToolList=mctl printMC = PrintMCTree() printMC.ParticleNames = ["Lambda_c+","Lambda_c~-"] printMC.ParticleNames = ["D0","D~0"] printMC.ParticleNames = ["Xi_cc++","Xi_cc~--"] printMC.ParticleNames = ["B0","B~0"] printMC.ParticleNames = ["B+","B-"] ######################################################################## from Configurables import DaVinci DaVinci().EvtMax = -1 #DaVinci().PrintFreq = 1 #DaVinci().SkipEvents = 4 # Events to skip DaVinci().DataType = "2018"
# For a quick and dirty check, you don't need to edit anything below here. ########################################################################## # Create an MC DTT containing any candidates matching the decay descriptor mctuple = MCDecayTreeTuple("MCDecayTreeTuple") mctuple.Decay = decay mctuple.ToolList = ["MCTupleToolHierarchy", "LoKi::Hybrid::MCTupleTool/LoKi_Photos"] # Add a 'number of photons' branch # mctuple.addTupleTool("MCTupleToolReconstructed").Associate = False # mctuple.MCTupleToolReconstructed.FillPID = False mctuple.addTupleTool("MCTupleToolKinematic").Verbose = True mctuple.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Photos").Variables = {"nPhotos": "MCNINTREE(('gamma' == MCABSID))"} mctuple.addTupleTool("MCTupleToolP2VV").Calculator = "MCBs2JpsiPhiAngleCalculator" # Print the decay tree for any particle in decay_heads printMC = PrintMCTree() printMC.ParticleNames = decay_heads # Name of the .xgen file produced by Gauss EventSelector().Input = ["DATAFILE='{0}' TYP='POOL_ROOTTREE' Opt='READ'".format(datafile) for datafile in datafiles] # Configure DaVinci DaVinci().PrintFreq = 10000 DaVinci().TupleFile = "/Disk/speyside8/lhcb/gcowan1/generation/Bs2JpsiPhi/DVntuple.root" DaVinci().Simulation = True DaVinci().Lumi = False DaVinci().DataType = str(year) # DaVinci().UserAlgorithms = [printMC, mctuple] DaVinci().UserAlgorithms = [mctuple]
# Options for a typical DaVinci job creating DSTs # # @author Patrick Koppenburg # @date 2009-02-04 # ######################################################################## from Gaudi.Configuration import * from Configurables import DaVinci ############################################################################## # # Print the J/psi # from Configurables import PrintDecayTree, PrintHeader, PrintMCTree pJpsi = PrintDecayTree('PrintJpsi') pJpsi.Inputs = ["MyJpsi"] pMC = PrintMCTree() pMC.ParticleNames = ['J/psi(1S)'] # ph = PrintHeader() # from Configurables import DecayTreeTuple tuple = DecayTreeTuple("Tuple") tuple.Inputs = ["MyJpsi"] tuple.ToolList += [ "TupleToolMCBackgroundInfo", "TupleToolMCTruth", "TupleToolKinematic" ] tuple.Decay = "J/psi(1S) -> ^mu+ ^mu-" ############################################################################## # #
mctuple.ToolList = [ "MCTupleToolHierarchy" , "MCTupleToolKinematic" , "LoKi::Hybrid::MCTupleTool/LoKi_Photos" ] mctuple.addTool(MCTupleToolKinematic()) mctuple.MCTupleToolKinematic.Verbose=True # LoKi variables LoKi_Photos = LoKi__Hybrid__MCTupleTool("LoKi_Photos") LoKi_Photos.Variables = { "nPhotos" : "MCNINTREE ( ('gamma'==MCABSID) )" } mctuple.addTool(LoKi_Photos) pMC = PrintMCTree() pMC.ParticleNames = [ DecayHeader ] DaVinci().TupleFile = 'tupleProduction-'+EventType+'.root' DaVinci().EvtMax = -1 DaVinci().Simulation = True DaVinci().Lumi = False DaVinci().InputType = "DST" DaVinci().DataType = "2012" DaVinci().UserAlgorithms = [ pMC, mctuple ] EventSelector().Input = [ "DATAFILE='Gauss-%s.xgen' TYP='POOL_ROOTTREE' Opt='READ'"%EventType ]
from Configurables import MCDecayTreeTuple mcTuple = MCDecayTreeTuple("MCTuple") mcTuple.Decay = "( [ [B0]nos => ^( J/psi(1S) => ^mu+ ^mu- ) ^( KS0 => ^pi+ ^pi- ) ]CC ) || ( [ [B0]os -> ^( J/psi(1S) => ^mu+ ^mu- ) ^( KS0 => ^pi+ ^pi- ) ]CC )" mcTuple.ToolList = [ "MCTupleToolKinematic", "TupleToolEventInfo", "MCTupleToolReconstructed" ] from Configurables import MCTupleToolReconstructed, MCReconstructed #ToolSvc().addTool(MCReconstructed) #ToolSvc().MCReconstructed.OutputLevel = 1 #mcTuple.OutputLevel = 1 from Configurables import PrintMCTree pmc = PrintMCTree() pmc.ParticleNames = ["B0", "B~0"] ######################################################################## # # DaVinci # from Configurables import DaVinci DaVinci().EvtMax = 100 DaVinci().SkipEvents = 0 DaVinci().DataType = "2010" DaVinci().Simulation = True #DaVinci().CondDBtag = 'MC09-20100827-vc-md100' DaVinci().TupleFile = "DecayTreeTuple.root" # Ntuple DaVinci().MoniSequence = [tuple, evtTuple, mcTuple] # , pmc ] DaVinci().appendToMainSequence([sc.sequence()])
####################################################################### # # Print Reconstructed Bs # from Configurables import PrintDecayTree, PrintDecayTreeTool tree = PrintDecayTree("PrintFoundBs") tree.Inputs = [SeqBs2JpsiPhi.outputLocation()] tree.addTool(PrintDecayTreeTool, name="PrintDecay") tree.PrintDecay.Information = "Name M P Px Py Pz Pt chi2" DaVinci().MoniSequence = [tree] # The monitoring stuff ####################################################################### # # Print Print All True Bs (only on MC) # from Configurables import PrintMCTree, PrintMCDecayTreeTool mctree = PrintMCTree("PrintTrueBs") mctree.addTool(PrintMCDecayTreeTool) mctree.PrintMCDecayTreeTool.Information = "Name M P Px Py Pz Pt chi2" mctree.ParticleNames = ["B_s0", "B_s~0"] mctree.Depth = 2 # down to the K and mu DaVinci().MoniSequence += [mctree] # The monitoring stuff ####################################################################### # # Configure the application # DaVinci().UserAlgorithms = [seq] # The selection sequence DaVinci().HistogramFile = "DVHistos_5.root" # Histogram file DaVinci().EvtMax = 1000 # Number of events DaVinci().DataType = "2012" # DaVinci().Simulation = True #