Loading [MathJax]/extensions/tex2jax.js
Imperial Analysis
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
CMSSW & Git

Setting up CMSSW in the git era

The entire CMSSW area (under the /src directory) is controlled by a single git repository. We create a new branch starting from a given release tag, e.g. CMSSW_5_3_7, and through successive commits build up the set of modified packages we need to run our own analysis code. One advantage of this method is that a user doesn't have to build this branch for every new CMSSW area they create, but can simply "fetch" a pre-built branch from a remote fork of the CMSSW git repository.

Note
The CMSSW-facing part of this package is designed to compile and run out-of-the-box in a wide range of CMSSW releases. If all you need to do is run some code in this package in an un-modified CMSSW release then there is no need to set up git to the manage the CMSSW working area, just clone this repository into UserCode/ICHiggsTauTau following the instructions below and compile normally with scram.

Setting up CMSSW using a pre-configured branch

The official CMSSW repository is hosted here: https://github.com/cms-sw/cmssw. If you do not already have a GitHub account, please read through the instructions at http://cms-sw.github.io/cmssw/faq.html, in particular ensure you have configured git with your personal information:

git config --global user.name [First Name] [Last Name]
git config --global user.email [Email Address]
git config --global user.github [GitHub account name]
#If you are running at IC you also need to do: git config --global http.sslVerify false
#This extra line is not needed at CERN. Anywhere else if you see a fatal error message relating to SSL certificate problems it may be required

Before working with CMSSW in git, you will need to create a copy (or fork) of the official CMSSW repository in your own account at https://github.com/cms-sw/cmssw/fork. You will be able to store your own CMSSW branches and developments in this forked repository.c

You also need to follow the instructions here to create and add a ssh key: https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh

Create a new CMSSW area:

export SCRAM_ARCH=slc7_amd64_gcc700
# The SCRAM_ARCH parameter will depend on what CMSSW release you are trying to use. For both using the analyser and ntuple production we currently use CMSSW_10_2_19 which uses slc7_amd64_gcc700 as above
scramv1 project CMSSW CMSSW_10_2_19
cd CMSSW_10_2_19/src/
cmsenv

Initialise this area for git by adding a single package:

git cms-addpkg FWCore/Version
# If you are not running on a machine based at CERN, this script will ask if you want to create a new reference repository.
# You should answer yes to this, and the script will copy the entire cmssw repository to your home folder,
# which will make setting up subsequent release areas a lot faster.

This command will have created two remote repositories, official-cmssw and my-cmssw. It will also have created and switched to a new branch, from-CMSSW_X_Y_Z. An additional remote can be added which provides the pre-configured branches shared by the group:

git remote add ic-cmssw git@github.com:danielwinterbottom/cmssw.git
# fetch from the ic-cmssw remote repository and merge the from-CMSSW_X_Y_Z into your own local branch.
git pull ic-cmssw from-CMSSW_10_2_19
# Check which branch you actually need to merge in here. Descriptive names are useful, e.g. "higgstautau_from-CMSSW_5_3_7"

# At this point, if you run 'ls' you will not see any new packages in the release area.
# This is because the repository operates in sparse-checkout mode, hiding folders unless they are
# explicitly made visible.  This is important, as we don't want to have to compile every single package.
# To make the packages visible that have been modified from the release tag, run these commands:

git cms-sparse-checkout CMSSW_10_2_19 HEAD
git read-tree -mu HEAD

Next, add the IC analysis code package:

git clone git@github.com:danielwinterbottom/ICHiggsTauTau.git UserCode/ICHiggsTauTau

If you want to run the vertex refitting you need to also clone this directory:

git clone git@github.com:danielwinterbottom/TauRefit.git VertexRefit/TauRefit/

At this point everything is ready, and the working area can be compiled in the normal way with scram. New developments that are relevant for everyone can be committed to a branch and pushed to central IC repository (ic-cmssw). If you wish to test some new changes, or just share with specific people, it will be safer to work from a new branch, either based on the CMSSW release tag, or some commit on the from-CMSSW_X_Y_Z branch, e.g.

git checkout -b my-analysis-from-CMSSW_X_Y_Z CMSSW_X_Y_Z # from the release tag
git checkout -b my-analysis-from-CMSSW_X_Y_Z from-CMSSW_X_Y_Z # from the pre-configured branch
... do some development ...
git push my-cmssw my-new-branch