190 likes | 202 Views
DecayTreeTuple – an update ( v2r3p1). Robert W. Lambert, Imperial College London. What is DecayTreeTuple. DecayTreeTuple is: A labour-saving device A common tool for writing ntuples Continuously expanding/developing Highly configurable An ntuple is:
E N D
DecayTreeTuple – an update(v2r3p1) Robert W. Lambert, Imperial College London. Software Week, June 2009
What is DecayTreeTuple • DecayTreeTuple is: • A labour-saving device • A common tool for writing ntuples • Continuously expanding/developing • Highly configurable • An ntuple is: • User defined quick and dirty analysis solution • A compact ordered list of all relevant data • A reduced, condensed set of data about events/candidates • One typical starting point for an analysis • Easily viewed/plotted in Root • Produced from DSTs (possibly micro-DSTs) Software Week, June 2009
What is a TupleTool? • A TupleTool: • Adds information into the tuple • Contains a “Fill” method • Is called by the DecayTreeTuple • Will typically contain a set of common entries • Previous talk: • http://indico.cern.ch/contributionDisplay.py?contribId=26&sessionId=2&confId=25000 • Jeremie Borel, March 2008 • There has been a lot of work since then!! • I will give an overview of where we are now Software Week, June 2009
Purpose of this talk • For the unconverted: • Introduce DecayTreeTuple • Demonstrate the use of DecayTreeTuple • Categorise types of TupleTools • Introduce the new DaVinci Tutorial • For Everyone • Provide an up-to-date list of all TupleTools • Provide a quick-reference of tool useage • For Experts • Give an overview of what has changed • Open discussion of what needs to be changed in the future Software Week, June 2009
Using DecayTreeTuple • Pick a Type of Tuple • Pick the TupleTools you want to write • Configure the tools in your python opts file Software Week, June 2009
1.Types of Tuple • EventTuple • Writes out one entry per event • Filled by (MC)EventTupleTools • MCDecayTreeTuple • Uses the MCDecayFinder • Writes once per candidate, LHCb::MCParticle • Filled by MC(Particle)TupleTools • DecayTreeTuple • Uses the PhysDesktop and a DecayDescriptor • Writes once per decay candidate, LHCb::Particle • Filled by (Particle)TupleTools Software Week, June 2009
2.TupleTools • TupleTools add/fill information into the ntuple • TupleTools inherit from one of three base classes • IEventTupleTool • Fills information about the event • IParticleTupleTool • Fills information about an LHCb::Particle • IMCParticleTupleTool • Fills information about an LHCb::MCParticle Software Week, June 2009
EventTupleTools • Can be added to any of the tuples, to fill info about the event Software Week, June 2009
MCParticle TupleTools • Added to an MCDecayTreeTuple, fills info on MCParticles Software Week, June 2009
Particle TupleTools • Added to a DecayTreeTuple, fills info about the particles Software Week, June 2009
Special TupleTools • LoKi::Hybrid::TupleTool • Add any entry which exists in the CombineParticles framework • Perform basic maths with/between entries • TupleToolMCBackgroundInfo • Does MCTruth association through BackgroundCategory • Stores the results • TupleToolMCTruth • Performs MCTruth association with SmartAssociator • Fills MCParticleTupleTools attached to it • TupleToolPi0 • Information and MCTruth association for special case of Pi0 Software Week, June 2009
3. Using options • Get an instance and add the TupleTools • Define the decay, with ^ for the particles to process • The ‘head’ particle is processed by default from Configurables import DecayTreeTuple tuple = DecayTreeTuple() tuple.InputLocations = [ "Bs2JpsiPhi" ] #your algorithm name tuple.ToolList += [ "TupleToolMCTruth" , "TupleToolMCBackgroundInfo" , "TupleToolKinematic" , "TupleToolEventInfo" , "TupleToolTrackInfo" ] tuple.Decay = "[B_s0 -> (^J/psi(1S) => ^mu+ ^mu-) (^phi(1020) -> ^K+ ^K-)]cc” Software Week, June 2009
LoKi::Hybrid::TupleTool • A VERY powerful TupleTool • Add anything from the CombineParticles framework • Massive list of LoKi::Hybrid functors to choose from: • https://twiki.cern.ch/twiki/bin/view/LHCb/LoKiHybridFilters LoKi_B=LoKi__Hybrid__TupleTool("LoKi_B") LoKi_B.Variables = { # " name " : " functor ", “PID" : "ID" , "BPVDIRA" : "BPVDIRA" , "MassDiff_Bs0" : "DMASS('B_s0')" , "P2" : "P*P“ } tuple.addTool(LoKi_B) tuple.ToolList+=["LoKi::Hybrid::TupleTool/LoKi_B"] Software Week, June 2009
MCTruth • To add MCTruth information, you first add the MCTruth Tool • This does the association, • Then fill MC(Particle)TupleTools for this associate • (No need for multiple assosciation calls) tuple = DecayTreeTuple() … tuple.ToolList += [ "TupleToolMCTruth" ] MCTruth = TupleToolMCTruth() MCTruth.ToolList = [ "MCTupleToolKinematic" , "MCTupleToolHierarchy" ] tuple.addTool(MCTruth) Software Week, June 2009
Tutorial • Tutorial/Analysis v8r2 • DaVinci Tutorial 6 • Basic DecayTreeTuple • https://twiki.cern.ch/twiki/bin/view/LHCb/DaVinciTutorial6 • Setting up and using a few tools • DaVinci Tutorial 7 • Advanced DecayTreeTuple • https://twiki.cern.ch/twiki/bin/view/LHCb/DaVinciTutorial7 • LoKi::Hybrid::TupleTool • Working with MCTruth • Configuring Branches • Writing your own TupleTool Software Week, June 2009
Summary • Tuples are often the starting point for a user analysis • DecayTreeTuple is a common labour-saving tool • Latest version v2r3p1 • Many changes have happened recently: • Now many TupleTools • Can/Should use LoKi::Hybrid::TupleTool where possible • MCTruth association simplified • New tutorials reflect the situation • Tutorial/Analysis v8r2 • Enjoy your analysis! Software Week, June 2009
End • Questions/Discussion Software Week, June 2009
Backup • Backup slides Software Week, June 2009
Branches • Branches are used to separate out particles: • Different TupleTools can be added/configured for each one tuple.Branches={ "B" : "[B_s0]cc : [B_s0 -> (J/psi(1S) => mu+ mu-) (phi(1020) -> K+ K-)]cc" , "KPlus" : "[B_s0]cc -> (phi(1020) -> ^K+ K-) ? " , "KMinus" : "[B_s0]cc -> (phi(1020) -> K+ ^K-) ? " } tuple.addTool(TupleToolDecay, name="B") LoKi_B=LoKi__Hybrid__TupleTool("LoKi_B") LoKi_B.Variables = { "PID" : "ID" , "BPVDIRA" : "BPVDIRA" , "MassDiff_Bs0" : "DMASS('B_s0')" } tuple.B.ToolList+=["LoKi::Hybrid::TupleTool/LoKi_B"] tuple.B.addTool(LoKi_B) Software Week, June 2009