Getting Started with SiD DD4HEP


At the moment, our code is on GitHub (https://github.com/iLCSoft/lcgeo), where the core DD4hep software and the CLIC and ILD models are stored as well. The latest/work version is labelled SiD_o2_v02. The XML configuration is located in lcgeo/SiD/compact/SiD_o2_v02 and the C++ drivers are located in lcgeo/detector/.

Browse or check out the code via https://svnsrv.desy.de/websvn/wsvn/General.ddsim/lcgeo

If needed for read access, a new basic account can be registered for anyone, by anyone else who has a grid certificate, at https://svnsrv.desy.de/admin/svn

Important version notes (updated 16 March 2017)

We are running on SL6 machines and haven't tried other architectures. Note that you must have cvmfs installed (ask your local sysadmin). Latest update was on 16 March 2017, using the latest ilcsoft release v01-19-01 for everything. Make sure you replace correct latest versions in all examples below.

Building the detector model (lcgeo)

Download the code and remove some unneeded ILD drivers (these first five steps are to be done one time only):

svn co https://svnsrv.desy.de/public/ddsim/lcgeo/trunk lcgeo
rm lcgeo/detector/calorimeter/SHcal*
rm lcgeo/detector/calorimeter/SEcal*
rm lcgeo/detector/CaloTB/CaloPrototype*
mkdir lcgeo/build

Setup the environment (these steps will have to be repeated at the beginning of every session):

source /cvmfs/sft.cern.ch/lcg/releases/gcc/4.8.4/x86_64-slc6/setup.sh
source /cvmfs/ilc.desy.de/sw/x86_64_gcc48_sl6/v01-17-10/init_ilcsoft.sh
cd lcgeo/build/

Prepare the build environment (note the ending double-dots!):

cmake -DCMAKE_CXX_COMPILER=`which g++` -DCMAKE_C_COMPILER=`which gcc` -C /cvmfs/ilc.desy.de/sw/x86_64_gcc48_sl6/v01-17-10/ILCSoft.cmake ..

cmake  -DCMAKE_CXX_COMPILER=`which g++` -DCMAKE_C_COMPILER=`which gcc`   -DILCUTIL_DIR=/cvmfs/ilc.desy.de/sw/x86_64_gcc49_sl6/v01-19-01/ILCSOFT.cmake     -C  $ILCSOFT/ILCSoft.cmake  .. (with new v01-19-01 release)

Build the code with

make -j4
make install

You will now have to update your environment to include the newly created apps

cd ../
source bin/thislcgeo.sh

Modifying the code

If you modify the detector model, lcgeo needs to be rebuilt. See this wiki about how to tweak the drivers.

If you add, remove, or move files from the directories, you have to rerun cmake as above (note the double-dots .. at the end)

cd build/
cmake -DCMAKE_CXX_COMPILER=`which g++` -DCMAKE_C_COMPILER=`which gcc` -C /cvmfs/ilc.desy.de/sw/x86_64_gcc48_sl6/v01-17-10/ILCSoft.cmake ..
Note: to suppress all warnings add option -DCMAKE_CXX_FLAGS="-w" to the above cmake command.

If you edit files (source code) you need re-run make:

make -j4
make install
(or simply make -j4 install)

Running simulation and reconstruction

To run the code, you have to initialise your environment at the beginning of your work session (i.e. when starting a new shell, after ssh). Remember that you also have to rebuild the code in case you modify any of the source files. If you've just built lcgeo as above, you've already initialised your environment, so you can skip the next subsection.

Session initialisation

You must run these commands at the beginning of every session (assuming you are in the lcgeo directory):

source /cvmfs/sft.cern.ch/lcg/releases/gcc/4.8.4/x86_64-slc6/setup.sh
source /cvmfs/ilc.desy.de/sw/x86_64_gcc48_sl6/v01-17-10/init_ilcsoft.sh
source bin/thislcgeo.sh

Depending on your setup, you might also have to do

export LCGRELEASES=/cvmfs/sft.cern.ch/lcg/releases/LCG_84
export PYTHONDIR=$LCGRELEASES/Python/2.7.10/x86_64-slc6-gcc48-opt
export PATH=$PYTHONDIR/bin:$PATH
export LD_LIBRARY_PATH=$PYTHONDIR/lib:$LD_LIBRARY_PATH
export PYTOOLSDIR=$LCGRELEASES/pytools/1.9_python2.7/x86_64-slc6-gcc48-opt
export PYTHONPATH=$PYTOOLSDIR/lib/python2.7/site-packages:$PYTHONPATH
export PATH=$PYTOOLSDIR/bin:$PATH

Running simulation

Assuming you are in the lcgeo directory (else do cd ../), and that you have initialised your session as above, do

python example/lcio_particle_gun.py
ddsim --compactFile=SiD/compact/SiD_o1_v01/SiD_o1_v03.xml --runType=batch --inputFile mcparticles.slcio -N=1 --outputFile=testSiD_o1_v03.slcio

Then to inspect the output use:

dumpevent testSiD_o1_v03.slcio 1
or
anajob testSiD_o1_v03.slcio

Running digitization and reconstruction

Use the latest SiDReconstruction.xml attached to this twiki page. You also need to have the basic gear_sid.xml file in your directory. For example (assuming you are in the lcgeo directory):

wget https://twiki.ppe.gla.ac.uk/pub/LinearCollider/GlaSiDGettingStarted/SiDReconstruction_v03_160711.xml
wget https://twiki.ppe.gla.ac.uk/pub/LinearCollider/GlaSiDGettingStarted/gear_sid.xml

Once you've done this, and assuming you are still in the lcgeo directory, and you have initialised your session as above, run

Marlin SiDReconstruction_v03_160711.xml
and this will produce a file named sitracks.slcio located in the current directory.

Visualizing the output using CED

Note that for the event display to work I had to ask my local sysadmin to install freeglut (e.g. for SLC6, freeglut-2.6.0-1.el6.x86_64) so that the library libglut.so was available. Point to a CED installation with glced:

export PATH=/cvmfs/ilc.desy.de/sw/x86_64_gcc44_sl6/CED/v01-09-02/bin/:$PATH

A few extra parameters are missing from the SiD_o1_v03.xml in v01-17-10, so download and put the modified SiD_o1_v03a.xml attached to this page in your local lcgeo/SiD/compact/SiD_o1_v01/ directory. You may need to make the following environment modification, depending on your local machine and how you connect to it:

unset LIBGL_ALWAYS_INDIRECT

Then run, assuming you are still in the lcgeo directory:

ced2go -d SiD/compact/SiD_o1_v01/SiD_o1_v03a.xml sitracks.slcio

Analysing the output

We could run a simple analysis and draw a few plots. For this let us re-run ddsim and ddreco with a few more events

ddsim --compactFile=SiD/compact/SiD_o1_v01/SiD_o1_v03.xml --runType=batch --inputFile mcparticles.slcio -N=1000 --outputFile=testSiD_o1_v03.slcio
Marlin SiDReconstruction_v03_160711.xml

Now the files testSiD_o1_v03.slcio and sitracks.slcio each contain 1000 events.

Our example analysis code can be found here. From lcgeo do

cd ../
wget https://twiki.ppe.gla.ac.uk/pub/LinearCollider/GlaSiDGettingStarted/TrackAna.tgz
tar -zxvf TrackAna.tgz
ls Tracking/
and you will see
CMakeLists.txt
gear_sid.xml  
HitResiduals.xml
include/fpcompare.h
include/LinkDef.h  
include/HitResiduals.h
src/HitResiduals.cc
Assuming you are in the lcgeo directory, and you have initialised your session as above, let us compile the example with:
cd Tracking
mkdir build lib
cd build
cmake -DCMAKE_CXX_COMPILER=`which g++` -DCMAKE_C_COMPILER=`which gcc` \
  -DILCUTIL_DIR=/cvmfs/ilc.desy.de/sw/x86_64_gcc48_sl6/v01-17-10/ilcutil/v01-03/ -C $ILCSOFT/ILCSoft.cmake ..
make -j4 install
Edit HitResiduals.xml to make sure you have the right input file and detector model. Make the new processor known to Marlin
cd ../
CWD=`pwd`
export MARLIN_DLL=$MARLIN_DLL:$CWD/lib/libTrackAna.so
ALERT! Do this export only once, else Marlin will complain about duplicate libraries!

Then run your new processor with

Marlin HitResiduals.xml
This will produce a file named hitresiduals.root which contains something like this:

resX.png

Troubleshooting

There were problems with libraries from /cvmfs/sft.cern.ch/ that might have been due to a faulty CVMFS repository (see this report).

Topic attachments
I Attachment History Action Size Date Who Comment
XMLxml SiDReconstruction_v03_160711.xml r2 r1 manage 37.4 K 2016-09-21 - 17:58 DanProtopopescu Tutorial reconstruction XML
XMLxml SiD_o1_v03a.xml r1 manage 8.4 K 2016-09-07 - 11:27 AidanRobson minor modified SiD_o1_v03.xml for ced event display
Compressed Zip archivetgz TrackAna.tgz r1 manage 6.9 K 2016-09-19 - 16:24 DanProtopopescu Track analysis example
XMLxml gear_sid.xml r1 manage 0.3 K 2016-09-05 - 13:47 AidanRobson basic gear file to satisfy reconstruction
Unknown file formatslcio mcparticles.slcio r1 manage 215.4 K 2016-09-21 - 20:57 DanProtopopescu Simulation input file
PNGpng resX.png r1 manage 41.1 K 2016-09-19 - 16:22 DanProtopopescu resX example plot
Unknown file formatslcio testSiD_o1_v03.slcio r1 manage 25.5 K 2016-09-21 - 21:34 DanProtopopescu Tutorial input for reco (1 event)
Topic revision: r28 - 2017-03-16 - DanProtopopescu
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback