HONR268N 2020 FALL
HW1:
9-17
- Electron muon and tau all have -1 charge, but from e- to tau mass increases
- mkdir ___ makes file/directory with name ___ , cd goes into files, cd .. goes out, cd(~) goes home
- quick notes of standard model:
- 6 quarks, up charm top have +2/3 charge, other has -1/3
- only up down are stable, all others including 6 antiquarks are not
- increase in mass down the model, top heaviest
- hadrons are particles made of quarks, baryons have 3 quarks, mesons 2
- baryons are protons(uup) neutrons(udd) ("baryonic matter")
- 6 leptons, e- muon tau -1 charge, neutrinos 0 charge, mass increases down
- e- and neutrinos stable, muon tau not
- 6 other antis, antielectron(positron) stable
- particle and anti annihilation, release energy, but particle and anti gone
HW2:
'echo $0' returns '-bash' meaning my shell is the bash variant. 'echo $SHELL' returns '/bin/bash'
linux command structure is 'command -option1 -option2 ... target1 target2' (the dashes are necessary to specify optional) (target is the file being commanded on)
typing 'command --help' returns description of what command does
pwd returns current directory,
ls lists files in directory,
ls -l gives some more details ("use long listing format"),
ls -h is used with -l to print sizes in human readable format, seems to just simplify 4096 to 4k
'mkdir new_directory' creates new directory named "new_directory"
'cd new_directory' goes into that directory
'ls ..' returns the list of files when you backstep out of the current directory, but doesnt actually backstep (pwd is same)
'cd ..' actually backsteps
'rmdir new_directory' removes/deletes the named directory
up arrow retrieves last command, repeatedly up arrowing retrieves older commands
'ls –CFx /usr/bin' appears to find some hidden directory usr/bin and list whats in it. usr nor bin can be found by ls in ~
'ls -l /bin' returns same thing as ls -l but just in bin
'find /usr –name “*g++*” –print' appears to first find all files in usr that have "g++" string in the name, then prints those names all out
'which g++' returns a directory, /usr/bin/g++ , maybe its just retrieved the directory of where g++ is
hitting tab after command, like after 'ls /home/cms' returns list of file specifications to "complete" your command, so you know the specific files if you didnt already
'whoami' returns your username (everything prior to the @ address)
'~' is like keyword for home directory
^^
from this it appears 'touch' command creates simple files, as opposed to directories, in current directory
'find -name', as earlier, returns files with certain string in their filename, there is certain syntax too,
looking at * asterisks, which represent kind of filler, to accept any string in that place
similar to a blank underscore space, can be read as looking for files with name "test_" or "_1"
'.' seems to refer to current directory
'rm' removes named files (as opposed to rmdir removing directories)
as said, rm commands are irreversible, no undo or backup history, so good idea to never use it unless some other emergency or storage issue
I'm unsure exactly whats going on, my best guess:
'>' creates something or atleast tags a file/process with a name in "" as opposed to its file name
'>>' might be adding another tag name to whats already there, multiple tags
'ls -l > log.txt' might just return the tag and filename both, as well as the other aspects ls-l usually returns
'cat log.txt' maybe just clears the tags
looking for other useful commands to learn:
'wget' gets stuff from the internet, have used it last semester to download gfortrat and madgraph and others
'tar -xvzf' a form of unzipping files? (specifically with the madgraph file, might be more general for others)
(wont show image result in terminal, as it displays long list of every file directory being generated in unzip)
'gzip' zips files, affixing .gz to file name, only works for files not directories
'mv' moves file into other directories, or can just rename file
control+c ^C quits the current command should there be an error or command is taking too long
control d saves content and quits when editing a file
also worth adding now I believe > operator means create new content, and >> means edit on top
'grep' returns the line of the string you are searching for in a file, so 'grep string file.file'
'run' command executes executables
wont demonstrate here, have done with last sem with madgraph, returns too many lines, but ends in a sort of ui
'sed' find and replace string in file usually in format "sed -i 's/FIND/REPLACE/g' file.file"
'cp' makes a copy of a file in the same directory, in the format of 'cp file newFile'
emacs:
'emacs –nw test.txt' creates new file text.txt and opens terminal mode editor
control xs and y saves and closes editor
control c ofc closes
Lecture 9-21 some notes:
quantum mech:
-wave functions
-dualilty particle vs waves
-probability and uncertainty
-electron momentum probability
-over larger scale, uncertainty much smaller hence classical phys certainty
-trade off certainty btw knowing mntm/velocity vs location location
-resulting from measuring bc throwing photon at particle
- ∆p∆x>=h/2
-nature constants can change
- ex quasistable higgs boson mass
-vacuum expectation value
-particles or waves
-wave function
HW3:
$ARG just refers to the variable passed in as argument.
$ARG* is the argument with any number of characters following it?
when executing, "Missing name for redirect."
will continue hw3 on wed
chmod color codes files?
Redoing:
Still getting missing name for redirect
Also correcting HW 2, its ctrl XC then Y that saves and closes
Even uncommenting the find line (which was not colour coded so probably had some problem) gives same error
Will just skip for now.
Can't test these scripts but can try to write them:
Write homesearch.tcsh search for any files which contain <input> in name, log the results of the search to a file called homesearch_<input>.txt:
set ARG=$1
echo $ARG
echo "$ARG"
echo "$ARG*"
echo `ls / `
echo "check directory one level up"
echo `ls ../ `
echo "check the current directory"
echo `ls ./ `
cd
find /usr -name "*$ARG*" | > homesearch_<$ARG>.txt
Not sure how to output to a file from tcsh
Exercise Piping:
Passing whatever output from left of the | pipe as input for whatever is on the right
Exercise:
sed -i -e 's/one/two/g' test.txt
Made txt file with the right text
sed cant read the file even though its in the directory
HW 4:
Using the Taylor expansion for (1-x)^(-1/2) 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 = γmc^2
Expanding (1-x)^(-1/2)
f(0) = (1-x)^(-1/2) = 1
f'(0) = (1-x)^(-3/2) / 2 = (1)^(-3/2) / 2 = 1/2
f''(o) = 3(1-x)^(-5/2) / 4 = 3/4
f ~ 1 + x/2 + 3x^2/4
for when x (beta) is near 0 (speed small compared to light), gamma is the f above, which means the mc^2 amount is near 0 leaving mv^2.
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.
y= (1/2)ln((E+pz)/(E-pz))
η = − ln(tan(θ/2))
y=η
(1/2)ln((E+pz)/(E-pz)) = − ln(tan(θ/2))
(0.5) [ ln((E+pz)/(E-pz)) + 2ln(tan(θ/2)) ] = 0
ln(tan^2(θ/2)(E+pz)/(E-pz)) = 0
tan^2(θ/2) (E+pz) / (E-pz) = 1
pz = magnitude * cosθ = Ecosθ
tan^2(θ/2) (E + Ecosθ) / (E - Ecosθ) = 1
tan^2(θ/2) (1 + cosθ) / (1 - cosθ) = 1
tan(θ/2) = (1-cosθ)/sinθ
((1-cosθ)^2 / sin(θ)^2) (1 + cosθ) / (1 - cosθ) = 1
(1 - cosθ) (1 + cosθ) / sin(θ)^2 = 1
(1 - cos(θ)^2) / sin(θ)^2 = 1
sin^2 + cos^2 = 1 --> 1-cos^2 = sin^2
sin(θ)^2 / sin(θ)^2 = 1
1 = 1
Why muons travel farthest in the detector? You can find the answer using google. Give the reference of your source with the answer.
Muon has relatively weak interaction with other particles and also has very high time dilation, which means it experiences time slower in its rest frame and will thus travel a much longer unimpeded distance than if it were experiencing time from a "stationary" observer
https://gustavus.edu/physics/concertFiles/media/Cosmic_Ray_Muon_Detection_Thesis.pdf
Coding portion:
Hello world cpp program:
#include <iostream>
using namespace std;
int main()
{
cout <<"Hello World!" << endl;
return 0;
}
running on account:
g++ compiles the english higher code cpp code into assembly langauge, that is run by the computer's os, the assembly langauge being the langauge that the processor actually understands and executes on (linux,osx...)
g++ compiles the cpp into an a.out file which has all the assembly langauge, run the executable as its called with ./
Finding what versions of cpp is used on the VM:
Doing g++ -dumpspecs returns out a spew, in which the version being used can be found. In running the command, I found its 4.4.7
Other info and commands:
g++ -O name.out code.c renames the executable file of code from a.out to whatever you put for name.out
Coding with variables:
#include <iostream>
using namespace std;
int main() {
cout << "hello world" << endl;
int i=2;
cout << "i = " <<i<<endl;
double a=3.3;
cout << "a = " <<a<<endl;
int j = a*i;
cout << "a*i = "<<j<<endl;
return 0;
}
2*3.3 = 6 because the last variable was declared as an int, so when multiplying just truncates the decimal to an integer.
More numbers:
#include <iostream>
using namespace std;
int main() {
int n=10;
cout << "n is "<<n<<endl;
n--;
cout<<"n is now "<<n<<endl;
n++;
cout<<"n is now "<<n<<endl;
return 0;
}
++ operator sets the var equal to itself plus one, -- sets it minus one, so c++ name is maybe naming the langauge one step better than C
Using ++ and -- before the variable instead of after (++x) :
#include <iostream>
using namespace std;
int main() {
int n=10;
cout << "n is "<<n<<endl;
--n;
cout<<"n is now "<<n<<endl;
++n;
cout<<"n is now "<<n<<endl;
return 0;
}
So there is no immediate difference in flipping the order.
But in more complex expressions and lines, suffixing ++/-- will do the operation immediately so its updated value is used,
whereas prefixing the operation will only update the affected variable after the line has finished, so the expression will be using the older not updated var
Non numeric variables ex:
#include <iostream>
using namespace std;
int main() {
bool prop;
prop = (5>1);
cout<<"prop is "<<prop<<endl;
prop = (1>5);
cout<<"prop is "<<prop<<endl;
prop = (1 != 5);
cout << "prop is " <<prop<<endl;
return 0;
}
Prop is a boolean value here (true/false, 1/0)
Loop:
#include <iostream>
using namespace std;
int main() {
int n=10;
while(n>0) {
cout<<"n is "<<n<<endl;
n--;
}
return 0;
}
Loop just does some operation over and over, can choose to terminate if it meets condition (when n is 0), just same as other langauges
More loops:
#include <iostream>
using namespace std;
int main() {
// when we declare a for loop, we also initialize the loop variable\
,
// specify the exit condition, and tell the program how to modify t\
he
// loop variable at the end of each loop
for (int n=10; n>0; n--) {
cout<<"n is "<<n<<endl;
}
// in a for loop, the loop variable (in this case, 'n') only exists\
in
// the loop. we are not able to call 'n' from out here
// uncomment the following line and see for yourself
// cout<<"n outside the loop: "<<n;
return 0;
}
Just a for loop, same as other langauges, three statements inside, does in/decrementing inside
Rewrite this using for loops:
#include <iostream>
using namespace std;
int main() {
int n=0, m=0;
while(n<10) {
// this is the slow (or outer) loop
cout << "n is " << n << ": ";
m=0;
while(m<=n) {
// this is the fast (or inner) loop
// in this loop, the slow loop variable (n) is a constant
// this loop must run to completion before the slow loop
// can progress (during every iteration of the slow loop!)
cout << m;
m++;
}
// now the fast loop has finished and the slow loop can
// continue with the current iteration
cout << endl;
n++;
}
return 0 ;
}
Output with while loops: (should be same for for loops)
Using for loops:
#include <iostream>
using namespace std;
int main() {
for (int n = 0; n < 10; n++)
{
// this is the slow (or outer) loop
cout << "n is " << n << ": ";
for (int m = 0; m <= n; m++)
{
// this is the fast (or inner) loop
// in this loop, the slow loop variable (n) is a constant
// this loop must run to completion before the slow loop
// can progress (during every iteration of the slow loop!)
cout << m;
}
// now the fast loop has finished and the slow loop can
// continue with the current iteration
cout << endl;
}
return 0 ;
}
Result with for loops:
Skipping debug part of hw for now
#include <iostream>
// opens a connection stream (io stands for input output) for the code to provide output to some console (cout and such)
using namespace std;
// enae class touched on this, something about getting code to communicate on the same page, std represents this standard address
int main() {
// main method where most main code is executed in, returns an integer value
cout <<"Hello World!" << endl; //Print hello world to screen followed by end line (endl)
// c in cout stands for console, so cout is outputing whatever text is specified into the console.
// '<<' are cpp operators, indicating sort of way to add Strings to it. << only used for outputting, >> is for inputting
// endl just means u add an "enter" line afterwards.
return 0; //Exit the program
// return statements end the method, 0 is the integer returned
}
HW 5
Logic c++:
#include <iostream>
using namespace std;
int main() {
int n = 10;
while (n>=10) {
if(n>5) {
cout<<"n is "<<n<<endl;
}
else {
cout<<"n = "<<n<<endl;
n--;
}
return 0;
}
}
output:
just logic like other langauges
while loop only executes if n is 10 or more, which means by default will satisfy the if (n>5) statement, hence n is 10 and not n = 10
Pointers:
#include <iostream>
using namespace std;
int main() {
int i = 10;
cout << "The memory address of i is " << &i << "\n";
cout << "The data stored at memory address " << &i << " is " << i << "\n";
int* p = &i;
cout << "The value of p is " << p << "\n";
cout << "We say that p 'points at' the memory location referenced by address " << p << "\n";
cout << "The data stored at memory address " << p << " is " << *p << "\n";
return 0;
}
variable "i" contains 10, meaning value 10 stored at a memory location designated by nickname i, but there is a more numeric location that i really refers to
&i gives the actual location, memory address
A pointer is a variable that stores that memory address, represented with the next syntax of int* p = &i
*p returns the data that the pointer is pointing to, the content of the address that p is pointing to, this case is the int 10 from i = 10
output from pointer code
Program 1:
/*PROGRAM 1*/
#include <iostream>
using namespace std;
int main(){
int i = 10;
int j = i;
cout << "i= " << i << " and j= " << j << "\n";
i=5;
cout << "i= " << i << " and j= " << j << "\n";
j=1;
cout << "i= " << i << " and j= " << j << "\n";
return 0;
}
Output:
Program 2:
/*PROGRAM 2*/
#include <iostream>
using namespace std;
int main(){
int i = 10;
int* p = &i;
cout << "i= " << i << " and *p= " << *p << "\n";
i=5;
cout << "i= " << i << " and *p= " << *p << "\n";
*p=1;
cout << "i= " << i << " and *p= " << *p << "\n";
return 0;
}
Output:
The difference between the two programs:
Program 2 actually uses pointers.
In the output of Program 1, the variables i and j have no dependence on each other, changing one doesn't change the other as they point to different addresses
In Program 2, p points to the same address i and so any change done on the contents of i or p changes the outputted values of the other
Using "new" in pointers:
#include <iostream>
using namespace std;
int main(){
int* p = new int(5);
cout << "p points at address " << p << "\n";
cout << "The data stored in address " << p << " is " << *p << "\n";
*p = 10;
cout << "Now the data stored in address " << p << " is " << *p << "\n";
return 0;
}
Output:
Declaring a pointer without declaring a variable before hand, use new keyword as above.
new int() just tells to find an "empty" memory location and puts 5 in, so *p points to that memory location
Write new code, create new pointer p1, point to new double with value 3.14, declare pointer p2 to same double as p1, print addresses and the values, multiply value of original double by 2, print values of *p1 and *p2 again:
Code:
#include <iostream>
using namespace std;
int main()
{
double* p1 = new double(3.14);
double* p2 = p1;
cout << "p1 address is " << p1 << " and has value " << *p1 << endl;
cout << "p2 address is " << p2 << " and has value " << *p2 << endl;
*p1 *= 2;
cout << "p1 address is " << p1 << " and has value " << *p1 << endl;
cout << "p2 address is " << p2 << " and has value " << *p2 << endl;
return 0;
}
Output:
Physics:
How much copper to stop proton with kinetic energy 1 GeV:
Copper CSDA range for 1E3 MeV proton: 4.757E2 g/cm^2
Copper density: 8.96 g/cm^3
--> 4.757E2 g/cm^2 / (8.96 g/cm^3) = 53.1 cm
Need 53.1 cm to stop proton
Prove mv2/r = qv B becomes pT = 0.3qrB:
mv^2/r = qvB ---> mvT = pT
pT * v/r = qvB
pT = qrB ---> convert momentum to units of eV --> c = 3E8 /s, q multiplies by 1/e
pT = 3E8qrB --> in terms of GeV, divide 10^9
pT = 0.3qrB
Coding:
Code example of whiles and ifs, cout the purpose of the code:
#include <iostream>
using namespace std;
int main()
{
int number = 1;
int primeCheck = 2;
while (number <= 100)
{
primeCheck = 2;
bool isPrime = true;
while (primeCheck < number)
{
if (number % primeCheck == 0)
{
isPrime = false;
}
primeCheck ++;
}
if (isPrime)
{
cout << number << " is prime" << endl;
}
number ++;
}
return 0;
}
Code outputs if numbers from 1 to 100 is prime: at each increment, checks to see if divisible (modulo remainder) by any number less than it (second while loop increment)
Output:
Alter the script below so it outputs list of files updated within current month:
#!/bin/tcsh
set month = `date | awk '{print $2}'`
echo $month
set tmpday = `date | awk '{print $3}'`
echo $tmpday
if ($tmpday < 10) then
set today = " $tmpday"
else
set today = $tmpday
endif
echo $today
ls -lat | grep "$month $today"
Output:
Modified:
#!/bin/tcsh
set month = `date | awk '{print $2}'`
echo $month
set tmpday = `date | awk '{print $3}'`
echo $tmpday
if ($tmpday < 10) then
set today = " $tmpday"
else
set today = $tmpday
endif
echo $today
set tmpday = 1
while ($tmpday <= $today)
echo $tmpday
ls -lat | grep "$month $tmpday"
set tmpday = `expr $tmpday + 1`
end
Output:
HW 6
ROOT:
Tried it with CMSSW_5, didn't work, so did with 10_2_6 atleast just for this week:
Also .quit doesn't work?
Arrays and Vectors:
#include <iostream>
using namespace std;
/************************************************\
* *
* Arrays *
* This program demonstrates arrays *
* *
\************************************************/
int main() {
// a loop to demonstrate 1D arrays
int ii[3] = {1,2,3};
int j=0;
while (j<3) {
cout <<" ii of "<<j<<" is "<<ii[j]<<endl;
j++;
}
// a loop to demonstrate 2D arrays. How are these lemenst distributed in rows and colums?
int LL[3][2] = {1,2,3,4,5,6};
j=0;
int k;
while (j<2) {
k=0; // do not forget to initialize k here
while (k<3) {
cout<<" LL of "<<j<<" "<<k<<" is "<<LL[j][k]<<endl;
k++;
}
j++;
}
return 0;
}
Output:
In the 2D array, the content in {} is arranged from first to last populating the first row from first to last column, then to the next row till the end.
The better way to declare 2d arrays with content is to do { { }, { } }, having an array {} for each row
Reading file:
#include <iostream>
#include <fstream>
using namespace std;
int main() {
ofstream myfile;
myfile.open("example.txt");
myfile<<"write some junk.";
myfile.close();
return 0;
}
iostream is already input output with console, but fstream is what allows to open and read and write to files
ofstream myfile creates an output stream object
.open(file) directs that stream to the specified file
the default << and >> work as same with the file streams as they do with console, << writes
.close() ends the stream (because the stream is iterative, can't really go backwards)
Vectors:
main:
/* MAIN.CPP */
#include <iostream>
#include <fstream>
// include the program dotprod.cpp so that we can find the dot_prod function \
#include "dotprod.cpp"
using namespace std;
int main () {
// declare the vectors \
double vector1[3];
double vector2[3];
// open the input file \
ifstream infile;
infile.open("vectors.txt");
// store the input in the vectors and print the vectors for the user \
infile>>vector1[0]>>vector1[1]>>vector1[2];
cout<<" Vector 1 is ("<<vector1[0]<<","<<vector1[1]<<","<<vector1[2]<<")"<<endl;
infile>>vector2[0]>>vector2[1]>>vector2[2];
cout<<" Vector 2 is ("<<vector2[0]<<","<<vector2[1]<<","<<vector2[2]<<")"<<endl;
// close the input file \
infile.close();
// call the dot_prod function from dotprod.cpp \
dot_prod(vector1,vector2);
return 0;
}
dotprod:
/* DOTPROD.CPP */
#include <iostream>
using namespace std;
double dot_prod(double v1[3],double v2[3]) {
double dotdot;
dotdot = v1[0]*v2[0]+v1[1]*v2[1]+v1[2]*v2[2];
cout<<" The dot product is "<<dotdot<<endl;
return 0;
}
vectors.txt:
1 2 3
4 5 6
7
Output:
Modifying to get scalar at end of file and output multiples, highlighted is what was added:
/* MAIN.CPP */
#include <iostream>
#include <fstream>
// include the program dotprod.cpp so that we can find the dot_prod function
#include "dotprod.cpp"
using namespace std;
int main () {
// declare the vectors
double vector1[3];
double vector2[3];
double scalar;
// open the input file
ifstream infile;
infile.open("vectors.txt");
// store the input in the vectors and print the vectors for the user
infile>>vector1[0]>>vector1[1]>>vector1[2];
cout<<" Vector 1 is ("<<vector1[0]<<","<<vector1[1]<<","<<vector1[2]<<")"<<endl;
infile>>vector2[0]>>vector2[1]>>vector2[2];
cout<<" Vector 2 is ("<<vector2[0]<<","<<vector2[1]<<","<<vector2[2]<<")"<<endl;
infile>>scalar;
cout << " The scalar is 7" << endl;
// close the input file
infile.close();
// call the dot_prod function from dotprod.cpp
dot_prod(vector1,vector2);
cout << " The scalar multiple is (" <<vector1[0]*scalar<<","<<vector1[1]*scalar<<","<<vector2[2]*scalar<<")"<<endl;
cout << " The scalar multiple is (" <<vector2[0]*scalar<<","<<vector2[1]*scalar<<","<<vector2[2]*scalar<<")"<<endl;
return 0;
}
multiplying the vectors as vector1*scalar into a new vector did not work, so just multiplied each element in cout
Output:
Random numbers:
#include <iostream>
#include <math.h>
using namespace std;
// this function is the actual random number generator
// this code is stolen from the book numerical recipes for fortran
// it relies on random generated from overflow of memory locations
// and is a pseudo random number generator
const int a = 7141;
const int c = 54773;
const int mmod=256200;
double getFlatRandom(int& inew) {
double mranflat = 0.;
inew = inew%mmod;
double aa = double(inew)/double(mmod);
mranflat=aa;
inew = a*inew+c;
return mranflat;
}
// in this code, we will call the pseudo-random number generator and learn some things
// about its properties by filling and then displaying a histogram
int main() {
int num;
cout << "Enter the number of loop iterations: ";
cin >> num;
int inew = 2345; // This is the "seed" for the random number generator
// we will put the results from the call into a histogram that we can look at, to learn some of its
// properties. This histogram has 10 bins.
int histo[10] = {0,0,0,0,0,0,0,0,0,0};
double atmp; //
// call the random number generator 1000 times and fill a histogram
for (int i = 0; i<num; i++){
atmp=getFlatRandom(inew); // call the random number generator
histo[int(atmp*10)]++; // increment the histogram bin the number falls within
}
// print the histogram to the screen
for (int i = 0; i<10; i++){
cout<<i<<": ";
for (int j=0; j<int((double(100*histo[i])/double(num))+0.5); j++) {
cout << "=";
}
cout << endl;
}
return 0;
}
Output:
Removing "&" symbol to see the output:
Output:
So it seems all the '=' went to the first one, so & is needed to denote a new address to store the random content
n bytes store 2^8n-1, 2^8 is beuacause of bytes having 8 bits that can be one of two number 0 and 1, so n bytes powers that to n.
-1 needed bc can only go up to highest number before needing another bit, for example in base 10, 100 numbers starting from 0 ends in 99
Print the 1st 10 random numbers it generates:
The following code was added to main after population of inew:
for (int i = 0; i < 10; i++)
{
cout << getFlatRandom(inew)<<endl;
}
Output:
It is the same output because of seed
Changing seed to 2349951 :
Output is different, nothing significant:
Physics:
secretparameters.txt contains 91. 15. 0.005
Root works now
resolutions.C:
#include "Riostream.h"
#include <iostream>
#include <fstream>
/*
some code to help us understand why and how resolutions affect our ability to measure the
mass of a particle
*/
// main routine
void resolutions(){
// set debug mode
bool idebug=0;
// set up the display
gROOT->Reset();
gROOT->SetStyle("Plain");
gStyle->SetOptStat(0);
gStyle->SetOptFit(11);
gStyle->SetErrorX(0);
TCanvas *c1 = new TCanvas("c1","Our data",200,10,700,500);
c1->SetFillColor(0);
c1->SetBorderMode(0);
c1->SetBorderSize(1);
c1->SetFrameBorderMode(0);
// book some histograms
TH1F *histo1 = new TH1F("histo1","mass",1000,0.,200.);
// setup random number generator
gRandom->SetSeed();
// get the secret parameters
ifstream myfile;
myfile.open("secretparameters.txt");
double mass, resE, resA; // maas, resolution in Energy, reolution and Angle.
myfile>>mass>>resE>>resA;
myfile.close();
// make N bosons at rest
// each boson will decay to 2 back-to-back daughter particles
// they will be back-to-back by conservation of momentum, since the momentum of the mother was zero
// assume that the mass of the daughter particles is small compared to the mother mass so we can
// assume that their energy will be large compared to their mass and we can treat them as massless.
// and thus their energy is equal to the magnitude of their momenta
// by conservations of energy, their energy
// work in 2D. Can always choose my coordinate system so that the 2 daughters are in the same plane
int N=1;
double etrue1,etrue2,phitrue1,phitrue2; // true energy of the 2 daughters
double e1,px1,py1,phi1; // smeared 4-momenta of daughter 1
double e2,px2,py2,phi2; // smeared 4-momenta of daughter 2
double masssmeared;
for(int i=0;i<N;i++) {
// set true energy
etrue1=mass/2.;
etrue2=mass/2.;
if(idebug) cout<<"etrue "<<etrue1<<" "<<etrue2<<endl;
// choose phi for daughter 1 and daughter 2
phitrue1=2*TMath::Pi()*gRandom->Rndm();
phitrue2 = phitrue1+TMath::Pi(); // they are back to back. Now we dont have to worry aboy the sign of momentum.
if(idebug) cout<<"phitrue "<<phitrue1<<" "<<phitrue2<<endl;
// smear true energy with resolution of detector
e1=etrue1+resE*gRandom->Gaus(0.,1.);
e2=etrue2+resE*gRandom->Gaus(0.,1.);
if(idebug) cout<<"e "<<e1<<" "<<e2<<endl;
//smear angles with resolution of the detector
phi1=phitrue1+resA*gRandom->Gaus(0.,1.);
phi2=phitrue2+resA*gRandom->Gaus(0.,1.);
if(idebug) cout<<"phi "<<phi1<<" "<<phi2<<endl;
//calculate 4 momenta after smearing. Here momentum = energy and all we need to do it to divide the momentum vector into its components.
px1=e1*cos(phi1);
py1=e1*sin(phi1);
px2=e2*cos(phi2);
py2=e2*sin(phi2);
if(idebug) cout<<"pxs "<<px1<<" "<<py1<<" "<<px2<<" "<<py2<<endl;
// calculate smeared mass
masssmeared=sqrt((e1+e2)*(e1+e2) - (px1+px2)*(px1+px2) - (py1+py2)*(py1+py2));
if(idebug) cout<<"masssmeared "<<masssmeared<<endl;
histo1->Fill(masssmeared);
histo1->Draw("");
c1->Update();
c1->SaveAs("c1.gif");
}
}
For N = 1
Bug: Had to add another end bracket
Output:
N=10
root froze and wont operate anymore, can't return to ssh
8.4 Tesla:
pT = .3 qrB = .3 * 8.4 * 27000/2π = 10.8 TeV
if along earth's equator:
= .3 * 8.4 * 6371000/2π = 2,555 TeV
(muon chamber detector is at the very end of detector
solenoid magnet used to detect particle trajectories curving, used to calculate mmtm
hw: what is iron yoke, why muon lives longer, why muon curves? (magnetic field) (search up MIPS?)
calculating mmtm before and after collision, discrepancies mean particles not detected, prolly neutrino
sometimes, connecting dots in particle detector trajectory shows divergence from center,-->
--> indicative of a kink in trajectory before particle reached detector, usually heavy quarks like bottom bc
they decay so fast
)
11-2
Summary of paragraph in higgs paper:
Introduction:
In the standard model there are three forces with respective force carriers. Two of the forces, electromagnetic and weak interactions, having been unified under the electroweak theory, show an unexplained discrepancy in that the weak interaction force carriers, W and Z bosons, have mass whereas the EM carrier photon does not.
Combining the scalar field with the electroweak theory predicts the existence of the Higgs boson, but not an exact mass. The mass however can be bounded by the electroweak theory and various collider searches and excess energies, narrowing it down to approach a range of 120-135 GeV.
HW7:
Operating MadGraph and downloading output files:
At this point, ran mg5 process (2 protons?) to top and anti top, downloaded lhe output file to local.
Uploading provided py file to ssh:
^^ moving py file around to right place as shown in example. ran, no root?
Physics:
The actual CMS detector is a dense and high res collection of detectors and calorimeters weighing some 1000s of tones and 15 meter diameter.
The main part for which its named is for the solenoid magnet that surrounds the structure, applying a magnetic field to curve particle paths, and the extent of those curves help determine energies and momenta.
The inner trackers are made of silicon to actually detect particle paths with every small sensor each particle passes through.
ECAL and HCAL are calorimeters, meaning they determine the energies of particles with what particles pass through and stop at which layers.
ECAL is for electromagnetics, photons and electrons, while HCAL is for hardonic matter.
At the outer and most massive layers are the muon detectors, placed after all the other instrumentation that muons would pass through.
https://ispy-webgl.web.cern.ch/#
Can change view at the top bar in the middle with change of axes and rotating and zooming in and out and orthographic view
Electrons are green
Muons are red
Missing energy (neutrino) is purple
Jets are cones (orange)
If clockwise arcing with respect to mag field (in XY plane), it has positive charge, anticlockwise is negative
Hto4l 1st event:
4e, 2µ, 4p, 49j, 1miss, 15vert
2nd event:
2e, 4µ, 44j, 1miss, 11vert
BJetPlusX 1st event:
1p, 39j, 1miss, 11vert
2nd event:
1p, 49j, 1miss, 9vert
Double µ 1st:
4µ, 1p, 50j, 1miss, 20vert
2nd:
1e, 6µ, 2p, 54j, 1miss, 18vert
MET 1st:
7µ, 2p, 51j, 1miss, 18vert
2nd:
1p, 57j, 1miss, 24vert
Tau parked 1st event:
3p, 44j, 1miss, 10vert
2nd:
43j, 1miss, 9vert
double e 1st:
1e, 1p, 43j, 1miss, 13vert
2nd:
2e, 2p, 43j, 1miss, 14vert
double photon 1st:
1e, 2p, 51j, 1miss, 9vert
2nd:
1e, 3p, 50j, 1miss, 12vert
jetHT 1st:
3µ, 1p, 53j, 1miss, 16vert
2nd:
1µ, 1p, 56j, 1miss, 18vert
minimum bias 1st:
2µ, 38j, 1miss, 12vert
2nd:
47j, 1miss, 13vert
HW 8
Turns out every time root doesn't work I'm just not cmsenv'ing..
So to summarize, for any root files that need root to use:
- cd into CMSSW
- cmsenv
- cd further into whichever directory
- root -l file.root (opens root, enter line looks like "root [1] CURSOR"
- can't remember what command to run file (probably just file name)
- .quit to exit root
Don't have screenshot, so:
cd to CMSSW/src
cmsenv
mkdir Higgs-mass
wget http://hepcms-hn.umd.edu/~jabeen/Analysis/root-tree-example.tgz
tar zxvf that tgz file
do the root stuff above, root the ..pythia6.root file
enter command in root: HZZ4LeptonsAnalysisReduced->MakeClass("HiggsAnalysis")
Not sure what this does, guessing it uses the root file to create some files regarding the analysis of some event (this case h zz 4lep)
exit out and edit the newly generated Higgs C file to have the following:
(using vim, just the classic commands like "i" for insert and writing and deleting on the file, esc to leave insert, :wq to save and close):
(note dd deletes a line and 10dd deletes 10 lines, number before any command does the command that many times):
#define HiggsAnalysis_cxx
#include "HiggsAnalysis.h"
#include <TH2.h>
#include <TStyle.h>
#include <TCanvas.h>
void HiggsAnalysis::Loop()
{
// 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
// //
//
// // This is the loop skeleton where:
// // jentry is the global entry number in the chain
// // ientry is the entry number in the current Tree
// // Note that the argument to GetEntry must be:
// // jentry for TChain::GetEntry
// // ientry for TTree::GetEntry and TBranch::GetEntry
// //
// // To read only selected branches, Insert statements like:
// // METHOD1:
// // fChain->SetBranchStatus("*",0); // disable all branches
// // fChain->SetBranchStatus("branchname",1); // activate branchname
// // METHOD2: replace line
// // fChain->GetEntry(jentry); //read all branches
// //by b_branchname->GetEntry(ientry); //read only this branch
if (fChain == 0) return;
//
Long64_t nentries = fChain->GetEntriesFast();
//
Long64_t nbytes = 0, nb = 0;
TFile* output = TFile::Open("Dielectron_MC.root", "RECREATE"); // "RECREATE" would produce a ne\
w root file with name Dielectron_MC.root every time you run the code
//
TH1F* Z_ee = new TH1F("Z_ee", "Di-electron candidate invariant mass", 200, 0, 200);
double el1mt = 0.0;
double el1pt = 0.0;
double el1eta = 0.0;
for (Long64_t jentry=0; jentry<nentries;jentry++) {
Long64_t ientry = LoadTree(jentry);
if (ientry < 0) break;
nb = fChain->GetEntry(jentry); nbytes += nb;
// if (Cut(ientry) < 0) continue;
//
//
TLorentzVector el1, el2;
el1.SetPtEtaPhiM(f_lept1_pt, f_lept1_eta, f_lept1_phi, 0.0);
el2.SetPtEtaPhiM(f_lept2_pt, f_lept2_eta, f_lept2_phi, 0.0);
TLorentzVector zCandidate = el1 + el2;
Z_ee->Fill(zCandidate.M());
el1mt = el1.Mt();
cout << el1mt << endl;
//
}
//
//
Z_ee->Write();
output->Close();
}
Running commands in root .L HiggsAnalysis.C, then HiggsAnalysis t, then t.Loop():
t.Loop() outputted a much longer list here that only the beginning of is shown here
in the above code add new TLorentzVector el3, el4 for the 3rd and 4th lepton and set their pt, eta phi, mass.
Add these two vectors to get a new vector TLorentzVector zCandidate2.
Add the two vectors zCandidate and zCandidate2 to get a new TLorentzVector Higgs.
Define a new histogram H_zz
TH1F* H_zz = new TH1F("H_zz", "ZZ candidate invariant mass", 200, 0, 300);
Fill the H_zz histogram with HIggs mass. (using Higgs.M() )
Write the H_zz histogram.
open the output file and paste the Z_ee and H_zz histograms in your HW file.
...
TLorentzVector el1, el2, el3, el4;
el1.SetPtEtaPhiM(f_lept1_pt, f_lept1_eta, f_lept1_phi, 0.0);
el2.SetPtEtaPhiM(f_lept2_pt, f_lept2_eta, f_lept2_phi, 0.0);
el3.SetPtEtaPhiM(f_lept3_pt, f_lept3_eta, f_lept3_phi, 0.0);
el4.SetPtEtaPhiM(f_lept4_pt, f_lept4_eta, f_lept4_phi, 0.0);
TLorentzVector zCandidate = el1 + el2;
TLorentzVector zCandidate2 = el3 + el4;
TLorentzVector Higgs = zCandidate + zCandidate2;
TH1F* H_zz = new TH1F("H_zz", "ZZ candidate invariant mass", 200, 0, 300);
H_zz->Fill(Higgs.M());
Z_ee->Fill(zCandidate.M());
el1mt = el1.Mt();
cout << el1mt << endl;
//
}
//
//
Z_ee->Write();
H_zz->Write();
output->Close();
...
Can't open output graph
So, now it works, process i did (may have added extra steps but it works?):
root -l HiggsAnalysis.C
.quit
root -l Dielectron_MC.root
TBrowser T <-- this is the real step which opens a browser where u can view the histograms. can write anything for 'T'
Z_ee:
H_zz:
Probably some incorrect code, peak shouldn't be a 1
Cd back to src folder to do TMVAClassification.C code:
// @(#)root/tmva $Id$
/**********************************************************************************
* Project : TMVA - a ROOT-integrated toolkit for multivariate data analysis *
* Package : TMVA *
* Root Macro: TMVAClassification *
* *
* This macro provides examples for the training and testing of the *
* TMVA classifiers. *
* *
* As input data is used a toy-MC sample consisting of four Gaussian-distributed *
11 * and linearly correlated input variables. *
12 * *
13 * The methods to be used can be switched on and off by means of booleans, or *
14 * via the prompt command, for example: *
15 * *
16 * root -l ./TMVAClassification.C\(\"my method\"\)
// or to use default select method root -l ./TMVAClassification.C(\"\"\)
17 * *
18 * (note that the backslashes are mandatory) *
*
21 * The output file "TMVA.root" can be analysed with the use of dedicated *
22 * macros (simply say: root -l <macro.C>), which can be conveniently *
23 * invoked through a GUI that will appear at the end of the run of this macro. *
24 * Launch the GUI via the command: *
25 * *
26 * root -l ./TMVAGui.C *
27 * * *
9 * If no method given, a default set is of classifiers is used *
0 **********************************************************************************/
#include <cstdlib>
#include <iostream>
#include <map>
#include <string>
#include "TChain.h"
#include "TFile.h"
#include "TTree.h"
#include "TString.h"
#include "TObjString.h"
#include "TSystem.h"
#include "TROOT.h"
#include "TMVA/Factory.h"
#include "TMVA/Tools.h"
//#include "TMVA/TMVAGui.h"
int TMVAClassification( TString myMethodList = "BDTB, MLP, Likelihood" )
{
// The explicit loading of the shared libTMVA is done in TMVAlogon.C, defined in .rootrc
// if you use your private .rootrc, or run from a different directory, please copy the
// corresponding lines from .rootrc
// methods to be processed can be given as an argument; use format:
//
// mylinux~> root -l TMVAClassification.CUndefined control sequence \"
//
// if you like to use a method via the plugin mechanism, we recommend using
//
// mylinux~> root -l TMVAClassification.CUndefined control sequence \"
// (an example is given for using the BDT as plugin (see below),
// but of course the real application is when you write your own
// method based)
//---------------------------------------------------------------
// This loads the library
TMVA::Tools::Instance();
// Default MVA methods to be trained + tested
std::map<std::string,int> Use;
// --- Cut optimisation
Use["Cuts"] = 1;
Use["CutsD"] = 1;
Use["CutsPCA"] = 0;
Use["CutsGA"] = 0;
Use["CutsSA"] = 0;
//
// --- 1-dimensional likelihood ("naive Bayes estimator")
Use["Likelihood"] = 1;
Use["LikelihoodD"] = 0; // the "D" extension indicates decorrelated input variables (see option strings)
Use["LikelihoodPCA"] = 0; // the "PCA" extension indicates PCA-transformed input variables (see option strings)
Use["LikelihoodKDE"] = 0;
Use["LikelihoodMIX"] = 0;
//
// --- Mutidimensional likelihood and Nearest-Neighbour methods
Use["PDERS"] = 0;
Use["PDERSD"] = 0;
Use["PDERSPCA"] = 0;
Use["PDEFoam"] = 0;
Use["PDEFoamBoost"] = 0; // uses generalised MVA method boosting
Use["KNN"] = 1; // k-nearest neighbour method
//
// --- Linear Discriminant Analysis
Use["LD"] = 0; // Linear Discriminant identical to Fisher
Use["Fisher"] = 0;
Use["FisherG"] = 0;
Use["BoostedFisher"] = 0; // uses generalised MVA method boosting
Use["HMatrix"] = 0;
//
// --- Function Discriminant analysis
Use["FDA_GA"] = 0; // minimisation of user-defined function using Genetics Algorithm
Use["FDA_SA"] = 0;
Use["FDA_MC"] = 0;
Use["FDA_MT"] = 0;
Use["FDA_GAMT"] = 0;
Use["FDA_MCMT"] = 0;
//
// --- Neural Networks (all are feed-forward Multilayer Perceptrons)
Use["MLP"] = 1; // Recommended ANN
Use["MLPBFGS"] = 0; // Recommended ANN with optional training method
Use["MLPBNN"] = 0; // Recommended ANN with BFGS training method and bayesian regulator
Use["CFMlpANN"] = 0; // Depreciated ANN from ALEPH
Use["TMlpANN"] = 0; // ROOT's own ANN
//
// --- Support Vector Machine
Use["SVM"] = 1;
//
// --- Boosted Decision Trees
Use["BDT"] = 1; // uses Adaptive Boost
Use["BDTG"] = 0; // uses Gradient Boost
Use["BDTB"] = 0; // uses Bagging
Use["BDTD"] = 0; // decorrelation + Adaptive Boost
Use["BDTF"] = 0; // allow usage of fisher discriminant,int>::iterator it = Use.begin(); it != Use.end(); it++) std::cout << it->first << " ";
std::cout << std::endl;
return 1;
}
Use[regMethod] = 1;
}
}
// ----------------------------------------------------------------------------------ent:Color:DrawProgressBar:Transformations=I;D;P;G,D:AnalysisType\
=Classification" );
// If you wish to modify default settings
// (please check "src/Config.h" to see all available global options)
// (TMVA::gConfig().GetVariablePlotting()).onse values of all trained MVAs, and the spectator variables
factory->AddSpectator( "spec1 := var1*2", "Spectator 1", "units", 'F' );
factory->AddSpectator( "spec2 := var1*3", "Spectator 2ignal, signalWeight ");
factory->AddBackgroundTree( background, backgroundWeight );
// To give different trees for training and testing, do as follows:
// factory->AddSignalTree( sign ivar=0; ivar<4; ivar++) vars[ivar] = treevars[ivar];
// // add training and test events; here: first half is training, second is testing
// // note that ;
// }
// --- end ------------------------------------------------------------
//
// --- end of tree rrain=3000:NSigTest=3000:NBkgTest=3000:SplitMode=Random:!V" );
factory->PrepareTrainingAndTestTree( mycuts, mycutb,
"nTrain_Signal=1000:nTrain_Background=1000:SplitModeProp=FSmart:VarTransform=PCA" );
if (Use["CutsGA"])
factory->BookMethod( TMVA::Types::kCuts, "CutsGA",
"H:!V:FitMethod=GA:CutRangeMin[0]=-10:CutRangeMax[ TMVA::Types::kLikelihood", "LikelihoodPCA",
"!H:!V:!TransformOutput:PDFInterpol=Spline2:NSmoothSig[0]=20:NSmoothBkg[0]=20:NSmooth=5:NAvEvtPerBin=50:VarTransform=PCA" );
// Use a kernel density estimator to approximate the PDFs
if (Use["LikelihoodKDE"])
factory->BookMethod( TMVA::Types::kLikelihoodectively:
// "!H:!V:VolumeRangeMode=MinMax:DeltaFrac=0.2:KernelEstimator=Gauss:GaussSigma=0.3" );
// "!H:!V:VolumeRangeMode=RMS:DeltaFrac=3:KernelEstimator=Gauss:GaussSigma=0.3" );
if (Use["PDNone:Compress=T" );
if (Use["PDEFoamBoost"])
factory->BookMethod( TMVA::Types::kPDEFoam, "PDEFoamBoost",
"!H:!V:Boost_Num=30:Boost_Transform=linear:SigBgSeparate=F:MaxDepth=rpolMVAPdf=Spline2:NbinsMVAPdf=50:NsmoothMVAPdf=10" );
// Fisher with Gauss-transformed input variables
if (Use["Fi);(-10,10);(-10,10);(-10,10):FitMethod=GA:PopSize=300:Cycles=3:Steps=20:Trim=True:SaveBestGen=1" );
if (Use["FDA_SA"]) // can also use Simulated Annealing ();
if (Use["FDA_MCMT"])
factory->BookMethod( TMVA::Types::kFDA, "FDA_MCMT",
"H:!V:Formula=(0)+(1)*x0+(2)*x1+(3)*x2+(4)*x3:ParRanges=(-1,1);(-10,10);(-10,10);(VA::Types::kCFMlpANN", "CFMlpANN", "!H:!V:NCycles=2000:HiddenLayers\
=N+1,N" ); // n_cycles:#nodes:#nodes:...
// Tmlp(Root)ANN
if (Use["TMlpANN"])
factory->BookMethod( TMVA::Types::kTMlpANN, "TMlpANN", "!H:!V:NCycles=200:HiddenLayers=N+1,N:LearningMethod=BFGS:ValidationFraction=0.3" ); // n_cy\
cles:#nodes:#nodes:...
// Support Vector Machine
if (UsenType=GiniIndex:nCuts=20" );
if (Use["BDTB"]) // Bagging
factory->BookMethod( TMVA::Types::kBDT", "BDTB",
"!H:!V:NTrees=400:BoostType=Bagging:SeparationType=GiniIndex:nCuts=20" );
if (Use["BDTD"]) // Decorrelation + Adaptive Boost
factory->BookMethod( TMVA::Types::kBDT, "BDTD",
"!H:!V:NTrees=400:MinNod=1.02" );
// For an example of the category classifier usage, see: TMVAClassificationCategory
// --------------------------------------------------------------------------------------------------
// ---- Now you can optimize the setting (configuration) of the MVAs using the set of training events
// ---- STILL EXPERIMENTAL and onlyout << "==> Wrote root file: " << outputFile->GetName() << std::endl;
std::cout << "==> TMVAClassification is done!" << std::endl;
delete factory;
// Launch the GUI for the root macros
//if (!gROOT->IsBatch()) TMVA::TMVAGui( outfileName );
return 0;
}
int main( int argc, char** argv )
{
// Select methods (don't look at this code - not of interest)
TString methodList;
for (int i=1; i<argc; i++) {
TString regMethod(argv[i]);
if(regMethod=="-b" || regMethod=="--batch") continue;
if (!methodList.IsNull()) methodList += TString(",");
methodList += regMethod;
}
return TMVAClassification(methodList);
}
Output:
error with regMethod not being defined?
HW 9:
CPU is the actual computer that does all the processes and handles data in background, GPU handles the visual presentation to the screen and resolution and video.
pandas=10
zebras=20
total_animals_in_zoo=pandas+zebras
print(total_animals_in_zoo)
Output:
30
Two vars carry two values, get added with + operator, assigned to another var with = operator, print() to console
Area:
pi=3.14159 #Approx.
diameter=10
area = pi * diameter * diameter / 4
print(area)
Output:
78.53975
Operators * and /
Lists:
Method 1:
a = [1, 2, 3]
b = ['cat', 'dog', 'fish']
a=b
b=a
print('Method 1')
print(a)
print(b)
Output:
Method 1
['cat', 'dog', 'fish']
['cat', 'dog', 'fish']
By the time of b=a, a already was set equal to b, so both lists are just the same
a = [1, 2, 3]
b = ['cat', 'dog', 'fish']
temp = a
a = b
b = temp
print('Method 2')
print(a)
print(b)
Output:
Method 2
['cat', 'dog', 'fish']
[1, 2, 3]
temp list to store value so b isn't set to something already modified
Switch data so it makes sense:
dog_legs=0
human_legs=4
goldfish_legs=2
dogL = dog_legs
humanL = human_legs
goldL = goldfish_legs
dog_legs = humanL
human_legs = goldL
goldfish_legs = dogL
print('dog_legs ')
print(dog_legs)
print('human_legs ')
print(human_legs)
print('goldfish_legs ')
print(goldfish_legs)
Output:
dog_legs
4
human_legs
2
goldfish_legs
0
Functions:
Make function to round number to 5 dec place, print outside function
def round_to_n_places(num, digits):
return round(num, digits)
print(round_to_n_places(4.325456463, 5))
Output:
4.32546
Built in fxns
a=[1,5435,324,3,645365,23,4,5665,435,31, -543]
b=-10
c='cat'
print(c)
print(abs(b)) #absolute value
print(min(a)) #min value
print(max(a)) #max value
print(sum(a)) #sum
print(len(c)) #length of a string
print(sorted(a)) #sorts a list
What do you see when you run this co:
cat 10 -543 645365 656743 3 [-543, 1, 3, 4, 23, 31, 324, 435, 5435, 5665, 645365]