First things first, here's a PDF I found that explains a ton of stuff about ROOT and includes guided exercises for you to practice with (keep practicing over breaks and such so you don't forget anything):
https://www.nevis.columbia.edu/~seligman/root-class/RootClass2012.pdf
Git Hub Notes:
When pushing something to Git Hub:
*Initialized in HONRPHYS, haven’t initialized in PhysHonr268n yet
git init
git add <file name>
git commit –m “message” (will show up in Git Hub)
git push –u origin master
*If I need to remove and reset an origin:
git remote rm origin
git remote add origin git@github.com:MeghanFickett/HONRPHYS.git
*If other people have added stuff to my repository:
git init
git remote add origin (from above)
git pull origin master
*Write Code in emacs, then compile using:
g++ <file name> (This is for C++, with shell script, must change permission using chmod -x <file name>)
Then, to run, use:
./a.out <file name>
To Navigate in Linux:
pwd -> shows path of directory you're in at that moment (This is helpful if you need to copy something from your computer onto Linux or the other way around).
cd .. -> goes up one directory ( ../.. goes up two, ../../.. goes up three, etc.)
mkdir <name> -> makes a new directory
Writing in Emacs:
Here's another link I found that gives all sorts of shortcuts for navigating a script. For long codes, it is really important that you know how to search for a specific line by text or by number, etc. Learn how to be efficient, it will make you more powerful!
https://ccrma.stanford.edu/guides/package/emacs/emacs.html
To Secure Copy:
scp hon-fickett@hepcms.umd.edu:~/PhysHonr268n/HONRPHYS/(further directories if needed)/<file name> ./Downloads
*This sends the file I have identified to downloads where I can move it to my HONR268n documents folder on my desktop. I use the slashes to direct the copier to my file's exact location, I need to map out the location to the right directory.
To get files from my computer onto hepcms:
scp ./Downloads/<file name> hon-fickett@hepcms.umd.edu:~/PhysHonr268n/HONRPHYS/(continued file names if needed)/<filename.extension>
*To find my file path: pwd
ROOT:
For help, google TF1 class or TH1 class or Math, etc. CERN website will have most useful information usually.
Other link:
http://hadron.physics.fsu.edu/~skpark/document/ROOT/RootLecture/RootLecture290305.pdf
***To Create canvas on which graph will be displayed, type: TCanvas *c1 = new TCanvas("c1", "demo", 200, 10, 700, 500);
c1->SetFillColor(42)
***This set the background color to beige, but there are other colors that can be used. Google root fill colors to see the options available.
Format for TH1: TH1 *<name of graph you will reference> = new TH1("<name>", "<title>", <number of bins>, <min bin>, <max bin>)
Format for TF1: TF1 *<name of reference> = new TF1("<name>", "<equation>", <min x>, <max x>)
***Note: For TF1, when there are constants in the equation (parameters), you must define the parameters using this command:
<name of referenced graph> ->SetParameter(<parameter number>, <value>)
***When it it written in the equation, it will be in square brackets with the reference number. Ex: Parameter "0" will be written as [0].
May need to use TMath class for complicated functions, make sure to define whatever class you need to use. For random numbers, probably use TRandom.h, for math, probably use TMath.h (This is written when you use #include)
***To Get onto Root, must be in CMSSW_5_3_30 or in CMSSW_8_0_0
-> To add another CMSSW directory (some are more updated than others. For example, TBrowser only works with CMSSW_5_3_30):
cmsrel CMSSW_#_#_# (This creates a new subdirectory)
cd CMSSW_#_#_#
***Before you run a command, you must type: cmsenv to initialize root in CMS
To open Root window: root -nw
***Should see graphics pop up with logo
To run an executable on Root: .x <filename>
To run root interactively (like in HW 9 with ana.C)
root -l
.L ana.C+ (+ at the end compiles the code and makes command run faster)
ana t
t.Loop()
To quit Root to edit file back in emacs or see another file: .q
*A good way to save files in ROOT:
-> In root, run code, then do:
TBrowser new (This opens a GUI that allows me to click and view any graph that is part of the code)
->When I click on a graph, can "Save As" a .gif file
Another way to save in ROOT:
IN ROOT, draw the graph you want: <graph name> ->Draw();
Then, do: c1.Print("<name of file.gif>") -> this saves the graph as a .gif file with the name in quotes.
*Another way to save - copying (This is a good idea if I'm editing a code - make a copy of the original in case I need it again):
cp <file name.extension> ~/pathway to directory I'm working in
Absolute Path: to change directories or move somewhere, begin the pathway with " / ". This creates an "absolute path", which allows you to go the directory you want to go to regardless of where you are at that moment.