Skip to content

Instantly share code, notes, and snippets.

@vgvassilev
Last active September 17, 2020 06:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vgvassilev/d6dddbfb1962254746ac692279ea8bc0 to your computer and use it in GitHub Desktop.
Save vgvassilev/d6dddbfb1962254746ac692279ea8bc0 to your computer and use it in GitHub Desktop.
CMSSW Cheatsheet

Building ROOT in the context of CMSSW

wget https://raw.githubusercontent.com/cms-sw/cms-bot/master/config.map
eval `grep CMSSW_11_0_ROOT6_X config.map | grep -v DISABLED`
PKGTOOLS_TAG=V00-32-XX
CMSDIST_TAG=IB/CMSSW_11_0_X/gcc700
ARCH=slc7_amd64_gcc820
git clone -b $CMSDIST_TAG https://github.com/cms-sw/cmsdist
git clone -b $PKGTOOLS_TAG https://github.com/cms-sw/pkgtools
rootsrc=root-$(grep '### RPM ' cmsdist/root.spec | sed 's|.* ||;s| *$||')
git clone https://github.com/root-project/root $rootsrc
./pkgtools/cmsBuild --weekly -a $SCRAM_ARCH -i rootbuild -j 10 --source root:Source=$rootsrc build root

In this case you use local sources and if you have to update/fix root then just make chanegs in $rootsrc directory and re-run (this is again build full root). If you want to just re-build stuff you change then you can do somethink like this

cd rootbuild/BUILD/$SCRAM_ARCH/lcg/root/*/$rootsrc

Here you will find the copy of root src, you can make changes here. There is a file cmsdist-build.sh ( in one level up) which has all the env you need in order to run make command. e.g. just copy the 'for x in .... done' copy and run it in your shell you set all the paths needed for root build and then cd ../build and run make

Running CMSSW with custom ROOT build

Source what's needed:

ssh lxplus
bash
source /cvmfs/sft-nightlies.cern.ch/lcg/views/dev3/latest/x86_64-centos7-gcc8-opt/setup.sh
source /cvmfs/cms.cern.ch/slc7_amd64_gcc700/external/cmake/3.14.5/etc/profile.d/init.sh

cd /tmp/`whoami`

source /cvmfs/cms.cern.ch/cmsset_default.sh

scram project CMSSW_11_0_ROOT6_X_2019-08-28-2300 

cd CMSSW_11_0_ROOT6_X_2019-08-28-2300

NEW_ROOT=/path/to/new/root

sed -i -e "s|$(scram tool tag root_interface ROOT_INTERFACE_BASE)|${NEW_ROOT}|" config/toolbox/*/tools/selected/*.xml

scram setup

eval `scram runtime -sh`

ls -l $(which root)

Building CMSSW with a custom ROOT branch

setenv ARCH slc7_amd64_gcc820
setenv PKGTOOLS_TAG V00-32-XX
setenv CMSDIST_TAG IB/CMSSW_11_2_X/master
git clone -b $CMSDIST_TAG git@github.com:cms-sw/cmsdist.git CMSDIST 
git clone -b $PKGTOOLS_TAG git@github.com:cms-sw/pkgtools.git PKGTOOLS
#check scram list CMSSW_11_0_X to see if it is week0 or week1 and adjust the next command
PKGTOOLS/cmsBuild --repo cms.week1 -a $ARCH -j 6 --builders 5 build cmssw-tool-conf > & go.1 &
#edit CMSDIST/cmssw.spec to change the release name in the first line to match a release release (eg, CMSSW_11_2_X_2020-08-19-2300) and change runGlimpse to no and saveDeps to no to save time
PKGTOOLS/cmsBuild --repo cms.week1 -a $ARCH -j 16  build cmssw > & go.2 &
@davidlange6
Copy link

I believe this recipe needs a "scram b"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment