UCN: Difference between revisions
| (16 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
The Ultracold Neutron group, now the TRIUMF Ultracold Advanced Neutron (TUCAN) collaboration was created to measure the [https://en.wikipedia.org/wiki/Neutron_electric_dipole_moment neutron electric dipole moment (nEDM)]. This fundamental property, if non-zero, has serious ramifications for resolving the [https://en.wikipedia.org/wiki/Baryogenesis Baryogenesis problem]. | The Ultracold Neutron group, now the TRIUMF Ultracold Advanced Neutron (TUCAN) collaboration was created to measure the [https://en.wikipedia.org/wiki/Neutron_electric_dipole_moment neutron electric dipole moment (nEDM)]. This fundamental property, if non-zero, has serious ramifications for resolving the [https://en.wikipedia.org/wiki/Baryogenesis Baryogenesis problem]. | ||
= Overview = | |||
The project has two main components: (a) the UCN source and (b) the nEDM experiment. | The project has two main components: (a) the UCN source and (b) the nEDM experiment. | ||
| Line 16: | Line 16: | ||
The subsystems with DAQ interfaces are as follows: | The subsystems with DAQ interfaces are as follows: | ||
== UCN Source == | |||
Produces UCN | |||
Controlled through EPICS, monitored with MIDAS. Some MIDAS controls are implemented, such as the AutoStat page and the UCN sequencer. | |||
== Comagnetometer == | |||
An atomic gas (<sup>199</sup>Hg) inhabits the cell the UCNs are stored in. The gas is polarized with a free laser, and that polarization state is also measured with a laser. Measures magnetic field. | |||
DAQ not yet implemented | |||
== Cs Magnetometers == | |||
An array of glass cells containing Cs gas are distributed inside the magnetically shielded room. The polarization state is also pumped and probed with lasers, this time through fibre optics. Measures magnetic field gradients. | |||
DAQ exists as a set of student python scripts, yet to be integrated into MIDAS | |||
== B0 Coil == | |||
A coil which produces a highly stable and uniform static magnetic field | |||
== Useful Links | DAQ not yet implemented | ||
== B1 Coil == | |||
A coil which produces the oscillating RF fields for spin flips | |||
DAQ not yet implemented | |||
== Shim Coils == | |||
An array of coils inside the MSR to homogenize the field | |||
DAQ exists as a python script which controls an arduino, yet to be integrated into MIDAS | |||
The main repository is [https://github.com/ucn-triumf/ShimCoil_CurrentControl here], with the [https://github.com/ucn-triumf/ShimCoil_SerialArduino arduino code here]. | |||
== Guiding coils == | |||
An array of coils to maintain UCN polarization in their journey to and from the magnetically shielded room | |||
DAQ not yet implemented | |||
== Ambient Magnetic Coil (AMC) == | |||
A large Helmholtz coil to counteract the cyclotron magnetic field | |||
DAQ not yet implemented | |||
== High voltage == | |||
A large electric field to tease out the electric dipole moment | |||
DAQ not yet implemented | |||
== Ambient monitoring == | |||
Monitoring of ambient temperature and magnetic field | |||
=== Temperature === | |||
Measured through "canaries": battery-powered arduinos with a temperature sensor on the TRIUMF IOT network. | |||
Integrated into MIDAS. [https://github.com/ucn-triumf/fe_canary_env_temp Frontend repo] | |||
=== Magnetic Fields === | |||
Measured through fluxgates and a custom DAQ produced by the TRIUMF electronics group. | |||
[https://github.com/ucn-triumf/fefluxgate Frontend repo] | |||
= Machines = | |||
The below list is incomplete, needs expanding | |||
{| class="wikitable" | |||
|+ DAQ Computers in use by the UCN group (last updated Jul 23, 2026) | |||
|- | |||
! Hostname (.triumf.ca) | |||
! Purpose | |||
! Location | |||
! OS | |||
! Status | |||
|- | |||
| daq01.ucn | |||
| Legacy primary DAQ machine and MIDAS host | |||
| UCN counting room | |||
| CentOS7 | |||
| Active | |||
|- | |||
| daq02.ucn | |||
| Runs digitizer frontend | |||
| Meson hall B2 | |||
| CentOS7 | |||
| Active | |||
|- | |||
| daq04.ucn | |||
| Multi-monitor EPICS control station | |||
| UCN counting room | |||
| Ubuntu 24 | |||
| Active | |||
|- | |||
| daq06.ucn | |||
| Test environment | |||
| Virtual machine | |||
| Ubuntu 24 | |||
| Active | |||
|- | |||
| daq07.ucn | |||
| Laser enclosure frontend | |||
| Laser enclosure, Meson hall B2 | |||
| Ubuntu 24 | |||
| Active | |||
|- | |||
| tucan01.ucn | |||
| New primary DAQ machine and MIDAS host | |||
| UCN counting room | |||
| Ubuntu 24 | |||
| In setup | |||
|- | |||
| ktm-readout.ucn | |||
| Kicker timing monitor frontend and web host | |||
| Cyclotron roof | |||
| Ubuntu 24 | |||
| Active, untested | |||
|- | |||
| ktmserver | |||
| Legacy KTM web host | |||
| Virtual machine | |||
| CentOS7 | |||
| Active | |||
|} | |||
= DAQ Software and Setup = | |||
== Directory Organization == | |||
Here we describe the organization and setup of the DAQ computer. While there are many other directories not listed here, they are outside of the core functionality of the main DAQ. | |||
* <code>/home/ucn/</code> (shared home) | |||
** <code>online/</code> (daq01 midas main directory) | |||
*** [https://github.com/ucn-triumf/autostat <code>autostat</code>] (python script to automate cryostate functions) | |||
*** [https://github.com/ucn-triumf/epics2midas <code>epics2midas</code>] (read EPICS variables to midas ODB) | |||
*** [https://github.com/ucn-triumf/fe_canary_env_temp <code>fe_canary_env_temp</code>] (canary temperature monitor) | |||
*** [https://github.com/ucn-triumf/fefluxgate <code>fefluxgate</code>] (read custom orange DAQ box for fluxgates) | |||
*** [https://github.com/ucn-triumf/ktm_frontend <code>ktm</code>] (Legacy KTM frontend) | |||
*** <code>odb_dumps</code> (Main repository of regular ODB dumps) | |||
*** [https://github.com/ucn-triumf/scmfe <code>scmfe</code>] (SCM frontend) | |||
*** [https://github.com/ucn-triumf/sequence-control <code>sequence-control</code>] (UCN sequencer frontend) | |||
*** [https://github.com/ucn-triumf/shiftschedule <code>shift_schedule</code>] (Scheduler frontend) | |||
*** [https://github.com/ucn-triumf/ucn-alarms-notification <code>ucn-alarms-notification</code>] (Alarm actions: phone/email users) | |||
*** [https://github.com/ucn-triumf/ucn_detector_analyzer <code>ucn_detector_analyzer</code>] (Main UCN counting: processing/online analysis - produce root files) | |||
*** [https://github.com/ucn-triumf/ucn-v1725 <code>ucn-v1725</code>] (CAEN digitizer frontend, runs on daq02.ucn) | |||
*** [https://github.com/ucn-triumf/ucn-web-control <code>ucn-web-control</code>] (Custom pages) | |||
** <code>packages/</code> (source and build directories: MIDAS, EPICS, CAEN, ROOTANA, etc) | |||
* <code>/data3/</code> (large storage drive) | |||
** <code>ucn/midas_files</code> (.mid.gz files and similar) | |||
** <code>ucn/root_files</code> (.root, for analysis, after preprocessing) | |||
== Setup Instructions == | |||
Here's the general path to setting up the main DAQ machine (steps taken on tucan01.ucn): | |||
=== Install ubuntu 24 === | |||
As per the instructions [https://daq00.triumf.ca/DaqWiki/index.php/Ubuntu here] | |||
=== Install MySQL === | |||
==== Create partition on drive for MySQL histories ==== | |||
In ZFS you don't really create fixed-size "partitions" the way you would with fdisk/gparted. Instead a pool (created from disks) is carved into datasets (filesystems) or volumes/zvols (block devices). Space is shared from the pool by default, and you constrain size with quota/reservation (for datasets) or a fixed volume size (for zvols). | |||
See existing pools | |||
<pre> | |||
ucn@tucan01:~$ zpool list | |||
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT | |||
bpool 1.88G 210M 1.67G - - 7% 10% 1.00x ONLINE - | |||
rpool 936G 6.09G 930G - - 0% 0% 1.00x ONLINE - | |||
</pre> | |||
Clearly rpool is the main filesystem. We want to allocate about 700 GB from this for the mysql database: | |||
<pre> | |||
sudo zfs create rpool/sqlstorage # create | |||
sudo zfs set reservation=700G rpool/sqlstorage # guarantee the size that other datasets can't eat into | |||
zfs list # check success | |||
</pre> | |||
==== Install MySQL ==== | |||
We will install mysql and set the data base location to /sqlstorage (following [https://www.digitalocean.com/community/tutorials/how-to-move-a-mysql-data-directory-to-a-new-location-on-ubuntu-16-04 this tutorial]). Note that the mysql error log defaults to <code>/var/log/mysql/error.log</code> in the case of issues. | |||
<pre> | |||
sudo apt install mysql-server | |||
sudo systemctl status mysql-server # should show enabled and active | |||
</pre> | |||
Now we find the default database directory, should likely be <code>/var/lib/mysql</code>. If not make the substitute in the commands that follow. | |||
<pre> | |||
sudo mysql -u root | |||
SELECT @@datadir; | |||
exit; | |||
</pre> | |||
With this confirmed, we change the data directory: | |||
<pre> | |||
sudo systemctl stop mysql | |||
sudo systemctl status mysql # confirmed inactive | |||
sudo rsync -av /var/lib/mysql /sqlstorage # copy database to new location | |||
sudo mv /var/lib/mysql /var/lib/mysql.bak # rename old database in case of errors | |||
</pre> | |||
Now edit the basic settings section of the config file (<code>sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf</code>) to match the following: | |||
<pre> | |||
# | |||
# * Basic Settings | |||
# | |||
user = mysql | |||
# pid-file = /var/run/mysqld/mysqld.pid | |||
# socket = /var/run/mysqld/mysqld.sock | |||
port = 3306 | |||
datadir = /sqlstorage/mysql | |||
</pre> | |||
Even if apparmor is disabled, you still need to change the alias file and re-enable apparmor, otherwise you will get the error <code>Job for mysql.service failed because the control process exited with error code.</code>. To resolve this, edit the apparmor alias file (<code>sudo vim /etc/apparmor.d/tunables/alias</code>) and add the following line to the end: | |||
<pre> | |||
alias /var/lib/mysql/ -> /sqlstorage/mysql/, | |||
</pre> | |||
Apply changes by restarting apparmor, then re-disable: | |||
<pre> | |||
sudo systemctl restart apparmor | |||
sudo systemctl stop apparmor | |||
sudo systemctl disable apparmor | |||
sudo systemctl status apparmor | |||
</pre> | |||
Then restart the server | |||
<pre> | |||
sudo systemctl restart mysql | |||
</pre> | |||
Confirm that it worked by re-checking the data directory inside mysql | |||
<pre> | |||
sudo mysql -u root | |||
SELECT @@datadir; | |||
exit; | |||
</pre> | |||
When finished, delete the original directory | |||
<pre> | |||
sudo rm -rf /var/lib/mysql.bak | |||
</pre> | |||
==== Uninstall MySQL ==== | |||
In the case of serious issue, here are steps to completely purge mysql from your system: | |||
<pre> | |||
sudo systemctl stop mysql | |||
sudo apt purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-* | |||
sudo rm -rf /etc/mysql /var/lib/mysql /var/log/mysql | |||
sudo apt autoremove | |||
sudo apt autoclean | |||
</pre> | |||
==== Setup MySQL Users and Database ==== | |||
By default there should be a root user which can access the database without any password. Use that and the following commands to set up the database: | |||
=== Install MIDAS === | |||
=== Install ROOT === | |||
=== Install ROOTANA === | |||
= Contacts = | |||
Some useful contact persons (TRIUMF PIs): | |||
* R. Picker | |||
* N. Yazdandoost | |||
= Useful Links = | |||
* [https://ucn.triumf.ca UCN Plone] | * [https://ucn.triumf.ca UCN Plone] | ||
* [https://daq01.ucn.triumf.ca/ UCN DAQ (old - daq01)] | * [https://daq01.ucn.triumf.ca/ UCN DAQ (old - daq01)] | ||
* [https://github.com/ucn-triumf Github] | |||
Latest revision as of 19:29, 24 July 2026
The Ultracold Neutron group, now the TRIUMF Ultracold Advanced Neutron (TUCAN) collaboration was created to measure the neutron electric dipole moment (nEDM). This fundamental property, if non-zero, has serious ramifications for resolving the Baryogenesis problem.
Overview
The project has two main components: (a) the UCN source and (b) the nEDM experiment.
The source was largely completed and shown to be functional in 2026. It is operated primarily though EPICS, with monitoring though MIDAS histories with a MySQL database. It operates on beamline 1U (BL1U), splitting off of 1V (which later becomes BL1A). With a fast kicker magnet, the TUCAN collaboration can kick individual beam buckets to BL1U to take a fraction of beam, while enabling beam to BL1A. Design operating current is 40 uA. The UCN source has two end stations for experiments: one for the nEDM experiment, and the other is planned for PENeLOPE.
The nEDM experiment is the primary experiment for the UCN source and is composed of many subsystems, each with their own controls and DAQ setup. Experiments are generally conducted as follows:
- produce UCNs in the source,
- open a valve to let the UCNs diffuse to the experimental chamber
- store the UCNs in the chamber for some time, while applying high voltage, and RF pulses
- open the chamber valve to let the UCNs diffuse to the detectors
The subsystems with DAQ interfaces are as follows:
UCN Source
Produces UCN
Controlled through EPICS, monitored with MIDAS. Some MIDAS controls are implemented, such as the AutoStat page and the UCN sequencer.
Comagnetometer
An atomic gas (199Hg) inhabits the cell the UCNs are stored in. The gas is polarized with a free laser, and that polarization state is also measured with a laser. Measures magnetic field.
DAQ not yet implemented
Cs Magnetometers
An array of glass cells containing Cs gas are distributed inside the magnetically shielded room. The polarization state is also pumped and probed with lasers, this time through fibre optics. Measures magnetic field gradients.
DAQ exists as a set of student python scripts, yet to be integrated into MIDAS
B0 Coil
A coil which produces a highly stable and uniform static magnetic field
DAQ not yet implemented
B1 Coil
A coil which produces the oscillating RF fields for spin flips
DAQ not yet implemented
Shim Coils
An array of coils inside the MSR to homogenize the field
DAQ exists as a python script which controls an arduino, yet to be integrated into MIDAS
The main repository is here, with the arduino code here.
Guiding coils
An array of coils to maintain UCN polarization in their journey to and from the magnetically shielded room
DAQ not yet implemented
Ambient Magnetic Coil (AMC)
A large Helmholtz coil to counteract the cyclotron magnetic field
DAQ not yet implemented
High voltage
A large electric field to tease out the electric dipole moment
DAQ not yet implemented
Ambient monitoring
Monitoring of ambient temperature and magnetic field
Temperature
Measured through "canaries": battery-powered arduinos with a temperature sensor on the TRIUMF IOT network. Integrated into MIDAS. Frontend repo
Magnetic Fields
Measured through fluxgates and a custom DAQ produced by the TRIUMF electronics group. Frontend repo
Machines
The below list is incomplete, needs expanding
| Hostname (.triumf.ca) | Purpose | Location | OS | Status |
|---|---|---|---|---|
| daq01.ucn | Legacy primary DAQ machine and MIDAS host | UCN counting room | CentOS7 | Active |
| daq02.ucn | Runs digitizer frontend | Meson hall B2 | CentOS7 | Active |
| daq04.ucn | Multi-monitor EPICS control station | UCN counting room | Ubuntu 24 | Active |
| daq06.ucn | Test environment | Virtual machine | Ubuntu 24 | Active |
| daq07.ucn | Laser enclosure frontend | Laser enclosure, Meson hall B2 | Ubuntu 24 | Active |
| tucan01.ucn | New primary DAQ machine and MIDAS host | UCN counting room | Ubuntu 24 | In setup |
| ktm-readout.ucn | Kicker timing monitor frontend and web host | Cyclotron roof | Ubuntu 24 | Active, untested |
| ktmserver | Legacy KTM web host | Virtual machine | CentOS7 | Active |
DAQ Software and Setup
Directory Organization
Here we describe the organization and setup of the DAQ computer. While there are many other directories not listed here, they are outside of the core functionality of the main DAQ.
/home/ucn/(shared home)online/(daq01 midas main directory)autostat(python script to automate cryostate functions)epics2midas(read EPICS variables to midas ODB)fe_canary_env_temp(canary temperature monitor)fefluxgate(read custom orange DAQ box for fluxgates)ktm(Legacy KTM frontend)odb_dumps(Main repository of regular ODB dumps)scmfe(SCM frontend)sequence-control(UCN sequencer frontend)shift_schedule(Scheduler frontend)ucn-alarms-notification(Alarm actions: phone/email users)ucn_detector_analyzer(Main UCN counting: processing/online analysis - produce root files)ucn-v1725(CAEN digitizer frontend, runs on daq02.ucn)ucn-web-control(Custom pages)
packages/(source and build directories: MIDAS, EPICS, CAEN, ROOTANA, etc)
/data3/(large storage drive)ucn/midas_files(.mid.gz files and similar)ucn/root_files(.root, for analysis, after preprocessing)
Setup Instructions
Here's the general path to setting up the main DAQ machine (steps taken on tucan01.ucn):
Install ubuntu 24
As per the instructions here
Install MySQL
Create partition on drive for MySQL histories
In ZFS you don't really create fixed-size "partitions" the way you would with fdisk/gparted. Instead a pool (created from disks) is carved into datasets (filesystems) or volumes/zvols (block devices). Space is shared from the pool by default, and you constrain size with quota/reservation (for datasets) or a fixed volume size (for zvols).
See existing pools
ucn@tucan01:~$ zpool list NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT bpool 1.88G 210M 1.67G - - 7% 10% 1.00x ONLINE - rpool 936G 6.09G 930G - - 0% 0% 1.00x ONLINE -
Clearly rpool is the main filesystem. We want to allocate about 700 GB from this for the mysql database:
sudo zfs create rpool/sqlstorage # create sudo zfs set reservation=700G rpool/sqlstorage # guarantee the size that other datasets can't eat into zfs list # check success
Install MySQL
We will install mysql and set the data base location to /sqlstorage (following this tutorial). Note that the mysql error log defaults to /var/log/mysql/error.log in the case of issues.
sudo apt install mysql-server sudo systemctl status mysql-server # should show enabled and active
Now we find the default database directory, should likely be /var/lib/mysql. If not make the substitute in the commands that follow.
sudo mysql -u root SELECT @@datadir; exit;
With this confirmed, we change the data directory:
sudo systemctl stop mysql sudo systemctl status mysql # confirmed inactive sudo rsync -av /var/lib/mysql /sqlstorage # copy database to new location sudo mv /var/lib/mysql /var/lib/mysql.bak # rename old database in case of errors
Now edit the basic settings section of the config file (sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf) to match the following:
# # * Basic Settings # user = mysql # pid-file = /var/run/mysqld/mysqld.pid # socket = /var/run/mysqld/mysqld.sock port = 3306 datadir = /sqlstorage/mysql
Even if apparmor is disabled, you still need to change the alias file and re-enable apparmor, otherwise you will get the error Job for mysql.service failed because the control process exited with error code.. To resolve this, edit the apparmor alias file (sudo vim /etc/apparmor.d/tunables/alias) and add the following line to the end:
alias /var/lib/mysql/ -> /sqlstorage/mysql/,
Apply changes by restarting apparmor, then re-disable:
sudo systemctl restart apparmor sudo systemctl stop apparmor sudo systemctl disable apparmor sudo systemctl status apparmor
Then restart the server
sudo systemctl restart mysql
Confirm that it worked by re-checking the data directory inside mysql
sudo mysql -u root SELECT @@datadir; exit;
When finished, delete the original directory
sudo rm -rf /var/lib/mysql.bak
Uninstall MySQL
In the case of serious issue, here are steps to completely purge mysql from your system:
sudo systemctl stop mysql sudo apt purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-* sudo rm -rf /etc/mysql /var/lib/mysql /var/log/mysql sudo apt autoremove sudo apt autoclean
Setup MySQL Users and Database
By default there should be a root user which can access the database without any password. Use that and the following commands to set up the database:
Install MIDAS
Install ROOT
Install ROOTANA
Contacts
Some useful contact persons (TRIUMF PIs):
- R. Picker
- N. Yazdandoost