Computing Methods for Physics

News

  • 5/5: information about the May special exam session available at Exams.
  • 18/2: the calendar of oral discussion is available.
  • 12/2: The text of the exam is now available. (pdf)
  • 23/1: The text of the exam is now available. (pdf)
  • 6/1: Happy new year! there will be no lecture on Tue 7 Jan. The next and last lecture will be on Fri 10 Jan.
  • 13/12: The lectures are cancelled today due to the weather advisory.
  • 26/11: I will not be in the office on Wednesday 27 Nov. Students who need to come to office hours can email me to fix an appointment on Friday.
  • 18/11: the text of the exam for the November session is now available.
  • 17/11: the text of the exam for the special session will be posted on 18 Nov by 15:00.
  • 12/11: There will be no lecture on Friday 15/11 or office hour on Wed 13/11 because of a conference.
  • 8/11: the lab session on Monday 11/11 will start at 9:30.
  • 5/11: due to a personal problem I will not be available for office hour on Wednesay 6 Nov. There will be additional office hour on Thursday 6 Nov at 10-12.
  • 22/10: first lab session will be on Monday 28 October at 10am in Laboratorio di Calcolo.
  • 8/10: there will be no lecture on Friday 11 Oct
  • 26/9: there will be a virtual visit of the CMS experiment at CERN on Friday 27 Sep at 17:45
  • 20/9: Lectures will start on Tuesday 24 Sep

Orario Lezioni

Lectures start on Tuesday 25 September 2019

  • Tuesday 12-14, Aula 7 , Nuovo Edificio di Fisica
  • Friday 12-14, Aula 6 , Nuovo Edificio di Fisica
  • Lab Sessions: there will be about 5-6 lab sessions on Monday 10-12 in Laboratorio di Calcolo, Nuovo Edificio di Fisica. Dates: 28/10, 11/10, 18/11, 25/11, 2/12, 9/12, 16/12.

Evaluation of the course by students (OPIS)

All students attending the course are kindly invited to fill the short survey on the evaluation of the course (OPIS) using the following code number.

See the instructions on filling the survey.

Material

Lectures of 2018
  • Lec 01, 24/9: Introduction to the course (introduction). Introduction to C++. (pdf, examples)
  • Lec 02, 27/9: References and pointers in C++. Constant. Namespace. Introduction to Class. (pdf, examples)
  • Lec 03, 1/10: Classes and objects in C++. Interface and attributes. Constructors. Separating interface and implementation. Header and source files. (pdf, examples)
  • Lec 04, 4/10: Header and source files. Dynamic memory allocation. Destructor. Using class std::vector. (pdf, examples)
  • Lec 05, 8/10: Destructor. const member functions. Default arguments for functions. Applications in C++. Arguments from command line. external libraries. Introduction to ROOT. (pdf, examples)
  • Lec 06, 15/10: Numerical convolution: Gaussian detector resolution and monochromatic source. Gaussian convolution of exponential decay length distribution. Dynamically allocated object as data members. Overloading operators. Adding operators to class Datum. (pdf, examples)
  • Lec 07, 18/10: Overloading operators and friend methods. Static data members and methods. Application to compute weighted average. (pdf, examples)
  • Lec 08, 22/10: Example of static data member in class Datum. Enumerators. use case for std::map, std::pair, and std::vector. class Vector3D. (pdf, examples)
  • Lec 09, 25/10: Input/Output with TTree and TFile. Random Generators in ROOT. Using ROOT classes for functions and fitting. (md, examples)
  • Lab 01, 28/10: Design and implementation of a class for Complex numbers and their algebra. (md)
  • Lec 10, 29/10, Data storage with TTree. Input and output. Branches with variable size. (md, examples)
  • Lec 11, 5/11: Input/Output of custom class objects with TTree. Reading of TTree created by others: Application for analysis of TTree. Creating custom analysis class. (md, examples, ROOT setup and configuration)
  • Lec 12, 8/11: Object oriented programming: Inheritance. Base and derived class. Polymorphism with virtual methods. Examples of Shape, Particle, Person, Function and their use case. (pdf, examples)
  • Lab 02, 11/11 9:30-12:00: finishing Complex class and exercises with ROOT. (md)
  • Lec 13, 12/11: Polymorphism: abstract class. Applications. (pdf, examples) Strategy pattern: examples and applications: Numerical integration methods. custom Function class. (md, examples)
  • Lab 03, 18/11 9:30-12:00: Implement numerical integration methods with the Strategy Pattern. (md)
  • Lec 14, 19/11: Composition pattern: examples and applications: leaf and composites in graphical applications. Example of a solar system simulation with composite objects. Examples in high energy phyiscs: tracks, photons, electrons, jets. (md, examples)
  • Lec 15, 22/11: Templates and generic programming in C++. Template functions and classes. STL containers. Error handling with exceptions. (pdf, examples)
  • Lab 04, 25/11 9:30-12:00: Input of TTree from file, use of MakeClass for analysis, plots of kinematic variables and invariant mass. (md)
  • Lec 16, 26/11: Makefile: usage and examples with implicit rules. (md) Introduction to Python. Main differences with C/C++. Introduction to jupyter. (md, examples) (HOWTO download the lecture notebook)
  • Lec 17, 29/11: Makefile: custom recipes, variables and functions, building libraries. (md, examples) Basics of python: semantics, flow control, data types, functions, modules. (jupyter notebook, examples)
  • Lab 05, 2/12 9:30-12:00: study of energy loss by ionisation and the Bragg peak in matter (md)
  • Lec 18, 3/12: data types in python: sequences. Lists, Tuples. Example of plotting with matplotlib. Dictionaries. (jupyter notebook, examples)
  • Lec 19, 6/12: Data types in python: Dictionaries and sets. Comprehensions. data analysis with sets, lists, dicts. Plotting a histogram. NumPy arrays: revisiting motion of a body under gravity. Animated plots with matplotlib. Function with multiple return values in python (jupyter notebook, examples)
  • Lab 06, 9/12 9:30-12:00: motion in 3D with friction (md)
  • Lec 20, 10/12: Numpy and array-oriented programming with ndarray. Example of random walk with arrays. File I/O and handling in python. Functions with variable number of arguments. Command line arguments for python programs. (jupyter notebook, examples)
  • Lab 07, 16/12 9:30-12:00: python (md)
  • Lec 21, 17/12: Classes, inheritance, and polymorphism in Python (jupyter notebook, examples)
  • Lec 22, 20/12: Brief introduction to Machine Learning and its applications. Types of Machine Learning and main challenges. Examples. (md)
  • Lec 23, 10/1: Binary classification with with scikit-learn. Precision and recall. (jupyter notebook)
  • Lec 24, 13/1 9:30-12:00: Binary classification: the ROC curve. examples in particle physics (jupyter notebook)
  • Lab 08, 15/1 13:00-16:00: Implemenation of a vicinity sensor with Arduino using an ultrasonic module (md)

Useful resources

  • VirtualBox: If you have a windows or MacOS machine you can use a virtual linux machine.
    1. Install the free virtual box application
    2. In your browser download the Ubuntu18.04-cmp-64bit.ova which is a virtual machine based on Ubuntu 18.04, and has ROOT and python tools already installed, and the bash and csh environements configured.
    3. You can now double-click on this ova file (image of a vitual machine) and you you see Ubuntu starting up in a window
    4. the system will start up without asking for username and password. The user is called student and the password is physics. You will only need the password to update or add new packages for example for python.
  • C++ compiler for Windows: you can install the free version of Visual Studio
  • C++ compiler for Mac OS: it is available for free as part of XCode. You need to install the "command line tools". See for example these simple instructions.
  • C++: useful C++ reference guides Cplusplus.com, cppreference.com
  • ROOT: framework for data analysis. Checkout the website at root.cern. The reference guide is all you need to navigate exisiting classes. You can browse it online or download on your machine. See also the installation guide for setting up your machine. Unless you have special needs (e.g. old operating system) you should use the PRO version.
    See a short summary on setting up ROOT on your machine.
  • Arduino: the official arduino website https://www.arduino.cc is a good starting point for beginners
  • Python: the official python website is a good resource for introduction to Python. Check out also https://pythonprogramming.net for targgetted and specific tutorials.
  • jupyter: open-source web application for writing documents and live code in many languages, including C++ and python. A good starting point is https://jupyter.org
  • scikit-learn: is a kit for machine-learning in python. Valuable info available at their webiste http://scikit-learn.org
  • pandas: Python Data Analysis Library: provides high-performance, easy-to-use data structures and data analysis tools in python. Details at http://pandas.pydata.org