Fixing ROOT Problem with gfortran libs (on Yosemite)

After installing gfortan from, I could no longer use pyROOT - python would crash as soon as I tried to import ROOT. The fix turned out to be:

  • sudo port selfupdate
  • sudo port upgrade outdated
  • recompile ROOT from scratch

Reco Transform for exclusive samples

On lxplus do:

pathena " inputAODFile=%IN outputNTUP_SMWZFile=%OUT.NTUP_SMWZ.root" "--inDS=mc11_7TeV.185352.LPair_BSY_DDiss_ggTOmumu_20M60_LeptonFilter.merge.AOD.e2456_a186_s1571_a145_r2993/" "--outDS=user.ahamil.mc11_7TeV.185352.LPair_BSY_DDiss_ggTOmumu_20M60_LeptonFilter.merge.NTUP_SMWZ.e2456_a186_s1571_a145_r2993_v1/"
(replace "ahamil" with your username, and IN / OUT datasets with appropriate datasets)

Feynman diagrams in Latexit on OSX 10.8

So simple...

  • install from Texshop Download Page
  • follow step 2 of Taku's page (I didn't need to do step 1)
  • there is no "Composition" panel in Latexit 2.5, the relevant stuff is under the "Typesetting" panel

ROOT v5.34 on ubuntu 11.04 with python 2.7 (PGLabs machines)

Installing ROOT v5.34 on the PGLab machines:

  • sudo apt-get install gcc g++ make binutils libx11-dev libxpm-dev libxft-dev libxext-dev python-dev
  • download source from ROOT
  • unzip tarball, move root folder to /home/user/Applications/root_v5.34.05
  • ./configure linux    --prefix=/usr/local/  --with-x11-libdir=/usr/lib/i386-linux-gnu   --with-xft-libdir=/usr/lib/i386-linux-gnu  --with-xext-libdir=/usr/lib/i386-linux-gnu
  • make
  • make install
  • sudo ldconfig
  • add source /home/user/Applications/root_v5.34.05/bin/ to .bashrc

ROOT v5.34 on mac osx 10.6.8 with python 2.7

Upgrading ROOT to v5.34, I did the following:

  • download source from ROOT
  • unzip tarball in /Applications/root\_v5.34 folder (moved content of root folder to root\_v5.34)
  • ./configure macosx --enable-python --enable-builtin-freetype (freetype thing might not have been necessary, I put that in when macosx64 flag was failing)
  • make -j2
  • add the following to my .bash\_profile (last two necessary because of non-default python location)
    • source /Applications/root_v5.34/bin/
    • export PYTHONDIR=/Library/Frameworks/Python.framework/Versions/Current
    • export PATH=$PYTHONDIR/bin:$PATH

Panada Setup

Panda instructions on Panda Twiki (see "Information for Users").

I use prun to run panda without Athena.

For LXPLUS, essentially just need to:

  • export PATHENA_GRID_SETUP_SH=/afs/
  • source /afs/
  • I put these in my bash profile as alias psetup

This is an example to execute a completely general job. Here is a python script, call it

import sys
print sys.argv
f = open('out.dat','w')
Then run it with
$ prun --exec "python" --outDS user.ahamil.test1234

Go to Panda Monitoring page to see how your job is doing.

  • Under "Quick Search" on the left you can enter your "PandaID" number that was printed when you submitted the job.
  • You also get an email when your job is finished.

When it's finished you can download the output dataset using dq2, for example dq2-get user.ahamil.test1234 will download the job output.

Printing to Minolta printer with a MAC

Just in case any one else in the department has a mac:

  • Download the driver from: (select bizhub 363)
    • download should be a file called 423_Series_MacOS_v1.3.0.sit
  • Open the 423_Series_MacOS_v1.3.0.sit file, should create a directory with name 423_Series_MacOS_v1.3.0
  • In the directory, go to "Driver" -> "OS_10_Y_X" -> "A4" -> "bizhub_423_10Y.pkg" (Y is the particular version of OSX you have)
  • Run the "bizhub_423_10Y.pkg" installer
  • In you mac System Perferences, add the printer using the IP address and the Line Printer Daemon protocol (IP address
    • select paper source PC-409, Finisher FS-529, Puncher None
  • Open a document you want to print in Preview
    • Print the document
    • Select the printer you just installed
    • In the dropdown that says "Preview", select "Output Method"
      • select "Account Track" and enter you username in "Department" and your password in "Password"
    • In "Presets" dropdown, select "Save As" to save the Account Track settings for next time.

PyROOT on Mac OS 10.6.X

Instead of recompiling ROOT, I decided to install compatible versions: ROOT version 5.26 and Python 2.5.4 of the libraries (there may be other combinations of libraries that work, but I don't know what they are or where to find them)

  • download the Python v2.5.4 from and install it following the instructions on the site
  • download the ROOT v5.26 from and install it following the instructions on the site and in the ROOT instruction manual (found on the ROOT site)
  • set some environment variables (in your .bash_profile) to get python to be able to read the ROOT libraries:
    • export ROOTSYS=/Applications/root
    • export PATH=$ROOTSYS/bin:$PATH
    • export PYTHONDIR=/Library/Frameworks/Python.framework/Versions/Current
    • export PATH=$PYTHONDIR/bin:$PATH

You might find this pystartup file useful to make your python do tab completion and history.

Installing ATHENA via Pacman kit

Official ATLAS instructions are at:

Here is what I did on my 64bit SLC5 machine.

Get and install pacman:

Install an Athena release (17.0.6 in this example):

  • cd /usr/local/atlas/pacman-*
  • source
  • mkdir /usr/local/atlas/athena
  • mkdir /usr/local/atlas/athena/17.0.6
  • cd /usr/local/atlas/athena/17.0.6
  • pacman -get am-CERN:17.0.6

I can't seem to get the Kit Validation pacman -get am-CERN:17.0.6+KV to work, it fails in trying to access some server in rome... Note that you can also get the pacman command for a specific release, at (click on the release and scroll to the bottom of the page)

Now add the following to your .bashrc file:

  • export path_to_kit=/usr/local/atlas/athena/17.0.6
  • export AtlasSetup=/$path_to_kit/AtlasSetup
  • alias asetup='source $AtlasSetup/scripts/'

When you start a new terminal you should now be able to do:

  • asetup 17.0.6
  • athena -i

There was a problem compiling the PhysicsAnalysis, so I also needed to install some 32-bit package (I'm not sure why):

  • yum install glibc-devel-2.5-65.el5_7.1.i386

VNC via SSH tunnel

If you have a machine behind a firewall that you would like to VNC to, but do not have direct ssh access to that machine, you can ssh tunnel to the machine if you have some server behind the firewall that you do have access to. For example: logging into the geneva cluster through lxplus, or logging into your UCT desktop via

Some nomenclature:

  • XXX is your local machine, ie. your laptop
  • YYY is the machine inside the firewall that you have access to (ie. or
  • ZZZ is the machine you want to access (ie. geneva cluster or your desktop machine)
In other words, you are working on XXX and you will tunnel through YYY to get to ZZZ

The instructions:

  • Login to ZZZ to start a VNC server session:
ssh YYY
ssh ZZZ
Note, this session stays alive until it is explicitly killed (see last point). When starting the vncserver for the very first time (you're not having a ~/.vnc direcoty yet), you will be prompted for a password. This is the password you'll have to use when connecting later on (vnc passwords can be set using the vncpasswd command).

The vncserver command gives you a session name, something like

New ' USERNAME' desktop is
This tells you that the vncserver is listening on (this is the SESSION_NAME which you need for killing it later).

  • From XXX machine create an SSH tunnel to YYY
ssh -g -f -L 5901:localhost:5901 -x -e none YYY sleep 200000
The message 'bind: Address already in use' can be ignored.

  • Login to the YYY machine to create a 2nd tunnel to ZZZ:
ssh YYY
ssh -g -f -L 5902:localhost:5901 -x -e none ZZZ sleep 200000
The 1 in ':5901' corresponds to display 1. This has to be the number returned by the vncserver!

* From XXX start the vncviewer:

vncviewer localhost:2
the ':2' specifies to use display 2, the one that we forwarded to display 1 on the ZZZ machine. Use the password you gave when you first started the vnc server.

  • Killing the VNC server session, on the ZZZ machine do:
vncserver -kill MY_SESSION_NAME

VNC connection to lxplus

Connect to lxplus using Chicken of the VNC from my mac

Start the VNC server on lxplus:

  • ssh vncserver

Returns something like: New ' (ahamil)' desktop is This means"" means it is running on lxplus433's desktop 1

Create an ssh tunnel to your machine (localhost):

  • ssh -L5801:localhost:5801 -L5901:localhost:5901
(replace the '1' in 5801 and 5901 with the desktop number and the '433' with the values returned above)

Start Chicken of the VNC on your mac:

  • put in Host: localhost and Display: 1
The password is set when you first start the vnc server on lxplus (or by using the vncpasswd command)

installing ROOT on Ubuntu 9X pglab03 machine

wget  ##get ROOT, pick your favourite version
tar -xzvpf root_v5.30.04.source.tar.gz
cd root

WHERE_TO_INSTALL_ROOT=/usr/local     ## feel free to change this

./configure --with-x11-libdir=/usr/lib --with-xft-libdir=/usr/lib --with-xext-libdir=/usr/lib --with-xrootd-opts=--syslibs=/usr/lib --prefix=$WHERE_TO_INSTALL --enable-python --with-python-incdir=/usr/local/ccp4/Coot-0.6.0/include/python2.6/  --with-python-libdir=/usr/local/ccp4/Coot-0.6.0/lib/python2.6/config/  --disable-xrootd

sudo make install                     ## sudo needed at least for for /etc/root

source bin/
root                                  ##  :-)   works...

Then add this to your .bash_profile

source /usr/local/bin/

mounting afs on OSX 10.6

Download the binary from, install it (use "" as the "cell name"). You should now see /afs/ mounted on your local drive. Use klog to authenticate with kerberos so that you can see your afs area.

compiling LHAPDF on OSX 10.6

Installed LHAPDF 5.8.1 on OSX 10.6:

  • get LHAPDF from
  • followed install instructions, got the error listed at
  • used fink ( to install gcc45 (command fink install gcc45)
    • fink binaries are put in /sw/bin/ and are named like gcc-4 so they don't conflict with existing compilers on you computer
  • configured with ./configure --prefix=/your/install/directory --enable-low-memory  CC=/sw/bin/gcc-4 CXX=/sw/bin/g++-4 FC=/sw/bin/gfortran (as suggested in Mac Os problems page)
  • ran make, got another error (error: command 'gcc' failed with exit status 1) after Making all in pyext
  • re-configured with above configure command plus --disable-pyext
  • make and make install completed successfully!

renewing Grid Certificate

Official instructions:

Below are my (potentially outdated) instructions:

When you get the mail saying you need to "renew or request a new" User Certificate:

  • go to
  • click "Request or renew user certificate using Mozilla browser"
  • follow instructions to request a new certificate
  • go back to and revoke the old certificate

Now you need to move the certificate to where ever you want to use the grid:

  • go to Firefox (4.0.1) -> Preferences -> Advanced -> View Certificates
  • find the new certificate in the list, and click "Backup"
    • you will be requested to make up a password
    • a blah.p12 file will be made
  • copy the blah.p12 file to lxplus (or where ever)
  • do the following
> openssl pkcs12 -in mycert.pfx -clcerts -nokeys -out usercert.pem
> openssl pkcs12 -in mycert.pfx -nocerts -out userkey.pem
> chmod 400 userkey.pem
> chmod 444 usercert.pem
  • you will be asked for another password (this is your 'grid' password)
  • then move these two .pem files to the .globus directory (if you don't have one, make one!)

You should now be able to do:

> source /afs/
> voms-proxy-init -voms atlas'

problems with LaTeXiT and feynmp

When Latexit gets "stuck", try to delete the contents of the temp folder: /var/folders/sW/sWtXsIPxEOqc8ab3fkHk8++++TI/-Tmp-/LaTeXiT-2.3.0/

You can find the location of the temp folder in the logfile (do "Latex->Display Last Log")

hacking an eps file

To move text around in an eps file, open in a text editor, find the lines that look like:

gsave  2268 1948 0 0 C 1855 680  t 0 r /Helvetica findfont 53.2685 sf 0 0 m (ATLAS) show NC gr

In this example

  • text is "ATLAS"
  • x and y positions of the text are 1855 and 680
  • font type is Helvetica

landscape table in Latex

To put a Latex table in landscape, use the "turnpage" environment:

table blah...

move files based on their creation time

for file in `ls`; do if [ `stat -f %m $file` -gt 1280304400 ]; then mv $file newDir/; fi; done

list files without extension

This can be used to list files without their extension
ls -1 | sed 's/\(.*\)\..*/\1/'

If you want to rename all *.eps file or use them in a convert or mv command, you can use something like:
for file in `ls -1 *.eps | sed 's/.eps//'`; do convert $file.eps $file.pdf; done

join pdf files

To join two (or more) pdf files, there is an automator script written in mac os 10.4 and above:
ln -s /System/Library/Automator/Combine\ PDF\ Pages.action/Contents/Resources/

Then you can use it to join, say input1.pdf and input2.pdf into a file final.pdf like this:
./ -o final.pdf input1.pdf input2.pdf

mac screen-capture

  • apple-shift-4 is the shortcut for a screen-shot
  • you can change the default file type by doing: defaults write type png then log-out, log-in

tkdiff and SVN

By doing a "tkdiff local_file_name" you get a diff between the SVN base and you local file!

ROOT Setup

Put the following in a file called .rootrc in your afs home area:

# Path used to find macros.
Unix.*.Root.MacroPath:      .:/afs/$(ROOTSYS)/macros:

# Rint (interactive ROOT executable) specific alias, logon and logoff macros.
Rint.Load:               /afs/
Rint.Logon:              /afs/
Rint.Logoff:             /afs/

Then you can put macros in your rootalias.C file, things like a start TBrowser shortcut (you only need to type "tb()" on ROOT prompt):

// start TBrowser______________________________________________________________________
void tb(int sx=550, int sy=400) {
  static int nb = 0;  
  new TBrowser(Form("tb_%i",nb),Form("tb_%i",nb),sx,sy);

And you can put your default styles in rootlogon.C:

   gStyle->SetOptStat(11111111); // print overflows/underflows in the stat box
   gStyle->SetOptFit(1110); // print fit results in the stat box

MacBook Setup

Here is what I did to setup my MacBook:

CMT Version of a Package

Do cmt show versions Trigger/TrigEvent/TrigEventAthenaPool will show you both the version for the current release and the one you have checked out.

I've got a script which just checks out the correct version of a package for the release you have set up. It is available at /afs/, to run it you need to source

There is a script that does this already! It is

Remove New Lines and Tabs in Emacs

New Lines: do a search and replace, replacing "C-q C-j" with " "

Tabs: replace "C-q " with " "

Trigger Validation Test --test AthenaModernRDO --rundir AthenaModernRDO --config $AtlasArea/../../AtlasTrigger/$AtlasVersion/Trigger/TrigValidation/TriggerTest/Testing/trigValidation.conf

EvtMax in jobOptions

If you do an EvtMax = 10 and yet still get the whole data file processed, try theApp.EvtMax = 10

Feynman Diagrams in LaTeXiT

To do Feynman diagrams in LaTeXiT:

Who has SVN tag rights

Look at:

Tab completion in emacs

ALT+/ is "tab completion" in emacs

Enhanced Biased Datasets

You can find the top and enhanced bias datasets defined here:

cmthome setup

To allow a more flexible work area setup, you could change your ATLAS_TEST_AREA macro in your requirements file to:


Then you

source ~/cmthome/ -tag...

and it uses the work area where you are.

Dataset Numbers in AMI

With the new naming convention the configuration tag


really is critically important. All that the mc08 means is that it is Monte Carlo generated in 2008, according to the naming convention. If you want to find out what is in your MC sample (and you should) you always have to look this up (use eg the "Interpret config tag" box on the "Dataset Search" in AMI).

For this config tag, AMI clearly says for e323 that it is an FDR2 evgen process, that the simu+digi (s400, d99) was done in and the reco (r474) is done with It works! Please learn to use it!

DEBUG in One Algorithm

from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()

from TrigEgammaHypo.TrigEgammaHypoConf import TrigL2PhotonFex
TrigL2PhotonFex = TrigL2PhotonFex(OutputLevel=DEBUG)
topSequence += TrigL2PhotonFex

Tag Collection in TRIG nightly

  • power user
  • AtlasTrigger
  • 14.X.0-TRIG browse
  • OverRideLockAndUpdatePV

Reading Trigger from AOD

root [1] gSystem->Load("");
root [2] Cintex::Enable();
root [3] gSystem->Load("");
root [4] TBrowser b; // now I'm able to access all variables

Getting Commit & Tag Rights

To get commit and tag rights to a package, email atlas.release at

Setting up a pcache

source ./cmthome/ -tag=pcache,32,${rel},noTest
source /afs/${rel}/AtlasProductionRunTime/cmt/

New Grid Certificate

I let my grid certificate expire, here is what I did to get a new one:

Using Hephaestus to find memory leaks

See UsingHephaestus. It's built into athena so you basically just do:

athena --leak-check-execute >& leak.log

You may need to change the jobproperties.perMonFlags.doMonitoring to False in your jobOptions file, then you should get the leak check output in LeakCheck.txt (otherwise it might be in ntuple.pmon.heph.log)

Using gdb with athena

Running all of athena in debug mode takes too much time and memory. To compile just one package in debug, but to leave the rest of ATLAS in opt mode (taken from UsingDebugBuiltPackagesWithOptBuild):

Add the following lines to the requirements files of the package:

macro cppdebugflags '$(cppdebugflags_s)'
macro_remove componentshr_linkopts "-Wl,-s"
(the last line is probably only needed if it's a component library)

Now do

cmt config
make binclean

You should now have a library with debugging symbols (you can check with nm), suitable for use with gdb (see GdbDebugger).

To run athena with gdb, you can do -d

Using Valgrind

See UsingValgrind

In short:

  • build debug libraries as above
  • source /afs/
  • valgrind --leak-check=yes --trace-children=yes --num-callers=8 --show-reachable=yes `which` >& valgrind.log

Replace text in file

To replace all instances of a word with another word in a file(s):
rpl 'oldtext' 'newtext' ./*
(the binary is /afs/

Remove files loop

for file in `cat rmlist.txt`; do rm $file; done
for file in `cat rmlist.txt`; do cvs remove $file; done

Database issues

If job fails with message like:

CORAL/RelationalPlugins/oracle    Error ORA-02391: exceeded simultaneous SESSIONS_PER_USER limit (authenticating)
CORAL/Services/ConnectionService  Warning Failure while attempting to start a session on connection to service ATLAS_COOLPROD: Cannot create a new session. ( CORAL : "ISession::startUserSession" from "CORAL/RelationalPlugins/oracle" )
RalSessionMgr     Info Instantiate a R/W RalSessionMgr for 'COOL_INDET/OFLP200'
RalSessionMgr     Info Connect to the database server
IOVDbSvc                                            ERROR dbConnection is not correctly initialized. Stop.
one can use at cern a local replica by running beforehand

Converting case

echo "ff1c2c40-cc13-4b1a-b805-e9271be8c9d6" | tr 'a-z' 'A-Z'
gives FF1C2C40-CC13-4B1A-B805-E9271BE8C9D6

LCG Computing Elements

To get a list of the LCG computing elements do: lcg-infosites --vo atlas ce

DB errors

If you get Persistency database errors, try to make the following links in your run directory:

ln -s /afs/ sqlite130
ln -s /afs/ geomDB

Setting up nightlies

4 Apr 2007

To setup the nightlies, make a cmthome with requirements containing:

set   SITEROOT /afs/
macro ATLAS_DIST_AREA ${SITEROOT}/atlas/software/dist                               
macro ATLAS_TEST_AREA /afs/
use AtlasLogin AtlasLogin-* $(ATLAS_DIST_AREA)

Do the cmt stuff:
source /afs/
cmt config

Set up a particular release:
source -tag=rel_1,oneTag
source /afs/

This is for the "AtlasOffline" project in "rel_1". You can do it for other projects, like "AtlasTrigger", and for other releases, like rel_2, etc...

Set read permissions on afs

4 Apr 2007

fs setacl -dir blah/ -acl system:anyuser read
to do it recursively in [dir] do: afind [dir] -t d -e "fs setacl -dir {} -acl [ACLS to set]"

ATHENA can't find a file

3 Apr 2007

Try adding projects to the following environment variables: DATAPATH, PYTHONPATH, JOBSEARCHPATH

remove .xxx extension from files

5 Mar 2007

for oldfile in *.float; do newfile=${oldfile%.*float}; echo $oldfile $newfile; done

decoding compiler symbols

28 Feb 2007

When the compiler gives you something like: undefined symbol: _ZN14TrigTauClusterC1Edddl
you can decode the symbol by doing: echo _ZN14TrigTauClusterC1Edddl  | c++filt
which gives you something like: TrigTauCluster::TrigTauCluster(double, double, double, long)

getting a tag

26 Feb 2007

To figure out which tag of a package corresponds to a particular release do

  • get_tag package_name (for example: get_tag Trigger/TriggerRelease)
This gives you a list with the tag corresponding to each ATHENA release (note that 12.x.x is 2.x.x)

/include problem

2 Feb 2007

If you get a compiler error like: mkdir: cannot create directory `/include': Permission denied check to make sure that the $TestArea environment variable is set correctly!

Command to make hists...

19 Dec 2006

=for var in $(less varlist.txt); do echo $var" = new TH1F(\""$var"\",\";"$var";\",100,0, 1);"; echo "sc = add_histogram("$var");" ; echo 'if(sc.isSuccess()) return StatusCode::FAILURE;' ; echo " "; done=

Get Rid of Collection Tree in aan

29 Nov 2006

To get rid of the Collection Tree in the Athena Aware Ntuple (in 11.0.5), I commented out line 482 m_tree->Fill(); of the file PhysicsAnalysis/AnalysisCommon/AnalysisTools/AnalysisTools-00-00-24/src/AANtupleStream.cxx

Getting a Grid Certificate

18 Sep 2006

I started with:
Which lead me to:
On lxplus I executed ~gridca/scripts/cert-req from my home directory.
The output of the command is at =lxplus:~/.globus/grid_cert.log= is the guy who checks the certification request.
He pointed me to this page to follow the rest of the steps: (I'm now done step 2)
Got an email from my CERN CA with my certificate, which I copied to lxplus:~/.globus/usercert.pem (and made it readable to only me)
After importing the certificate into my browser I went to to "register".
I think I am now an ATLAS VO "applicant"... whatever that means...


14 Sep 2006

athena -i runs athena in interactive mode
athena -b runs athena in batch mode
athena -s outputs where it is in the jobOptions file as it executes
athena -d runs athena in debug mode with =gdb=
Quick Lessons about GDB:

  • sharedlib will make where put out the file and line number instead of just the .so file
  • up and down will move up and down in the stack
  • list gives you the lines of code surrounding the present location


13 Sep 2006

Use nohup for remote running. For example:
nohup > athena.log &


13 Sep 2006

Regular unix commands don't work with CASTOR. Use the following:

  • nsls /castor/ to list
  • rfcp to copy files
  • rfmkdir to make directories

Margins in pdf

13 Jul 2006

White margins appear in converting ppt to pdf.
To get rid of them: Adobe Acrobat -> Tools -> Print Production -> Crop Pages -> Remove White Marginsg

Edit | Attach | Watch | Print version | History: r108 < r107 < r106 < r105 < r104 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r108 - 2015-06-17 - AndrewHamilton
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main 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