Notes and Goals:
Entry #1 - September 21, 2020
Similarities: -1 charge
Differences: mass of electron < mass of muon < mass of tau
only electron is stable, muon and tau are unstable
pwd = shows current directory
ls = shows files in the current directory
ls -l = shows the creator and date created of the files in alphabetical order
ls -lr = shows the creator and date created of the files in reverse alphabetical order
mkdir [...] = creates a new file within directory called [...]
cd [...] = moves into the directory called [...]
ls .. = shows files of the previous directory
cd .. = moves into the previous directory
rmdir [...] = removes a file in the current directory
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Homework 2
The 'touch' command creates a file in the current directory.
Including the '.' after the 'find' command only searches through the contents of the current directory.
The '*' searches for the contents that include the text ("file"/"test") within its name. '?' is also a wildcard character, but it only searches for a single unknown character whereas '*' searches for contents with any number of unknown characters.
'rm' removes a file and 'rmdir' removes a directory/folder
'rm *' would remove all the files and folders in the current directory. There's is no undo or command that will bring back those files.
echo "test"
echo "test1" > log.txt
ls
cat log.txt
echo "test2" > log.txt
cat log.txt
echo "test3" >> log.txt
cat log.txt
Both operators put the text or contents (before the '>' -- test2) into the file (after the '>' -- log.txt). The '>' command replaces the contents of the file and the '>>' adds to the contents of the file.
The '>' would replace and lose the original contents of the file
ls -l > log.txt
This would put the creators and the date created into the text file.
Whatever the ls -l prints on the terminal will be put into the text file
10 useful commands
'cp'
'cp log.txt /Users/connordin' would copy log.txt and paste it into the 'connordin' directory
also stays in TEST directory
'mv'
'mv log.txt /Users/connordin' would move log.txt into the 'connordin' directory
log.txt no longer in TEST directory
'mv log.txt newlog.txt' would rename that file to newlog.txt
'grep'
search through all text in a given file
'grep connordin newlog.txt' will return the line that has the text 'connordin'
'diff'
compares two files and outputs the lines that do not match
'history'
shows commands you have used before
(having trouble getting into the cluster lol)
'man'
gives a manual on how to use different commands
'man tail' will explain how to use the 'tail' command
'q' will exit the manual
'zip' 'unzip'
compresses or decompresses files
'clear'
clears the terminal
before:
after:
control + c
stops the currently run program
'passwd'
changes password for the user
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Entry #2 - September 27, 2020
Emacs...
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Homework 3
tcsh ./testscript.tcsh <argument>
(where instead of the word argument you would use a different word such as "cms" or "make".)
It seems like this script takes a user's input and outputting files containing the input, searching through the /directory path, the current directory, and a level up from the current directory
./testscript.tcsh <argument>
ls –l testscript.tcsh
chmod +x testscript.tcsh
ls –l testscript.tcsh
./testscript.tcsh <argument>
The 'chmod" command allows the file to execute.
Exercise:
Now, as an exercise, try using emacs to write a simple script based on testscript.tcsh called homesearch.tcsh which takes one input, <input>.
homesearch.tcsh should search your home directory and its subdirectories for any files which contain <input> somewhere in their name. Finally, homesearch.tcsh should log the results of the search to a file called homesearch_<input>.txt. (Don't forget to 'chmod +x' your new script!) Try:
touch testfile
./homesearch.tcsh testfile
cat homesearch_testfile.txt
What is the output of this script?
Exercise:
In Linux, what is piping (done with the symbol | )?
In Linux, piping, denoted by '|' lets you use two or more commands such that output of one command serves as input to the next.
Exercise:
The command
sed -i -e 's/one/two/g' test.txt
searches the word "one" everywhere in the file test.txt and replaces it with the word "two."
Copy paste the following text to create test.txt file in your directory. Write a script that uses this and/or other commands to :
1. replace every "was" with "is"
Before with "was"
After with "is"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Entry #3 - Sept 29, 2020
C++
versions of c++ are contained in your CERN virtual machine:
version 4.2.1 are also on this machine
Variables
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Homework 4
Using the Taylor expansion for when x is small, show that the relativistic expression for kinetic energy becomes the one you are familiar with from high school physics when beta (v/c) is small compared to 1. Hint: Total E = Kinetic energy + rest mass energy =
https://en.wikipedia.org/wiki/Kinetic_energy
Show that rapidity and pseudorapidity are equal for massless particles. Hint: Start with the equation for Rapidity in the book. Note that for massless particles E= magnitude of 3-momentum |P|. Also, note that z-component of a vector in angular coordinates is vector magnitude times cos-theta. Finally, you need to google couple of cos-theta trigonometric identities.
rapidity: pseudorapidity:
Since both particles are massless, momentum and energy will be equal to each other.
Why muons travel farthest in the detector? You can find the answer using google. Give the reference of your source with the answer.
"Because muons can penetrate several meters of iron without interacting, unlike most particles they are not stopped by any of CMS's calorimeters. Therefore, chambers to detect muons are placed at the very edge of the experiment where they are the only particles likely to register a signal."
- http://cms.web.cern.ch/news/muon-detectors
MAIN
VARIABLES
SOME OPERATIONS WITH NUMBERS
'++' adds the numerical variable by one, and ''--" subtracts the numerical variable by two
'++n' vs 'n++'
Found this on Quora... it appears like ++n runs the commands within the line whereas n++ needs to have its own line
NON-NUMERICAL VALUES 1
LOOPS
FOR LOOPS
SLOW AND FAST LOOPS (NESTED)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Homework 5
LOGIC STATEMENT
Pointers
'new'
COMPUTING
small C++ code that shows examples of if and while logic statements
Alter the script given below so that it outputs the list of files that were updated within the current month
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Homework 5
Arrays and vectors in C++
dot product
scalar multiple
main.cpp
terminal prints...
sample random number generator...
removing the '&' from the mranflat function...
In this case, the '&' allows the parameter to point towards the address of the argument. The lack of '&' causes 'inew' to evaluate to the same value since the address itself is not changing (whereas the data stored in the address does change).
with n bytes, unsigned data with a value up to 28n-1 can be stored.
Show how we get to this number?
Base of 2 represent that binary trait of a bit (0 or 1), and it is raised to the power of 8 because there are 8 bits in on byte. 8*n would represent the number of bits as n equals the number of bytes. Subtract by 1 to account for the value of 0.
Put a cout statement into the code that makes it print the first 10 “random” numbers it generates.
added an if-statement to this block of code. The result...
trial 1...
additional trials...
It appears that the first 10 numbers do not change.
Try changing the seed (it should be odd and large). What happens then?
The first 10 randomly generated numbers are different when I changed seeds. With the different seed, the first 10 numbers stay the same despite changing the number of iterations.
Now try changing the number of times you call the random number generator from 1000 to other numbers (say, 10, 100, 100000, etc). What do you notice about the contents of the histogram?
The first numbers are the same despite changing the number of iterations. The histogram looks when changing the number of iterations.
'srand' function
CLASSES
done
there is an intentional mistake in the code
there was a missing bracket
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 mass of the mother particle would be about 97 GeV. I believe the true mother mass is 91 GeV so it is off by 6 GeV.
N=10
ranges from about 71 to 111. Center around 90
N=100
ranges from about 36 to 141. Center around 90
N=1000
ranges from 8 to 151. center around 90. looks more like a bell curve
Now open secretparameters.txt and change the first number in it to 1. Repeat with N=1,10,100,1000. What have you learned?
N=1
Measurement is at 25. Much lower compared to the N=1, m=91 measurement at 97
N=1
range: 11-43, center around 25
N=100
range: 2-59, center around 22
N=1000
range: 0-43, center around 80. center around 13. forming a bell curve shape again
Overall:
The center for these trials may be inaccurate since I cannot see the negative values. Changing the mass of the mother particle caused the graph to shift towards that change.
____________________________________________________________________________________________________________________________________________
Logbook Entry 11/11
MADGRAPH
To start madgraph
./bin/mg5_aMC
Note the dot at the beginning of the command.
Let's start with the first point, how to generate a process:
MG5_aMC>generate p p > t t~
Note that space is mandatory between the particle names.
To list all defined processes, type
MG5_aMC>display processes
If you want to know more about particles and multiparticles present,
MG5_aMC>display particles
MG5_aMC>display multiparticles
If you want to add a second process, use the add process command:
MG5_aMC>add process p p > W+ j, W+ > l+ vl
This adds a decay chain process, with the W+ decaying
leptonically.
Now let us create the output of these processes that we will use to generate and calculate cross-sections:
MG5_aMC>output MY_FIRST_MG5_RUN
To generate your events:
MG5_aMC> launch MY_FIRST_MG5_RUN
Local terminal 'control n' (thanks bryan!)
Write a brief description of major parts of the CMS detector. What are the physical dimensions of each part?
Beam pipe:
Tracker:
Calorimeter:
Solenoid:
Muon tracker:
Find how to change the display to show you a view along the beam pipe?
orthographic view, x-y plane,
Which color tracks are electrons?
Green
Which color tracks are muon?
Red
Which color track missing energy is represented with?
Pink
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)
If a track has clockwise curvature, it is POSITIVELY charged.
How are jets depicted in this visualization?
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?
electrons
muons
photons
jets
missing energy
vertices
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Using relativistic kinematics - TLORENTZ vector class to get Z-boson and Higgs boson invariant mass
HZZ4LeptonsAnalysisReduced->MakeClass("HiggsAnalysis")
Homework 8
/ In a ROOT session, you can do:
// Root > .L HiggsAnalysis.C
// Root > HiggsAnalysis t
// Root > t.GetEntry(12); // Fill t data members with entry number 12
// Root > t.Show(); // Show values of entry 12
// Root > t.Show(16); // Read and show values of entry 16
// Root > t.Loop(); // Loop on all entries
Homework 9
What is the difference between CPU and GPU?
CPU handles tasks much faster and executes commands and processes necessary for a computer to run. GPU are similar but are more specialized for the graphics and visual aspects of what the computer presents.
PRE-DECLARED VARIABLES
Exercise: Using the pre-declared variables, calculate the area of a circle, and assign it to a new variable named 'area'. Print 'area' to the console.
TEMPORARY VARIABLES
Method 1 doesn't work. 'a=b' sets list 'a' as ['cat', 'dog', 'fish']. When running the line 'b=a', list 'a' now has the strings rather than the numbers, so list 'b' will have the strings.
Method 2 creates a variable 'temp'. This stores the data in list 'a' while allowing list 'a' to store the numerical values of list 'b'. Then it sets list 'b' to the data stored in temp, which had the original list 'a'.
Exercise: Using temporary variables, switch the following data so that it makes sense. Print the new variables to the console.
FUNCTIONS
Exercise: Write a function that will round a number to 'n' digits. Test your function using a print statement. Make sure the print statement is outside of your function.
MORE BUILT-IN FUNCTIONS
Exercise: Write a function that takes in two lists as arguments. Your function must first find the max of both lists. It must return the product ('*') of the maxes. Test your function by printing to the console.
BOOLEAN AND CONDITIONALS
Exercise: Using print statements, and built-in functions min(), max(), sum(), write some code that either evaluates to True or False.
If-else statements
Exercise: Change values of a and b such that other two conditions are met.
Exercise: Write a function to determine if the absolute value of the minimum in a list is odd. If it is odd, print 'odd' to the console. Else, print 'even' to the console
Exercise: You are analyzing sports teams. Members of each team are stored in a list. The Coach is the first name in the list, the captain is the second name in the list, and other players are listed after that. These lists are stored in another list, which starts with the best team and proceeds through the list to the worst team last.
Final is between the two teams. Complete the function below to select the captain of the losing team and print to console.
Exercise: The next iteration of Mario Kart will feature an extra-infuriating new item, the Purple Shell. When used, it warps the last place racer into first place and the first place racer into the last place.
Complete the function below to implement the Purple Shell's effect. Pass the list 'standings' into your function and print the updated standings to the console. (Hint: Keep in mind the concept of temporary variables from a previous lesson)
for loop
while loop
Exercise: Your lucky number is 7. You really like 7. You even like numbers divisible by 7 (do I smell a modulus operator?). Write a function that counts the frequency of numbers divisible by 7 in a list, and print that frequency to the console.
first screenshot
second screenshot
third screenshot