Computing Methods for Physics (2018/19)

Orario Lezioni

Il corso dell'anno accademico 2018/19 inizia il giorno martedi` 25 settembre 2018

  • Tuesday 12-14, Aula 7 , Nuovo Edificio di Fisica
  • Friday 12-14, Aula 6 , Nuovo Edificio di Fisica
  • Recovery of lectures lost because of bad weather: on Monday 3 and 10 Dec 2018 and 14 Jan 2019 at 14:00-16:00, Aula 4, Nuovo Edificio di Fisica

Exam procedure (modalita` d'esame)

All exam sessions are available on infostud. The exam procedure is identical for all sessions. For each session:

  1. Registration on infostud is mandatory to take the exam.
  2. On the 1st day of each session, a PDF file with the text of the exam will be posted on this website. The exam will include:
    • at least 1 exercise with C++ for a total of 15 points
    • at least 1 exercise with python for a total of 15 points
    • the score will be the sum of the two parts
  3. Each student who has registered for the session, must send her/his solution following the instructions on this website and also reported on the PDF file, within 48 or 72 hours.
  4. The exams will be graded only for students registered on infostud.
  5. There will be 2 or 3 dates and times (depending on the number of registered students) before the end of each sessions for students to come in and discuss their solutions and answer questions. A final grade will be proposed based on the discussion.
  6. Grades not recorded (verbalizzato) on infostud before the end of the sessions will be lost. A new exam must be taken at a following session.
  7. Students who have taken the midterm test can choose one of the following options:
    • Solve only the python problem(s) for a total of 15 points, and the remaining points will be given by (midterm score)/2. Example: someone had 26 at the midterm, solves only the python problem and obtains 13 points, final score will be 13+26/2 = 26
    • Solve both C++ and python problems and use their midterm bonus (maximum 3 points) to be added to their total. Example: someone had 26 at the midterm, solves python and C++ problem and obtains 25 points, the score will be 25+2 = 27
  8. Bonus points and grades from midterm are valid for all exam sessions until end of 2019
  9. There are no limitations on how many times the exam can be taken.
  10. A valid grade can be declined. But the midterm grade and bonus cannot be used for a new try and the full exam must be taken.

Midterm test

The midterm test is available. In order to submit your project you have to

  1. Log into https://mail.uniroma1.it with your Sapienza credentials
  2. go to this form to upload your material.

The deadline for submission is Thursday 29 Nov at 20:00. The form will be closed after this time.

Midterm bonus:

  • 3 points for scores 30-28
  • 2 points for scores 27-25
  • 1 point for scores 24-22
  • 0 points for scores 21-18

Results of the midterm test are now available at this link.

Given that there are many similar or identical tests, the scores and bonus will be confirmed after an oral discussion after the exam.

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.
  • GEANT4: a toolkit in C++ for detailed simulation of passage of particles in matter. Details and applications on their website https://geant4.web.cern.ch
  • 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
  • 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
  • scikit-learn: is a kit for machine-learning in python. Valuable info available at their webiste http://scikit-learn.org

Material

  • Lec 01, 25/9: Introduction to the course (introduction). Introduction to C++. (pdf, examples)
  • Lec 02, 28/9: References and pointers in C++. Constant. Namespace. Introduction to Class. (pdf, examples)
  • Lec 03, 2/10: Classes and objects in C++. Interface and attributes. Constructors. (pdf, examples)
  • Lec 04, 5/10: Separating interface and implementation. Header and source files. (pdf, examples)
  • Lec 05, 8/10: Using class std::vector. Dynamic memory allocation. Destructor. const member functions. Default arguments for functions. (pdf, examples)
  • Lec 06, 9/10: Applications in C++. Arguments from command line. external libraries. Introduction to ROOT. (pdf, examples)
  • Lec 07, 12/10: Dynamically allocated object as data members. Overloading operators. Adding operators to class Datum. class Vector3D. (pdf, examples)
  • Lec 08, 15/10: Overloading operators and friend methods. Static data members and methods. Application to compute weighted average. (pdf, examples)
  • Lec 09, 16/10: Example of static data member in class Datum. Enumerators. use case for std::map, std::pair, and std::vector (pdf, examples)
  • Lec 10, 19/10: Input/Output with TTree and TFile (examples)
  • Lec 11, 23/10: I/O with TTree: variable size arrays. Storing user-defined Class in TTree (md, examples, ROOT setup and configuration)
    This lecture has been written with the Markdown language. The graphical viewer is provided by GitHub
  • Lec 12, 26/10: Application for analysis of TTree. Creating custom analysis class. (md, examples)
  • Lec 13, 6/11: Object oriented programming: Inheritance. Base and derived class. (pdf, examples)
  • Lec 14, 9/11: Polymorphism: abstract class and virtual methods. Applications. (pdf, examples I, examples II)
  • Lec 15, 13/11: Strategy pattern, examples and applications: Numerical integration methods. custom Function class.
    Composition pattern, examples and applications: leaf and composites in graphical applications. (md, examples)
  • Lec 16, 20/11: Composition pattern: leaf and composites in graphical applications. Example of a solar system simulation with composite objects. (md, examples)
  • Lec 17, 23/11: Composition pattern: examples in high energy phyiscs: tracks, photons, electrons, jets. Midterm test (pdf)
  • Lec 18, 27/11: Templates and generic programming in C++. Template functions and classes. (pdf, examples)
  • Lec 19, 30/11: Discussion of midterm test and solution: Pros and cons of using void functions with non-const pointers. Polymorphic detectors.
  • Lec 20, 3/12: Template class. STL containers. Error handling with exceptions. (pdf, examples)
  • Lec 21, 4/12: Introduction to Python. Main differences with C/C++. Introduction to jupyter. (md, examples) Instructions for downloading the lecture notebook
  • Lec 22, 7/12: basics of python: semantics, flow control, data types, functions, modules. (nb, examples)
  • Lec 23, 10/12: data types in python: sequences. Lists, Tuples. Example of plotting with matplotlib (md, examples)
  • Lec 24, 11/12: data types in python: Dictionaries and sets. Comprehensions. data anlaysis with sets, lists, dicts. Plotting a histogram. revisiting example from previous lecture. (md, examples)
  • Lec 25, 14/12: More on Functions in python. Animated plots with matplotlib. (md, examples)
  • Lec 26, 21/12: Numpy and array-oriented programming with ndarray. Example of random walk with arrays. (md)
  • Lec 27, 8/1: Classes, inheritance, and polymorphism in Python (md, examples)
  • Lec 28, 11/1: File I/O and handling in python. Functions with variable number of arguments. Command line arguments for python programs (md, examples)
  • Lec 29, 14/1: Photons and hadronic jets in proton collisions. Brief introduction to Machine Learning and its applications. (md)
  • Lec 30, 15/1: Types of Machine Learning and main challenges. Example of b-tagging with machine learning. (md)

Topics in upcoming lectures

  • C++
  • Python