@@ -15,7 +15,7 @@ The `Campaigns` subgroup contains actual repos corresponding to different analys
In the following, we provide two alternative methods to install the framework.
### Method #1: From scratch with the default installer
### Method \#1: From scratch with the default installer
In general, it is recommended that you install the software on a fast disk to ensure fast compilation (e.g. AFS), but that you process the heavy n-tuples on a dedicated area (e.g. NFS at DESY, EOS at CERN). Keeping the software neat and clean is important for reproducibility.
It is currently working at CERN (CH), at DESY (DE), at IIHE (BE), and for GitLab CI. Feel free to make a merge request to include your favourite facility.
The `setup` is necessary at CERN (CH), at DESY (DE), at IIHE (BE), and for GitLab CI, but may not be necessary on all platforms (e.g. your private laptop).
2. Run the installation:
```
./install.sh
```
*Remark*: if a CMSSW release has already been sourced, it will use that one instead of installing a new one.
3. Then change to the directory of the CMSSW release (by default, it is created in the local directory) and compile as follows:
3. After a few minutes, you get back to the prompt. You only have to set up the newly compiled environment:
```
cmsenv
scram b -j$(nproc)
source tools/setup.sh
```
4. After a few minutes, you get back to the prompt. You have to rerun `cmsenv` to actually see the commands in the shell. Then you're all set.
### Method #2: By hand, step by step
### Method \#2: By hand, step by step
*Work in progress*
<!---
In the following, we explain the installation of the framework step by step. A few packages external to CMSSW are necessary (e.g. TUnfold), which you will need to tell CMSSW how to find them with `scram setup`.
First source your CMSSW release and close to a directory where you want to install the external packages.
...
...
@@ -73,10 +73,11 @@ cd $CMSSW_BASE/src/JMEAnalysis/JetToolbox
patch -p1 $OLDPWD/jetToolbox_120X.patch
```
5. Clone the `Tables` wherever you like and the `Core` in CMSSW, and compile as usual with `scram b -j`.
-->
## Setting up the environment
First source the minimal environment for CMSSW with `source ./setup`, then just source the CMSSW release as usual with `cmsenv`.
First source the minimal environment with `source ./setup`, then `source ./tools/setup.sh`.
To run CRAB jobs, you will also need to set up a valid [grid certificate](https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookStartingGrid#ObtainingCert). If you already have done so, this will enable it:
To make [RUCIO](https://twiki.cern.ch/twiki/bin/viewauth/CMS/Rucio) requests, the `setup` file tried to guess your RUCIO username from your local username (unless was already set up). This is not guaranteed to work and you may have to define your RUCIO username ahead for sourcing the DAS environment.
### Contributing
If you modify part of the source code of a module (e.g. `Core`), you can recompile it as follows:
```
cd $DAS_BASE
cmake --build Core.build --target install
```
(This is analog to `cd $CMSSW_BASE; scram b`.)
It is good practice to check that your changes do not harm the rest of the code. For this, tests can be run as follows:
```
cd $DAS_BASE/Core.build
ctest .
```
(analog to `cd $CMSSW_BASE; scram b runtests`.)
For `cmake` and `ctest`, one can always specify `-j8` to compile with 8 cores (for instance), or more generally `-j$(nproc)` to compile with the number of cores on the present machine.
Despite multitasking, the whole process of compiling and testing may take a few minutes. In case you would like to compile and/or test a subset of the code, do the following (where `JEC` is here just taken as an example):
```
cd $DAS_BASE/Core.build/JEC
make install
```
(analog to `cd $CMSSW_BASE/src/Core/JEC; scram b`.)
Whenever developing, it is perfectly fine to only compile subsets of the code to speed up the whole process. Instead, whenever running over large samples, it is advised to commit and to rerun the whole `Core` to ensure compatibility and reproducibility of the resulsts.
### Updating a module
If you want to update source code of a module (e.g. `Core`), assuming no local changes, you can proceed as follows:
```
cd $DAS_BASE/Core
git pull
cmake -B $DAS_BASE/build
cmake --build build --target install
```
In case of local changes, you should first commit them, or use `git stash` to pause the changes temporarily (after the update, it will be sufficient to run `git stash pop` to recover your changes).