DaVinci Tutorial Tips

You've done the tutorial, how does that help you?

What have you learnt

You should now be familiar with how to write C++ and python for DaVinci, getting jobs to run inside Ganga, and have some feeling for the flexibility and power of the DaVinci framework.

You should know that the developers are constantly working to improve the C++ and python, and that means it is much better to use the simpler common code than your own private code. Then you can ask questions about on the mailing list, and be sure it is 'tested' every night by the development team, in what we call the LHCbNightlies.

You should have realised that most of the tutorials are only examples of what you will commonly do inside DaVinci, and are not meant to be used as they are in your analysis!

You should understand that for most analysis a combination of CombineParticles and DecayTreeTuple is all that is required inside DaVinci.


After doing the tutorials, you may be using an old version of DaVinci, and may have a lot of obsolete code in your cmtuser area. You will hopefully have run many DaVinci jobs inside ganga, and so have a long job history. None of these are useful for your day-to-day working.

Cleanup cmtuser (in Ganga):

j=jobs[-1] #or whatever the last tutorial job was that you ran

Then: if you don't have anything else in your cmtuser area, just delete it, it's much simpler. Otherwise remove the Tutorial packages and anything else you had to getpack to run the tutorials. You won't need them, hopefully ever again, if you do need them, you can look through the directory where they are kept on afs.

Cleanup Ganga:


Get Ready

Redo DaVinciTutorial0.

You then have at least one Ganga job which works and gets you ready.

Look through the already existing DaVinci options files:

dir=e['DAVINCIROOT'] + '/options'
ls $dir

Pick the options file which is most similar to what you are trying to do and copy it to a local directory. Change your ganga job to use this.

Methods of working: Avoiding the pain!

The methods of working are very different depending if you are just performing a number-crunching analysis, or developing the core software, and everyone has his/her own preferred way of working. The methods below fit in the best with this tutorial.

100% Ganga

The benefits of using ganga are firstly you have just learnt how to use it in this tutorial. Secondly with this approach you don't need to know any syntax other than python.

It is beneficial to use ganga directly on the command line, not to use a script. By scripting you lose everything awesome about python, such as the ability to ask for help() on objects, and to dynamically adjust your procedure. You will also suffer great pain if ganga changes just a little bit.

A combined approach would be to define python functions in your .ganga.py file which submit your preferred jobs, but there is no difference between doing this and using templates for jobs stored directly in ganga. You will suffer less pain using templates since the code is migrated by the ganga team, and you don't have to do anything if ganga changes.

Always use the latest versions

Unless you have a really concrete un-assailable unfixable problem with some DaVinci version, you should always move to the latest version as soon as it comes out. (i.e. you need a single consistent version for your thesis)

If you do have a problem, there are many people who will work to try and fix it, and probably you should then move to the next DaVinci as soon as that fix is in there.

Afs options directory

Unintentionally pinning yourself down to a single project version is a big problem, particularly if you keep to the above strategy. If you ever do this you will suffer great pain when the next project version is released. One key place this can occur is in your options files. don't getpack DaVinci just to edit/create options. If instead you maintian a single directory structure where you keep all your options files your migration will be as simple as changing the version in Ganga, and maybe a couple of lines of your options file.

I use cmtuser/MyOptsFiles/DaVinci/.

Final Tips

A few examples of what to avoid are::

  • don't getpack DaVinci just to edit/create options
  • don't getpack DaVinci to update a package, when you can just move to the next version
  • don't getpack DaVinci to update a package. You can just getpack the package itself!
  • don't write/keep a lot of personal C++ code which you don't add to DaVinci itself
  • don't be shy about asking for help. First look through the FAQ, and the DOxygen, then raise a question on the mailing list. Several eager people will answer you very quickly.

Have fun in your pain-free analysis!

-- RobLambert - 28-Jan-2010

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r3 - 2010-11-30 - RobLambert
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    LHCb All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback