DAS
3.0
Das Analysis System
|
Core
If you modify part of the source code of a module (e.g. Core
), you can recompile it as follows:
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:
which is 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
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 just one executable or library, do the following (where the JEC
library is here just taken as an example):
which is analog to (cd $CMSSW_BASE/src/Core/JEC; scram b)
. Commands will differ if you specified a generator other than GNU Makefiles.
Whenever developing, it is perfectly fine to only compile subsets of the code to speed up the whole process. Whenever running over large samples, it is instead advised to commit and to rerun the whole Core
to ensure compatibility and reproducibility of the results.
Also, for convenience, an alias has been defined: quick Core
to compile Core
or quick Core/JEC
to compile Core/JEC
.
Finally, if you apply any changes in the n-tupliser or the Objects
module, you can only test it via a container in CMSSW (which may not be possible on all machines):
(Remember that scram returns 0 even if the tests have failed. Read through the output carefully to know if the code has worked.)
If you want to update the source code of a module (e.g. Core
), assuming no local changes, you can proceed as follows:
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).
Use template
to add a basic file in a new or existing module. This automatically updates the CMakeLists.txt
files with the necessary info. You may then edit the file and compile it as explained above.
Proceed as follows to add a module in Core
:
add_subdirectory()
statement in Core/CMakeLists.txt
;Core
, where the code will be hosted;bin
,interface
,src
,test
,scripts
,python
;CMakeLists.txt
in the new subdirectory with relevant core_add_library()
and core_add_executable()
: ``cmake core_add_library( # this block only in case of files in
srcor
test SOURCES file1.cc [file2.cc ...] # source files in
src<tt>(at least one is required) TESTS JMEmatching # name of the file intestwith the same name (although truncated from the
.cc` extension) ) core_add_executable( # repeat this block for every executable in bin
, must come after core_add_library
applyJERsmearing # name of the file in bin
with the same name (although truncated from the .cc
extension) LIBRARIES correctionlib # name of dependencies (other Core modules or external libraries); this line is optional ) `` The definition of
core_add_library()and
core_add_executable()can be found in
$DAS_BASE/Core/cmake/CoreHelpers.cmake`.A good trick is to learn how to make interactive rebases (git rebase -i
) so that the commits of your MR tell a meaningful story.
Fight against the increase of entropy by
Happy analysis!