Welcome to the SK tutorials!
Before we start using SK software and code, it is important that we make sure you have a computer to work on that can use the tutorial software. The ideal place to do the tutorials is on-site, such as on the Duke neutrino computers. If that is difficult or not possible, these tutorials can also be done on the Kamioka computers, or remotely, via ssh or vpn.
Either way, you’ll need to get an account. Talk with your professor, they can help set you up! If you’re working on site, you can just log in to the computer, and go. If you’re working off-site, you’ll need some software to help you connect remotely. Information on that is located on <some separate page to be made>. Don’t forget to change your password away from the default one as soon as possible!
Say hello to the terminal!
Though you should probably just use the keyboard (how quaint). Using the terminal to manipulate files and run software may seem antiquated, but it is actually quite easy to do, and quite powerful, once you get used to it. If you are new to this, you might want to read up on some of the basic commands, such as:
ls dirname to list the contents of a directory
cd dirname to go to a directory ( cd .. to go up one level )
cp file1 file2 to copy one file to another
You can find tips and other help from a variety of places online. Some suggestions include this tutorial, this wikibook, the Duke Physics computing documentation, and, of course, google. Before you know it, you’ll wonder how you lived before tab completion and middle-click paste.
The most common thing you will be doing is editing text files (the code!) You will need to use a text editor. A popular one for beginners is gedit. Those looking for a more powerful text editor may find emacs or vim to be more to their liking. Whichever one you choose, you can open a file to read (or write, if you’re allowed) with the editor name, followed by the file name. For example
to open the file examplefile.C in gedit. If examplefile.C didn’t exist when you started, this would create a new file with that name.
Setting the shell
The shell is the software which takes the commands you type in to the terminal and turns them into actions. Most unix/linux shells are fairly similar, but, for simplicity, we will be assuming the tcsh shell here. If you aren’t already using it, you can open the tcsh shell by just typing:
into a terminal prompt. To set the shell permanently to tcsh, you should:
On the Duke neutrino computers (or if sshing to them):
You can change your shell using the self-service tool https://oit.duke.edu/selfservice
under “advanced user options”, “Change your UNIX shell”.
On other computers:
Check with your administrators about how to change the shell.
Set the login script
You should create a file called .tcshrc in your home directory (~). This “login script” contains a list of commands that execute when you login to a new “shell”. You can create and/or edit this file using your favorite text editor. At the very least, it should contain the following (assuming you are using the Duke computers):
setenv PROJECT /var/phy/project/hep/neutrino source $PROJECT/soft-CentOS8/updateEnv/env.csh setenv LD_LIBRARY_PATH $SKOFL_ROOT/lib:$ATMPD_ROOT/lib:$LD_LIBRARY_PATH setenv TUTEXAMPLES /var/phy/project/hep/neutrino-data/projects/tutorials
On the Kamioka computers, the minimum is:
source /usr/local/sklib_g77/cshenv_g77_skofl_16c+atmpd_16c setenv TUTEXAMPLES /disk01/usr2/tutorials
You will note that, in addition to the lines necessary to run the software, we have also set an environment variable, $TUTEXAMPLES, which contains the path to the tutorial example data file directory. That will be useful later.
This login script (which is hidden by default, as are all files whose names begin with a period) can be modified and customized as much as you like. An .tcshrc file can be found for the Duke computers at:
and for the Kamioka computers at:
Feel free to borrow anything you like and copy it into your own .tcshrc (this is also good practice with the text editor).
Keep home and work separate
Lastly, it is a good idea to keep your home directory separate from your work directory (for a variety of reasons). So let’s set up a work directory for you now!
Close first your terminal window and open a new one. From now on, any new terminal window will first execute your .tcshrc file and set up a bunch of environmental variable like $PROJECT used below.
On the Duke computers:
cd $PROJECT/work move to the work directories mkdir myusername make a directory with your username cd myusername move to that directory mkdir tutorials now you have a subdirectory just for tutorial stuff
On the kamioka computers:
cd ~ move to the home directory mkdir work make a work directory inside the home directory cd work move to that work directory mkdir tutorials now you have a subdirectory just for tutorial stuff
One more thing… let’s make ROOT look pretty
When you start using ROOT, you’ll want to make your plots look nice, otherwise one of the Duke professors will go all HULK SMASH and break you. You might want to set up the ROOT logon script stuff now.
Working Outside the Office
If you want to work on the tutorials from somewhere other than the machines in the physics department, you will need to do a bit of setup on your local machine. If you are using OSX or Linux, you simply need to log in with X11 forwarding turned on from the command line:
ssh -YC <user>@phy-compute-03.phy.duke.edu
You will typically want to have XQuartz on your local machine if you are working on a Mac. If you are using Windows, you need to install an ssh client (suggested: putty) and an X11 server. X-Win32 is available for download through Duke OIT. You may need to go into the settings of putty to make sure that X-forwarding is enabled. Once you have the xserver installed, start it up, and then use Putty to connect to, e.g. phy-compute-03.phy.duke.edu as above. FastX may be a better option if these don’t work.
You will have to have two-factor authentication set up, and you also may need to use a VPN. With your Duke netid and CiscoAnyConnect, you can connect using portal.duke.edu.