Presentation is loading. Please wait.

Presentation is loading. Please wait.

Nikhef Bfys Workshop Day One: Exploring a (m)DST Juan Palacios 22-06-2009.

Similar presentations


Presentation on theme: "Nikhef Bfys Workshop Day One: Exploring a (m)DST Juan Palacios 22-06-2009."— Presentation transcript:

1 Nikhef Bfys Workshop Day One: Exploring a (m)DST Juan Palacios 22-06-2009

2 June 22, 2009 - Juan Palacios –1 Plan Very brief explanation of some terminology Plan for the day References Help and hints

3 Terminology DST –Data file or format after the reconstruction phase (Brunel) of the LHCb software chain MicroDST –Data file containing a subset of data from the DST plus data obtained from the analysis (DaVinci) phase –Part of the event written, only for events passing a selection Vanya’s DST –Extended DST (only that name has been taken for something else now) with some analysis stuff (Particles, secondary vertices) added in –Full events written, bun only when certain particles have been selected June 22 2009Exploring the (m)DST - Juan Palacios - Bfys workshop June-09 2

4 DST format (1) All three types have the same “format” –LHCb event model types stored in some kind of directory-like locations in something called the transient event store or TES from now on –Gaudi framework allows us to get them by querying locations like “/Event/Rec/Track/Best”, “Event/Phys/SomeSelection/Particles” June 22 2009Exploring the (m)DST - Juan Palacios - Bfys workshop June-09 3

5 DST format (2) For our purposes, all that matters is that the framework loads these things from the DST onto memory, and we can get them by asking for them Reality can be more complicated –Framework allows to invoke some code that produces the stuff automatically when you ask for it and it isn’t there: DataOnDemandSvc We won’t be using that in this workshop June 22 2009Exploring the (m)DST - Juan Palacios - Bfys workshop June-09 4

6 Plan for the day (1) We will just open some files, look at what is there, and make some plots and calculations We will use GaudiPython –No C++ programming Do not have the seven years necessary to teach that –Good at scripting –Full access to Gaudi framework tools, algorithms and services –Access for non-LHCb SW components MathLibs, STL stuff, RooFit Any python library that is installed June 22 2009Exploring the (m)DST - Juan Palacios - Bfys workshop June-09 5

7 Plan for the day (2) Set the Bender v12r1 environment go to the GaudiPython tutorial package –~/cmtuser/Bender_v12r1/Tutorial/GaudiPy thonTutor – This is installed on all the accounts on the workshop server and if you followed the CernVM instructions you should have it installed too Simple event loop example in ~cmtuser/Bender_v12r1/Tutorial/ GaudiPythonTutor/scripts/EventL oop.py – Have a look at it and run it June 22 2009Exploring the (m)DST - Juan Palacios - Bfys workshop June-09 6

8 Plan for the day (3) Plain text descriptions of problems in $GAUDIPYTHONROOT/exercises – We will try to do exercises/pvs0.txt exercises/tracks0.txt exercises/particles0.txt exercises/particles1.txt – If quick with previous one. Might requires some slightly complicated python exercises/particles2.txt exercises/particles3.txt – if we have time. If we’ve done particles1 then it should be trivial June 22 2009Exploring the (m)DST - Juan Palacios - Bfys workshop June-09 7

9 About the exercises They are designed to give you a feeling of what can be quickly achieved –From basic plots of pT, eta, PV multiplicity, to more complicated things like proper time resolution Some require more complicated python –This is just for simplicity and to avoid code duplication. We could achieve the same with many more lines similar to the simpler examples They gradually build up towards the functionality of Ex/MicroDSTExample/scripts/MicroDSTReadingE xample.py There are example partial solutions in the GaudiPythonTutor package – No prizes for guessing where to find them June 22 2009Exploring the (m)DST - Juan Palacios - Bfys workshop June-09 8

10 About the exercises (2) There are example partial solutions in the GaudiPythonTutor package – No prizes for guessing where to find them But don’t just copy-and-paste them, if something is not clear, just ask – We should avoid relying blindly on black magic Don’t hesitate to ask questions about Python – It isn’t the topic of the tutorial but it will make your like much, mich easier June 22 2009Exploring the (m)DST - Juan Palacios - Bfys workshop June-09 9

11 References (1) doxygen is your best friend –Class and function documentation –http://lhcb-release-area.web.cern.ch/LHCb- release- area/DOC/davinci/releases/latest/doxygen/clas ses.htmlhttp://lhcb-release-area.web.cern.ch/LHCb- release- area/DOC/davinci/releases/latest/doxygen/clas ses.html –Many problems users have could be solved by them if they’d looked at the doxygen for a few classes –Documentation for some algorithms and tools not great Complain to the authors! June 22 2009Exploring the (m)DST - Juan Palacios - Bfys workshop June-09 10

12 References (2) Wiki pages are your other best friends –DaVinci https://twiki.cern.ch/twiki/bin/view/LHCb/DaVinci –GaudiPython FAQ https://twiki.cern.ch/twiki/bin/view/LHCb/GaudiPython –Loki (the engine behind Bender and many other things) https://twiki.cern.ch/twiki/bin/view/LHCb/LoKi –MicroDST https://twiki.cern.ch/twiki/bin/view/LHCb/MicroDST –Particle -> MC association https://twiki.cern.ch/twiki/bin/view/LHCb/Particle2MC –Particle -> PV relating https://twiki.cern.ch/twiki/bin/view/LHCb/Particle2PV –Other links https://twiki.cern.ch/twiki/bin/view/LHCb/DaVinci - Reference_Wiki_pages_and_noteshttps://twiki.cern.ch/twiki/bin/view/LHCb/DaVinci - Reference_Wiki_pages_and_notes June 22 2009Exploring the (m)DST - Juan Palacios - Bfys workshop June-09 11

13 Hints and Help June 22 2009Exploring the (m)DST - Juan Palacios - Bfys workshop June-09 12

14 Using python help Get information about stuff –>>help(ClassName) –>>help(InstanceName) We got book from a python module. Look at the top of EventLoop.py : –from MicroDSTExample.HistoUtils import book, fill Can call help directly: –help(book) –help(fill) Make a 2D histo, name fred, then –help(fred) June 22 2009Exploring the (m)DST - Juan Palacios - Bfys workshop June-09 13

15 Obtaining Gaudi Tools Needed for proper-time fitter, MC association, partilce->PV association –myTool = toolSvc.create(“ImplementationName”, interface=“InterFaceName) –propTimrFitter = toolSvc.create(“ProperTimeFitter”,interface=“ILifeTim eFitter” Getting references –GaudiPython equivalent of foo(double& x) is a bit complicated: –from ROOT import Double –x = Double(0.) –foo(x) June 22 2009Exploring the (m)DST - Juan Palacios - Bfys workshop June-09 14

16 Gaudi Units Can get definitions of units from module –from GaudiKernel import SystemOfUnits as units –help(units)# see what units are available –x = someTool.getX() –x_inGeV = x/units.GeV June 22 2009Exploring the (m)DST - Juan Palacios - Bfys workshop June-09 15

17 Getting c++ classes All C++ namespaces in special module –from GaudiPython.Bindings import gbl –# get some short cuts to avoid typing –LHCb = gbl.LHCb –std = gbl.std –myParticle = LHCb.Particle() –# get an std::vector –DoubleVector = std.vector(“double”) –# make a size 100 vector full of 0.5 –v0 = DoubleVector(100, 0.5) June 22 2009Exploring the (m)DST - Juan Palacios - Bfys workshop June-09 16

18 Histogram help Saving histograms –Need Ex/MicroDSTExample v2r6 One version higher than that used for workshop –from MicroDSTExample.HistoUtils import HistoFile –hFile = HistoFile(“fileName.txt”) –help(hFile) –hFile.save(histo1, histo2, histo3, …) –hFile.close() Histogram service –histSvc = appMgr.histSvc() –histSvc.dump() # print all histos booked so far –Help(histSvc) June 22 2009Exploring the (m)DST - Juan Palacios - Bfys workshop June-09 17

19 EventLoop.py Check that the data location is OK –Server: /data/bfys/lhcb/workshop –CernVM (Mac): /data/lhcb python –i gives you interactive prompt after running script so you can plot Look at the script to see what plots have been made –appMgr.histSvc().dump() –plotName.plot() June 22 2009Exploring the (m)DST - Juan Palacios - Bfys workshop June-09 18

20 tracks0.py Use a DST –Not enough tracks on MicroDST Track location: –‘/Event/Rec/Track/Best’ What is the meaning of this? –from GaudiKernel import SystemOfUnits as units –help(units) # of things in a container –ContainerName.size() June 22 2009Exploring the (m)DST - Juan Palacios - Bfys workshop June-09 19

21 tracks0.py (2) Checking Track type tType = myTrack.type() if tType == gbl.LHCb.Track.Long : fill(longTrackPlot, ….) gbl.LHCb.Track.Long is the GaudiPython equivalent of LHCb::Track::Long June 22 2009Exploring the (m)DST - Juan Palacios - Bfys workshop June-09 20

22 particlesN.txt Use the MicroDST –Has a Bs->J/Psi(mm)Phi(KK) selection –B0s particles in ‘Event/microDST/Phys/DC06selBs2JpsiPhi_inbiased/Particles’ Try using the SystemOfUnits stuff to plot momenta and masses in GeV and proper times in ps –from GaudiKernel import SystemOfUnits as units –help(units) June 22 2009Exploring the (m)DST - Juan Palacios - Bfys workshop June-09 21

23 ParticlesN.txt (2) fitter = toolSvc(…) time = Double(-99999.) error = … propTime = fitter.fit(vertex, particle, time, error, chi2 June 22 2009Exploring the (m)DST - Juan Palacios - Bfys workshop June-09 22


Download ppt "Nikhef Bfys Workshop Day One: Exploring a (m)DST Juan Palacios 22-06-2009."

Similar presentations


Ads by Google