-- IsaPedraza - 07 Nov 2013

GIF Software

Task ContactPeople
Virtual Box and C++ Data Acquisition Riccardi Cristina, Paola Salvini and Jan Eysermans
Bash and Web Interface Jan Eysermans and Isabel Pedraza
Data Analysis and Monitoring Isabel Pedraza and Alessandro Braghieri
Weather Station Interface Alessandro Braghieri, Riccardi Cristina and Paola Salvini

Virtual Box and C++ Data Acquisition

Directory Structure

Directory Explanation
/home/user/www/htdocs/ root folder for the web interface, all the html, php and javascript files are stored
/home/user/www/cgi-bin/ bash scripts directory (hvscan.sh, meteo.sh, other bash scripts)
/home/user/meteo/ the meteo data files are stored here, one file for each meteo station (see last section for more info).
/home/user/CAEN1527/ the CAEN libraries
/home/user/CAEN1527/CAEN1527_monitoring/ the executable c-files which communicates with the CAEN mainframe
/home/user/GIF_DataAnalysis/ plot scripts of Isabel (see section "Data Analysis and Monitoring" for more info)
/home/user/data/hvscan/X/ the hvscan datafiles for mainframe X (X = mainframe name)
/home/user/data/stabilitytest/X/ the stabilitytest datafiles for mainframe X (X = mainframe name)
/home/user/data/tmp/X/ directory for saving temporary hvscan files (X = mainframe ID)
/home/user/Dropbox/ the dropbox folder

CAEN Libraries and executables

The source code of the c-files is located in /home/user/CAEN1527/CAEN1527_monitoring/. Each mainframe is stored in the database and has an identification number, called "mid" (mainframe id). Every c-file makes connection to the mysql database (therefore, the parameter mid is always needed), and load the mainframe information (address, login information ...).

Executable and parameters Explanation
/HVmon mid returns for each installed detector the following values: detectorid, vset, vmon , iset, imon ,status, pw, process
/HVscan mid writes a tmp file in "/home/user/data/tmp//home/user/data/tmp/X/", with the following values: detector, vset, imon, temp, pressure, rh
/hvscanstop mid stop the current hvscan, powers off the detectors, set a low voltage and delete the tmp files
/SetI0 not used, old code
/SetI0_single mid slot channel value set a new I0-set value for a single detector
/SetPower mid pw reads the HVscan config file "/home/user/data/tmp//hvscan_conf" and power on/off (pw 1 or 0) for all detectors subjected to the HVscan
/SetPower_single mid slot channel pw sets the power for a single detector
/SetTrip not used, old code
/SetTrip_single mid slot channel value set a new trip-set time value for a single detector
/SetV0 mid value reads the HVscan config file "/home/user/data/tmp//hvscan_conf", and set a high voltage on the detectors subjected to the HVscan
/SetV0_single mid slot channel value set a new high voltate for a single detector
/StabilityTest reads the detector values (name, dateformat, detectorname, slot, channel, vapp, i_avg, status, pressure, temp, rh) for every mainframe, and every detector subjected to the stabilitytest

To compile the c-files (root required):

cd /home/user/CAEN1527/
make install

Bash and Web Interface

The used programming languages are: html/php/javascript for the web interface, bash for the scripts and ansi-c for the communication with the CAEN mainframes.

In general, the GIF software consists of 2 layers: the web interface and the executables, which provides the connection with the mainframe. Both layers are connected by a mysql database. All the mainframe information and detector information is stored in the database with the web interface, and is read out by the executables. The only exception to this is the HVscan, see the section below.

The GIF software allows to use multiple CAEN mainframes. These mainframes can be managed in the "Configure Mainframes" page. For each mainframe, detectors can be added in the "Manage detectors" page.


The installed detectors are listed here. Every 2 s, an ajax event is executed which updates the set-values and monitored-values. This ajax event calls the executable "HVmon", and returns all the information of the detectors.

The power on/off buttons calls the "SetPower" executable.

The HV, tripSet and i0Set calls respectively the executables "SetV0_single", "SetTrip_single" and "SetI0_single".


On the HVscan page, the HVscan can be configured and started. 4 profiles are available (Source ON/OFF, Argon/Normal gas), with each its specific HV ranges and measure timings. The default parameters for a profile can be modified by clicking on "Set as default values". When the HVscan is started, a log file is created to monitor the HVscan progress.


- It is possible to perform only ONE HVscan in time.

- When selecting ARGON-GAS-MIXTURE_SOURCE-ON, the plot script of Isabel runs automatically after the HVscan is done.

- When the HVscan is finished, all the detectors are powered off and a low voltage is set.

If a HVscan is started, a configuration file "/home/user/data/tmp//hvscan_conf" is created. It contains the HVscan parameters (HV ranges and timings), and all the detectors which are selected. Then, the "/home/user/www/cgi-bin/hvscan.sh" script is executed. This bash script contains instructions to set the HV, read the HV and make the average measurement. After the HVscan is finished, the data and log file are moved to the data directory, and tmp files are removed.


There is a graphical web interface to on line monitor Current and Voltage of the chambers as a function of the time for the Stability tests. It can be accessed at http://cms904.cern.ch/onlmon.php

  • Select one of the available chambers and click the "PLOT" button.The vertical axis range is automatically set but the user can later adjust it by filling the form below the plot with proper values.
  • The "Multi-PLOT" button allows to select and superimpose on the same plot data of 2 different chambers.
The user can zoom the plot dragging the mouse in a desired time interval. To unzoom click the "Show all" label in the upper right corner of the plot.
If you place the mouse pointer on the plot, colored labels appear showing the numeric values in that point.

The plot image can be exported as a file using the green icon.

(March 2014, a.b. - April 2014 update)

Data Analysis and Monitoring


The software for data Acquisition can be downloaded as:

You need ROOT to use it.

svn co svn+ssh://cernusername@svn.cern.ch/reps/isapedraza/GIF_DataAnalysis
cd GIF_DataAnalysis 
make GIF_resistance
make Plot_HVvsCurrent_StbilityGIF

To RUN Stability

To run the stability test, go to scripts and run


It will run over the whole data set. The results will be saved on: /home/user/Dropbox/GIF/STABILITY

To RUN Resistivity

GIF_resistance filename.csv

The results will be saved on: /home/user/Dropbox/GIF/HVScan/GIF/filename (or in the 904 folder in case the name of the frame changes to CAEN904 )

Automatic monitors

To run the HV frame monitor (set up to send an e-mail to Jan, Nicolas and Isabel) in case the HV goes off or the chambers are of run:

cd GIF_DataAnalysis/scripts 

To run the monitoring plots for the currents every 6 hours run

cd GIF_DataAnalysis/scripts 

Weather Station Interface

The weather station at GIF is an Oregon Scientific WMR200 with 2 wireless sensors to measure temperature and relative humidity. One sensor is placed inside the gif tent and the other near the glass RPC. The weather station (base) has its own sensors to measure pressure, temperature and relative humidity.

name type location data
sensor 0 base station GIF T, RH, P
sensor 1 wireless g-RPC T, RH
sensor 2 wireless RPC (GIF tent) T, RH

The station is connected to a PC running Windows 7 (PCDT1GS31). The free software Weather Station Data Logger (by sourceforge) has been installed to log environmental data. The software writes data into the local folder: C:\Documents and Settings\LocalAccount\Desktop\MeteoGIF that has been shared over the network.

On the Virtual Box in 904 (cms904.cern.ch) the shared folder containing data is mounted as /mnt/meteogif filesystem. The command has been included in the /etc/fstab file, so the filesystem is automatically mounted on reboot.

In a similar way the data folder of the 904 weather station is mounted on the Virtual Box as /mnt/logfiles filesystem.

Raw environmental data (logging frequency 1 minute, field description in the file header)

  • GIF: A single file, WxLog.csv, contains data of all the configured sensors.
  • 904: Lots of files are produced! Data are written, among others, in monthly separated files whose names are mYYYYlg.txt, where m is the month number (1 or 2 digits) and YYYY is the year (4 digits).
Reformatted enviromental data (data at hourly intervals, field description in the file header).
  • GIF: /home/user/www/htdocs/online/meteoGIF.dat
    T, RH and P are average values in 1 hour interval
  • 904: /home/user/www/htdocs/online/meteoCAEN904-2.dat
    T, RH and P taken from the row data at each hour.
Data files can be downloaded from the web interface: http://cms904.cern.ch/online

Scripts on the Virtual Box (in the folder /home/user/www/cgi-bin).

  • meteo_copy.csh: reads the raw data of both weather stations and reformats them. The script is executed every hour at minute 08 by the cron daemon.
  • meteo_last10m.csh: provides data for HV corrections of the chambers installed at GIF. It calculates the average environmental parameters by taking row data of the last 10 minutes. It is executed every 10 minutes by the cron daemon, starting at minute 05, so just before each stability test that needs up to date enviromental data.
  • readmeteo.csh: it is executed by the stability test program. This script takes the most recent environmental data of both weather stations and writes them in two single line files to be used for HV corrections. For 904 the last measurement in the raw data is used, while for GIF the average of the last 10 minutes is calculated.
    The files for HV corrections are stored in the /home/user/meteo folder and their names are thpgif.txt and thp904.txt. Line format: "T RH P F" where F=0 means up-to-date values, F=1 otherwise.
  • meteo_alert.csh: it checks that meteo data are regularly logged and are available on the virtual box. In case of problems an email alert is sent.
Scheduler file for the cron daemon: meteo.crontab

# To activate modifications to this file, use the command
# "crontab meteo.crontab" as root
# reformat row data every hour at minute 08
08 * * * * /home/user/www/cgi-bin/meteo_copy.csh
# generate data for HV correction every 10 minute at minute 05
5-59/10 * * * * /home/user/www/cgi-bin/meteo_last10m.csh > /mnt/meteogif/last_10m.csv
# check data logging every half of an hour
*/30 * * * * /home/user/www/cgi-bin/meteo_alert.csh

Plots: Temperature, humidity and pressure vs time available for both the 904 and the GIF meteo stations. The user can zoom the plot dragging the mouse in a desired time interval. To unzoom click the "Show all" label in the upper right corner of the plot.
If you place the mouse pointer on the plot, colored labels appear showing the numeric value in that point.

- From the GIF main page http://cms904.cern.ch/ click the "Meteo" label

- Stand alone interface at http://cms904.cern.ch/onlmon.php

(March 2014, a.b.- April 2014 update)

External access GIF software

To access the web interface outside CERN, open a terminal on your local computer and run:

ssh -l CERNusername -L 2080:cms904.cern.ch:80 lxplus.cern.ch

The web interface is then accessible in the brower by http://localhost:2080

File transfer to the virtualbox can be done through the sftp protocol. On your local computer, run

ssh -l CERNusername -2 -N -L 2000:cms904.cern.ch:22 lxplus.cern.ch

You can now login with a sftp-client to the virtualbox (hostname: http://localhost:2000, username: user)

A third option is teamviewer, with the ID 929 014 825.

Edit | Attach | Watch | Print version | History: r26 < r25 < r24 < r23 < r22 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r26 - 2015-05-29 - IsaPedraza
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback