This is the material used during my course. You can find all information about the course at http://www.roma1.infn.it/people/rahatlou/cmp/
-
Introduction to the course: pdf
-
References and pointers in C++. Constant. Namespace. Introduction to Class: pdf examples
-
Classes and objects in C++. Interface and attributes. Constructors: pdf examples
-
Separating interface and implementation. Header and source files: pdf examples
-
Using class std::vector. Dynamic memory allocation. Destructor. const member functions. Default arguments for functions: pdf examples
-
Applications in C++. Arguments from comamnd line. external libraries. Introduction to ROOT: pdf examples
-
Simple instructions for ROOT setup and configuration of ROOT and the shell environment: md
-
Dynamically allocated object as data members. Overloading operators. Adding operators to class Datum. class Vector3D: pdf examples
-
Overloading operators and friend methods. Static data members and methods. Application to compute weighted average: pdf examples
-
Example of static data member in class Datum. Enumerators. use case for std::map, std::pair, and std::vector pdf examples
-
Input/Output with TTree and TFile: branches with simple
int
anddouble
variables: examples -
I/O with TTree: variable size arrays. Storing user-defined Class in TTree: md, examples
- jupyter notebook for interactive example of writing and ready a TTree with variable size arrays WriteReadTree.ipynb (you need jupyter installed on your machine. See https://jupyter.org. Both ROOT and jupyter must use the same version of python.)
-
Application for analysis of TTree. Creating custom analysis class: md, examples
-
Object oriented programming: Inheritance. Base and derived class. Introduction to polymorphism: pdf, examples
-
Polymorphism: abstract class and virtual methods. Applications: pdf, examples I, examples II
-
Strategy pattern, examples and applications: Numerical integration methods. custom Function class: md, examples
-
Composition pattern, examples and applications: leaf and composites in graphical applications. Example of a solar system simulation. md, examples
-
Template and generic programming in C++. Template functions: pdf, examples
-
Template classes. STL library. Error handling in C++ with exceptions: pdf, examples
-
Introduction to Python. Main differences with C/C++. Introduction to jupyter: md, examples
-
Python basics: semantics, flow control, built-in, functions, modules. Inline help: md, examples
-
Data structure in python: sequences. Lists, Tuples. Example of plotting with matplotlib. Motion of a body under gravity: md, examples
-
Data types in python: Dictionaries and sets. Comprehensions. data analysis with sets, lists, dicts. Plotting a histogram. revisiting example from previous lecture.: md, examples
-
More on Functions in python. Animated plots with matplotlib: md, examples
-
Numpy and array-oriented programming with ndarray. Example of random walk with arrays: md
-
Classes in python: inheritance and polymorphism: md