I'm assuming this is for computing stuff. My physics stuff is in my notebook (it would be a pain to write out all that math).
For this class, I will run a linux virtual machine. This will be easier than trying to use PuTTY and I can use Windows at the same time.
First, I downloaded virtualbox here: http://download.virtualbox.org/virtualbox/5.1.8/VirtualBox-5.1.8-111374-Win.exe
have worked with both Fedora and Debian. Fedora seems to be more "complete" (more features) but Debian seems to just work easier. A lot of people use ubuntu, but I have not on my personal setups for that reason. A link to a Debian system image is here, which I used: http://cdimage.debian.org/debian-cd/8.6.0/amd64/iso-cd/debian-8.6.0-amd64-netinst.iso (Links to an external site.)
I followed this guide: http://www.brianlinkletter.com/installing-debian-linux-in-a-virtualbox-virtual-machine/ (Links to an external site.) A few changes: I gave it more ram and more storage! I don't remember how much storage I gave it, but 8 gigs is not enough and it is easier to give it more storage now than expand it later after finding you didn't give it enough. Same with RAM: I gave it 2 gigs. The guide only gives it a gig.
Alright, now when I open my virtual machine I get an image that looks like this (after changing the background!):
To make my virtual machine more usable, I installed the guest additions! I went to devices in the menu bar and clicked 'Install guest additions CD image.'
This dialogue popped up. I clicked 'run,' and the guest additions were installed.
September 7:
So I can't get into the server. My password won't work...this is embarrassing.
Follow-up:
Turns out I was using hon_motter@hepcms.umd.edu not hon-motter@hepcms.edu. My bad...
September 10:
HW2 has some really relevant computing stuff. the question is:
Imagine you have just logged onto a Linux machine. What commands should you do to create a subdirectory with the name “junk”
In Linux, what does the mv command do? (if you don’t know, use google to find out, or mv –help)
In emacs, what does the command <cntl>s do?
In emacs, what does the command <cntl>a do?
In emacs, what does the command <cntl>e do?
My answers:
1. 1) ssh -y hon-motter@hepcms.umd.edu
(EnterPassword)
mkdr junk
2. It moves a file from one directory to another (ex. mv /Documents/Doc /Videos moves a file ‘Doc’ from the Documents folder to the Videos folder)
3. Searches a file
4. Sends the cursor to the beginning of the current line.
5. Sends the cursor to the end of the current line.
I posted this in discussion:
Alright, I sweated a bit over this so here is how to take a file from your hepcms.umd.edu directory to a directory on your machine (so you can, say, submit your emacs assignment).
scp username@hepcms.umd.edu:~/filename.ext filename.ext
Where the first 'filename.ext' (ext, being any sort of extention, like .txt) is the file you want to transfer from your hepcms directory (you can add stuff to this, ex if your file is in the directory /HONR268N/EMACSASSIGNMENTS/, it would look like: scp username@hepcms.umd.edu:~/HONR268N/EMACSASSIGNMENTS/filename.ext filename.txt).
The second 'filename.ext' is where you want to dump the file from your hepcms directory. Again, you can modify this (ex if you want to put it in /username/home/Documents/. Also, you can not specify a file in the destination command and instead of [I assume] appending the file into an already existing one, it will just dump that file into the specified directory).
Also, a fun PDF of emacs commands (YAY!!): https://www.gnu.org/software/emacs/refcards/pdf/refcard.pdf
September 20:
Took this from my homework 3:
grep <options> <pattern> <location>
Grep serches for the specified pattern in the specified location and (usually) prints the line where the pattern is found.
<command 1>|<command 2>
It takes the output from command 1 and spits it into command 2
Some super simple bash script:
#!/bin/tcsh
set ARG=$1
grep $ARG ./*.*
#end
This is in a file with the .tcsh extension. To run it, one must execute this: 'chmod +x fileName.tcsh' which makes it executable and then run it by doing this: './fileName.tcsh [some argument].'
September 25:
Git stuff (shamelessly ripped off of Sanna Madan)
pushing a file onto your git repository from your HONRPHYS folder on the cluster
Let's say you create a file on your cluster in HONRPHYS, and you want to have it officially be a part of your git repository. Then, do:
git init
git remote add origin <url> (if you already have the origin, don't worry about this)
git add <filename>
git commit -m "message" (this is just a note you attach to the process of adding your file to your git repository)
git push origin master
updating your HONRPHYS folder on the cluster
Let's say you want to sync your directory on the cluster to the git repository (other people may have added files to it, or you may have added files to it through the website). Then, do:
git init
git remote add origin <url>
git pull origin master
October 4:
A better example of a bash script (shamelessly ripped off of HW5):
#!/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"
October 9:
How to get a CMS release (I am using 7_6_3 for my research thing):
cd to the directory you want to put it in
cmsrel CMSSW_7_6_3
Now when you want to use it, do cmsenv.
Easy.
For X11, I thought for the longest time that I had to change some ssh configuration files on my machine, but it turns out that using ssh -y -X username@location will do it!
I also found a way to access the cluster with the file explorer. Open it again and click "Connect to Server" on the left side. Then type in ssh://hepcms.umd.edu and press connect. It will ask you in a box to enter your username and password (per CERN rules you shouldn't have the computer remember those). Then, you can explore the cluster in a GUI, which is much easier, especially for moving files around. I can submit projects without having to copy the files somewhere else first now.
There, TADA! d
October 14:
I can't get into the cluster again. I know I am using the the right password this time. I accidentally did something dumb with my USB network adapter and now its blocking me. I thought at first it might be those changes to SSH config files, but I can still get into grace...
I emailed the tech people about it, and they think I'm stupid, but they're working on it.
UPDATE:
Turns out it was my network adapter. When I try to get onto the cluster with WIFI it works fine, just my USB adapter appears to be blocked. They should be fixing it now.
October 23:
So HW7 is awful...but I learned some stuff.
TH1F *histo1 = new TH1F("histo1", graphName.str().c_str() ,100,0.,1.);
Apparently, the TH1F class has a constructor with ("name", "description", (double)numBuckets, (double)lowerBound, (double)upperBound); //I'm guessing with the last two
gRandom->SetSeed();
Starts up gRandom. It must be static, because I never initialized an instance. SetSeed might take an argument, I don'k know (but it would make sense).
double data = gRandom->Rndm();
The right side creates a random double between 0-1.
TF1 *varyB = new TF1("Boost Varies", "exp( (-1.0 * [0] * sqrt(1.0 - pow(x, 2)) ) / ( x * [2] * [3] ))", 0, .999999);
varyB -> SetParameter(0, distance);
varyB -> SetParameter(2, c);
varyB -> SetParameter(3, decayTime);
TF1 has a constructor that goes ("Name", "expression", (double)lowerBound, (double)upperBound);
The following four lines are to initialize any vars that may be needed in the expression to the TF1 object. Its a pain, but I can't think of any other way to make it work if I was developing it.
November 9:
I was thinking about headers and stuff and I forget how they work! I referenced a project that I had done a while back, uploaded the files to my Google Drive, and posted this in the discussion:
I was talking to some people today and they didn't know what a header was! For that reason, I'm attaching a C++ project I did in sophomore year to help with my PreCal/Trig class. It does much more simple stuff than the programs we use in class and is much smaller, so you should be able to follow it better. The main program (main.cpp, same as a .C in our case) includes all of the headers and uses information from them. Some of the headers even use stuff from other headers.
Yes, I know some of the coding is sloppy. I was still beginning, give me a break!
https://drive.google.com/drive/folders/0BwTdCo2EfxF0aFo3NWtCdElfWVU?usp=sharing
November 25:
Because I have no life, I am finishing HW9 and 8 (in that order) over Thanksgiving. Here's what I learned:
HW9:
HZZ4LeptonsAnalysisReduced->MakeClass("ana")
This (when used in root) makes a class and a header (in this case ana.C and ana.h) out of a root file that you can use for various operations/analysis.
These handy commands compile and run a function called Loop in a class called ana (snippets copied shamelessly from the HW page).
root [0] .L ana.C+ root [1] ana t root [2] t.Loop()
However when it came time to print:
root [3] el1_eta->Draw();
Things broke. I'm assuming that this is because el1_eta is not a public or even an instance variable. I tried for a while to get this to work, but ended up just going to the root file created and looking at it in TBrowser.
TBrowser, BTW, is initialized with 'new TBrowser' in root. I can't seem to split it off the main thread, though...
Next, I learned about drawing things simultaneously. The tutorial had:
h_ee_mc ->DrawNormalized(""); h_ee_data->DrawNormalized("SAMES");
Where those two things are TH1F objects. I found that the argument "SAME" worked better than "SAMES."
Finally, cuts! If you look in the header file (ana.h in this case) there are a bunch of variables listed, most somewhat intuitively. In the while loop in the Function Loop() in ana.C, you can put an if statement to make cuts like this:
if(undesirableCharacteristics) continue;
I have had it ingrained into me that using continue is horrible, even though I had no idea what it did! It is actually very helpful in this case, skipping the rest of the code (where you put things in graphs) in the loop and going back to the top.
HW8:
First off it was hard to find problem 1. I think root can view events from .XML as well, but I didn't really find anything else.
For number 5, I don't think we've looked at that link a first time to look at it again. In any case, it took a bit to realize what was going on (after which I had an "Oh duh" moment).
Float_t x[n] = {1, 2, 3, 4, 5, 6};
Float_t y[n] = {3.9,6.5,8.1,13.5,15.5,16};
Float_t ex[n] = {.01,.01,.01,.01,.01,.01};
Float_t ey[n] = {.05,.05,.05,.05,.05,.05};
TGraphErrors *gr = new TGraphErrors(n,x,y,ex,ey);
It turns out that the first array are for the x values, the second for y values, then x and y standard error. I lost the helpful statistic cross when I changed the data for some reason, though... T
For the Draw of any TGraph, these options are available (I think combinations work in some cases):