Experimental data processing laboratory

A.Y. 2020/2021
Overall hours
Learning objectives
We aim to offer students an introduction to the fundamental numerical computing techniques in use in the physical sciences field. Basic operating system features and commands are covered, then data structures
(in particular as included in the C++ standard library), numerical integration techniques, solution of differential equations and random-number based methods. We emphasize on a deep understanding of both the advantages and the limitations of each numerical technique. The C++ programming language is used, so its main design features (inheritance, encapsulation and polymorphism) are explained, in the context of the object-oriented (OO) design and programming paradigm.
Expected learning outcomes
Upon completion of the course each student will be able to:
1) interact with the UNIX operating system, in particular its input/output and data storage subsystems.
2) write C++ code to acquire and/or analyze experimental data and compute the main statistical estimators.
3) implement a few numerical algorithms in C++ (function root finding, integrals, differential equation solution.
4) write numerical C++ code to study a few simple mechanics and electrostatics problems.
5) write a random number generator and understand its operation and limitations.
6) use a random number generator to compute one- and multi-dimensional integrals.
7) use a random number generator to simulate the operation of an experimental apparatus, and propagate the systematic error introduced by such a measurement.
Course syllabus and organization

Single session

Lesson period
First semester
The course will be delivered remotely. Lectures will take place on the zoom platform to allow real-time interactions between students and teachers. Lab sessions will take place remotely on a dedicated platform which will be illustrated during the course.
Course syllabus
During the course some numerical techniques to deal with physical problems of interest will be presented. The reference language for the implementation of these techniques is C++: during the development of course the main features of this language (classes, templates, polymorphism) will be discussed.
In more details the covered topics will be:
1) Experimental data analysis: reading data from a file, elementary statistical analysis and visualization of the collected data.
- Basic elements of the C language (data types, control structures)
- Introduction to object-oriented programming, the concept of class
- Template classes and functions
- Data containers and algorithms: elementary containers, STL containers (vector, list and map) and algorithms (algorithm.h)
2) Exercises on object oriented approach: calculation of electric and gravitational fields
- derived classes. encapsulation.
3) Methods for finding zeros of a function: bisection algorithm, secant and Newtown methods. Performance and limitations.
- virtual methods, abstract classes and polymorphism
4) Numerical quadrature techniques: midpoint method, trapezoid and Simpson methods. Estimate of the error in the calculation of an integral with numerical techniques.
5) Solution of ordinary differential equations. One step methods (Euler and Runge-Kutta). Application to various physical systems: pendulum, forced and damped harmonic oscillator. Error analysis.
6) Remarks of probability theory, random variables and central limit theorem. Random number generators for uniform, exponential and Gaussian distributions. "Inverse function" and accept / reject methods. Monte Carlo techniques for the integration of a function and for the simulations of experimental measurements.
Prerequisites for admission
1) knowledge of the main syntax elements of the C language: types of variables, control structures (if, for, while), functions and how to pass data to a function.
2) basic elements of mathematical analysis: Taylor series, integration theory, differential equations
Teaching methods
The course is divided into 12 two-hour lessons in the classroom and 12 three-hour laboratory sessions. In each lesson the basic theoretical elements are introduced for a new topic which is then deepened through concrete applications in the following laboratory session. In the laboratory sessions, mathematics and physics problems are addressed by implementing numerical algorithms discussed in the class lessons in C ++ codes.
Students carry out the laboratory course exercises following the indications on the reference site and asking for help to the teacher or assistants in case of need.
Teaching Resources
D.S. Malik: Programmazione in C++. Apogeo, 2013.
N. M. Josuttis: The C++ Standard Library-A Tutorial and Reference, 2nd Edition, Addison Wesley Longman, 2012
W.H. Press et al.: Numerical recipes in C/C++: the art of scientific computing, Cambridge University Press
Assessment methods and Criteria
To verify the learning level of the students, three different elements will be evaluated:
1) codes created by the student during the laboratory sessions for the solution of the proposed exercises.
2) a practical computer test
3) an oral discussion.
The final mark will be defined during the oral examination and will take into account the outcome of the three parts listed above. The exercises carried out will be evaluated in terms of correctness, completeness and efficiency in the implementation of the code. The practical test, lasting two hours, aims to verify the student's ability to apply the knowledge acquired during the course to a new physical problem: the student will have to create a C++ program that allows the solution of the proposed problem. In this test the student will be allowed to use the material he made during the laboratory. Finally, the oral test, lasting about an hour, will start from a discussion of the contents of the written test and then ascertain more generally the knowledge of the theoretical (algorithms) and methodological (coding) aspects covered in the course.
FIS/01 - EXPERIMENTAL PHYSICS - University credits: 6
Laboratories: 36 hours
Lessons: 24 hours
Turno 1
Professor: Carminati Leonardo Carlo
Turno 2
Professor: Carminati Leonardo Carlo
Turno 3
Professor: Maino Davide
Turno 4
Professor: Tomasi Maurizio
Turno 5
Professor: Galli Davide Emilio


Lesson period
First semester
* Teaching methods.
The 2020/21 course will be presented remotely and synchronously (during the allocated class times) using the Zoom sharing platform. The environment for the course assignments will be typically a virtual machine installed on students' laptops (other forms will be agreed upon at the beginning of the course with attending students).

* Program and reference material
This is unchanged w.r.t. previous years.

* Exam and evaluation criteria
The exam form is unchanged w.r.t. previous years (it still requires the demonstration and discussion of an original application), but exams take place remotely via the Zoom platform.
Course syllabus
The course starts with a short refresher on the C++ program structure and compiler chain, the C++ language semantics and its procedural applications, compile and debug tools. The structure of the standard iostream and STL libraries is then analyzed in some depth: especially their application in developing efficient data handling algorithms (the reference data analysis package is ROOT). The generic object-oriented design and coding model is then introduced. A brief survey of classical numerical methods follows: root finding, ordinary differential equation
solution, numeric integration, random number generation according to a given PDF. Basic operating system and system library functionality for peripheral access, process control, network communication and parallel execution is finally explored and applied.
Prerequisites for admission
Basic expertise in using a computer, a basic knowledge of its operation and familiarity with procedural programming in any high-level language are assumed. These are e.g. proposed and taught in the "Informatica" course of the Physics degree curriculum.
Teaching methods
The course includes a series of traditional lectures. Each lecture is followed by an assigment that has to be completed (coded and executed) on the computer. Assigment solutions are then shared, discussed and commented upon at the beginning of the next lecture.
Teaching Resources
Course material: http://labmaster.mi.infn.it/Laboratorio2/serale/
Reference textbooks:
* N. Josuttis, The C++ Standard Library, a tutorial and reference, 2nd edition, Addison Wesley
* R. Lischner, "C++ in a nutshell", O'Reilly
* W.H. Press et al., "Numerical recipes in C/C++: the art of scientific computing", Cambridge University Press
* J.Peek, G.Todino, J.Strang, "Learning the Unix Operating System", O'Reilly
Assessment methods and Criteria
Each student is asked to develop an original application using the C++ language. The topic and purpose of the application are selected freely by the student and subject to approval by the course instructor. The exam starts with a practical demonstration of the developed application, followed by a discussion and oral exam. The course final grade (expressed in thirtieths) will evaluate both the practical and the oral part of the exam.
FIS/01 - EXPERIMENTAL PHYSICS - University credits: 6
Laboratories: 36 hours
Lessons: 24 hours
On appointment
Wednesday 14:30-16:00, or in other days by appointment (contact me by e-mail or telephone)
Dip. di Fisica, stanza A/T/S5b (piano 0 edificio LITA), via Celoria, 16
By appointment
Room I/T/11A at "Palazzina Calcolo", Physics Department (via Celoria 16)
Ask the teacher
Laboratorio di Strumentazione Spaziale, Department of physics (via Celoria 16, Milano)