------------------------------- HW 1 -------------------------------
similarities and differences of the electron, muon, and tau leptons
These leptons are elementary particles with a charge of -1 and a spin of ½. Tau leptons are the largest leptons followed by muons. Tau leptons and muons both decay whereas electrons do not.
What do commands ‘mkdir' and 'cd ../..’ do?
Mkdir is used to make a directory
Cd is used to go into a folder in the given directory or go back to a folder high up the file structure
The cd .. command will take you up a folder in the file system
------------------------------- HW 2 -------------------------------
What are the fundamental particles and forces? How many particles standard model of particle physics has?
Fundamental forces
gravity
electromagnetism
Strong nuclear force - gluons
weak nuclear force
Standard model particles
Quarks (6) - (Up, down, charm, strange, top, and bottom)
Leptons (6) - (Electrons, Muons, Tau - neutrino pairs)
Gauge Bosons (4) - (Photons, W, Z, gluons)
Scalar Boson (1) - (Higgs Boson)
What is spin of a fundamental particle?
It is an intrinsic form of angular momentum
What is the difference between bosons and fermions?
Fermions have a spin value of an odd half integer such as 1/2 or 3/2
Bosons have and integer spin such as 0 or 1
What is Linux?
Linux is an open source operating system that use the Linux shell
What is a Linux Shell?
A command line interface that provides the user with a way to input commands
How do you find which shell your are working in?
echo $0
What is basic linux command structure?
command -option1 -option2 target1 target2
What do the following commands do?
Pwd gives current directory path
Ls lists files in current directory
Ls -l lists files in current directory with more information about the files
Different ls extensions give different info about files in the current directory
Cd can be used to change the current directory
Mkdir makes a directory in the current folder
Rmdir removes given folder from current directory
Whoami gives the current user
Echo outputs text in the terminal
Cat can be used to read out things from files
More is also used to read out files into the command line
What is the difference between ls, ls ., and ls .., ls /, ls ./
The different arguments indicate a different type of command
Ls lists files in current directory
ls . appears to do the same thing as ls
ls .. list out all the files in the file above the current file
ls / appears to list all files in the top level directory
Note - If you ever go abode the home directory you can get back by doing cd home/(username) or cd ~
ls /. appears to do the same thing as ls
How can get help to learn more about linux commands on the command line?
Lots of resources on the internet as well as --help extension on most commands and help command
What is symbol ~ used for in the directory structure?
~ generally indicates the home directory in a file path
What do uparrow and enter keys do?
Enter runs the currently input command
Up Arrow can be used to select recently used commands
What kind of programs/apps you can use to open the following file types: .txt, .C, .cpp, .root, .sh, .csh
Most text editors should be able to open up these types of files
What do operators, > and >> do?
> >> are used to redirect the output of a program to a location other than the terminal
> Will replace a file with the given name
>> Will append the output to the given file
What is emacs?
Emacs is a text editor
emacs -nw mycode.C
Using the -nw will open emacs in the command line
Note - Use control X control C to close the command line interface
emacs mycode.C
This opens the current file in a separate window but the command line is always busy so you cant enter more commands while the current file is open in emacs
emacs mycode.C &
Using the & at the end outputs an integer in the terminal
Additionally using the & allows you to continue to use the same command line while using emacs
What do you expect to heppen if you run the command ‘emacs myfile.txt &’ where the file myfile.txt does not exist already.
It will create a file for you to write in with the given name
How do you save a file in emacs?
You save a file using file save or the command C-x C-s
What did it seem like the 'touch' command does?
Touch seems to be a way to create empty files
Why do you think we include that '.' after the 'find' commands?
We include the . to specify the current directory
Based on the outputs from the four 'find' commands, what purpose do you think the '*' character serves? (Hint: it's called the "wildcard" character in Linux jargon)
The *1 indicates that you are looking for anything ending in 1 and 1* would indicate you are looking for anything starting with 1
What did the 'rm' command do, and how do you think 'rm' differs from the 'rmdir' command we saw earlier?
Rm will remove ANYTHING regardless of contents
Rmdir will only remove empty directories
Finally, to test your understanding, why do you think that you should never run the command 'rm *'?
Running rm * will remove all directories it can
What do the '>' and '>>' operators do? How are they similar? How are they different?
> >> are used to redirect the output of a program to a location other than the terminal
> Will replace a file with the given name
>> Will append the output to the given file
What is one potential danger of using the '>' operator?
The > operator can delete data as it can overwrite it
What do you expect to see if you run: (ls -l > log.txt) (cat log.txt)
It will overwrite the files with a list of information about the current folder
Use google and collect 10 Linux commands that you think could be useful for you
ps - lists processes
kill - used to kill a process
clear - clears terminal
before
after
history - shows recently run commands
mv - move a file from one directory to anther
cmp - outputs the difference between two files
sudo - run root and other commands from different users/access levels
head - shows first few lines of a file
tail - shows last few lines of a file
grep - finds lines with certain words
------------------------------- HW 3 -------------------------------
What is a shell script?
Shell script - file containing command that can execute all the commands if run
What do line #!/bin/tcsh on top of a shell script means?
The line is included at the top to tell the computer where to execute the script
What is command 'chmod +x' used for?
Chmod +x will make it executable
What do ’touch’ command do?
Touch creates empty files
How do you execute a shell scripts?
Use ./(file name) to execute (file name)
What is the argument to a shell script?
Arguments can be passed in to scripts so they can be used dynamically
Parameters use the $(number) to be declared
What is the difference between ’sometext’ and ‘$sometext’ in a shell script?
Adding the $ makes it a variable reference
What is piping (|) in linux and how to use it?
Piping lets you send the output of one command to another
How can you search and replace something in a file from command line or from within a shell script.
To find and replace use - sed -i -e 's/a/b/g' test.txt
searches for "a" in the file test.txt and replaces it with "b."
What do you think chmod command does?
The chmod command changes the permissions of a file
Exercise
Note - Concatenation is done by just mashing all the things you want concatenated together
What is the output of this script?
It doesn't output anything but the resulting file that is created contains every file on the system that is not hidden
-File not included as it could not fit all on the screen
In Linux, what is piping (done with the symbol | )? Write a short description.
Piping lets you send the output of one command to another, it is very useful if you are looking to run lots of commands all at once as you don't need to sit there and input results from one command into another
Exercise:
Note - I shortened the text file so the output could be easily displayed all at once
Ps ux can be used to display the PID of recent commands - Makes it easy to close suspended processes so you can disconnect from server/use kill (UID) to stop process
-ps is process status
-ux specifies all commands run by the current user
------------------------------- HW 4 -------------------------------
Why muons travel farthest in the detector.
Muons travel the farthest because they interact with very few other particles this makes them difficult to stop. If they do not interact with anything they will not lost momentum and will travel farthest, most of the other particles are caught by the calorimeters (Electromagnetic and hadronic) which stop their progress where as most muons travel strait through the calorimeters
https://www.lhc-closer.es/taking_a_closer_look_at_lhc/1.detectors
How can you create a file with emacs?
You just open a file that doesn't exist and then when you save it the file will be created
How to print a statement in c++ code.
You use cout << (What you want to print out);
what is ‘ #include xyz’ mean in a C++ file?
It means to include another external package and methods in the code
How to add comments in C++?
you use // and then everything after it in the line is a comment
How do you compile c++ code to create and executable that you can then run as './executible-name’?
you use the g++ then file name to compile the code
What does the g++ compiler do?
It creates an executable that can then be used to actually run the code on the system
What punctuation c++ code uses to separate the code lines?
It uses a semicolon (;)
What does command 'g++ dumpspecs’ do?
Note - the command is (g++ -dumpspecs)
It displays a lot of information that seems to be information about the system and perhaps the versions of c++ on it
How you define variables of kind int, double, float, bool,
you use the variable type then the name then an equals sign and then the value you are defining it to be
ex. int i = 3;
What do the operators ++ and —, !=, ==, do?
++ Increments a variable by 2
-- decreases a variable by 2
!= is not equals and is a comparator
== is equals is also a comparator
How while and for loops work in c++?
While loops do things wile the initial condition is true, they are defined using a while(Condition){run this code}
For loops do things for each iteration defined in the loops condition for (declare variable; repeat while true, change something)
How to add debug statements in the C++code?
you can use a cout that only outputs if debugging is enabled, this lets you see the process without interfering with it
using the ++ before a variable will increment the variable and then use the increment value in the line where as using variable ++ will use the current value in the line before increment
g++ --help lets you know a lot of different features that a command has and their general implementation
the g++ -O allows you to rename the output file
Code
------------------------------- HW 5 -------------------------------
How you define Pointers in C++? How you can get the address and the value of a pointer?
You can get the value of a pointer by putting a & in front of the variable name
How can you define a pointer with a new memory address?
You declare a pointer by adding a * after the variable type and placing the reference instead of a value
Using ‘date' and ‘awk' commands in a script.
Date is used to get and display the current date and time
awk allows you to define a sort of function that can then be used on multiple items kind of iteratively
The difference in the two methods is that one of them uses references and the values will change together i.e. when i changes in the second example, p will also change
Computing
Note for some reason I kept getting an error that did not change the output but did give this error
I was able to rectify this by changing the header to use /sh instead
This fixed the reason, I'm guessing that it fixed it because tcsh is probable an extension that is not entirely supported by the main node or has files on other nodes that are related to tcsh that it could not access due to other nodes being down(note this last part is purely speculation)
In addition to using sh instead of tcsh I had to add "" around the $month or it would say that that option is not a valid parameter
I'm speculating that this is because the parameter type where it is not cast as a string is supported in tcsh but not in sh
The output
------------------------------- HW 6 -------------------------------
What is ROOT? (answer in the context of LHC data analysis. We are not concerned with any other uses of the word ‘root’)
Root is a data analysis tool that can be used to display data
What does command ‘cmsenv’ do?
It seems to set up a place that root can be run, ensure that this is run before trying to use root
What happens when you run command ‘root'?
assuming you have run the cmsenv command, it switches the terminal to the root interpreter
What is the difference between commands ‘root' and 'root -l’
it will not bring up the logo window or display the version information and logo in the command line
How do you quit a root session?
.Q
Working with arrays in C++.
arrays begin with index 0, their size cannot be changed once formed, you also set the type of variable contained in the array at the time of declaration
int name [3]; this makes an array with size 3 that can hold integers
int name [3] = {3,2,1}; this makes an array with size 3 that contains 3 at index 0, 2 at index 1, and 1 at index 2
you can get or set an index using name [index]
multi dimensional arrays can be created using multiple bracketed sizes
int name [3][2]; makes a 3 x 2 array
How can you add single and multiline comments in C++?
// for single line and /* (text here) */ for multiline
Note:
Ofstream: signifies the output file stream and is used for writing data to files
Ifstream: signifies the input file stream and is used for reading data from the file
How to read data from a file in C++ code?
you use the fstream package
you declare a variable of type ifstream
you use the variable and the method .open("filesname") to open the file
note you can see if a file has been opened successfully using file.is_open()
you then can output the contents using cout << fileName.rdbuf()
How to create, write into, and close a txt file in C++
you use the fstream package
you declare a variable of type ofstream
you use the variable and the method .open("filesname") to open the file
you can create a file by opening a file that does not exist
you can then write to the file using the << to the variable that had opened the file
you can close a file using the .close() method
What is the difference between a vector and a scalar in C++?
a vector is basically a list that's size can be altered - can hold multiple values
a scalar is able to only hold one value
How to use vectors in C++?
first start by importing the vector package using #include <vector>
declare a vector using vector<int> name;
use .push_back(item) to add item to the end of the list
use .pop_back(item) to remove item at the end of the list
note you need to use .begin + index to get the correct index
use .insert(index, item) to add an item at a given index
use .erase(index) to remove an item
How to use a random number generator in C++? Which #include file is needed to use this function in your C++ code?
use #include <stdlib.h>
using rand() will generate a long number, use % 10 to get a number between 1-10 or %100 for one between 1-100
use srand(int or double) to set the seed
note: time is a good seed if you want constantly random numbers
What do we mean by the ’seed’ of a random number generator?
it is the value that is used to generate the string of numbers that the random value is pulled from
What changes in the distribution of random numbers as you increase statistics?
The amount of variance decreases? The distribution becomes more consistent
What is ‘class' in C++?
a way to make a complex variable with other objects or methods contained
Name two classes you have used in C++ code in this class?
String and Double
How do you run C++ code with root?
Use the .L command followed by the name of the cpp file
How do you book, fill, draw, and save a histogram in C++ code to be used in root?
The Fill(x) -> Fill(x, y, z, w) methods will fill the histogram using the input arguments and increments by the weight w
Arrays
Opening and writing in files
Importing other files and methods/Scalar multiplication
Random Numbers
Try removing this and see how the result changes. What does the & do?
It prevents the variable from changing, all the trials result in the same value and there is no randomness besides the first value
Show how we get to this number?
Bits can have 2 states so the base is 2, then there are 8 bits per byte so that is the exponent. You then multiply the exponent by the number of bytes to get the number of digits that can be stored.
What do you notice?
If the seed does not change then the first 10 digits are always the same
What do you notice about the contents of the histogram?
The higher the count the less variance in the graph
Set N=1 and run it. From this "data", what would you guess the mass of the mother particle is? And, how far would you guess the true mother mass could be from this measured value?
The value implies that the actual mass is around 96 but more data is needed for a better conclusion, after further test I would guess that this value is less than 10 from the actual value
Now change N to 10. What do you find?
It starts to give a more accurate representation
Change N to 100? What do you find?
Change N to 1000. What do you find?
What have you learned?
More trials give a more complete picture of what the actual result is
------------------------------- HW 7 -------------------------------
What is missing energy?
Missing energy is energy that cannot be accounted for in the reaction
What are jets?
Jets are made up of narrow cones of hadrons created by the hadronization of a quark or gluon
How to distinguish between physics objects in the detector?
1. electrons
Electrons are represented as the green tracks and are caught in the electromagnetic calorimeter
2. Muons
Muons are represented by the long red tracks that are picked up by the muon chambers
3. photons
Photons are represented by the yellow lines and are caught in the electromagnetic calorimeter
4. jets
Jets are represented by the orange cones, they are stopped by the calorimeters where their energies are measured
5. missing energy
The purple track represents missing energy which can represent a neutrino the vector is calculated biased on the observed variables and what is unaccounted for
6. vertices
The vertices are groups of tracks with each representing a proton-proton collision
What is MadGrapgh package used for?
It is used to view particle collision data
How is tar command used? what is the difference between xvzf and cvzf options for tar?
The tar command is used to unpack zipped files, the xvzf option stands for x - extract, v - verbose, z - a gzipped file, f - tar archive opperaion
in cvzf the c means to create a new archive
What kind of information you can find in the madgrapgh output .lhe file?
the file includes data about the collision events
What is montecarlo (MC) ID?
Its the id for a particular simulation
Write a brief description of major parts of the CMS detector.
Beam pipe - inner area where the particles travel
tracker - records the paths of charged particles
calorimeter - measures the energy of electrons and photons
solenoid - large solenoid magnet to determine the charge mass ratio of particles from their path in the magnetic field
muon tracker - placed at the outer ring to track muons
Find how to change the display to show you a view along the beam pipe?
You can use the left click and drag with the mouse to move around the picture of the detector, you can also orient using the axis buttons at the top of the screen
Which color tracks are electrons?
green tracks
Which color tracks are muon?
long red tracks
Which color track missing energy is represented with?
purple tracks
How are jets depicted in this visualization?
Jets are represented by the orange cones
Can you figure out if a track has clockwise curvature, it is +vely charged or negatively charged? (when looking at the x-y view, with x along the horizontal axis)
Yes, the curvature shows what kind of event has taken place, a deviation clockwise in a magnetic field indicates a positive charge, where as counterclockwise deviations indicates a negative charge
Study at least 2 events from each category in the files available with the display and specify how many objects of each kind are seen in every event?
Event: Events/Run_202299/Event_421267699
electrons - 4
muons - 3
photons - 4
jets - 52
missing energy - 1
vertices - 16
Event: Events/Run_201707/Event_805047482
electrons - 4
muons - 1
photons - 4
jets - 42
missing energy - 1
vertices - 11
HZZ4LeptonsAnalysisReduced->MakeClass("HiggsAnalysis")
What does this command do?
It creates the .C and .h files for the c++ code
numpy - can be used to get absolute value of arrays and use other numerical functions
Link to notebook with all the python code
https://colab.research.google.com/drive/1MWu584Su2uXM1jbT_PImbUcsOH7Es7p_?usp=sharing