Introduction to DaVinci Roel Aaij Nikhef, Amsterdam LHCb Week 26 - - PowerPoint PPT Presentation

introduction to davinci
SMART_READER_LITE
LIVE PREVIEW

Introduction to DaVinci Roel Aaij Nikhef, Amsterdam LHCb Week 26 - - PowerPoint PPT Presentation

Intro Functors Workflow Exercises Introduction to DaVinci Roel Aaij Nikhef, Amsterdam LHCb Week 26 September 2011 Many thanks to Patrick Koppenburg for letting me cannibalise his slides! Roel Aaij (Nikhef) Introduction to DaVinci 26


slide-1
SLIDE 1

Intro Functors Workflow Exercises

Introduction to DaVinci

Roel Aaij

Nikhef, Amsterdam

LHCb Week 26 September 2011

Many thanks to Patrick Koppenburg for letting me cannibalise his slides!

Roel Aaij (Nikhef) Introduction to DaVinci 26 September 2011 Tutorial 1 / 19

slide-2
SLIDE 2

Intro Functors Workflow Exercises

Contents

1 Introduction to DaVinci 2 LoKi-Hybrid Functors 3 Workflow and Data 4 Exercises Roel Aaij (Nikhef) Introduction to DaVinci 26 September 2011 Tutorial 2 / 19

slide-3
SLIDE 3

Intro Functors Workflow Exercises

Contents

1 Introduction to DaVinci 2 LoKi-Hybrid Functors 3 Workflow and Data 4 Exercises Roel Aaij (Nikhef) Introduction to DaVinci 26 September 2011 Tutorial 3 / 19

slide-4
SLIDE 4

Intro Functors Workflow Exercises

DaVinci Links

DaVinci web page:DaVinci project page From there you’ll find :

Some documentation. Links to doxygen. The DaVinci wiki and Tutorial page

Bugs and feature requests are tracked in the LHCb software Savannah page. If you think you see a bug, go there first. Any DaVinci question can be asked at the DaVinci mailing list: lhcb-davinci@cern.ch .

You need to be registered to use it. You can do that online.

Distributed analysis question should be asked at lhcb-distributed-analysis@cern.ch . General software questions should go to lhcb-soft-talk@cern.ch Always give all information that is relevant to your question! (no “It stopped working. What has changed?”)

Roel Aaij (Nikhef) Introduction to DaVinci 26 September 2011 Tutorial 4 / 19

slide-5
SLIDE 5

Intro Functors Workflow Exercises

Input: ProtoParticles

ProtoParticles: are the end of the reconstruction stage have all the links about how they have been reconstructed have a list of PID hypothesis with a probability contain the kinematic information Charged ProtoParticles: One per track Add Rich, Calo, Muon info Neutral ProtoParticles: One per Cluster Add Track info (could be an electron)

Roel Aaij (Nikhef) Introduction to DaVinci 26 September 2011 Tutorial 5 / 19

slide-6
SLIDE 6

Intro Functors Workflow Exercises

Particles

Particle = ProtoParticle + one PID choice

  • ne defined mass

Physics analyses deal with Particles

You need to know the 4-vectors to compute the mass of a resonance

The PID is your choice

The same ProtoParticle can be made into a π+ and a µ+. . . This makes sense. Think of a pion from B → ππ decaying in

  • flight. Does it stop being a signal pion because it decayed

before the Muon detector? Some ProtoParticles can be ignored All this is done by configuring a ParticleMaker algorithm

You don’t need to worry about the configuration. Many standards are pre-defined But you need to choose which to use.

Roel Aaij (Nikhef) Introduction to DaVinci 26 September 2011 Tutorial 6 / 19

slide-7
SLIDE 7

Intro Functors Workflow Exercises

Standard Particles

To ensure that everybody agrees on what is a K +, a π+ or a K 0

S, we have a set of standard particles predefined.

They are defined in python/CommonParticles/*.py in the Phys/CommonParticles package (svn link). All you need to know are the names of the algorithm that created them: StdLooseKaons, StdTightProtons . . . StdNoPIDsXxxx: All tracks are made to Xxxx (IPχ2 applied) StdAllXxxxYyyy: Same but without IPχ2 applied. StdLooseXxxx: Loose PID cuts for hypothesis Xxxx StdTightXxxx: Tight PID cuts for hypothesis Xxxx They are interfaces to the selection framework (see later)

from StandardParticles import StdLooseMuons, StdLoosePions print StdLooseMuons.outputLocation()

Roel Aaij (Nikhef) Introduction to DaVinci 26 September 2011 Tutorial 7 / 19

slide-8
SLIDE 8

Intro Functors Workflow Exercises

Creating and Selecting Particles

A Selection is a sequence of algorithms which create or filter Particles. In the stripping: start from final state Particles and produce

  • ne or more steps of composite particles:

Bs → J/ψ(→ µ+µ−)φ(→ K +K −). In user jobs: start from some existing particles and apply extra cuts or use them to create a new decay tree. Big Fat Warning: Don’t try to redo all the combinatorics on a stripped DST.

Roel Aaij (Nikhef) Introduction to DaVinci 26 September 2011 Tutorial 8 / 19

slide-9
SLIDE 9

Intro Functors Workflow Exercises

Creating and Selecting Particles

A Selection is a sequence of algorithms which create or filter Particles. In the stripping: start from final state Particles and produce

  • ne or more steps of composite particles:

Bs → J/ψ(→ µ+µ−)φ(→ K +K −). In user jobs: start from some existing particles and apply extra cuts or use them to create a new decay tree. Big Fat Warning: Don’t try to redo all the combinatorics on a stripped DST. You cannot cut looser than the stripping already did and will not be able to unfold the biases, so: DON’T TRY, EVER!!

Roel Aaij (Nikhef) Introduction to DaVinci 26 September 2011 Tutorial 8 / 19

slide-10
SLIDE 10

Intro Functors Workflow Exercises

How to work with Particles

There are several ways to get a the numbers for your analysis out: Plain C++: DVAlgorithm inherits from GaudiAlgorithm (and

  • GaudiTupleAlg. . . ), some typing saved, bugs prevented.

LoKi: “Loops and Kinematics”. Templated C++, more typing saved, more bugs prevented. GaudiPython, Bender: Interactive python, will come to that later. LoKi::Hybrid: Used in Stripping. The common assumption is that physicists always do the same, hence any line of C++ you type is likely to be a duplication of what your office-mate is typing right now.

Roel Aaij (Nikhef) Introduction to DaVinci 26 September 2011 Tutorial 9 / 19

slide-11
SLIDE 11

Intro Functors Workflow Exercises

Contents

1 Introduction to DaVinci 2 LoKi-Hybrid Functors 3 Workflow and Data 4 Exercises Roel Aaij (Nikhef) Introduction to DaVinci 26 September 2011 Tutorial 10 / 19

slide-12
SLIDE 12

Intro Functors Workflow Exercises

LoKi-Hybrid

In the end, you are interested either in properties of your particles, or you want to select then. The LHCb software contains a large set of LoKi functors which implement these (and more) operations. They are implemented in C++, but can be used in python too!

Commonly used are M, P, PT, TRCHI2, but also BPVLTCHI2,

  • CHILDCUT. Some take arguments, some don’t. Example:

(M > 2.5 ∗ GeV)&(M < 4 ∗ GeV). The idea is that any reasonable selection requirement can be coded using functors.

The list can be viewed here: https://twiki.cern.ch/twiki/bin/view/LHCb/LoKiHybridFilters It’s very sensitive to syntax orthodoxy. The parentheses are not optional. And it’s &, not && or and.

Roel Aaij (Nikhef) Introduction to DaVinci 26 September 2011 Tutorial 11 / 19

slide-13
SLIDE 13

Intro Functors Workflow Exercises

LoKi-Hybrid Demo

As it’s python it can be tested at the python prompt:

from math import sqrt from LoKiPhys.decorators import * from LoKiCore.functions import monitor p = LHCb.Particle() p.setParticleID( LHCb.ParticleID(11) ) m = p.momentum() m.SetPx ( 1000 ) m.SetPy (

  • 1000 )

m.SetPz ( 10000 ) m.SetE ( sqrt( m.P2() + 5000*5000 ) ) p.setMomentum ( m ) fun = PX+PY print PX(p), PY(p) , fun(p) fun2 = PX>750 print fun2(p) fun3 = monitor(fun2) print fun3(p) from LoKiCore.doxygenurl import browse browse(PT) Roel Aaij (Nikhef) Introduction to DaVinci 26 September 2011 Tutorial 12 / 19

slide-14
SLIDE 14

Intro Functors Workflow Exercises

Contents

1 Introduction to DaVinci 2 LoKi-Hybrid Functors 3 Workflow and Data 4 Exercises Roel Aaij (Nikhef) Introduction to DaVinci 26 September 2011 Tutorial 13 / 19

slide-15
SLIDE 15

Intro Functors Workflow Exercises

What to do?

The workflow of you analysis should be:

1 Read your candidates 2 Refine your candidates (more cuts) 3 TisTos your candidate

If TIS, you’re lucky, keep it If TOS, keep it only if Tossed by one of “your” lines

4 Store (or fit) it somehow. 1

DecayTreeTuple (not good, but sometimes useful)

2

DST (better, but number of events must be “small”)

3

MicroDST (best)

4

GaudiPython (very useful for testing and reading your own DST/MicroDST)

5 In all cases: Make sure you know what you need before

starting (Stripping and Trigger).

Roel Aaij (Nikhef) Introduction to DaVinci 26 September 2011 Tutorial 14 / 19

slide-16
SLIDE 16

Intro Functors Workflow Exercises

The Data

Open the Bookkeeping using:

The Dirac web portal the BK GUI (lhcb bkk on lxplus) Ganga

Look at LHCb/Collision11. You can take magnet down or up. Real Data. We’re up to Reco 11a - Stripping 16 (17 is the soon to start reprocessing). Select your stream (DIMUON.DST for this tutorial). One or two files is more than enough for our purpose.

Roel Aaij (Nikhef) Introduction to DaVinci 26 September 2011 Tutorial 15 / 19

slide-17
SLIDE 17

Intro Functors Workflow Exercises

Contents

1 Introduction to DaVinci 2 LoKi-Hybrid Functors 3 Workflow and Data 4 Exercises Roel Aaij (Nikhef) Introduction to DaVinci 26 September 2011 Tutorial 16 / 19

slide-18
SLIDE 18

Intro Functors Workflow Exercises

Hands-on Exercises

Several exercises available: Have a look at DaVinci Tutorial 0.5 and 8 to: You’ll need the head of Tutorial/Analysis.

Create a Ganga JobTemplate for DaVinci. Be introduced to Selections. Write an NTuple using DecayTreeTuple.

Follow this up with the GaudiPython excersises to:

Directly inspect particles. Fill histograms and NTuples. Use functors to conveniently get particle properties.

If you’re still not done, try to make a selection for B+ → J/ψK + starting from the NeuroBayes J/ψ and adding StdLooseKaons. You can also have a look at the wonderful world of Bender.

Roel Aaij (Nikhef) Introduction to DaVinci 26 September 2011 Tutorial 17 / 19

slide-19
SLIDE 19

Intro Functors Workflow Exercises

DaVinci Tutorial

  • Ex. 0: Set things up
  • Ex. 1: Loop over muons and make some plots
  • Ex. 2: Extend the algorithm to make a J/ψ (if you have time)
  • Ex. 3: Make your algorithm more generic: select also a φ

Do Ex. 1 to 3 if you plan to develop C++ in DaVinci.

  • Ex. 4: The recommended way of writing a selection

Everything you need is on the wiki page The main difficulty is to figure out what to copy-paste where. Don’t be afraid to ask if you are unsure

  • Ex. 5: Debugging
  • Ex. 6: MC truth, Trigger, Tagging, and much more
  • Ex. 7: More Tuples
  • Ex. 8: Read Stripped DSTs

Roel Aaij (Nikhef) Introduction to DaVinci 26 September 2011 Tutorial 18 / 19

slide-20
SLIDE 20

Intro Functors Workflow Exercises

GaudiPython Tutorial

ganga: How to use GaudiPython with ganga. particles0: Fill some histograms or and NTuple. functors0: Use functors and fit the proper time. You’ll need the head version of Tutorial/GaudiPythonTutor. Read the .txt files in the exercises folder. Some exercises still need to be updated, at the moment only particles0 and functors0 are ready. There are solutions available.

Roel Aaij (Nikhef) Introduction to DaVinci 26 September 2011 Tutorial 19 / 19