Computing Methods for Physics

News

All news and communications will be posted to Google Classroom code: bvcru2c. Please subscribe to Classroom for all future communications.

Accademic year 2020/21

Students that intend to attend this course in Fall 2020 are kindly invited to fill this form and register on google classroom code: bvcru2c for all future communications.

Detailed information available on catalogo dei corsi di studio.

Students without Sapienza credentials (not registered on google classtoom) should fill this survey on Lab activities by Sunday, 11 October, 12:00.

Orario Lezioni

Lectures start on Tuesday 29 September 2020

Material

(Old websites: 2018, 2019)

All material on C++ (extended weekly): pdf

  • Lec 01, 29/9: Introduction to the course (introduction). Introduction to C++. (board, examples)
  • Lec 02, 2/10: References and pointers in C++. Constant. Namespace. Functions. (board, examples).
  • Lec 03, 6/10: Pointers and references in functions. Introduction to Class. Classes and objects in C++. Interface and attributes. Constructors. (board, examples)
  • Lec 04, 9/10: Separating interface and implementation. Header and source files. Using class std::vector. (board, examples)
  • Lec 05, 13/10: Dynamic memory allocation. Destructor. const member functions. Default arguments for functions. Applications in C++. Arguments from command line. external libraries. (board, examples 4, examples 5)
  • Lec 06, 16/10: ROOT for data analysis. Overloading operators. Adding operators to class Datum. (board, examples)
  • Lab 01, 19/10: Developing a class Complex with operators for algebra of complex numbers (activity)
  • Lec 07, 20/10: Overaloding operators = and +=. Special this pointer. Overloading operators and friend methods. Static data members and methods. (board, examples, homework due by 26 Oct 23:59 )
  • Lec 08, 23/10: Example of static data member in class Datum. Enumerators. use case for std::map, std::pair, and std::vector. Numerical convolution: Gaussian detector resolution and monochromatic source. (board, examples)
  • Lab 02, 26/10: Implement a class Vector3D with operators, scalar and vector product (activity)
  • Lec 09, 27/10: Numerical convolution: Gaussian detector resolution and monochromatic source. Convolution of exponential decay length distribution. Object oriented programming: Inheritance. Base and derived class. (board, examples)
  • Lec 10, 30/10: Polymorphism with virtual methods. Examples of Shape, Particle, Person, Function and their use case. (board, examples)
  • Lab 03, 2/11: Implement polymorphic Constant, Exponential, and Polynomial classes using a base class Function (activity)
  • Lec 11, 3/11: Polymorphism: abstract class. virtual and pure virtual functions. Strategy Pattern , examples and applications: Numerical integration methods. custom Function class. (md, board, examples)
  • Lab 04, 9/11: Implementation of numerical integration methods with Strategy Pattern. (activity)
  • Lec 12, 10/11: Definition and use of histograms (1D and 2D) and graphs. Environment variables in shell. Compiling and linking with ROOT libraries. Composite pattern: examples and applications. Examples in phyiscs: resistors, particles, molecules and atoms. Leaf and composites in graphical applications. (md, board)
  • Lec 13, 13/11: Composite pattern. Composite particles. Resistors. Energy Clusters. simulation of solar system with composite objects. (md, board, examples)
  • Lab 05, 16/11: Polymorphic hierarchy of Resistor and Parallel with composite pattern. (activity)
  • No lecture on 17/11
  • Lec 14, 20/11: ROOT for data storage and I/O. TFile and TTree. Branches with variable per-event size. Simulation with ROOT. Random generators in ROOT. (md, board, examples)
  • Lab 06, 23/11: Numerical simulation with ROOT. (activity)
  • Lec 15, 24/11: Example of relativistic boost with ROOT. (md) Using TTree created by others: Application for analysis of TTree. Creating custom analysis class. (md, board, examples)
  • Lec 16, 27/11: Makefile: usage and examples. Implicit rules; custom recipes, variables and functions, building libraries (md). Introduction to Python. Differences with C/C++. Python with jupyter notebook. (md, board, examples)
  • Lab 07, 30/11: Analysis of simulated events from LHC. (activity)
  • Lec 17, 1/12: Basics of python: semantics, flow control, data types, functions, modules. data types in python: sequences. Lists, Tuples. Example of plotting with matplotlib. (notebook, examples)
  • Lec 18, 4/12: Data types in python: Dictionaries and sets. Comprehensions. data analysis with sets, lists, dicts. Plotting a histogram. Function with multiple return values in python. NumPy arrays. Revisiting motion of a body under gravity. (notebook)
  • Lab 08 (REMOTE ONLY on google Meet), 7/12: Energy loss by ionisation. (activity)
  • Lec 19, 11/12: Animated plots with matplotlib. (notebook) Use of Numpy: Random walk. (notebook)
  • Lab 09, 14/12: Simulation of motion under gravity with friction. (activity)
  • Lec 20, 15/12: I/O with python. I/O of numpy arrays. Fitting data with scipy. (notebook) Classes in python: inheritance and polymorphism. (notebook)
  • Lec 21, 18/12: Brief introduction to Machine Learning and its applications. Classification and Regression. Application in particle physics. (md)
  • Lab 10, 21/12: Numerical simulation of the Higgs mass spectrum and fit to data. (activity)
  • Lec 22, 22/12 (online-only): Example of Binary classification with with scikit-learn: Precision and recall. ROC curve. (notebook)

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. Download the virtual machine with CentOS7 distribution CentOS7.ova. This virtual machine has ROOT, python3, jupyter and a bunch of other python modules already installed.
    3. Import the virtual machine (ova file) in VirtualBox (File->Import...)
    4. Start the virtual machine
    5. The credentials to use are student with password cmp-2020. You can also update or add new packages for example for python. The root (super user) password is the same as for student.
    6. There is also an old Ubuntu 18.04 virtual machine from last year. This machine has ROOT and python tools installed. The credentials are user student with password physics.
  • 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