C++ or Python?
Up until this point, the commands for ROOT/C++ and Python/ROOT were nearly identical.1 I presented them in the context of using cling, ROOT’s C++ environment.
From this point forward, using ROOT/C++ is different from using Python with ROOT extensions (“pyroot”). You have to decide: in which language do you want to use ROOT? My initial advice is to ask your supervisor. Their response, in ascending order of likelihood, will be:
A clear decision (C++ or Python).
“I don’t know. Which do you feel like learning?”
“I have no idea what you’re talking about.”
If it’s up to you, this may help you decide:2
In favor of Python:
Learning Python is easier and faster than learning C++.
Python can be more appropriate for “quick-and-dirty” analysis efforts, if that’s the kind of work you’ll be doing this summer.
In favor of C++:
All of the ROOT documentation, the Advanced Exercises, the Expert Exercises of this tutorial, and most of the tutorials included with ROOT are in C++.
If you’re going to be working with your experiment’s analysis framework, it will almost certainly involve working in C++.
C++ code, when compiled, is faster than Python (see this discussion).3
- 1
See here for the differences when using Python versus ROOT/C++.
- 2
Here are the areas in which neither has a clear advantage:
Both C++ and Python are used worldwide, so knowing either one is useful.
Python’s interactive development is usually cited as an advantage over C++, but ROOT offers the interactive C++ interpreter, cling.
Both languages have substantive numerical computing libraries (e.g., SciPy in Python, GSL in C++).
Rivals to C++ and Python include (respectively) the Julia programming language and the Ruby scripting language. As far as I know none of the particle-physics groups connected with Nevis use them.
- 3
There are various tricks for making Python run faster; e.g., the %pypy cell magic, the Cython extension, list comprehensions, clever use of numpy. You’ll learn about them if you choose to become a Python expert.