Gnuscope

From FSU Fox's Lab Wiki
Jump to navigation Jump to search

introduction

The code is for the analysis of gamma-ray spectroscopy. It can date back to July 2002. The last update of the code was June 28, 2017.

The code use GTK2 for a graphical interface.

To download https://fsunuc.physics.fsu.edu/~caussyn/gnuscope_ddc_gtk2.tar.gz

data structure

The data is a binary format. A event should be like this:

<multi><ID><Energy><ID><Energy>.... <multi>

where <multi> is a multiplicity of the event, <ID> is the ID of the detector, and <Energy> is the energy of that detector.

items data type length max
mulit unsigned char 1 byte 256
ID unsigned char 1 byte 256
Energy unsigned short 2 byte 65535

Simple C++ code

writing =

FILE * outFile = fopen("saveFileName.gnc", "w+");

int numEvent = 1000;
int maxMulti = 100;

char * multi = new char[numEvent];
char ** ID = new * char[numEvent];
unsigned short ** energy = new * char[numEvent];
for( int i = 0; i < numEvent; i++){
  ID[i] = new char[maxMulti];
  energy[i] = new char[maxMulti];
}

// fill data here


// write file
for( int ev = 0; ev < numEvent; ev++){
  fwrite(multi[ev], 1, 1, outFile);  // write multi[ev] to outFile for 1 byte and 1 time.
  for( int i = 0; i < multi; i++){
    fwrite(id[ev][i], 1, 1, outFile); 
    fwrite(energy[ev][i], 2, 1, outFile); // write energy[ev][i] to outFile for 2 byte and 1 time.
  }
  fwrite(multi[ev], 1, 1, outFile); 
}
fclose(outFile);

Reading

Using docker

Compiling the code usually results in failure in Debian 10 or Ubuntu 20.04. To bypass this, we can use docker to run the code in Ubuntu 14.04.

For detail on setup the docker image, please check https://fsunuc.physics.fsu.edu/elog/dataServer/3.

One of the inconveniences is that the program can only run locally, not remotely.