Guy's Sandbox

Docodon

In many ways, Docodon is a copy of Jaguar. However, due to computer issues and software updates, there are a number of important differences that are described on this page.

Frequent Issues

The web server says it can't find/access this file/folder even though it has read/write/execute permissions!

This might be a problem with SELinux. To fix this, I generally use in the command line:

chcon -R -t httpd_sys_rw_content_t /path/to/folder/file

The server returned a "500 Internal Server Error" but there's no information in the error_log!

That happens.

Unfortunately, I'm not sure how to solve it. You should know that I've already edited the php.ini file and ensured that:

display_errors = On
display_startup_errors = On
error_reporting = E_ALL


...Good Luck!

Docodon Installed Software

Apache 2.4.27

Apache's configurations have mainly been left untouched. User directories have been enabled and are set-up under "~[user]/public_html". The server's main website folder is at "/var/www/html".

The error_log is located at "/var/log/httpd/error_log" (you can also access it at "/etc/httpd/logs/error_log"). Fair warning: there have been frequent issues with the error_log not displaying information about 500 Internal Server Errors.

Important Commands
apachectl restart //restarts the web server
apachectl stop //stops the web server
apachectl start //starts the web server
service httpd status //displays info on the web server
tail -[number] /var/logs/httpd/error_log //gives you the latest [number] lines in the error_log file instead of dumping the entire file into your terminal


Gallery 3.0.9

The Gallery 3 folder is located in "/var/www/html/". To edit it, root access is required.

Image and Album Permissions

Images/albums are saved in "gallery3/var". This folder has '775' permission, meaning that any images NOT in an album are viewable (but not necessarily editable) by everyone. Permissions only apply to albums. If you want two photos to have different permissions, then they MUST be in different albums.

Remember that, when you change the permissions of an album, all albums within are also locked to at least the same degree. For example:

If ALBUM_A contained ALBUM_B and only logged-in users could view ALBUM_A, then only logged-in users (or possibly a more exclusive group of users) could view ALBUM_B.


Sometimes, when editing the permissions of an album, Gallery 3 will tell you that "mod_rewrite isn't enabled", etc. and permissions can't be changed. You should be able to ignore this.

Types of Permissions
• View: Permission to see/browse the album but not necessarily see the images at their full size
• View in full size: Permission to view their images at their full size. Using this permission without the "View" permission is allowed but nearly pointless because the user could not navigate to the pictures.
• Edit: Allows the user to edit the photos/album: the photo title, description, filename, internet address, and tags.
Users & Groups

In Gallery 3, there's always an "admin" user. Docodon's admin user was named "admin". If this user is deleted, Gallery will automatically promote another user to admin status.

Only the admin can manage the gallery, including adding/deleting users and groups, installing/activating/deactivating the modules, and editing the appearance of the site. By default, there are two groups: "everyone" and "registered users" which mean "anyone who visits the website with or without an account" and "anyone with an account". If a user is in two groups with different permssions (e.g. "everyone" and "registered users"), the user gets the "best of both worlds". For example:

USER is in GROUP_A and GROUP_B. GROUP_A can view PHOTO_1 but not PHOTO_2. GROUP_B can view PHOTO_2 but not PHOTO_1. USER would be able to view both PHOTO_1 and PHOTO_2.

WebDAV

WebDAV allows you to interact with Gallery 3 like a folder on your computer (except command line WebDAV clients like DaviX or Cadaver). This makes it easier when uploading many images at once.

When using these clients in WebDAV mode (HTTP, not HTTPS), connect to the Gallery via this link: http://docodon.triumf.ca/gallery3/index.php/webdav/gallery/ and use your Gallery 3 account. When using Transmit, you have to split this link up into:

Server: "docodon.triumf.ca"
Initial Path: "/gallery3/index.php/webdav/gallery/"


By default, the clients will take you to the main Gallery album folder.

According to the creator of the Gallery 3 WebDAV module, the module is known to work with the following WebDAV clients: Cyberduck, Transmit, and Cadaver. There have been issues with "Finder" (macOS) and "Windows Explorer" (Windows).

When it comes to Docodon's WebDAV module, things are little different. Below is a list of what clients work and what don't (and what sort-of do).

Functional WebDAV Clients
• Transmit
• DaviX (annoying to use)
• Finder
• CyberDuck
• DAV Explorer
Untested
• Windows Explorer

Sometimes, all WebDAV clients fail to list the directories. If this happens, use Gallery's admin account to activate and deactivate the WebDAV module at: http://docodon.triumf.ca/gallery3/index.php/admin/modules

PHP 5.4.16

To allow Gallery 3 to run, I enabled "short_open_tag" in PHP 5 and downloaded/enabled the "Multibyte String" extension. All other PHP settings are at their default values.

MySQL 5.7.18

Gallery uses the MySQL database "gallery3". Gallery 3 has run a lot of MySQL commands on that database and the details of what it's done are unknown.

Important Details

8pi HV & HV Monitor

To move the HV monitors from PHP4 to PHP5, a wrapper (domxml-php4-to-php5.php) was imported. This allowed the use of the PHP 4 DOM XML parser library.

The PHP files didn't seem to have access to the "/tmp" folder so the XML files (i.e. "tighv01.xml", "8piauxhv.xml", etc.) were moved directly into "~gg/public_html/(8pi or hv)".

Crystal Database

"Pear", a package manager, was installed to install "MDB2" on Docodon which was used in the Crystal Database PHP files. The MySQL driver for MDB2 was also installed. No other changes were made.

MySQL Database Imports

All MySQL databases from Jaguar have been imported into Docodon. For some reason, Docodon's MySQL server didn't want to create a database named "group" so that database has been renamed "docodon_group". The "~gg/public_html/group/", "~gg/public_html/group_v1", etc. folders are affected by this name change.

Several PHP files throughout Docodon access the MySQL server. If (and when) the MySQL login details are changed, the following files will have to be edited (this list may be expandable):

• ~gg/public_html/group_v4/db_connect.php

In the "group" folders, I preserved the past login details in the comments. Each line's comments describe its past iterations:

$db_username = 'username_newest'; //username_old, username_older, etc.$db_password = 'password_newest'; //password_old, password_older, etc.


Gamma Dose Calculator

When adding another set of "Egam" and "Branch", simply click "Add Input" and fill in the new input fields. The "Total Dose" value should automatically recalculate as you input the values but, if it doesn't, click "Recalculate" to force the value to refresh.

Neutron Dose Calculators

There are two neutron dose calculators. One allows for neutron sources of varying distances and assumes a neutron emission rate of 1 Bq. The other accepts a single distance and strength (in Bq) for all the neutron sources. It also accepts a "Branch" (in %) for each neutron source.

The page that accepts a value for the strength of the neutron source can be found at: http://docodon.triumf.ca/~guys/neutrondose.html The page that allows for varying distances of neutron sources can be found at: http://docodon.triumf.ca/~guys/neutrondose2.html

In both calculators, to add another source, click "Add Input" and fill in the appearing input fields. The "Total Dose" value should automatically recalculate as you type in the values but, if it doesn't, click "Recalculate" to force the value to refresh.

Liquid Nitrogen Fill Times

The Liquid Nitrogen refillers log the duration of each of their runs. This is collected and graphed at: http://docodon.triumf.ca/~guys/LN2FillTimes/

The older version of this graphing system can be found at http://docodon.triumf.ca/~guys/LN2FillTimes/ln2filltimes_old.html. There's no guarantee that this page will work.

Using the Graph

The LN2FillTimes page will generate a .png of the fill times. The x-axis represents the date and time when the liquid nitrogen was refilled and the y-axis represents how long the process took.

By default, the page will show data up to 10 days in the past. To make it show X days in the past, type the number into the text box at the top of the page. Once you click away from the text box, the graph will update.

To switch refill system is being shown (i.e. Griffin, Tigress, and Lab), simply click on the drop-down menu at the top of the page. By default, the graph is for the Griffin system.

Finally, to decide which liquid nitrogen refiller you want to view, click on the button that contains the filler's name or use the "Show All"/"Hide All" button to toggle ALL the fillers. You can graph multiple refillers at once.

Energy Calibration Scripts

The energy calibration scripts are really two pieces of code: 'linear_energy.C' and 'quad_energy.C', for the initial linear calibration and finer quadratic calibration respectively.

Thankfully, there's a nice script that runs both of them for you: "energy.sh". The code needs more input from you so make sure you stick around for the beginning of both calibrations. Usually, the linear calibration finishes fairly quickly. After the calibration process finishes (for both linear and quadratic), the histograms are saved to a file for viewing ('lin_cal.root' or 'quad_cal.root'). It's recommended you check these to make sure something didn't go horribly wrong.

Linear Calibration

The linear energy code can run with Europium-152, Barium-133, Cobalt-56, and Cobalt-60 at the moment. It's strongly recommended to use Co-60 because that element's gamma ray spectrum only contains two peaks, making it less likely that the code will confuse the ordering of the peaks. In the future, if more elements are added, other elements with very separated peaks could also be used to the same effectiveness.

The code asks for the first two letters and the mass number of the source (e.g. eu152, co60). It also asks for the file path to the analysis???.root file that contains the data. For simplicity's sake, use an absolute path.

The calibration process works like so:

1. Using the TSpectrum class, it locates the centroids of the peaks in the histogram
2. To get a more accurate location of the peaks, it then fits them with the below equation (Gaussian distribution with the Gauss error function and a background noise constant):
• $Ae^{\frac{(x-B)^2}{2*C^2}}*(1+erf(D*\frac{(x-B)}{\sqrt{2}C}))+E*\frac{1}{2}*(1-erf(\frac{x-B}{\sqrt{2}C)}))+F$
3. Using the TGraph class, it maps the centroids of the peaks (in channels) to their corresponding energies and fits a linear equation to the data points.
4. It does the above for each core of the TIGRESS detector.
5. It saves the details of the fitted linear equations to a text file: "lin_energy_coeff.txt"

The linear energy code can run with Europium-152, Barium-133, Cobalt-56, and Cobalt-60 at the moment. The quadratic calibration energy code depends on the linear calibration code. You HAVE to run the linear energy calibration code first.

First, specify if you want the program to fit a quadratic or linear equation on the peaks. Then, you can choose to run multiple sources at once with the quadratic calibration code. Enter the sources in the same format as the Linear Calibration. Hit <Enter> after each source. When you don't want to input any more sources, type 'END' or 'end' and press <Enter>. It will then ask you for the file paths for each of the source data, not necessarily in the same order that you named the sources in the first step.

The quadratic calibration process works like so:

1. Using the linear calibration data, it estimates where the peaks are in the source's gamma spectrum.
2. For each of the estimates, it fits an equation (the one displayed in "Linear Calibration") on a certain range around the estimates.
3. Using those fits, it calculates the centroids of the actual gamma ray peaks.
4. It does the above for each source.
5. It then maps all the centroids (from all the sources) against their respective energies and fits a quadratic equation. Usually, the quadratic coefficient is very small.
6. It does the above for each core of the TIGRESS detector.
7. It then writes the quadratic coefficients to a text file: "quad_energy_coeff.txt"

Double Checking the Data

In the same folder as 'lin_cal.root' or 'quad_cal.root' (whichever you want to view), run:

grsisort -l lin_cal.root


When the GRSISort environment opens, run:

TBrowser s


A file explorer should pop up and, under "ROOT Files", click on "lin_cal.root" or "quad_cal.root". Then browse through the histograms and graphs:

• Histograms: These show the gamma spectra from the TIGRESS detectors. Make sure that the red curved peaks match up with the histogram's blue peaks. Most importantly, make sure the peaks are at the same x-coordinates.
• Equation Graphs: These show the fitted equation used to convert charge to gamma energy. Make sure the points match up with the red line and the red line has a positive slope. For the linear calibration process, if the red line has a negative slope, the peaks weren't matched to the correct energies. For the quadratic calibration process, if the red line has a negative slope, something has gone horribly, horribly wrong. Also, the red line should be fairly linear. The quadratic graphs are technically parabolic but only to an imperceptible degree.
• Residuals Graphs: These graphs show how well the equation (from above) was fitted to the points. Each point represents the difference between the fitted equation and the actual data point. The line should bounce between positive and negative and usually have a magnitude of less than "1". If one of its points are well above 1 (or well below -1), check that graph's corresponding histogram has had its peaks properly fitted.

In the histograms, make sure that the red curved peaks match up with the histogram's blue peaks. Most importantly, make sure the peaks are at the same x-coordinates. In the graphs, just make sure the points are on the red line and the red line has a positive slope. For the linear calibration process, if the red line has a negative slope, the peaks weren't matched to the correct energies. For the quadratic calibration process, if the red line has a negative slope, something has gone horribly, horribly wrong. Also, the red line should be fairly linear. The quadratic graphs are technically parabolic but only to an imperceptible degree.

Fixing the Calibration Data

Note: This process only applies for the quadratic calibration.

When double-checking the histograms, you can fix particularly bad peak fits with "calib_fix.C". Run "calib_fix.C" with the following command:

grsisort -l calib_fix.C


It will then ask you if you want to overwrite "quad_cal.root". Answering "Yes" will overwrite the equation fit graphs and the residuals in "quad_cal.root" but preserve the gamma spectra. The new equation fit graphs & residuals would be put in place of the old ones. Answering "no" will have the program write the new equation fit graphs and residuals to "quad_fit.root".

It will then ask you if you want to fit the data with a quadratic equation or a linear equation. You can decide either way, as this is not affected by your choice from the initial quadratic calibration.

It will then ask you for how many gamma peaks the calibration process is using (which is dependent on which and how many radioactive sources you're using). Below is a list of how many peaks for each source. If you're using multiple sources, simply add the numbers up.

• Europium 152: 7
• Barium 133: 4
• Cobalt 56: 4
• Cobalt 60: 2

Then type in the Graph Number with the bad peak fit (and hit <Enter>), the approximate location of the bad peak fit (and hit <Enter>), and the location of where the peak actually is (and hit <Enter>). The program will then search for the peak you're trying to fix and confirm the change with you (make sure the program found the correct peak!). You'll then be asked for the next peak fix. When you're finished fixing peaks, type "-1" (negative one) as the Graph Number. The program will rewrite the coefficients in "quad_energy_coeff.txt" and, depending in your choice, will either overwrite the equation/residuals graphs from "quad_cal.root" or write the graphs to "quad_fit.root".

If you want to delete a gamma peak from a graph, enter the graph number (and hit <Enter>), the approximate location of the bad peak fit (and hit <Enter>), and "-1" for the "New Centroid Location". This will delete it from the equation fitting. However, the point will still be displayed in histograms and the "residual" graphs.

Efficiency Curves

Efficiency curve generation expects you've already generated a calibration file. If you haven't, you should go do that first. Efficiency curve generation has more steps than energy calibration. Make sure you follow each one carefully.

If you think you'll have to generate multiple histogram files, then you should make use of the DEFAULT option in "histogram_make.c". Instead of inputting the calibration file over and over again, you can type DEFAULT and it will use a hard-coded default file. First, however, you need to open up "histogram_make.c" in a text editor and set the DEFAULT file path to your calibration file path. The variable for the DEFAULT file path is in the first line and you just need to replace the already existing file path with your own calibration file.

It's worth noting that the gamma peak fitter isn't perfect. It fits a Gaussian equation (the one mentioned in Energy Calibration) around a peak and, using that peak's parameters, it creates a background noise function. That background function is what's actually important; the height of the peak doesn't directly affect anything. For peaks that are too thin, it usually helps to increase the initial value of the "sigma" variable.

If you want the parameters from the efficiency curves, run the below process and then open “EffFitParams[Addback or TigCrys].txt”. It's in CSV format so you can open it with a spreadsheet editor. The first value in each line (i.e. column A in a spreadsheet) represents the graph number the curve corresponds to. The rest of the values are the parameters for curve equation. There are four groups: Radware-Rel, Radware-Abs, Simple-Rel, Simple-Abs. “Radware” means that the values are parameters for the “Radware” equation. “Simple” means they're for the Simple (4-parameter) equation. “Rel” is for a relative efficiency curve. “Abs” is for an absolute efficiency curve.

To process data from a certain branch, you must have run that branch with the previous program. For example, you need to create "Addback" histograms in histogram_make.c to run gamma peak fitting on them!

1. Run "grsisort -l histogram_make.c"
2. Specify if you'd like to use the Addback or Tigress Crystals branch (or both).
3. Enter the file path to your analysis tree.
4. Enter the file path to your calibration file (or type "DEFAULT" to use the default option).
5. Enter the run number of your data file. This will be used to name the output histogram file.
6. Run "grsisort -l gammapeakfitter.c"
7. Specify if you'd like to use the Addback or Tigress Crystals branch (or both).
9. Enter the run number of your data file (the same one you entered for "histogram_make.c").
10. Do the above for all of the radioactive sources you're using.
11. Run "grsisort -l efficiency.c"
12. Specify if you'd like to use the Addback or Tigress Crystals branch (or both).
13. Name the output file it will generate.
14. Enter the last four digits of the IDs of all the radioactive sources you're using (hit <Enter> after each one). When you have no more sources to input, type "END" and hit <Enter>.
15. For each of your sources:
1. Enter the timestamp (YYYY MM DD hh mm) of your calibration run file. This should be the median timestamp (halfway through the run).
2. Enter the run number and the length of time your run took (in seconds).
16. Done! Remember to browse through the output file and make sure the efficiencies make sense.

There are two functions used to fit the efficiency curves. One has eight parameters (the Radware function) and one has four.

$H*e^{((A+B*log(\frac{x}{100}) + C*log(\frac{x}{100})*log(\frac{x}{100}))^{-G} + (D + E*log(\frac{x}{1000})+F*log(\frac{x}{100})*log(\frac{x}{100}))^{-G})^{-\frac{1}{G}}}$
$D*10^{A*log_{10}(x)+B*log_{10}(x)*log_{10}(x)+\frac{C}{x^2}}$