80
Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Embed Size (px)

Citation preview

Page 1: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Installing and Using the FIT HEP A Development Environment

Michael StaibSummer 2012

Page 2: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

• In this guide we will look at how to start from scratch and build all of the necessary tools to operate the SRS and perform analysis using AMORE.

• For this tutorial we will start with a blank virtual machine and work our way up from there but all of this can be easily duplicated on a real machine.

• In the end we should be able to operate both DATE and AMORE, as well as use all of the available tools for analysis of real data that have been developed from the virtual machine. A final version of the virtual disk image from this process can be found on the cluster This can be ported to any computer and used to run analysis or just to play around...Have fun!

• The guide will be as detailed as possible, some possible troubleshooting possibilities will be addressed, but the guide is far from comprehensive. Some very valuable resources are:

https://ph-dep-aid.web.cern.ch/ph-dep-aid/ for ALICE DAQ documentation including DATE and AMORE.

https://espace.cern.ch/rd51-wg5/srs/default.aspx for SRS documentation and software including firmware releases.

http://www.google.comfor everything else

Overview

Page 3: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Table Of ContentsClick a link to be taken to the chapter...

Chapter 1: Installing SLC5 within VirtualBox

Chapter 2: Installing DATE, AMORE, and Eclipse

Chapter 3: Interacting with the SVN Repository

Chapter 4: Configuring DATE for use with the SRS

Chapter 5: Uploading Firmware to FEC

Chapter 6: Using the Beam Test AMORE Version

Chapter 7: Using the Offline Alignment Codes

Page 4: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Chapter 1

Installing SLC 5 within VirtualBox

Page 5: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

• First things first, we need a computer.

• Thankfully, since we will use a virtual machine, you don’t really need a new one. There are some obvious losses in performance since your machine will run inside of another machine, but at the very least you won’t have to run SLC 5 and its ancient Linux kernel version for your day to day needs.

• First point yourself to https://www.virtualbox.org/ and choose the download link on the left hand side. Then choose the VirtualBox platform package for the system you are using. I will be installing it on Windows 7 64-bit, so I will choose to install the version for Windows hosts. I assume everyone has installed windows software before, so just click next for a while until it is ready to use...

I’m using this one

Virtual Machine Only

Page 6: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Open VirtualBox. It will probably ask if you want to install the add-on pack. You will need this later so definitely install this now.

You should now see something like this, except your left panel will be blank, but not for long!

Click on New in the upper left corner to create a new virtual machine. This will open the New Virtual Machine Wizard.

Click Next and then choose a name for the machine. This is up to you. I will call mine “Farewell AMORE”.

Choose “Linux” and “Red Hat (64 bit)” from the drop down menus.

Click next, and then choose the amount of RAM you want to allocate to the system. Note that this memory will only be accessible from the virtual machine, so be sure you leave enough for Windows to run on. Typically, I use half of my memory ~4 GB. I wouldn’t suggest less than 2 or 3 GB. Virtual Machine Only

Page 7: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Click Next, and we will create the virtual hard disk.

If you download the version from the cluster, you would choose “Use existing hard disk” here and point it to the .vdi file you downloaded from the cluster. You can then start the machine in VirtualBox and hit the ground running.

For the case of a new machine, choose the options shown on the right. Then click Next.The file type will be VDI, click Next. Then choose “Dynalically allocated”. Click Next and choose the name and size of the hard drive you want to create. I chose SRSDevMaster and 250GB, then just click Create until the wizard is complete. You should now see the virtual machine in VirtualBox.

Your new computer

Virtual Machine Only

Page 8: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

You can think of your new virtual machine as a new computer, with all of the things you expect a computer to have. To install SLC 5 we will insert an image file (.iso) into a virtual disk drive on our virtual machine.

SLC installation images can be found at http://linux.cern.ch or more specifically for SLC5http://linux.web.cern.ch/linux/scientific5/docs/install.shtml

Download the “Boot CD image” for “64-bit systems”

Now in virtual box, click on your virtual machine and then click “Settings”

Then click on Storage

Next click on the “Empty” CD Drive

Then the icon on the right of the small CD. Finally “Choose a virtual CD/DVD disk file...”

Navigate to the boot.iso image you downloaded from the website above. Click “Ok”.

Page 9: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Now it’s time to start your new virtual machine. With your machine highlighted click on start on the main VirtualBox window.

The first time you use this it may fail! It may complain about virtualization or VT not being enabled. This must be done in the bios. You will need to restart the computer, enter the bios, and then enable a setting that should be something like “virtualization technology” or VT or something like that. This allows the virtual machine to take control of some of the cores of your CPU.

If everything is working fine, the virtual machine will start up and the installation for SLC5 will start.

You want to install in graphical mode, so hit enter.

Be sure you have a very stable internet connection, Do not try to install over WiFi!

The next two questions should be easy(Language and Keyboard layout)

Choose the “HTTP” install method.

You should leave the TCP/IP settings as the default unless you know what you are doing...

Page 10: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Now use the following:

Web site name: linuxsoft.cern.chDirectory: /cern/slc5X/x86_64/

Use the keyboard to choose OK and the next part of the installer will be downloaded.

The following screen will appear

Now for the real installation...

Click Next

Page 11: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Choose Yes

Defaults are OK here

Yes

Next

Choose YesYes

Page 12: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Next

Default OK

Default OK

NextDefault OK

Next

Page 13: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Choose nearest location (in the same time zone), and uncheck the “System clock uses UTC” option.

Next

Choose a root password. For this I will use something generic (password is the root password), can be changed later for more security

NextDefaults fine here, we will play with it later

Next Next

Page 14: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

You might receive errors like this one, It is a known bug, but CERN has not fixed it in their

release. Just keep clicking retry and the installation should continue.

Now we made it...click reboot

Page 15: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

But, this will put you back here because you have to remove the virtual disk from the virtual drive

on the virtual machine

Close the window the machine is running in and choose “Power off the machine”

Remove the virtual disk in settings and start the machine again

This first boot will take a while since it will run yum autoupdate. Good

time for another coffee.

Page 16: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

I just enable everything except http

Choose Permissive

Choose the followingDate+Time

Sound...easyWelcome to SLC5!

Log in with username “root” and the password you created during installation(“password” in this case).

Page 17: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

The first thing we need to do is set up a user account, and install the guest additions from VirtualBox onto our VM.

To make a new user, go here. Click Add User, and then put in all of the

information. To start I have used username SRSUser with the password the same as the

user name. I also choose not to create a private group for the user.

Page 18: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Now the guest additions for VirtualBox...

Choose “Install Guest Additions”

This will pop up, just close this window since we will do the next step from the

terminal

Open a terminal then do thisLines with are important.

Now the guest additions are installed. We will finally disable yum autoupdate, so

nothing we do is overwritten by an update

Virtual Machine Only

Page 19: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

To disable yum autoupdate, do the following as root

> gedit /etc/sysconfig/yum-autoupdate change the lines

YUMUPDATE=1 YUMUPDATE=0YUMONBOOT=1 YUMONBOOT=0

Save, and then issue the commands in terminal as root

> /sbin/chkconfig --del yum-autoupdate > /sbin/service yum-autoupdate stop> reboot

The system will restart, then you can log in with the username and password you created (SRSUser).

We have now completed the initial setup of our virtual machine. In the next chapter we will install DATE , AMORE and Eclipse onto our virtual machine.

Page 20: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Chapter 2

Installing DATE, AMORE, and Eclipse

Page 21: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

First let’s start out by changing a setting in SLC5. Now that you are logged in as a user, open the “Home Folder” under “Places” in the task bar.

I don’t really like this view, so choose “Edit”--> “Preferences”

In “Behavior” choose “Always open in browser windows” and close. When you reopen the

home folder, it will be the better view

Page 22: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

To install DATE, the first thing you need to do is install the ALICE DAQ repository on the computer. This can be found on the cluster

/home/g4hep/VirtualMachineSetup/yum-alice-daq.slc5_64.repo

Copy this file (as root) into the directory /etc/yum.repos.d/ on the virtual machine.

Now things get easy...In a terminal as root

> yum install date> yum install MySQL-server MySQL-devel> /sbin/service mysql start

> unset DATE_SITE> . /date/setup.sh> newMysql.sh

The output of the newMysql.sh script is shown on the next page

Page 23: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Unless you need to change the host name, all of the default values should be ok. The defaults are shown in the [] brackets. Just hit enter to use them.

Page 24: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Now as the DATE user (in this case SRSUser) do the following. All Non-default values have been marked

Page 25: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Now as the DATE user (in this case SRSUser) do the following. All Non-default values have been marked

Page 26: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Now as root:

This is all of the configuration of DATE we will do for now. but it is not quite ready to take data from the SRS. We will do that configuration in a later chapter.

And finally start the DIM server (as root):

> /date/runControl/start_dim.sh

Finally copy the file /home/g4hep/VirtualMachineSetup/rc.local to /etc/rc.local as root on the virtual machine to make sure that this is done at every boot.

> scp [email protected]:/home/g4hep/VirtualMachineSetup/rc.local /etc/rc.local

Page 27: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Now to install AMORE. As root:

> yum install amore

Now let’s change the .bashrc file for the SRSUser account. Copy the file

/home/g4hep/VirtualMachineSetup/bashrc on the cluster to /home/SRSUser/.bashrc on the virtual machine

Using the “scp” command is best. type scp --help if you need it.

> scp [email protected]:/home/g4hep/VirtualMachineSetup/bashrc /home/SRSUser/.bashrc

Open a new terminal. You will see these errors:

To fix, run the following as user:

> amoreMysqlSetup> newAmoreSite

The output is shown on the next page.

Page 28: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

All of the default values should be ok, unless you changed the MySQL host name earlier.

Page 29: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Now we can install the generic GUI that I have found to be quite powerful. To do this (as user):

> cd> svn co https://alisoft.cern.ch/amore_modules/branches/current_deploy/dqmv> cd dqmv> make install > cd

The generic GUI is now installed and can be started with the command:

> amoreGui

Page 30: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Now to create the AMORE agent we will run. use the command newAmoreAgent (as user)

Agent name is SRS01DET code is SRSPublisherModule is SRSPublisher

These non-default values indicated below in output. Now the AMORE setup is complete. We will now install eclipse so we can checkout the newest code from the SVN on the cluster.

Page 31: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Just a note that at this point I had to reinstall the VirtualBox guest additions. I was unable to change the resolution of my screen to my desired setting, and the virtual machine was still capturing the mouse. A quick reinstall repeating the earlier steps did the trick.

Installing Eclipse is quite easy. Navigate to http://www.eclipse.org/downloads/ and select “Eclipse IDE for C/C++ Developers” . Download the “Linux 64-bit” version to the home directory. Then just untar using the command:

> tar -xvf eclipse-cpp-juno-linux-gtk-x86_64.tar.gz

Then just change into the directory

> cd eclipse/

and run the binary

> ./eclipse

The first time it loads you will need to select a workspace. The default value is just fine.

Choose to use this as the default.

Page 32: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Now we need to install Subclipse to interact with the SVN with Eclipse. All you need to do is the following.

In Eclipse click on “Help” then “Install New Software”. In the “Work with:” box type http://subclipse.tigris.org/update_1.8.x then hit “Add”

Make a name (“Subclipse” is fine) and click OK.

Choose all of the packages that appear and click Next, and then Next again when it tells you to review the

items to be installed. Accept the license terms and click Finish.

Page 33: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Restart eclipse when it asks you to. You will get an error like this, but not to worry as it will not affect the operation as far as I can tell. Maybe it can be

fixed at a later point...Update this guide if you figure this out!

Click OK if you get a message like this

Finally click on

Page 34: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

To import the latest code from the SVN perform the following steps

Click on this icon in the upper-left corner

Choose “Checkout Projects from SVN”

First the login credentials for the cluster

Page 35: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Then the log in credentials for the SVN repo

Now highlight the directory you want to import, click Next

Default OK, click Next

OK, click Finish

The newest version of AMORE will then be downloaded into the default workspace.

Some tips on how to use the SVN with Eclipse will be presented in the next chapter.

Page 36: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Chapter 3

Interacting with the SVN Repository

Page 37: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

SVN is a nice tool that allows us to keep all of our code in a centralized location. It also makes version management very simple, allowing the user to revert to an earlier version of the code, or quickly check the changes that have been made.

On the cluster, a repository has been created in the folder /home/g4hep/SVNRepo

It is strongly advised that the user not try to change anything in this folder, as some changes may corrupt the repository. The steps used to create the repository are listed below.

Log in to cluster.

> svnadmin create ~/SVNRepo

Edit the file ~/SVNRepo/conf/svnserve.conf with vi or emacs

> vi ~/SVNRepo/conf/svnserve.conf

Add the following (or uncomment the appropriate lines)

Steps to set up SVN

anon-access = noneauth-access = writepassword-db = passwd

Page 38: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Then in the file ~/SVNRepo/conf/passwd set up the user and password pairs in the form:

username = password

Now just start the svnserve daemon with the command

> svnserve –d

The rest we will do from the virtual machine (or local computer)

This is how you set up a new project on the SVN using the terminal, and Eclipse:

> svn mkdir svn+ssh:/[email protected]/home/g4hep/<new project> –m “Initial folder creation”

Where you have replaced <new project> with the name that you want to use.Now using Eclipse, check out the project the same way you did for AmoreSRS here.

This time there will be a few more steps since we need to configure some things for use with eclipse. It will ask you to crate a new project. On the “Select a Wizard” screen choose “C++” under the “C/C++” dropdown menu.

Page 39: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Next make a name for your project and choose “Makefile project” with Empty project and Toolchain “Linux GCC”. Then click “Finish”

Now you can just add classes and files using eclipse if you are working on new code. If you are working on existing code, right click on the project folder in the workspace and select “Import”. Then on the screen that appears, under “General” choose “File System”. Then browse for the directory where the code resides, and select the folders that you want to add to the Eclipse project. Click finish and they should be added to the project.

Page 40: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

The final thing to do is to commit the project to the SVN database. To do this right click on the project, then “Team” then “Commit...”

Put some message to explain any changes that have been made and click Finish.

It is a good idea to “Update to HEAD” any time you open Eclipse as this will be sure that you are working with the latest committed version of the code wherever you are. Be sure to

“Commit..” your work when you make a change or add something new that you want to keep.

Page 41: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

If you want to see the changes in a particular file over time in the repository, right click on the file, go to “Compare with” then “Revision”. Then select the revision you are interested in. The difference between the two will be displayed quite nicely in eclipse.

Play around a bit...The SVN is a very powerful tool. Check the internet for other uses. Feel free to add to this guide if there are any interesting tricks or tips.

Page 42: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Chapter 4

Configuring DATE for use with the SRS

Page 43: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Virtual Machine Only

In the case that you want to take data with the the SRS from a virtual machine, you must first be sure that your Ethernet card on the host computer supports gigabit Ethernet with jumbo frames.

In Windows, go to the Device Manager and check the properties of the Ethernet card. Be sure that jumbo frames are enabled, and set to 9KB MTU if the option exists. If Jumbo frames are not available on your Ethernet card, you will need a more capable Ethernet card to take data from the SRS.

Page 44: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Virtual Machine Only

Next we have to provide a second “virtual” Ethernet card to the virtual machine. Go to the settings for your virtual machine. Choose “Network” and then “Enable Network Adapter”. Make this a “Bridged Adapter” and then choose the name of your Ethernet card you want to use on the host computer. See the settings below. Now start up the virtual machine and we can start the real setup.

Page 45: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

The first thing to do is to add the udp detectors to the DATE_CONFIG. To do this, copy the file udp.sql from the cluster

> scp [email protected]:/home/g4hep/VirtualMachineSetup/udp.sql .

then run (as user):

> cat udp.sql | mysql -udaq -pdaq DATE_CONFIG

This will add the option for the correct equipment in editDb. Next we will make the drivers required for SRS operation. To do this do the following:

(as root)

> cd /date> export DATE_ROOT=`pwd`> export DATE_MYSQL=TRUE> unset DATE_SITE> unset ROOTSYS> . ./setup.sh> rm -rf RPMS> gmake rpm DRIVERS_ONLY=1

then install all of the rpm files in the directory /date/RPMS/ using rpm (as root).

> cd RPMS> rpm –iv *.rpm

You will see a FATAL error inserting the physmem driver, but this is not really a problem. We will fix that next.

Note that this is not an apostrophe. It is the character to the left of 1 on your keyboard

Page 46: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

What we need to do is to limit the amount of memory being used by the operating system. This can be done in the following way.

(as root)> gedit /boot/grub/menu.lst &

There will be a section that looks something like this:

title Scientific Linux CERN SLC (2.6.18-308.8.2.el5)root (hd0,0)kernel /vmlinuz-2.6.18-308.8.2.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quietinitrd /initrd-2.6.18-308.8.2.el5.img

change this line--> kernel /vmlinuz-2.6.18-308.8.2.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet

into--> kernel /vmlinuz-2.6.18-308.8.2.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet mem=3000M Then reboot.

This will allow the physmem driver to insert into the unallocated space. In this case, since I have 4 GB of RAM for my virtual machine, 1 GB of that will now be reserved for physmem. It is a good idea to make two entries since this additional memory could be useful for AMORE. See the menu.lst file on the cluster for an example of this. It is not a good idea to directly copy this file as the kernel version may change over time. If you choose to have two options, the first one listed will be the default. You will have to select what you want to load on the grub menu at boot time (the blue screen).

Page 47: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Now we can install the specific readout features for the SRS. copy the file readoutRD51.tar from the cluster to /tmp.

> scp [email protected]:/home/g4hep/VirtualMachineSetup/readoutRD51.tar /tmp

Then we will make the changes and recompile DATE.

(as root)

> cd /tmp> tar -xvf readoutRD51.tar> export DATE_SITE=/dateSite> source /date/setup.sh> cd /date> mv readout readoutORIG> mv readList readListORIG> mv /tmp/readout /date> mv /tmp/readList /date> yum install tcl tcl-devel tk tk-devel pciutils-devel> gmake distclean> gmake

Now everything is all set so that we can do the final configuration in editDb.

Page 48: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Open editDb by typing editDb in terminal as user. First we will add the equipment we will need.

First change the two test detectors rand1 and timer1 to be inactive. Just click on the ACTIVE boxfor both of the equipment and then click commit at the bottom of the window. Both of the eqipment should now be red. Next click on Add at the bottom of the window and follow the steps below.

Page 49: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Choose EqId (Equipment ID) 1, set the ipHost to 10.0.0.3 and set the ipBoard to 10.0.0.2,Choose a Equipment Name.

Make sure that both the UDP equipments you just created are set to active. Be sure that all of the changes are comitted. The commit button will write these settings into the MySQL database to be used by DATE.

If you have more than one FEC, just add an additional RorcDataUDP, set a different Equipment name, Increment the EqId (make it 2,3,4...) and set the appropriate IP address. Each FEC will need to have a different ipHost and ipBoard.

Page 50: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Next we will set up DATE so that it actually uses the memory that we set aside. In a terminal (as user)

The lower (larger) one is what we are looking for. We will need the exact size (1585446912) for this next step. In editDb, navigate to the “Memory Banks” tab. Click “New” and use the settings below.

Where you have used the size and KEY_PATH from the output of the command above.

Page 51: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Now a few small settings for the readout configuration and slow controls. Click on the “Files” tab then click “New”. Use the PATH “readout.config” and click “Add”. Once again click “New”, use the PATH “SOR.commands” and click “Add”. The list of files should now appear as below.

Next click on the “readout.config” file you created then click on the “Edit file” button to the right. Inset the following lines, Save and close the window. Then “Commit”

Now click on the “SOR.commands” file and click “Edit file”. Insert the following, save, close and commit.

That is all of the configuration we will need to do here, so you can now quit editDb.

Page 52: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Now we will need a few things from the cluster: the ethernet initialization script, the slow control scripts and the DATE startup script. (as user)

> cd> scp [email protected]:/home/g4hep/VirtualMachineSetup/slow_control.tar .> tar –xvf slow_control.tar> scp [email protected]:/home/g4hep/VirtualMachineSetup/ethInit1FEC.sh .> scp [email protected]:/home/g4hep/VirtualMachineSetup/date.sh .

Now go ahead and start date using the script provided (as user):

> ./date.sh

It will take a little while to start all the DAQ domains, but after it is done you should see our familiar interface. Now on to the final configurations.

Page 53: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

First take control of the DAQ by clicking on the lock and then DAQ Control

Click “Define” under “Disconnected Configuration”

This window will appear, click “GDC”

Click “less” to make the number 0 and close

Click “DETECTOR”Click on “DAQ_TEST”. It will turn

yellow, close this window Click “Save”

Click “OK”

Click “YES” when it asks if you want to apply your changes to the configuration. Then click “OK” again

and “YES”. Finally click the arrow to the right to proceed to the Connected Run Parameters.

Page 54: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Click “Define” under “Connected Run

Parameters”

Click “Common Parameters”

Use these settings then click “Apply to current values” and

close the window.

Click “LDC”

Use these values, Apply them and then close the window. Finally click “Save” to save the

values to “DEFAULT” finally press “OK” and “YES” when it

asks if you want to use the changes. Then “OK” and “YES” to get out of the connected run

parameters screen.

Page 55: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Now the system is essentially ready to take data. There are only two more things to do. First do the Ethernet initialization by starting a terminal and running (as root)

> ./ethInit1FEC.sh

This turns off the firewall iptables and sets the appropriate settings for the Ethernet card. Send a ping to the board just to be sure everything is working fine. Everything looks good so let’s move on.

Page 56: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

There have been some changes to the infoLogger in the recent versions of DATE. In order to see all of the interesting messages you will need to enable them.

Click “Online”Choose “any” from the

“Level” drop down menu Click “Online”

Page 57: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Now DATE should work as explained in the FIT DAQ manual. When working with just one FEC you may want to change some of the slow control settings to suit your needs. Take a look at the documentation on the cluster under /home/g4hep/VirtualMachineSetup/Documentation.The guides here are very useful and explain each of the memory registers that can be changed. When we set the SOR.commands, we set up the script slowControlConfig to send the slow control command when you press the “Start processes” button on the DATE DAQ. The two arguments 0 and 1 tell the script which range of IP addresses to initialize. These are the arguments of used in a for loop:

for (( i=$1;$i<$2;i++ ))

In a bash script $1 indicates the first argument after the command, $2 the second, etc...

So with the arguments 0 1 we will only initialize the FEC at IP 10.0.0.2.

If we instead used the arguments 2 4, we would initialize 10.0.2.2 and 10.0.3.2

Take a look at the script itself to see what the actual commands are for sending the slow control. This is also explained a bit in the slow control manual.

Page 58: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Chapter 5

Uploading Firmware to FEC

Page 59: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

This topic has already been covered in some detail in a guide from CERN. On the cluster I have made a folder ~/home/g4hep/VirtualMachineSetup/Documentation that contains some very useful documentation including the “FEC Firmware Upgrade Tutorial.pdf”.

I have also uploaded some versions of the FEC firmware to the cluster that you can install.

v207 is the latest firmware without zero suppressionv205 is the version currently installed for the MTSfec_apz_v1_0b.zip is the beta version of the zero suppression firmware

Install them as discussed in the guide. The “SRS PC” in the lab can be used to do the installation. Just “su” to root and type “Impact”. If this is not possible, it is very easy to install on a Windows PC as discussed in the guide. The instructions for installing the linux version of iMPACT can me found on the Xilinx website.

You can also open the guide by double-clicking here in the pptx version of this guide

Page 60: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Chapter 6

Using the Beam Test AMORE Version

Page 61: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

The newest version of the AMORE code has been designed to be backwards compatible, while enabling many new useful features. For the moment, the new and the old version of the AMORE code do not produce identical output. This can be attributed to three things (listed with classes involved):

•Single strip clusters are now allowed in the cluster building (SRSDetectorPlaneEvent).•Cluster building allows a single dead strip within any cluster (SRSDetectorPlaneEvent). •The position is no longer adjusted for a Gaussian fit of the cluster (SRSDetectorPlaneEvent). •Crosstalk in the APV is not corrected (SRSAPVEvent).

All of these things can be changed if you wish to get truly identical results.

The most important improvements to the AMORE code is the inclusion of a generalized detector characterization plots including efficiency and spatial resolutions using a “tracker” and “test” detector in a fairly general way. There have also been improvements to the format of the mapping file, and increased simplicity in the histogram configuration file. There is also now the ability to save the zero suppressed output of AMORE into a root file, allowing much faster processing and the ability to change some of the analysis procedures later and rerun the analysis without the added time of zero suppressing the data. There have been other guides for the AMORE package before, so this will not be in excruciating detail, but this guide should at least allow you to run the code and be able to interpret the output.

First let’s look at the changes in the configuration files.

Page 62: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

The main run configuration file is now called “runConfig.cfg”. Everything in this file should be self explanatory. The names of the run types has changed slightly:

Note that the new version of the code requires you to set an environmental variable (AMORESRS) telling where the root of the output files is found (in this case $HOME/amoreSRS). This can be set in the bashrc as it is on the virtual machine or can be exported in each session. This is so that if the installation is in a nonstandard location, the output will still go to the right place!

RAWPEDESTAL and PEDESTAL runs are the same as before with some optimizations to improve processing time. MTSANALYSIS is the standard MTS analysis package for POCA with combinatoric tracking. The MTSALIGNMENT is the usual MTS alignment type run. Here the track selection is based on the straightest path through the station as opposed to the combinatorics. The new run type is BEAMANALYSIS that contains most of the new parts of the code. You will also notice the new lines below. This allows you to turn on input from a root file instead of from raw data. This is discussed in more detail later.

Page 63: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

There have been many changes to the mapping file since the previous version of AMORE. Tehre is now the option to set the strip mapping type from the configuration. If you ever need to make a change to the strip mapping or add a new one in the future, you will need to look to SRSAPVEvent, SRSHit and SRSDetectorPlaneEvent. First thing in the mapping file is to define your detectors. The form can be found below.

For now the detector name must be GEM_ where the blank is 0-9 this should be changed at some point to allow any name that the user wants! Likewise the Plane name must be of the form _X or _Y where the blank is the detector name. All of this should be generalized at some point.

Page 64: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

The APV to FEC mapping has changed slightly to remove some depreciated variables. Also the apvID is now set as the configuration is read it. In this way it is not necessary to change all of the apvIDs if one APV needs to be removed from the analysis due to bad data.

Page 65: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

If you are using MTSANALYSIS or MTSALIGNMENT you can set up a MTS and shift the detectors in an identical way to the old code.

Page 66: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

The new BEAMANALYSIS type run requires that you set up a “TRACKER” and “TEST” detectors. This is done in a similar way to the MTS setup. You can also “SHIFT” the detectors in an identical way to the MTS (See previous slide) See the syntax for TRACKER and TEST detectors below:

The last entry is the “efficiency radius” that will be used for the analysis. If the hit is within this radius (in mm) the hit is taken as efficient. The “TEST” detectors will never enter into the fit of the track. The “TRACKER” detectors will be all that is used. However, it is possible to probe the detectors within the tracker as well. To do this , you must be sure that the detector fits are unbiased. For now this must be hard coded (could be improved). To unbias the fits, uncomment this line in SRSBeamTrackFitter and recompile (line 11).

Page 67: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

You can also define other efficiency cuts as shown below. This cuts on the impact point of the track on the detector. If the crossing point is outside of the rectangle declared below, it will not be counted for the efficiency.

The histogram configuration file has been changed drastically from the earlier version of the code. As a result, the production of many different types of histograms has become much easier without editing hundreds of lines of configuration. The entire contents of the file are seen below:

Note that there is some functionality lost in comparison with the old version of the code. Most notably the option to rebin the histograms without hard-coding is gone, as well as any changes in the titles. However, the entire SRSHistoManager code has been rewritten to make it a bit more user friendly. Either way this functionality should be restored as a project in the future. Also the ability to turn off histograms that you don’t want to see of a particular type. I have some ideas about the best way to do this, but haven’t implemented it.

Page 68: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

The most notable new feature is the ROOTFILE output. It is recommended to run this histogram type first by itself to produce a root file that contains the zero suppressed output from the run. The structure of the root file produced is shown below. It will be saved in $AMORESRS/results/ZeroSuppresion/<RUNNAME>.root where RUNNAME is set in runConfig.

The data are stored in a TTree, each event contains the following.

Event_number in the raw data file.NbOfHits in the eventPlaneName associated with each hit as a vector<TString>StripNumber associated with each hit as a vector<Int_t>Position of each hit as a vector<Float_t>Maximum charge of the hit as vector<Float_t>Time bin in which the maximum charge occurred as vector<Int_t>Time evolution of signal as vector < vector <Float_t> >

The RAWPEDESTAL and PEDESTAL files must be produced prior to the creation of this root file. The root file must also not already exist in the $AMORESRS/results/ZeroSuppression directory. If it does it will not be overwritten and the program will intentionally crash.

The only draw back for the moment is that is the strip mapping in the code needs to be changed, it is required to produce this zero suppressed root file again. A fix could also be hard coded. In general be very careful of the setup of your mapping file when producing this file type! It can have a huge impact on the result if something is wrong.

Page 69: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Now that you have the zero suppressed output you can run the other types using the root file. To do this, make the appropriate changes to the runConfig file.

Then you can produce the following other histogram types using the zero suppressed file.

Alternatively, MTSANALYSIS can be run over the zero suppressed data. This is quite nice since it will allow characterization plots to be easily made from the MTS runs.

Note: The RAWDATA, PEDESTAL, and ZEROSUP histograms are NOT supported with root file input. I have not checked, but it is likely that the program will segfault if you try to produce these histograms with root file input.

Since this is really a hack, in order to run amore you still need to provide a “raw” data file on the command line. This will not be used at all, so it can be any raw data file at all. You also still need to provide a pedestal file in the runConfig. This need of a pedestal file could be fixed in the future.

Page 70: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

The other histogram types will create the plots below. The output root file containing all of the histograms is saved to $AMORESRS/results/<RUNTYPE>_<RUNNAME>.root where RUNTYPE and RUNNAME come from the runConfig.cfg.

RAWDATAThe raw data are plotted for every APV connected in the mapping file. Only works with raw data input.

PEDESTALOnline pedestals are displayed for all APVs connected in the mapping file. Only works with raw data input and RAWPEDESTAL and PEDESTAL run types.

ZEROSUPThe zero suppression plots for each detector plane connected in the mapping are displayed. These plots are:

•Raw data for the entire plane•Pedestal subtracted plane data•Zero suppressed plane data•Time evolution of the signal•Maximum time bin of signal arrival

Only works with raw data input. The two top plots are the problem. Could be fixed so that the bottom three are produced with the root file input.

Page 71: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

ZIGZAGProduces only the position difference

plots for the ZigZag detectors. The detectors used are hardcoded in

SRSHistoManager::FillZigZagHistos

2DFor every 2D detector, a hit map that displays the hit location as well as an “energy map” that shows the total

accumulated charge. Also the charge sharing is plotted.

CLUSTSTATCluster statistics are plotted for every detector plane. These are:•1D HitMap•Cluster Size•Cluster Multiplicity•Cluster Charge Spectrum

TRACKINGProduces the tracking histograms using the TRACKER and TEST configuration in the mapping file. The following histograms are produced: •Local residuals (distance on detector)•Global residuals (distance in 3D space)•Correlation profiles of the residual vs the track impact point.•Efficiency radius scan that shows the inefficiency as a function of the efficiency radius.

NTUPLEProduces many of the same outputs of

CLUSTSTAT and TRACKING, but this time as Nuples for more precice storage of the data,

and easy correlation tests.

I plan on adding to this guide a bit in the future with a more detailed description of the plots that are produced. The best way to learn how to use it is to try it out!

Page 72: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Chapter 7

Using the Offline Alignment Codes

Page 73: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

The first thing you will need to do is to checkout the code from the SVN using Eclipse. Follow the same steps that we used earlier this time use an existing repository. Checkout the OfflineAlignment.Histogram or OfflineAlignment.Kalman package.

First let’s take a look at the OfflineAlignment.Histogram package:

The basic file structure you will check out is shown on the left. There is no configuration file for this code, and is one thing that should be improved in the future. For now, most of the things you will change are passed as arguments with the run command, and everything else is hardcoded. I have added some documentation to the code so you know what should be changed to alter the track types, etc.

First clean and build the code in Eclipse. Under the “Project” menu choose “Clean...” then “Clean projects selected below”, then “OK”.

Page 74: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Next, build the project by clicking on the hammer icon at the top of the screen.

Now we need to set up a run configuration for Eclipse so that we can launch the program. Or you can run from terminal, by navigating to ~/workspace/OfflineAlignment.Histogram/ and executing

> ./OfflineAlignment <map file> <data file> <number of iterations>

or

> ./OfflineAlignment <map file> <data file> <number of iterations> <POCA file name>if you want the POCA output file to be produced after alignment.

This method is not really suggested as it may not play nice with the SVN managed files. I am not really sure about this though. So instead to run the program directly in Eclipse, do the following.

Click on “Run”, then “Run Configurations”Set the “C/C++ Application to “OfflineAlignment”,

next click on “Arguments”

Page 75: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Here you put in the arguments of the program. We have the mapping file then the data file and finally the number of iterations we want to perform.

If you want to produce POCA output after alignment, just put one more argument with the name of the file that you want to create. This is optional, and the code will work fine with or without.

This is what you will change most often as you use different mappings and data files frequently. Finally click “Apply” and then “Run”. The code will then process the specified file for alignment.

All of the results will be saved in the “AlignmentFinalResult.root” file and also many plots will be saved into the “Results” directory of the project. That is pretty much it. Take a look through the source code if you want to play around a bit more.

Page 76: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Now let’s take a look at the OfflineAlignment.Kalman code. First checkout the code from the SVN with Eclipse. The directory structure will be something like what is shown below.

These are the configuration and output files. The settings for the Kalman alignment are stored in align.cfg. The final results are shown in alignment_result.root

Page 77: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

In order to use the Kalman alignment code, you will need an additional library for CLHEP (Common Library for High Energy Physics). to get this we will use yumex to enable a few additional repositories. Open a terminal, (as root)

> yumex

Click on the repository selection button on the left hand side and select all of the repositories except the “cernonly” repositories as they won’t work outside of CERN. Then hit the “Refresh” button. We really only need “dag” but some of the others can be helpful at times.

Page 78: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Next click on the “Package view” on the left (cardboard box icon), then click on available and search “clhep” the results should be as shown:

Select both of the packages that appear and hit “Process Queue” in the lower left. This will install the libraries you will need in order to work with the Kalman code.

Page 79: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

Now “Clean...” and “Build” and finally set up a run configuration. The settings are shown below.

First click here to make a new run

configuration

Page 80: Installing and Using the FIT HEP A Development Environment Michael Staib Summer 2012

And then the “Arguments” tab

This time it is just the mapping file and the input file. The rest of the settings for the alignment itself are in align.cfg and are all documented there.

Finally Apply and Run.

Play around a bit. This time the code is much heavier, so it will take some time to run. You will have to fish around in the code a bit if you want to output some specific quantities. The code that this is adapted from can be found at http://kalmanalignment.hepforge.org/ for additional documentation, or the original code if you want to take a look through it. Good luck.