Installation and Execution
Overview
Teaching: 0 min
Exercises: 20 minQuestions
How do I install CMSSW?
How do I compile and execute CMSSW?
Objectives
Review the steps necessary to setup a CMSSW area.
Learn how to compile and execute CMSSW jobs.
Setting up your CMSSW area
If you completed the lessons on virtual machines or Docker you should already have a working CMSSW area.
-
If you are using the VM:
-
turn on your virtual machine and go to the right shell according to the validation instructions:
-
-
If you are using Docker:
- Start the container with:
docker start -i <theNameOfyourContainer>
- Start the container with:
Make sure you change directories to the CMSSW_5_3_32/src
area; for instance, in Docker:
cd /home/cmsusr/CMSSW_5_3_32/src
Note that we are not really “installing” CMSSW but setting up an environment for it. CMSSW was already installed. This is why every time you open a new shell you will have to issue the cmsenv
command, which is just a script that runs to set some environmental variables for your working area:
cmsenv
Now you can check, for instance, where your CMSSW_RELEASE_BASE
variable points to:
echo $CMSSW_RELEASE_BASE
The variable may point to a local CMSSW install if you are using a Docker container:
/opt/cms/slc6_amd64_gcc472/cms/cmssw/CMSSW_5_3_32
or to a place in the shared cvmfs area if working in a virtual machine:
/cvmfs/cms.cern.ch/slc6_amd64_gcc472/cms/cmssw/CMSSW_5_3_32
cmsRun, the CMSSW executable
All the packages that comprise the CMSSW release in use have been already compiled and linked to one single executable, which is called cmsRun
. So, unless you want to create your own plugin (addition) for the software, you won’t even have to re-compile. You can actually try to execute this command by itself, but it will give you a configuration error:
cmsRun
cmsRun: No configuration file given.
For usage and an options list, please do 'cmsRun --help'.
So, inevitably, the cmsRun executable needs a configuration file. This configuration file must be written in Python. Do not worry, we will learn all about configuration in a next episode of this lesson.
Run with a configuration
Now try to run, but this time with a configuration file.
Solution
Compilation
We use scram, the release management tool used for CMSSW, to compile (build) the code:
scram b
Reading cached build data
>> Local Products Rules ..... started
>> Local Products Rules ..... done
>> Building CMSSW version CMSSW_5_3_32 ----
>> Entering Package Demo/DemoAnalyzer
>> Creating project symlinks
src/Demo/DemoAnalyzer/python -> python/Demo/DemoAnalyzer
>> Leaving Package Demo/DemoAnalyzer
>> Package Demo/DemoAnalyzer built
>> Subsystem Demo built
>> Local Products Rules ..... started
>> Local Products Rules ..... done
gmake[1]: Entering directory `/home/cmsusr/CMSSW_5_3_32'
>> Creating project symlinks
src/Demo/DemoAnalyzer/python -> python/Demo/DemoAnalyzer
>> Done python_symlink
>> Compiling python modules cfipython/slc6_amd64_gcc472
>> Compiling python modules python
>> Compiling python modules src/Demo/DemoAnalyzer/python
>> All python modules compiled
>> Pluging of all type refreshed.
>> Done generating edm plugin poisoned information
gmake[1]: Leaving directory `/home/cmsusr/CMSSW_5_3_32'
Note that scram only goes into the Demo/DemoAnalyzer
package that we created locally to validate our setup in a previous lesson. All the rest of the packages in the release were already compiled. Since there is nothing new to compile, it finishes very quickly. In a later episode we will modify this DemoAnalyzer
and will need to compile again.
Point to be made: if you compile at main
src
level, all the packages in there will compiled. However, if you go inside a specific package or sub-package, like ourDemo/DemoAnalyzer
, only the code in that subpackage will be compiled.
Note: if you are using a soft link to an area that is perhaps mounted from the host machine (like in the example from the Docker lesson), you must compile at the main
src
level, i.e.,/home/cmsusr/CMSSW_5_3_32/src
, otherwise the compilation will fail. A small price to pay for convenience.
Additional goodies
Your CMSSW environment comes with other executable scripts/tools that can be very useful. An example of those is the mkedanlzr
script that we use already to create the DemoAnalyzer
package. This script creates skeletons for EDAnalyzers that can later be modified or expanded. Notice that this package, DemoAnalyzer, has a similar structure as any of the CMSSW packages we mentioned before.
One can find out about other scripts like mkedanlzr by typing mked
and hitting the Tab key:
mked + Tab
mkedanlzr mkedfltr mkedlpr mkedprod
In this workshop, however, we will not be using those other ones.
There are also additional scripts, like the Event Data Model(EDM) utilities, the hltGetConfiguration trigger dumper, or the cmsDriver, which can be very useful. We will talk a bit about these later in the workshop, but now let’s check an example.
Finding the EventSize of a ROOT EDM file
Now, as a simple exercise, use one of the EDM utilities mentioned above to find out about the number of events in the ROOT file that is in the
Demo/DemoAnalyzer/demoanalyzer_cfg.py
config file of your analyzer package.Solution
Key Points
A CMSSW area is not really installed but set up.
cmsRun
is the CMSSW executable. There are also utilitarian scripts.You can compile CMSSW with
scram b