Difference between revisions of "LHCb Software At Nikhef: Prepare for Workshop 22-24 June 2009"

From LHCb Wiki
Jump to navigation Jump to search
 
(84 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
== Introduction ==
 
== Introduction ==
  
The B-Fys workshop will not take place at a high energy physics lab. For these reasons, it is recommended that people install a virtual machine on their laptops in order to be able to run LHCb software locally, without necessity of an internet connection. Whereas this is not a "standard" way of performing analysis at the moment, it might be beneficial to set this up anyway. In what follows, there are explanations on how to run either with an internet connection to nikhef, or with a local virtual machine. Once the installation has been done and the environment set correctly, running on the virtual machine should be the same as running at Nikhef.
+
The Bfys workshop will not take place at a high energy physics lab.  
 +
Wireless connection is available, but for the hands-on work, we will not rely on that.
 +
Instead we provide two solutions:
  
== Running at Nikhef ==
+
1) Connect to a computer/server.
 +
(See: [http://www.nikhef.nl/pub/experiments/bfyswiki/index.php?title=LHCb_Software_At_Nikhef:_Prepare_for_Workshop_22-24_June_2009#Running_on_Workshop_Server Running on Workshop Server] )
  
''' Logon at Nikhef '''
+
2) Install and configure virtual machine on your laptop, "CernVM".
 +
[http://www.nikhef.nl/pub/experiments/bfyswiki/index.php/How_to_install_and_configure_Cern_Virtual_Machine_(CernVM)_on_your_laptop (How to install)]
 +
 
 +
(This will give the possibility to run LHCb software locally,
 +
very much as if you logon to a computer inside your laptop...)
 +
 
 +
 
 +
 
 +
We ask you to try to run an example job on the server '''using your laptop''', before the workshop starts on Monday.
 +
(See [http://www.nikhef.nl/pub/experiments/bfyswiki/index.php?title=LHCb_Software_At_Nikhef:_Prepare_for_Workshop_22-24_June_2009#Running_on_Workshop_Server Running on Workshop Server])
  
<pre>
 
ssh user@ribble.nikhef.nl
 
ssh stbc-16  (on stoomboot)
 
</pre>
 
  
''' Set the environment '''
 
  
Here we set the environment for DaVinci, but it could also another LHCb application, like Bender or Panoramix.
+
In addition - to familiarize with the LHCb software jargon - we ask you to read through the  
<pre>
+
following pages too:
mkdir cmtuser
 
cd cmtuser
 
source /project/bfys/lhcb/sw/setup.sh  # for sh, bash, ksh, zsh
 
source /project/bfys/lhcb/sw/setup.csh  # for csh, tcsh
 
SetupProject --build-env DaVinci v23r1 # makes a DaVinci_v23r1 directory if one doesn't already exist
 
SetupProject DaVinci v23r1 # exports environment variables to the shell
 
</pre>
 
  
(NB: zsh-users should add 'setopt SH_WORD_SPLIT' to their .zshrc )
+
1) Python [http://www.astro.ufl.edu/~warner/prog/python.html Basics]
  
== Running on a virtual machine on your very own laptop ==
+
2) Bender [https://twiki.cern.ch/twiki/bin/view/LHCb/BenderTutorial Tutorial (twiki)]
 +
[http://www.nikhef.nl/pub/experiments/bfys/lhcb/computing/20080522_NIKHEF_Bender-Tutorial.pdf Tutorial (pdf)]
  
This assumes you have successfully installed a CernVM on your computer. The installation varies between Windows, Mac OS and Linux, so see section further down for instructions on how to set it up. It also assumes you have set up basic login scripts, and installed AFS, X11R6, CVS and SVN if necessary. Also note that you '''have to run an application like DaVinci, Bender or Panoramix at least once while connected to the network in order to cache the necessary software'''.
+
3) Gaudi [https://twiki.cern.ch/twiki/bin/view/LHCb/LHCbSoftwareTrainingBasics Basics (twiki)]
  
===Log onto your CernVM===
+
== Running on Workshop Server ==
  
This could mean starting the virtual machine and CernVM, starting it and logging in "remotely" from a terminal (Linux, Mac) or Exceed (Windows).
+
=== Login ===
''' Linux/Mac login'''
 
  
 +
Linux or mac:
 
<pre>
 
<pre>
ssh -Y -p 2222 CernVMUserName@localhost
+
ssh -Y u01@192.16.186.110    (# Available usernames: u01 - u15)
 +
Password: (LHCb psswrd)
 
</pre>
 
</pre>
  
'''Windows login'''
+
Windows:
 
 
 
<pre>
 
<pre>
Start exceed
+
Make sure you have Exceed running
Start ssh
+
ssh to 192.16.186.110      (# Available usernames: u01 - u15)
Connect to vm with ssh to 192.168.204.128
+
Password: (LHCb psswrd)
    (Your number might be different!)
 
    (fink tunnel x11 connections in ssh!)
 
 
</pre>
 
</pre>
  
''' AFS access '''
+
'''NB: In Egmond use: 192.168.1.1 '''
 +
 
 +
=== Environment ===
  
If you need access to CERN AFS areas,
+
At startup, the script /opt/LHCb/LbLogin.sh is executed for all users. It sets up the LHCb environment. After this, follow the steps described in [http://www.nikhef.nl/pub/experiments/bfyswiki/index.php/LHCb_Software_At_Nikhef:_Prepare_for_Workshop_22-24_June_2009#Setting_the_Environment]
<pre>
+
 
klog user@CERN.CH
+
=== Run ===
</pre>
 
Where user is your CERN AFS username. Note the '''UPPER CASE''' for the domain name.
 
Be careful: '''Never do: ls /opt/ !! (It could start caching all atlas software...)'''.
 
  
=== Set the environment ===
+
Run over events as described [http://www.nikhef.nl/pub/experiments/bfyswiki/index.php/LHCb_Software_At_Nikhef:_Prepare_for_Workshop_22-24_June_2009#Running_over_some_events_on_a_DST_or_MicroDST here].
  
This is the same as in the remote login to Nikhef, except that the LHCb environment should be set when you log in if you have set up your CernVM correctly.
+
== Running on a Cern Virtual Machine (CernVM) ==
<pre>
 
SetupProject --build-env DaVinci v23r1 # makes a DaVinci_v23r1 directory if one doesn't already exist
 
SetupProject DaVinci v23r1 # exports environment variables to the shell
 
</pre>
 
The main difference here is that if you do not have the necessary software installed, CernVM will pull it and cache it for you. So the first time you do this you should have an interned connection.
 
  
== Running over some events on a DST or MicroDST ==
+
This assumes you have successfully installed a CernVM on your computer. The installation varies between Windows, Mac OS and Linux, so see section further down for instructions on how to set it up. It also assumes you have set up basic login scripts, and installed AFS, X11R6, CVS and SVN if necessary, as indicated [http://www.nikhef.nl/pub/experiments/bfyswiki/index.php/How_to_install_and_configure_Cern_Virtual_Machine_(CernVM)_on_your_laptop#Configuration_of_CernVM here]. Also note that you '''have to run an application like DaVinci, Bender or Panoramix at least once while connected to the network in order to cache the necessary software'''.
  
After the environment has been set (either by remote login to Nikhef or CERN, or in the local CernVM on your laptop, we can start some simple analysis:
+
===Login===
  
''' Get a nice package full of example scripts (new Bender Examples package exists too...)
+
This could mean starting the virtual machine and CernVM, starting it and logging in "remotely" from a terminal (Linux, Mac) or Exceed (Windows).
  
If you haven't already got an examples package, get it, as you might need to perform modifications to some of the scripts. This has to be done when you have access to the internet.
+
==== Linux/Mac ====
  
 
<pre>
 
<pre>
getpack -p anonymous Ex/MicroDSTExample v2r5
+
ssh -Y -p 2222 CernVMUserName@localhost
 
</pre>
 
</pre>
 +
 +
====Windows====
  
 
<pre>
 
<pre>
cd ~/cmtuser/DaVinci_v23r1/Ex/MicroDSTExample/scripts
+
Start exceed
python -i MicroDSTReadingExample.py --input /data/bfys/h71/Workshop/SeqDC06selBs2JpsiPhiWithMC_50.0_Kevt_NoPVReFit.dst
+
Start ssh
 +
Connect to vm with ssh to 192.168.204.128
 +
    (Your number might be different!)
 +
    (fink tunnel x11 connections in ssh!)
 
</pre>
 
</pre>
  
''' Plot some of the histograms made by the script '''
+
=== Set the environment ===
  
 +
If you have followed the instructions for [http://www.nikhef.nl/pub/experiments/bfyswiki/index.php/How_to_install_and_configure_Cern_Virtual_Machine_(CernVM)_on_your_laptop#Configuration_of_CernVM setting up CernVM] and added the necessary group login scripts to your own login scripts, the LHCb environment should be set. If this is not the case,
 
<pre>
 
<pre>
>>> massPlots[443].plot()
+
# for sh, bash, ksh, zsh
>>> massPlots[531].plot()
+
. /opt/lhcb/group_login.sh
>>> massResPlots[531].plot()
+
# for csh, tcsh
>>> propTimePlots[531].plot()
+
source /lhcb/group_login.csh
>>> Ctrl-D
 
 
</pre>
 
</pre>
 
+
Then follow the steps outlined in [http://www.nikhef.nl/pub/experiments/bfyswiki/index.php/LHCb_Software_At_Nikhef:_Prepare_for_Workshop_22-24_June_2009#Setting_the_Environment Setting the Environment]. If you can't find the required version of DaVinci or Bender, try refreshing the CernVM cache. '''You need an internet connection for this!'''
Some more examples, using Gaudi or Bender environments and example scripts. Note we run them directly without getpacking them.
 
 
 
 
<pre>
 
<pre>
SetupProject Gaudi v21r0
+
sudo /etc/init.d/cernvm restart
python $GAUDIEXAMPLESROOT/python/HistoEx.py
 
SetupProject Bender v12r0
 
cd $BENDEREXAMPLEROOT/python/BenderExample/
 
./Phi.py
 
 
</pre>
 
</pre>
  
== Introduction to Python ==
+
The main difference in setting the application environments here is that if you do not have the necessary software installed, CernVM will pull it and cache it for you. So the first time you do this you should have an interned connection.
 
 
It is important that attendees make themselves familiar with the python programming language, at least at the level of writing simple scripts.
 
  
Extensive tutorial: [http://doc.python.org/tutorial Tutorial]
+
== Setting the Environment ==
 
 
Cheat Sheet: [http://www.yukoncollege.yk.ca/~ttopper/COMP118/rCheatSheet.html Cheat Sheet]
 
  
 +
We use the LHCb script [https://twiki.cern.ch/twiki/bin/view/LHCb/SetupProject SetupProject]. We don't need to care about details, other that when invoked with '''--build-env''' it doesn't set any environment variables in the shell, and it creates a folder
 
<pre>
 
<pre>
 
+
~/cmtuser/ProjectName_vXrY
/user/h71> python
 
>>> hello = "Hello world"
 
>>> print hello
 
>>> Ctrl-D
 
 
</pre>
 
</pre>
 +
where all the software should be built. We will be using the Bender v12r1 and DaVinci v23r1p1 environments, but since Bender used DaVinci, the environment necessary for the latter is provided by the former, so we will set the Bender environment.
  
== Install a Virtual Machine on your laptop: CernVM ==
 
 
See talk by Pere Mato, slide 14:
 
[http://indico.cern.ch/conferenceDisplay.py?confId=52399 17 March 2009]
 
 
CernVM beginner's guide:
 
[https://twiki.cern.ch/twiki/bin/view/Atlas/CernVMGuideDetail CernVM beginner's guide]
 
 
 
=== Windows ===
 
 
'''1) Download vmware player [http://www.vmware.com/download/player/ here] '''
 
 
<pre>
 
<pre>
Unzip and put CernVM in fixed place. For example C:\Program Files\CernVM
+
# this line in case ~/cmtuser/Bender_v12r1 doesn't exist yet
Start vmplayer from desktop
+
SetupProject Bender v12r1 --build-env
Open CernVM from C:\Program Files\CernVM
+
# this exports environment variables to the shell. Some people might not like doing this
Open in browser: http://192.168.204.128:8004/
+
SetupProject Bender v12r1
                (your number might be different!)
 
Create account. For example: use lxplus username and password
 
Virtual organization: lhcb
 
Change memory allocation in vmware player
 
  -> troubleshoot
 
    -> change memory allocation
 
        -> 1024 MB
 
 
</pre>
 
</pre>
  
 +
This procedure is common to working at CERN, Nikhef, CernVM and the workshop server, provided the LHCb scripts have been set up correctly, be it automatically in the login scripts, or explicitly by sourcing some script. Details are in the subsections for each platform.
  
 +
== Running over some events on a DST or MicroDST ==
  
 +
After the environment has been set (either by remote login to Nikhef or CERN, or in the local CernVM on your laptop,) we can start some simple analysis:
  
 +
=== Get Tutorial packages Tutorial/BenderTutor, Tutorial/GaudiPythonTutor if not already there ===
  
 
+
If you haven't already got the tutorial packages in your build area, get them, as you will need to perform modifications to the exercise scripts. This has to be done when you have access to the internet.
'''2) Create shared data folder on your laptop '''
 
 
 
<pre>
 
Make folder C:\Data
 
Change properties of C:\Data
 
  -> sharing
 
    -> network sharing without wizard
 
      V share
 
          name: Data
 
      V allow
 
</pre>
 
  
 
<pre>
 
<pre>
Edit the 2kB VMware configuration file (in C:\Program Files\CernVM\ ) and add:
+
cd ~/cmtuser/Bender_v12r1
  
sharedFolder.maxNum = "1"
+
# if the package is not there, do:
 +
# cvs co -r Tutorial/GaudiPythonTutor
 +
# cvs co -r v12r1 Tutorial/BenderTutor
  
sharedFolder0.present = "TRUE"
+
# re-sets the $GAUDIPYTHONTUTORROOT and $BENDERTUTOR environment variables
sharedFolder0.enabled = "TRUE"
+
SetupProject Bender v12r1
sharedFolder0.readAccess = "TRUE"
+
cd $GAUDIPYTHONTUTOR/cmt/
sharedFolder0.writeAccess = "TRUE"
+
cmt config
sharedFolder0.hostPath = "C:\Data"
+
make
sharedFolder0.guestName = "data"
+
cd $BENDERTUTORROOT/cmt
sharedFolder0.expiration = "session"
+
cmt config
 +
make
 +
</pre>
  
usb.autoConnect.device1 = ""
+
=== Run over some events and make plots using a script from the release area ===
 +
Don't worry, we'll go through exercises that will gradually allow us to write such a script. For now, just run it and stare, awe-struck, at the amazing plots.
  
NB: after editing the configuration file, restart VMware Player
+
'''Run over events'''
</pre>
 
  
 
<pre>
 
<pre>
In VMware:
+
python -i $MICRODSTEXAMPLEROOT/scripts/MicroDSTReadingExample.py --input <filename>
  -> Share folders
 
    -> o always enabled
 
</pre>
 
  
<pre>
+
# <filename> can take one of the following values depending on context:
Add the following line to /etc/fstab:
 
sudo emacs -nw /etc/fstab
 
    .host:/ /mnt/hgfs vmhgfs defaults 0 0
 
  
sudo ln -s /usr/sbin/mount.vmhgfs /sbin
+
# Workshop Server: /data/bfys/lhcb/workshop/Bs2JpsiPhiWithMC_1.mdst
 +
# Windows CernVM:  /mnt/hgfs/data/Bs2JpsiPhiWithMC_1.mdst
 +
# Mac CernVM:      /data/lhcb/Bs2JpsiPhiWithMC_1.mdst
  
I edited Phi.py and put input data location: /mnt/hgfs/data/Bs2DsK_1.dst )
 
Data can be found here:
 
/afs/cern.ch/lhcb/group/calo/ecal/vol10/DATA
 
(or ask Niels or Vanya for a copy...)
 
 
</pre>
 
</pre>
  
''' Starting CernVM '''
+
''' Plot some of the histograms made by the script '''
  
 
<pre>
 
<pre>
Start VMware Player (don't select 'Open', but 'Recent')
+
>>> massPlots[443].plot()
 +
>>> massPlots[531].plot()
 +
>>> massResPlots[531].plot()
 +
>>> propTimePlot.plot()
 +
>>> propTimeResPlot.plot()
 +
>>> refitPropTimeResPlot.plot()
 +
>>> Ctrl-D
 
</pre>
 
</pre>
Login to your CernVM with your SSH.
 
  
=== MAC ===
+
Some more examples, using Gaudi or Bender environments and example scripts. Note we run them directly without getpacking them.
 
 
I have succesfully tried using VirtualBox, from Sun Microsystems. It is free, it works.
 
Follow more or less the instructions in the [https://twiki.cern.ch/twiki/bin/view/Atlas/CernVMGuideDetail ATLAS CernVM wiki]
 
  
==== Download and untar CernVM 1.20 ====
 
Get the one for VirtualBox from [https://twiki.cern.ch/twiki/bin/view/Atlas/CernVM#Download_CernVM here]. Unzip and untar it. And figure out where in your file system it is. This will be the boot image "disk" for the operating system so VirtualBox will need it for booting.
 
This must be done *before* the VirtualBox step.
 
 
==== Get and set up VirtualBox ====
 
http://www.virtualbox.org/wiki/Downloads
 
Install it following instructions
 
run it and follow https://twiki.cern.ch/twiki/bin/view/Atlas/CernVMGuideVirtualBox
 
I went for ~1542MB memory as my laptop has 4GB.
 
 
<pre>
 
<pre>
Name:                CernVM
+
SetupProject Gaudi v21r0
OS Type:              Linux 2.6
+
python $GAUDIEXAMPLESROOT/python/HistoEx.py
Base Memory:          1532 MB
+
SetupProject Bender v12r1
Video Memory:        6 MB
+
cd $BENDEREXAMPLEROOT/python/BenderExample/
 
+
./Phi.py
Hard Disks
 
IDE Primary Master: cernvm-1.2.0-x86.vmdk (Normal, 5.24 GB)
 
 
</pre>
 
</pre>
I had some problems getting it to find the disk image. I did lots of
 
clicking around and it worked in the end. I cannot replicate the
 
"locate the vmdk file" snapshots in the
 
[https://twiki.cern.ch/twiki/bin/view/Atlas/CernVMGuideVirtualBox ATLAS VirtualBox wiki]
 
exactly. Maybe I'll try again to see.
 
  
For network setup, I used NAT following [https://twiki.cern.ch/twiki/bin/view/Atlas/CernVMGuideVirtualBox#NAT_Networking these instructions]
+
== Introduction to Python ==
  
Then I followed the rest of the steps [https://twiki.cern.ch/twiki/bin/view/Atlas/CernVMGuideVirtualBox here]
+
It is important that attendees make themselves familiar with the python programming language, at least at the level of writing simple scripts.
  
=== Linux ===
+
Python [http://www.astro.ufl.edu/~warner/prog/python.html Basics]
  
== Configuration of CernVM ==
+
Extensive tutorial: [http://doc.python.org/tutorial Tutorial]
  
This configuration of CernVM is platform independent. A few things need to be set up before we can start playing
+
Cheat Sheet: [http://www.yukoncollege.yk.ca/~ttopper/COMP118/rCheatSheet.html Cheat Sheet]
 
 
===Login scripts ===
 
 
 
If you want the LHCb environment to be correctly set by default each time you login, the following is necessary:
 
 
 
/opt/lhcb/group_login.sh (csh) has to be sourced at the end of the .bash_profile (.login)for bash (tcsh).
 
 
 
/opt/lhcb/group_shell.sh (.csh) SHOULD be sourced at the end of the .bashrc (.tcshrc). However, this doesn't work at the moment and Hubert claims it doesn't really make a difference for now.
 
 
 
The most important one for us, /opt/lhcb/LbLogin.sh (csh), should be sourced, I do this in my .bashrc (.tcshrc).
 
 
 
=== Installing missing software ===
 
 
 
I found that I was missing SVN, CVS and, less importantly for the workshop, AFS. To install these, it is necessary to get the packages:
 
  
<pre>
+
Example: [http://www.nikhef.nl/~h71/Workshop/Instructions/myfirst.py myfirst.py ]
sudo conary update cvs
 
sudo conary update subversion
 
sudo conary update openafs=1.4.8-1-1
 
sudo conary update openafs-client=1.4.8-1-1
 
sudo conary update openafs-kernel=1.4.8-1-1
 
</pre>
 
AFS has to be started:
 
<pre>
 
sudo /etc/init.d/afs start
 
</pre>
 
  
I also found that there was no gmake command. In CERN Linux this is just a symbolic link to /usr/bin/make but cmt calls gmake, so we need to have it. I just hacked it by making a link:
 
 
<pre>
 
<pre>
sudo -n -s /usr/bin/make /usr/bin/gmake
+
Execute:
</pre>
+
python myfirst.py
  
If you are using C-shell, remember to do type
 
<pre>
 
rehash
 
 
</pre>
 
</pre>
to update the paths, otherwise you won't see cvs, klog, etc. until the next time you log it.
 

Latest revision as of 12:03, 25 June 2009

Introduction

The Bfys workshop will not take place at a high energy physics lab. Wireless connection is available, but for the hands-on work, we will not rely on that. Instead we provide two solutions:

1) Connect to a computer/server. (See: Running on Workshop Server )

2) Install and configure virtual machine on your laptop, "CernVM". (How to install)

(This will give the possibility to run LHCb software locally, very much as if you logon to a computer inside your laptop...)


We ask you to try to run an example job on the server using your laptop, before the workshop starts on Monday. (See Running on Workshop Server)


In addition - to familiarize with the LHCb software jargon - we ask you to read through the following pages too:

1) Python Basics

2) Bender Tutorial (twiki) Tutorial (pdf)

3) Gaudi Basics (twiki)

Running on Workshop Server

Login

Linux or mac:

ssh -Y u01@192.16.186.110    (# Available usernames: u01 - u15)
Password: (LHCb psswrd)

Windows:

Make sure you have Exceed running
ssh to 192.16.186.110       (# Available usernames: u01 - u15)
Password: (LHCb psswrd)

NB: In Egmond use: 192.168.1.1

Environment

At startup, the script /opt/LHCb/LbLogin.sh is executed for all users. It sets up the LHCb environment. After this, follow the steps described in [1]

Run

Run over events as described here.

Running on a Cern Virtual Machine (CernVM)

This assumes you have successfully installed a CernVM on your computer. The installation varies between Windows, Mac OS and Linux, so see section further down for instructions on how to set it up. It also assumes you have set up basic login scripts, and installed AFS, X11R6, CVS and SVN if necessary, as indicated here. Also note that you have to run an application like DaVinci, Bender or Panoramix at least once while connected to the network in order to cache the necessary software.

Login

This could mean starting the virtual machine and CernVM, starting it and logging in "remotely" from a terminal (Linux, Mac) or Exceed (Windows).

Linux/Mac

ssh -Y -p 2222 CernVMUserName@localhost

Windows

Start exceed
Start ssh
Connect to vm with ssh to 192.168.204.128
     (Your number might be different!)
     (fink tunnel x11 connections in ssh!)

Set the environment

If you have followed the instructions for setting up CernVM and added the necessary group login scripts to your own login scripts, the LHCb environment should be set. If this is not the case,

# for sh, bash, ksh, zsh
. /opt/lhcb/group_login.sh
# for csh, tcsh
source /lhcb/group_login.csh

Then follow the steps outlined in Setting the Environment. If you can't find the required version of DaVinci or Bender, try refreshing the CernVM cache. You need an internet connection for this!

sudo /etc/init.d/cernvm restart

The main difference in setting the application environments here is that if you do not have the necessary software installed, CernVM will pull it and cache it for you. So the first time you do this you should have an interned connection.

Setting the Environment

We use the LHCb script SetupProject. We don't need to care about details, other that when invoked with --build-env it doesn't set any environment variables in the shell, and it creates a folder

~/cmtuser/ProjectName_vXrY

where all the software should be built. We will be using the Bender v12r1 and DaVinci v23r1p1 environments, but since Bender used DaVinci, the environment necessary for the latter is provided by the former, so we will set the Bender environment.

# this line in case ~/cmtuser/Bender_v12r1 doesn't exist yet
SetupProject Bender v12r1 --build-env
# this exports environment variables to the shell. Some people might not like doing this
SetupProject Bender v12r1

This procedure is common to working at CERN, Nikhef, CernVM and the workshop server, provided the LHCb scripts have been set up correctly, be it automatically in the login scripts, or explicitly by sourcing some script. Details are in the subsections for each platform.

Running over some events on a DST or MicroDST

After the environment has been set (either by remote login to Nikhef or CERN, or in the local CernVM on your laptop,) we can start some simple analysis:

Get Tutorial packages Tutorial/BenderTutor, Tutorial/GaudiPythonTutor if not already there

If you haven't already got the tutorial packages in your build area, get them, as you will need to perform modifications to the exercise scripts. This has to be done when you have access to the internet.

cd ~/cmtuser/Bender_v12r1

# if the package is not there, do:
# cvs co -r Tutorial/GaudiPythonTutor
# cvs co -r v12r1 Tutorial/BenderTutor

# re-sets the $GAUDIPYTHONTUTORROOT and $BENDERTUTOR environment variables
SetupProject Bender v12r1
cd $GAUDIPYTHONTUTOR/cmt/
cmt config
make
cd $BENDERTUTORROOT/cmt
cmt config
make

Run over some events and make plots using a script from the release area

Don't worry, we'll go through exercises that will gradually allow us to write such a script. For now, just run it and stare, awe-struck, at the amazing plots.

Run over events

python -i $MICRODSTEXAMPLEROOT/scripts/MicroDSTReadingExample.py --input <filename>

# <filename> can take one of the following values depending on context:

# Workshop Server: /data/bfys/lhcb/workshop/Bs2JpsiPhiWithMC_1.mdst
# Windows CernVM:  /mnt/hgfs/data/Bs2JpsiPhiWithMC_1.mdst
# Mac CernVM:      /data/lhcb/Bs2JpsiPhiWithMC_1.mdst

Plot some of the histograms made by the script

>>> massPlots[443].plot()
>>> massPlots[531].plot()
>>> massResPlots[531].plot()
>>> propTimePlot.plot()
>>> propTimeResPlot.plot()
>>> refitPropTimeResPlot.plot()
>>> Ctrl-D

Some more examples, using Gaudi or Bender environments and example scripts. Note we run them directly without getpacking them.

SetupProject Gaudi v21r0
python $GAUDIEXAMPLESROOT/python/HistoEx.py
SetupProject Bender v12r1
cd $BENDEREXAMPLEROOT/python/BenderExample/
./Phi.py

Introduction to Python

It is important that attendees make themselves familiar with the python programming language, at least at the level of writing simple scripts.

Python Basics

Extensive tutorial: Tutorial

Cheat Sheet: Cheat Sheet

Example: myfirst.py

Execute:
python myfirst.py