2008-PHYS-339 Statistics / Geiger

From McGill University Physics Department Technical Services Wiki

Files

  • Geiger handout (http://www.ugrad.physics.mcgill.ca/resources/339/2008/geiger/geiger.pdf) - PDF version of the lab handout
  • sample.data (http://www.ugrad.physics.mcgill.ca/resources/339/2008/geiger/sample.data) - The self-consistent sample data which is characterized in the appendix of the handout
  • geiger.tar.bz2 (http://www.ugrad.physics.mcgill.ca/resources/339/2008/geiger/geiger.tar.bz2) - Data collection package, see below for instructions
  • old-sample.data (http://www.ugrad.physics.mcgill.ca/resources/339/2008/geiger/old-sample.data) - The imfamous sample data as collected by defective acquisition software - can you figure out what went wrong?

Guide to compiling and running the provided software

Rather than left-clicking on the links above, you can right click and select the menu entry Copy Link Location, then use the middle mouse button to paste the location as an argument to Wget, as shown in the example below.

mark.orchard-webb@artemis:~$ mkdir -p /mnt/data/orchard/geiger
mkdir: cannot create directory `/mnt/data': Permission denied
mark.orchard-webb@artemis:~$ mkdir -p 339/geiger
mark.orchard-webb@artemis:~$ cd !!:2
cd 339/geiger
mark.orchard-webb@artemis:~/339/geiger$ cp -v /mnt/resources/339/geiger/* .
`/mnt/resources/339/geiger/chisq.c' -> `./chisq.c'
`/mnt/resources/339/geiger/geiger.pdf' -> `./geiger.pdf'
`/mnt/resources/339/geiger/geiger.tar.bz2' -> `./geiger.tar.bz2'
`/mnt/resources/339/geiger/old-sample.data' -> `./old-sample.data'
`/mnt/resources/339/geiger/sample.data' -> `./sample.data'
mark.orchard-webb@artemis:~/339/geiger$ 

This copies all the relevant resources to the current directory.

mark.orchard-webb@artemis:~/339/geiger$ ls -l
total 156
-rw------- 1 mark.orchard-webb users   4469 Jan 21 13:01 chisq.c
-rw------- 1 mark.orchard-webb users 103600 Jan 21 13:01 geiger.pdf
-rw------- 1 mark.orchard-webb users  31601 Jan 21 13:01 geiger.tar.bz2
-rw------- 1 mark.orchard-webb users   1634 Jan 21 13:01 old-sample.data
-rw------- 1 mark.orchard-webb users   1614 Jan 21 13:01 sample.data
mark.orchard-webb@artemis:~/339/geiger$ 

In case you are unfamiliar with tar files, they are basically archives, much like RAR, ZIP, ARJ or any of the multitude of other archive formats. To extract the contents of the archive use the command tar.

mark.orchard-webb@artemis:~/339/geiger$ tar jxvf geiger.tar.bz2 
configure
Makefile.in
geiger.c
geiger.1
geiger.5
mark.orchard-webb@artemis:~/339/geiger$ ls -ltr
total 316
-rw------- 1 mark.orchard-webb users    221 Jan 21  2003 Makefile.in
-rw------- 1 mark.orchard-webb users   1976 Jan 19  2004 geiger.1
-rw------- 1 mark.orchard-webb users   1329 Jan 19  2004 geiger.5
-rwx------ 1 mark.orchard-webb users 130488 Jan 16  2006 configure
-rw------- 1 mark.orchard-webb users  12880 Jan 16  2006 geiger.c
-rw------- 1 mark.orchard-webb users   4469 Jan 21 13:01 chisq.c
-rw------- 1 mark.orchard-webb users   1614 Jan 21 13:01 sample.data
-rw------- 1 mark.orchard-webb users   1634 Jan 21 13:01 old-sample.data
-rw------- 1 mark.orchard-webb users  31601 Jan 21 13:01 geiger.tar.bz2
-rw------- 1 mark.orchard-webb users 103600 Jan 21 13:01 geiger.pdf
mark.orchard-webb@artemis:~/339/geiger$ 

Now this software is slightly more complicated than the simple programs we worked with in the previous lab. This program requires a library supporting the data acquisition card and a graphics library. With more complicated software it is common to use a configure script which will test for necessary and optional libraries and customized the executable to the machine upon which it is run.

mark.orchard-webb@artemis:~/339/geiger$ ./configure
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
checking for X... no
checking for labmaster_initialize in -llabmaster... yes
checking for XCreateWindow in -lX11... yes
checking for GrSetMode in -lgrx20X... yes
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking for gethostname... yes
configure: creating ./config.status
config.status: creating Makefile
mark.orchard-webb@artemis:~/339/geiger$ 

The above is what you should see on a machine with the appropriate libraries installed.

mark.orchard-webb@artemis:~/339/geiger$ ls -l
total 360
-rw------- 1 mark.orchard-webb users    663 Jan 21 13:06 Makefile
-rw------- 1 mark.orchard-webb users    221 Jan 21  2003 Makefile.in
-rw------- 1 mark.orchard-webb users   4469 Jan 21 13:01 chisq.c
-rw------- 1 mark.orchard-webb users  14543 Jan 21 13:06 config.log
-rwx------ 1 mark.orchard-webb users  20866 Jan 21 13:06 config.status
-rwx------ 1 mark.orchard-webb users 130488 Jan 16  2006 configure
-rw------- 1 mark.orchard-webb users   1976 Jan 19  2004 geiger.1
-rw------- 1 mark.orchard-webb users   1329 Jan 19  2004 geiger.5
-rw------- 1 mark.orchard-webb users  12880 Jan 16  2006 geiger.c
-rw------- 1 mark.orchard-webb users 103600 Jan 21 13:01 geiger.pdf
-rw------- 1 mark.orchard-webb users  31601 Jan 21 13:01 geiger.tar.bz2
-rw------- 1 mark.orchard-webb users   1634 Jan 21 13:01 old-sample.data
-rw------- 1 mark.orchard-webb users   1614 Jan 21 13:01 sample.data
mark.orchard-webb@artemis:~/339/geiger$ 

As you can see, a few additional files have appeared, the most useful for us is the Makefile. This file describes how to compile the executable, it is used by the program Make as follows:

mark.orchard-webb@artemis:~/339/geiger$ make
gcc  -I/usr/local/include -INONE -g -O2 -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DHAVE_LIBLABMASTER=1 -DHAVE_LIBX11=1 -DHAVE_LIBGRX20X=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_UNISTD_H=1 -DHAVE_GETHOSTNAME=1  -c geiger.c
geiger.c:53: warning: built-in function 'y1' declared as non-function
gcc  -L/usr/local/lib -LNONE -o geiger geiger.o -lgrx20X -lX11 -llabmaster 
mark.orchard-webb@artemis:~/339/geiger$ 

Hopefully it is apparent why we use configure scripts and Makefiles :). So we now have a new executable geiger

mark.orchard-webb@artemis:~/339/geiger$ ls -l
total 500
-rw------- 1 mark.orchard-webb users    663 Jan 21 13:06 Makefile
-rw------- 1 mark.orchard-webb users    221 Jan 21  2003 Makefile.in
-rw------- 1 mark.orchard-webb users   4469 Jan 21 13:01 chisq.c
-rw------- 1 mark.orchard-webb users  14543 Jan 21 13:06 config.log
-rwx------ 1 mark.orchard-webb users  20866 Jan 21 13:06 config.status
-rwx------ 1 mark.orchard-webb users 130488 Jan 16  2006 configure
-rwx------ 1 mark.orchard-webb users 112387 Jan 21 13:07 geiger
-rw------- 1 mark.orchard-webb users   1976 Jan 19  2004 geiger.1
-rw------- 1 mark.orchard-webb users   1329 Jan 19  2004 geiger.5
-rw------- 1 mark.orchard-webb users  12880 Jan 16  2006 geiger.c
-rw------- 1 mark.orchard-webb users  23744 Jan 21 13:07 geiger.o
-rw------- 1 mark.orchard-webb users 103600 Jan 21 13:01 geiger.pdf
-rw------- 1 mark.orchard-webb users  31601 Jan 21 13:01 geiger.tar.bz2
-rw------- 1 mark.orchard-webb users   1634 Jan 21 13:01 old-sample.data
-rw------- 1 mark.orchard-webb users   1614 Jan 21 13:01 sample.data
mark.orchard-webb@artemis:~/339/geiger$ 

With the Geiger Counter turned on an the gamma source placed close to the detector, try the following:

mark.orchard-webb@artemis:/mnt/data/orchard/geiger$ ./geiger 100 100 0.05 geiger.data

You should get a window which after a few seconds looks something like this:

Image:Geiger-2007-01-15.png

Structure of data

Check the documentation in the source tar file

christian.voyer@hades:~$ man ./geiger.5
Reformatting geiger.5, please wait...

Reads

GEIGER(5)                   Lab Programmers Manual                   GEIGER(5)

NAME
       geiger - a data collection tool - the output data format

DESCRIPTION
       The  data  saved by the geiger program consists of two major parts, the
       header and the data-body.

HEADER
       The header is a single line consisting of 4 numbers:  replicas,  inter-
       vals,  columns  and  period.  replicas, intervals and columns are inte-
       gers, period is a floating point number.  The definitions of the param-
       eters are as follows:

       replicas
              The number of replicas requested.

       intervals
              The number of intervals per replica.

       columns
              The number of columns in the histogram.

       period The period in seconds requested by the user.  If the true period
              differed from this because of quantization this a user  problem.

DATA-BODY
       The  data-body  section  consists of replicas rows, each row containing
       columns numbers, separated by tab characters.  The sum of numbers in  a
       given  row  should  equal intervals.  The number in the Nth column of a
       replica represents the frequency of observation of N counts per  period
       during the replica measurement.

SEE ALSO
       geiger(1)

BUGS
       The period problem mentioned above.

AUTHOR
       Mark Orchard-Webb (orchard@physics.mcgill.ca)

Supplemental toys

  • chisq.c (http://www.ugrad.physics.mcgill.ca/resources/339/geiger/chisq.c) - This is an implementation of table C4. in Bevington. There are two functions of interest in this file:

double chisq_five (int dof)
returns the reduced Χ2 value which only 5% of replicas having dof are expected to exceed.
double chisq_ten (int dof)
returns the reduced Χ2 value which only 10% of replicas having dof are expected to exceed.
These functions are written in such a way that they can easily be pasted into another piece of code.

Historical Archives

Log