Subversion Repositories f9daq

Compare Revisions

No changes between revisions

Ignore whitespace Rev 128 → Rev 129

/lab/sipmscan/trunk/MIKRO/test.txt
File deleted
/lab/sipmscan/trunk/MIKRO/mikro_ctrl
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/lab/sipmscan/trunk/README
5,14 → 5,36
________________
1. Installation:
 
Installation is done through the usual "./configure" and "make" commands to enable the use of this software with 32 bit and 64 bit systems.
Pre-requisites for offline and online modes:
a) Offline mode (support for histogramming and analysis):
- A newer (5.34 or higher) pro version of ROOT (https://root.cern.ch).
b) Online mode (support for histogramming, analysis and data acquisition):
- Perl developer package libperl-dev for installation of net-snmp (sudo apt-get install libperl-dev).
- Current version of net-snmp (http://www.net-snmp.org).
- A newer (5.34 or higher) pro version of ROOT (https://root.cern.ch).
- USB developer package libusb-dev (sudo apt-get install libusb-dev).
 
Configure takes two arguments:
- First argument is the configure option (help, nomake, all, clean, compress).
- Second argument is the online/offline configure setting (only used when first argument is nomake or all), that enables the software to work with a connected CAMAC and scope (I), only a connected scope (S) or with no connected devices (O).
Installation is done through the usual "./configure" and "make" commands to enable the use of this software with 32 bit or 64 bit systems.
 
Configure takes the following arguments:
- First argument is the configure option (help, nomake, all, clean, compress):
help = shows configure help
all = prepares OS dependent files and makes the needed usb daq libraries
nomake = only prepares OS dependent files
clean = cleans the installation to the base file structure (keeps the results directory)
compress = compresses the base installation into a tar-ball
- Second argument is the online/offline configure setting (only used when first argument is nomake or all), that enables the software to work with:
a connected CAMAC and scope (I)
only a connected scope (S)
with no connected devices (O)
- The following arguments set specific computer details and can be entered in any order:
a) --root-install=/path/to/root/directory -> The ROOT install directory, if it is not installed in a standard location (especially needed when running the program with superuser, since it usually does not have the required environment variables).
b) --snmp-install=/path/to/snmp/directory -> The NET-SNMP install directory, if it is not installed in a standard location.
c) --ostype=YYYY -> Optional argument to specifically set the OS type to either 32bit (YYYY = i686) or 64bit (YYYY = x86_64). If argument not supplied, the configure script will try to get this information automatically through uname.
 
Running "./configure" or "./configure help" will give more information on specific uses.
Example:
./configure all I
./configure all I --root-install=/opt/root --snmp-install=/opt/net-snmp --ostype=i686
 
Makefile:
Once configuration is done, a Makefile will be generated and further installation is done by running "make". Running "make relib" will only recreate the libraries in case something has been edited in them.
19,15 → 41,22
Example:
make
 
On first run of the program, make sure to copy the ./mpod/WIENER-CRATE-MIB.txt to the MIB directory in your installation of net-snmp. This can be in:
~/.snmp/mibs
or
[/snmp/install/directory]/share/snmp/mibs
 
________________________
2. Running the software:
 
The software requires an installation of ROOT with set environment variable $ROOTSYS and $LD_LIBRARY_PATH. Once installation is performed, use
Once installation is performed, use
./start.sh
to start the software. Once the software starts it will let you know (in the terminal) if the CAMAC connection was correctly established.
to start the software in offline mode or
sudo ./start.sh
to start the software in online mode. Once the software starts, it will let you know (in the terminal) if connection to CAMAC was correctly established.
 
_______________
3. Short guide:
____________________
3. Feature overview:
 
The main window is divided into 5 subwindows:
a) Settings window:
54,6 → 83,7
- if using multiple files, use multiple file select or select all listed files
- files will be used in order displayed on the list
- to clear the complete list, use the clear list button
- to edit the header information of currently selected files, use the edit header button
- any opened measurement has an info display of its header at the bottom for easier navigation
 
d) Histogram window:
81,7 → 111,7
- Relative PDE -> calculation of the relative PDE for the currently selected files
 
c) Tools:
- Fieldpoint temperature sensor -> direct graphing of the fieldpoint temperature sensor (with settings for fieldpoint channel, start time and end time), output is a graph (if exporting) and a comma separated list saved to folder ./fieldpoint
- Fieldpoint temperature sensor -> direct graphing of the fieldpoint temperature sensor (with settings for fieldpoint channel, start time and end time), output is a graph (if exporting) and a comma separated list saved to folder ./fieldpoint. Updating the graph can cause unstable behavior. If possible, use ~/sipmscan/fieldpoint_standalone instead.
 
d) Windows:
- Specific window tiling
95,7 → 125,15
______________
4. Change log:
 
5.5.2015 (Current Rev):
17.7.2015 (Current Rev):
a) Fixed a problem with ADC peak fitting (peak fitting returning a segmentation fault).
b) Added support to edit file headers (in case, some were created at an older date and did not include some header information or there was a mistake in writing them).
c) Temperature data can only be retrieved when connected to the IJS network (IP = 178.172.43.xxx) and is disabled otherwise.
d) The relative PDE measurement now takes the incidence angle value directly from input files.
e) Currently, data acquisition only works on 32bit computers.
f) Fixed issue with program not correctly writting multiple channels.
 
5.5.2015 (Rev 128):
a) Added a header display for opened files in the histogram file selection window. This enables a quicker view of the measurement information.
b) Added an incidence angle input to be able to save sample rotation angle to headers of files.
c) Added support for the fieldpoint temperature sensor (FP RTD 122). Can now plot and export data from the sensor for a specific channel and specific time range. For now, this option only works if the PC you are using this program on is connected to an internet/ethernet connection at IJS.
/lab/sipmscan/trunk/configure
1,31 → 1,52
#!/bin/bash
 
function colorecho
{
echo -e$2 "\033[33m$1\033[39m"
}
 
function errorecho
{
echo -e "\031[33m$1\033[39m"
}
 
function helptext()
{
echo "#------------------------------"
echo "# Configure instructions: -----"
echo "#------------------------------"
echo ""
echo "./configure [option] [type]"
echo ""
echo "[option] = Option for configure:"
echo " - help = Display configure instructions."
echo " - nomake = Only prepare system dependent files (base directory and online/offline mode)."
echo " - all = Prepare system dependent files and make used libraries."
echo " - clean = Clean the installation directory. Does not clean the results directory."
echo " - compress = Compress the source code in a tar-ball."
echo ""
echo "[type] = Configure for use in online or offline mode (only needed in nomake and all):"
echo " - I = Online mode."
echo " - O = Offline mode (no connection to CAMAC, motor, voltage supply and scope)."
echo " - S = Offline mode with scope connection (no connection to CAMAC, motor and voltage supply)."
echo ""
echo "#------------------------------"
colorecho "#------------------------------"
colorecho "# Configure instructions: -----"
colorecho "#------------------------------"
colorecho ""
colorecho "./configure [option] [type] [install directories] [ostype]"
colorecho ""
colorecho "[option] = Option for configure:"
colorecho " help Display configure instructions."
colorecho " nomake Only prepare system dependent files (base directory and online/offline mode)."
colorecho " all Prepare system dependent files and make used libraries."
colorecho " clean Clean the installation directory. Does not clean the results directory."
colorecho " compress Compress the source code in a tar-ball."
colorecho ""
colorecho "[type] = Configure for use in online or offline mode (only needed in nomake and all):"
colorecho " I Online mode."
colorecho " O Offline mode (no connection to CAMAC, motor, voltage supply and scope)."
colorecho " S Offline mode with scope connection (no connection to CAMAC, motor and voltage supply)."
colorecho ""
colorecho "[install directories] = Directories where ROOT and NET-SNMP are installed (when running with superuser, this is important, otherwise optional):"
colorecho " --root-install=/root/install/directory"
colorecho " --snmp-install=/snmp/install/directory"
colorecho ""
colorecho "[ostype] = Specific setting for 64bit or 32bit version of OS (optional):"
colorecho " --ostype=i686 32bit OS type"
colorecho " --ostype=x86_64 64bit OS type"
colorecho ""
colorecho "Example:"
colorecho " ./configure all I --root-install=/home/user/root --snmp-install=/home/user/snmp"
colorecho ""
colorecho "#------------------------------"
}
 
# Check for arguments
if [ "$1" == "" ]; then
echo "Error! No arguments supplied."
errorecho "Error! No arguments supplied."
echo ""
helptext
exit 1
38,7 → 59,7
 
# Print help and exit if we give a wrong first argument
if [ "$1" != "nomake" ] && [ "$1" != "all" ] && [ "$1" != "clean" ] && [ "$1" != "compress" ]; then
echo "Error! Wrong configuration option selected (first argument)."
errorecho "Error! Wrong configuration option selected (first argument)."
echo ""
helptext
exit 1
46,7 → 67,52
 
startdir=$PWD
 
ostype=`uname -p`
# Check for ROOT and NET-SNMP install directories and for OS type
snmpsearch="--snmp-install="
rootsearch="--root-install="
ossearch="--ostype="
snmpdirectory=-1
rootdirectory=-1
osmanual=-1
for var in $@
do
case $var in
"$snmpsearch"*)
snmpdirectory=${var#$snmpsearch}
echo "NET-SNMP directory: $snmpdirectory";;
"$rootsearch"*)
rootdirectory=${var#$rootsearch}
echo "ROOT directory: $rootdirectory";;
"$ossearch"*)
osmanual=${var#$ossearch};;
*) ;;
esac
done
# If n ot supplied, check automatically for OS type
if [ $osmanual == -1 ]; then
ostype=`uname -p`
if [ "$ostype" != "x86_64" ] && [ "$ostype" != "i686" ]; then
ostype=`uname -i`
if [ "$ostype" != "x86_64" ] && [ "$ostype" != "i686" ]; then
ostype=`uname -m`
fi
fi
else
ostype=$osmanual
fi
# Check for installation directory of ROOT - if variables not currently set, remind user to set them before running make
if [ "$1" != "clean" ] && [ "$1" != "compress" ]; then
if [ $rootdirectory != -1 ]; then
printenv ROOTSYS > /dev/null
if [ $? != 0 ]; then
colorecho "ROOT environment variables not set. Please run \"source $rootdirectory/bin/thisroot.sh\", before using make."
fi
else
colorecho "Before running make, please make sure ROOT environment variables are set."
fi
fi
 
# Compiles the table microcontroller program
if [ "$1" == "all" ]; then
65,10 → 131,10
mkdir $startdir/camac_gui_windowed
mkdir $startdir/camac_gui_windowed/results
echo "Copying source files to temporary directory $startdir/camac_gui_windowed..."
cp -r configure daq.h daqscope.h GuiLinkDef.h libxxusb.cpp root_include.h start.cxx windowed_test.C windowed_test.h wusbcc.h wusbxx_dll.c wusbxx_dll.h mpod/ MIKRO/ vxi11_x86_64/ vxi11_i686/ input/ ./camac_gui_windowed/
cp -r configure daq.h daqscope.h GuiLinkDef.h libxxusb.cpp root_include.h README start.cxx windowed_test.C windowed_test.h wusbcc.h wusbxx_dll.c wusbxx_dll.h mpod/ MIKRO/ vxi11_x86_64/ vxi11_i686/ input/ fieldpoint/ ./camac_gui_windowed/
cd $startdir/camac_gui_windowed
echo "Cleaning the base directory in $startdir/camac_gui_windowed..."
rm -f *.bak
rm -f *.bakc
cd $startdir/camac_gui_windowed/input
echo "Cleaning the input directory in $startdir/camac_gui_windowed/input..."
rm -f *.bak
87,7 → 153,7
rm -r $startdir/camac_gui_windowed
exit 0
else
echo "Error! Directory ./camac_gui_windowed already exists."
errorecho "Error! Directory ./camac_gui_windowed already exists."
exit 1
fi
fi
97,15 → 163,26
 
if [ "$1" == "nomake" ] || [ "$1" == "all" ]; then
if [ "$2" == "O" ] || [ "$2" == "I" ] || [ "$2" == "S" ]; then
# Setting up the current working computer
grep -q "#define WORKSTAT 'N'" $startdir/input/workstation.h.in
if [ $? == 0 ]; then
sed "s/define WORKSTAT 'N'/define WORKSTAT '$2'/" $startdir/input/workstation.h.in > $startdir/workstation.h.mid
sed "s/define WORKSTAT 'N'/define WORKSTAT '$2'/" $startdir/input/workstation.h.in > $startdir/input/workstation.h.mid
fi
grep -q "#define rootdir \"path-to-installation\"" $startdir/input/workstation.h.in
if [ $? == 0 ]; then
sed "s/path-to-installation/$basedir/g" $startdir/workstation.h.mid > $startdir/workstation.h
rm $startdir/workstation.h.mid
sed "s/path-to-installation/$basedir/g" $startdir/input/workstation.h.mid > $startdir/input/workstation.h.mid2
rm $startdir/input/workstation.h.mid
fi
# Check if we are connected to IJS network
etnet=$(ifconfig | grep "178.172.43.")
if [ "$etnet" == "" ]; then
sed "s/define IJSNET 1/define IJSNET 0/" $startdir/input/workstation.h.mid2 > $startdir/workstation.h
rm $startdir/input/workstation.h.mid2
else
cp $startdir/input/workstation.h.mid2 $startdir/workstation.h
rm $startdir/input/workstation.h.mid2
fi
# Setting up the OS type specific files
grep -q "#include \"vxi11_user.h\"" $startdir/input/daqscope.C.in
if [ $? == 0 ]; then
sed "s/vxi11_user.h/.\/vxi11_$ostype\/vxi11_user.h/g" $startdir/input/daqscope.C.in > $startdir/daqscope.C
119,23 → 196,32
grep -q "CAMLIB = \$(LIBFILE)" $startdir/input/Makefile.in
if [ $? == 0 ]; then
if [ "$2" == "I" ]; then
sed "s/CAMLIB = \$(LIBFILE)/CAMLIB = \$(LIBFILE) -lusb/g" $startdir/Makefile.mid > $startdir/Makefile
sed "s/CAMLIB = \$(LIBFILE)/CAMLIB = \$(LIBFILE) -lusb/g" $startdir/Makefile.mid > $startdir/Makefile.mid2
rm $startdir/Makefile.mid
elif [ "$2" == "O" ] || [ "$2" == "S" ]; then
cp $startdir/input/Makefile.in $startdir/Makefile
cp $startdir/input/Makefile.in $startdir/Makefile.mid2
fi
fi
sed "s/OSTYPE=none/OSTYPE=$ostype/g" $startdir/Makefile.mid2 > $startdir/Makefile
rm $startdir/Makefile.mid2
 
if [ "$2" == "O" ] || [ "$2" == "S" ]; then
cp $startdir/input/daqusb.C.offline $startdir/daqusb.C
cp $startdir/input/start.sh.offline $startdir/start.sh
cp $startdir/input/libxxusb.h.offline $startdir/libxxusb.h
cp $startdir/input/usb.h.offline $startdir/usb.h
elif [ "$2" == "I" ]; then
cp $startdir/input/daqusb.C.online $startdir/daqusb.C
cp $startdir/input/start.sh.online $startdir/start.sh
cp $startdir/input/libxxusb.h.online $startdir/libxxusb.h
fi
 
echo "#!/bin/bash" > $startdir/start.sh
echo "dir=\`dirname \$0\`" >> $startdir/start.sh
echo "" >> $startdir/start.sh
echo "snmpdirectory=$snmpdirectory" >> $startdir/start.sh
echo "rootdirectory=$rootdirectory" >> $startdir/start.sh
echo "" >> $startdir/start.sh
cat $startdir/input/start.sh.in >> $startdir/start.sh
chmod a+x $startdir/start.sh
fi
fi
 
158,7 → 244,7
if [ "$2" == "O" ] || [ "$2" == "I" ] || [ "$2" == "S" ]; then
make
else
echo "Error! No configuration type selected (second argument)."
errorecho "Error! No configuration type selected (second argument)."
echo ""
helptext
exit 1
166,7 → 252,7
fi
cd $startdir
else
echo "No 64 bit VXI11 source folder."
errorecho "No 64 bit VXI11 source folder."
exit 1
fi
# 32 bit configuration rules
183,7 → 269,7
if [ "$2" == "O" ] || [ "$2" == "I" ] || [ "$2" == "S" ]; then
make
else
echo "Error! No installation type selected (second argument)."
errorecho "Error! No installation type selected (second argument)."
echo ""
helptext
exit 1
191,11 → 277,11
fi
cd $startdir
else
echo "No 32 bit VXI11 source folder."
errorecho "No 32 bit VXI11 source folder."
exit 1
fi
else
echo "No OS type information found."
errorecho "No OS type information found."
exit 1
fi
fi
/lab/sipmscan/trunk/daq.h
4,19 → 4,27
#define BUFF_L 2048
 
// Number of channels we are using (used only if we run daqusb.C, not the GUI version)
#define NTDC 1 /* TDC */
#define NTDCCH 1
#define NADC 2 /* ADC */
#define NADCCH 1
//#define NTDC 1 /* TDC */
//#define NTDCCH 1
//#define NADC 2 /* ADC */
//#define NADCCH 1
 
// Class for measurement process (DAQ for CAMAC)
class daq
{
private:
// Number of channels we are using
int NTDC;
int NTDCCH;
int NADC;
int NADCCH;
 
int devDetect; // variable to tell if we detect any devices
public:
unsigned long stackwrite[BUFF_L],stackdata[10000],stackdump[27000];
int fStop;
int connect();
int init();
int init(int);
int start();
int event(unsigned int *, int);
int stop();
/lab/sipmscan/trunk/input/start.sh.online
File deleted
Property changes:
Deleted: svn:executable
-*
\ No newline at end of property
/lab/sipmscan/trunk/input/start.sh.offline
File deleted
Property changes:
Deleted: svn:executable
-*
\ No newline at end of property
/lab/sipmscan/trunk/input/Makefile.in
7,7 → 7,7
 
# Includes, 32 vs. 64 bit type, libraries
INC=-I. -I$(ROOTINC)
OSTYPE = $(shell uname -p)
OSTYPE=none
LIBS=$(ROOTLIB) -L./ -lm
 
# Source and debug prefixes
53,15 → 53,15
libxxusb.o: libxxusb.cpp libxxusb.h
 
.cc.o:
$(CXX) -c $<
$(CXX) -fPIC -c $<
ar r $(LIBFILE) $@
 
.cpp.o:
$(CXX) -c $<
$(CXX) -fPIC -c $<
ar r $(LIBFILE) $@
 
.c.o:
$(CXX) -c $<
$(CXX) -fPIC -c $<
ar r $(LIBFILE) $@
 
# Rules for recreating the CAMAC DAQ libraries even if they exist (libdaqusb.so/.a)
/lab/sipmscan/trunk/input/daqscope.C.in
231,6 → 231,7
vxi11_receive(clink, posoff, WAVE_LEN);
choffset = (double)atof(posoff);
#else
sprintf(posoff, "Just some temporary string info.");
printf("Check for channel position offset (CHx:POS?)\n");
#endif
 
/lab/sipmscan/trunk/input/daqusb.C.offline
48,7 → 48,7
return 0;
}
 
int daq::init(){
int daq::init(int chan = 0){
 
// int i;
// long k;
60,6 → 60,20
CCCC;
CREM_I;
 
NTDC = 1;
NADC = 2;
if(chan != 0)
{
NTDCCH = chan/2;
NADCCH = chan/2;
}
else
{
NTDCCH = 1;
NADCCH = 1;
}
printf("after: NTDCCH = %d, NADCCH = %d\n", NTDCCH, NADCCH);
 
// create command stack for the TDC and ADC
k=1;
for(i=0;(i<NTDCCH)&&(i<NADCCH);i++) { stackwrite[k++]=NAF(NTDC,i,0); stackwrite[k++]=NAF(NADC,i,0); }
119,7 → 133,7
}
 
int daq::event(unsigned int *data, int maxn){
// int i,ib,count;
// int ib,count;
int count;
/* int events,evsize;
short ret;
136,7 → 150,7
DBG(printf("Event:%d EvSize:%d\n", events, evsize);)
for (int i=0;i<(NTDCCH+NADCCH);i++,ib++) data[count++] =stackdata[ib++]&0xffff;
if (stackdata[ib++]!=0xfafb){
printf("Error!\n");
printf("Error!\n");,
return 0;
}
events--;
161,8 → 175,8
daq::daq(){
fStop=0;
connect();
if(devDetect > 0)
init();
// if(devDetect > 0)
// init();
}
 
daq::~daq(){
190,7 → 204,7
// intercept routine
if (signal (SIGINT, CatchSig) == SIG_ERR) perror ("sigignore");
if (signal (SIGINT, CatchSig) == SIG_E,RR) perror ("sigignore");
#define BSIZE 10000
int i,ieve,nc,nb;
198,8 → 212,8
int hdr[4]={1,(NTDCCH+NADCCH+4)*sizeof(int)};
unsigned short adc;
unsigned int data[BSIZE];
daq *d= new daq();
time_t time_check;
daq *d= new daq();,
time_t time_check;,
 
// odpremo datoteko za pisanje
FILE *fp=fopen(fname,"w");
/lab/sipmscan/trunk/input/daqusb.C.online
26,7 → 26,7
//#define NADCCH 8
int ctrlc=0;
char *ccserial=(char*)"CC0126";
int devDetect; // variable to tell if we detect any devices
//int devDetect; // variable to tell if we detect any devices
 
int daq::connect(){
// odpri daq
48,7 → 48,7
return 0;
}
 
int daq::init(){
int daq::init(int chan = 0){
 
int i;
long k;
60,6 → 60,20
CCCC;
CREM_I;
 
NTDC = 1;
NADC = 2;
if(chan != 0)
{
NTDCCH = chan/2;
NADCCH = chan/2;
}
else
{
NTDCCH = 1;
NADCCH = 1;
}
printf("after: NTDCCH = %d, NADCCH = %d\n", NTDCCH, NADCCH);
 
// create command stack for the TDC and ADC
k=1;
for(i=0;(i<NTDCCH)&&(i<NADCCH);i++) { stackwrite[k++]=NAF(NTDC,i,0); stackwrite[k++]=NAF(NADC,i,0); }
119,7 → 133,7
}
 
int daq::event(unsigned int *data, int maxn){
int i,ib,count;
int ib,count;
int events,evsize;
short ret;
 
160,8 → 174,8
daq::daq(){
fStop=0;
connect();
if(devDetect > 0)
init();
// if(devDetect > 0)
// init();
}
 
daq::~daq(){
/lab/sipmscan/trunk/input/start.sh.in
0,0 → 1,23
if [ $rootdirectory != -1 ]; then
printenv ROOTSYS > /dev/null
if [ $? != 0 ]; then
echo "Preparing ROOT..."
source $rootdirectory/bin/thisroot.sh
fi
fi
 
if [ $snmpdirectory != -1 ]; then
printenv PATH | grep "snmp" > /dev/null
if [ $? != 0 ]; then
echo "Preparing NET-SNMP..."
export PATH=$snmpdirectory/bin:$PATH
fi
fi
 
if [ ! -d results ]; then
mkdir results
fi
 
root -l "$dir/start.cxx(\"$dir\")"
 
 
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/lab/sipmscan/trunk/input/workstation.h.in
1,9 → 1,12
#ifndef _workstation_h_
#define _workstation_h_
 
// Define the working computer (O=offline, I=IJS/online) and the base directory
// Define the working computer (O=offline, S=offline with scope, I=IJS/online) and the base directory
#define WORKSTAT 'N'
 
// Define if working computer is connected to IJS ethernet network (for fieldpoint)
#define IJSNET 1
 
#ifdef WORKSTAT
#define rootdir "path-to-installation"
#endif
/lab/sipmscan/trunk/mpod/test.sh
1,7 → 1,31
#!/bin/bash
 
echo "Bash start."
sleep $1
echo "Bash end."
snmpsearch="--snmp-install="
 
for var in $@
do
case $var in
"$snmpsearch"*)
echo "Mached argument: $var"
snmpdir=${var#$snmpsearch}
echo "SNMP directory = $snmpdir";;
*) ;;
# echo "Unmached argument: $var";;
esac
done
 
printenv PATH | grep "snmp"
if [ $? == 0 ]; then
echo "Something found."
else
echo "Nothing found."
fi
 
printenv ROOTSYS > /dev/null
if [ $? == 0 ]; then
echo "Something found."
else
echo "Nothing found."
fi
 
exit 0
/lab/sipmscan/trunk/mpod/test.sh.bak
1,7 → 1,24
#!/bin/bash
 
echo "Bash start."
sleep 5
echo "Bash end."
snmpsearch="--snmp-install="
 
for var in $@
do
case $var in
"$snmpsearch"*)
echo "Mached argument: $var"
snmpdir=${var#$snmpsearch}
echo "SNMP directory = $snmpdir";;
*) ;;
# echo "Unmached argument: $var";;
esac
done
 
printenv PATH | grep "snmp"
if [ $? == 0 ]; then
echo "Something found."
else
echo "Nothing found."
fi
 
exit 0
/lab/sipmscan/trunk/windowed_test.C
40,7 → 40,7
TGLayoutHints *fMenuBarItemLayout;
TGPopupMenu *fMenuFile, *fMenuAnalysis, *fMenuTools, *fMenuWindow, *fMenuHelp;
TGPopupMenu *fMenuHisttype;
TGMdiSubwindow *settingsPane, *mainSubwindow, *histogramPane, *histogramPaneFile, *histogramPaneCtr;
TGMdiSubwindow *settingsPane, *mainSubwindow, *histogramPane, *histogramPaneFile, *histogramPaneCtr, *fieldpointPane, *headerPane;
 
void InitMenu();
void MeasurementLayout();
79,6 → 79,7
void ListMultiSelect();
void ListSelectAll();
void FileListNavigation(int pn);
void HeaderEdit();
 
void DisplayHistogram(char *histfile, int histtype);
void SetHistRange();
86,7 → 87,7
void ChangeChannel();
void HistogramExport();
void MakeSurfPlot(TList *files);
void MakeBreakdownPlot(int nrp, double *volt, double *volterr, double *psep1, double *pseperr1, double *psep2, double *pseperr2, double *psep3, double *pseperr3, char *plotfile);
void MakeBreakdownPlot(int nrp, double *volt, double *volterr, double *psep1, double *pseperr1, double *psep2, double *pseperr2, double *psep3, double *pseperr3, char *plotfile, int separations);
 
void FitSpectrum(TList *files, int q);
void EdgeDetection(TGraph *pdf, TGraph *cdf, char *outname, TCanvas *g1dCanvas, double pdfmax, int direction);
98,7 → 99,11
void ExportTempPlot();
void GetTempFile(int set);
 
void RunMeas(void *ptr, int runCase, int zaxisscan);
void EditTickToggle(int set);
void headerchange(char *histfile, bool *changetype);
void headeredit();
 
void RunMeas(void *ptr, int runCase, int zaxisscan, int &scanon);
};
 
const char *histExt = ".root";
201,6 → 206,7
TGCheckButton *multiSelectAll;
TGTextButton *prevFile;
TGTextButton *nextFile;
TGTextButton *editHeader;
 
TGTextEntry *disptime;
TGNumberEntry *dispbias;
226,9 → 232,10
TGNumberEntry *fitTresh;
TGNumberEntry *fitInter;
TGNumberEntry *accError;
TGNumberEntry *minPeak;
TGNumberEntry *pedesLow;
TGCheckButton *exfitplots;
 
//TGButtonGroup *sChangroup;
TGCheckButton *sCH[8];
TGComboBox *sMeasType;
TGCheckButton *sCamaclink;
252,6 → 259,18
TGTextButton *exportTemp;
//TGTextButton *closeTemp;
 
TGCheckButton *biasedittick;
TGNumberEntry *biasedit;
TGCheckButton *posedittick;
TGNumberEntry *posedit[3];
TGCheckButton *tempedittick;
TGNumberEntry *tempedit;
TGCheckButton *angleedittick;
TGNumberEntry *angleedit;
TGCheckButton *laseredittick;
TGTextEntry *laseredit;
TGTextButton *editHead;
 
Bool_t firstrun = kTRUE;
Bool_t started;
Bool_t cleanPlots = kTRUE;
834,6 → 853,8
tempHour[set]->Select(timeinfo->tm_hour);
tempMinute[set]->Select(timeinfo->tm_min);
tempSecond[set]->Select(timeinfo->tm_sec);
 
inroot->Close();
}
else
printf("No file selected.\n");
868,6 → 889,215
 
// --------------------------------------------------------------
 
// Header editor functions --------------------------------------
 
// Toggle the edit possibility for header entries
void TGAppMainFrame::EditTickToggle(int set)
{
if(set == 1)
{
if(biasedittick->IsDown()) biasedit->SetState(kTRUE);
else biasedit->SetState(kFALSE);
}
else if(set == 2)
{
if(posedittick->IsDown())
{
posedit[0]->SetState(kTRUE);
posedit[1]->SetState(kTRUE);
posedit[2]->SetState(kTRUE);
}
else
{
posedit[0]->SetState(kFALSE);
posedit[1]->SetState(kFALSE);
posedit[2]->SetState(kFALSE);
}
}
else if(set == 3)
{
if(tempedittick->IsDown()) tempedit->SetState(kTRUE);
else tempedit->SetState(kFALSE);
}
else if(set == 4)
{
if(angleedittick->IsDown()) angleedit->SetState(kTRUE);
else angleedit->SetState(kFALSE);
}
else if(set == 5)
{
if(laseredittick->IsDown()) laseredit->SetState(kTRUE);
else laseredit->SetState(kFALSE);
}
}
 
// Run the editing of file headers
void TGAppMainFrame::headerchange(char *histfile, bool *changetype)
{
if(debug)
printf("Selected file: %s\n", histfile);
 
// Preparing input file and the temporary output file
inroot = new TFile(histfile, "READ");
 
char outname[256];
sprintf(outname, "%s/results/temp.root", rootdir);
outroot = new TFile(outname, "RECREATE");
 
// Tree structure of input file
TTree *header_data, *meas_data, *scope_data;
 
inroot->GetObject("header_data", header_data);
inroot->GetObject("meas_data", meas_data);
inroot->GetObject("scope_data", scope_data);
 
// Tree structure of output file
TTree *new_meas_data = meas_data->CloneTree();
TTree *new_scope_data = scope_data->CloneTree();
 
// Save branches from the old header to temporary variables
header_data->SetBranchAddress("nrch", &evtheader.nrch);
header_data->GetEntry(0);
header_data->SetBranchAddress("timestamp", &evtheader.timestamp);
header_data->GetEntry(0);
header_data->SetBranchAddress("biasvolt", &evtheader.biasvolt);
header_data->GetEntry(0);
header_data->SetBranchAddress("xpos", &evtheader.xpos);
header_data->GetEntry(0);
header_data->SetBranchAddress("ypos", &evtheader.ypos);
header_data->GetEntry(0);
header_data->SetBranchAddress("zpos", &evtheader.zpos);
header_data->GetEntry(0);
header_data->SetBranchAddress("temperature", &evtheader.temperature);
header_data->GetEntry(0);
if( header_data->FindBranch("angle") )
{
header_data->SetBranchAddress("angle", &evtheader.angle);
header_data->GetEntry(0);
}
header_data->SetBranchAddress("laserinfo", &evtheader.laserinfo);
header_data->GetEntry(0);
 
int itemp[5] = {0,0,0,0,0};
double dtemp[3] = {0.,0.,0.};
char ctemp[256];
 
itemp[0] = evtheader.nrch;
itemp[1] = evtheader.timestamp;
itemp[2] = evtheader.xpos;
itemp[3] = evtheader.ypos;
itemp[4] = evtheader.zpos;
dtemp[0] = evtheader.biasvolt;
dtemp[1] = evtheader.temperature;
if( header_data->FindBranch("angle") )
dtemp[2] = evtheader.angle;
else
dtemp[2] = 0.;
sprintf(ctemp, "%s", evtheader.laserinfo);
 
delete header_data;
delete meas_data;
delete scope_data;
inroot->Close();
delete inroot;
// Prepare branches for the new header
TTree *new_header_data = new TTree("header_data", "Header information for the measurement.");
new_header_data->Branch("nrch", &evtheader.nrch, "nrch/I");
new_header_data->Branch("timestamp", &evtheader.timestamp, "timestamp/I");
new_header_data->Branch("biasvolt", &evtheader.biasvolt, "biasvolt/D");
new_header_data->Branch("xpos", &evtheader.xpos, "xpos/I");
new_header_data->Branch("ypos", &evtheader.ypos, "ypos/I");
new_header_data->Branch("zpos", &evtheader.zpos, "zpos/I");
new_header_data->Branch("temperature", &evtheader.temperature, "temperature/D");
new_header_data->Branch("angle", &evtheader.angle, "temperature/D");
new_header_data->Branch("laserinfo", &evtheader.laserinfo, "laserinfo/C");
 
// Save new values (and old ones where we don't want to edit anything)
evtheader.nrch = itemp[0];
evtheader.timestamp = itemp[1];
if(changetype[0])
evtheader.biasvolt = (double)biasedit->GetNumber();
else
evtheader.biasvolt = dtemp[0];
if(changetype[1])
{
evtheader.xpos = (int)posedit[0]->GetNumber();
evtheader.ypos = (int)posedit[1]->GetNumber();
evtheader.zpos = (int)posedit[2]->GetNumber();
}
else
{
evtheader.xpos = itemp[2];
evtheader.ypos = itemp[3];
evtheader.zpos = itemp[4];
}
if(changetype[2])
evtheader.temperature = (double)tempedit->GetNumber();
else
evtheader.temperature = dtemp[1];
if(changetype[3])
evtheader.angle = (double)angleedit->GetNumber();
else
evtheader.angle = dtemp[2];
if(changetype[4])
sprintf(evtheader.laserinfo, "%s", laseredit->GetText());
else
sprintf(evtheader.laserinfo, "%s", ctemp);
 
new_header_data->Fill();
 
// Write down the temporary output file
new_header_data->Write();
new_meas_data->Write();
new_scope_data->Write();
 
delete new_header_data;
delete new_meas_data;
delete new_scope_data;
outroot->Close();
delete outroot;
 
// Replace the original file with temporary output file (and delete temporary file)
sprintf(outname, "cp -f %s/results/temp.root %s", rootdir, histfile);
retTemp = system(outname);
sprintf(outname, "rm -f %s/results/temp.root", rootdir);
retTemp = system(outname);
 
printf("Edited header in file: %s\n", histfile);
}
 
// Setup the editing of file headers
void TGAppMainFrame::headeredit()
{
unsigned int nrfiles = fileList->GetNumberOfEntries();
TList *files;
// Changelist: Bias, Position, Temperature, Angle, Laser info
bool changelist[] = { biasedittick->IsDown(), posedittick->IsDown(), tempedittick->IsDown(), angleedittick->IsDown(), laseredittick->IsDown() };
 
if( nrfiles > 0 )
{
// check the selected file/files and return its name/their names
files = new TList();
fileList->GetSelectedEntries(files);
if(files)
{
for(int i = 0; i < (int)nrfiles; i++)
{
if(files->At(i))
{
if(debug)
printf("Filename: %s\n", files->At(i)->GetTitle());
 
headerchange( (char*)(files->At(i)->GetTitle()), changelist );
}
}
}
}
}
 
// --------------------------------------------------------------
 
// Class related functions --------------------------------------
 
// Apply the upper voltage limit from settings pane to main window
1425,7 → 1655,7
}
 
// Make breakdown voltage plot
void TGAppMainFrame::MakeBreakdownPlot(int nrp, double *volt, double *volterr, double *psep1, double *pseperr1, double *psep2, double *pseperr2, double *psep3, double *pseperr3, char *plotfile)
void TGAppMainFrame::MakeBreakdownPlot(int nrp, double *volt, double *volterr, double *psep1, double *pseperr1, double *psep2, double *pseperr2, double *psep3, double *pseperr3, char *plotfile, int separations)
{
double fparam[2], fparamerr[2], meanval;
TLatex *latex;
1432,12 → 1662,25
char ctemp[256];
int sortindex[nrp];
 
TCanvas *canvas = new TCanvas("canv","canv",900,1200);
canvas->Divide(1,3);
TCanvas *canvas;
 
if(separations == 1)
{
canvas = new TCanvas("canv","canv",900,400);
}
else if(separations == 2)
{
canvas = new TCanvas("canv","canv",900,800);
canvas->Divide(1,2);
}
else
{
canvas = new TCanvas("canv","canv",900,1200);
canvas->Divide(1,3);
}
 
// First graph is plotted always
TGraphErrors *gr1 = new TGraphErrors(nrp, volt, psep1, volterr, pseperr1);
TGraphErrors *gr2 = new TGraphErrors(nrp, volt, psep2, volterr, pseperr2);
TGraphErrors *gr3 = new TGraphErrors(nrp, volt, psep3, volterr, pseperr3);
if(!cleanPlots)
gr1->SetTitle("1st - 2nd peak separation");
1446,26 → 1689,7
gr1->SetLineColor(kBlue);
gr1->SetMarkerColor(kBlue);
gr1->SetMarkerStyle(20);
gr1->SetMarkerSize(0.6);
if(!cleanPlots)
gr2->SetTitle("2nd - 3rd peak separation");
else
gr2->SetTitle();
gr2->SetLineColor(kMagenta);
gr2->SetMarkerColor(kMagenta);
gr2->SetMarkerStyle(21);
gr2->SetMarkerSize(0.4);
if(!cleanPlots)
gr3->SetTitle("3rd - 4th peak separation");
else
gr3->SetTitle();
gr3->SetLineColor(kGreen);
gr3->SetMarkerColor(kGreen);
gr3->SetMarkerStyle(22);
gr3->SetMarkerSize(0.6);
gr1->SetMarkerSize(0.4);
// Plotting the first breakdown voltage plot
canvas->cd(1);
1492,67 → 1716,98
sprintf(ctemp, "#splitline{#Delta_{p}(U) = (%.2lf #pm %.2lf)#timesU + (%.2lf #pm %.3lf)}{U_{0} = %.2lf #pm %.3lf}", fparam[0], fparamerr[0], fparam[1], fparamerr[1], meanval, meanval*(TMath::Abs(fparamerr[0]/fparam[0]) + TMath::Abs(fparamerr[1]/fparam[1])) );
latex = new TLatex();
latex->SetTextSize(0.039);
latex->DrawLatex(volt[0]-(volt[1]-volt[0]), 0.97*psep1[sortindex[nrp-1]], ctemp);
latex->DrawLatex(volt[0], 0.97*psep1[sortindex[nrp-1]], ctemp);
}
else
printf("#Delta_p(U) = (%.2lf #pm %.2lf)*U + (%.2lf #pm %.3lf)\nU_0 = %.2lf #pm %.3lf", fparam[0], fparamerr[0], fparam[1], fparamerr[1], meanval, meanval*(TMath::Abs(fparamerr[0]/fparam[0]) + TMath::Abs(fparamerr[1]/fparam[1])) );
 
// Plotting the second breakdown voltage plot
canvas->cd(2);
gPad->SetGridx(1);
gPad->SetGridy(1);
 
gr2->Draw("AP");
gr2->GetXaxis()->SetTitle("Bias voltage (V)");
gr2->GetYaxis()->SetTitle("Peak separation");
gr2->GetYaxis()->CenterTitle();
gr2->Fit("pol1","Q");
TF1 *fit2 = gr2->GetFunction("pol1");
fparam[0] = fit2->GetParameter(0);
fparamerr[0] = fit2->GetParError(0);
fparam[1] = fit2->GetParameter(1);
fparamerr[1] = fit2->GetParError(1);
 
meanval = -fparam[0]/fparam[1];
if(!cleanPlots)
// Second graph
if(separations > 1)
{
sprintf(ctemp, "#splitline{#Delta_{p}(U) = (%.2lf #pm %.2lf)#timesU + (%.2lf #pm %.3lf)}{U_{0} = %.2lf #pm %.3lf}", fparam[0], fparamerr[0], fparam[1], fparamerr[1], meanval, meanval*(TMath::Abs(fparamerr[0]/fparam[0]) + TMath::Abs(fparamerr[1]/fparam[1])) );
latex = new TLatex();
latex->SetTextSize(0.039);
latex->DrawLatex(volt[0]-(volt[1]-volt[0]), 0.97*psep2[sortindex[nrp-1]], ctemp);
TGraphErrors *gr2 = new TGraphErrors(nrp, volt, psep2, volterr, pseperr2);
if(!cleanPlots)
gr2->SetTitle("2nd - 3rd peak separation");
else
gr2->SetTitle();
gr2->SetLineColor(kMagenta);
gr2->SetMarkerColor(kMagenta);
gr2->SetMarkerStyle(21);
gr2->SetMarkerSize(0.4);
// Plotting the second breakdown voltage plot
canvas->cd(2);
gPad->SetGridx(1);
gPad->SetGridy(1);
gr2->Draw("AP");
gr2->GetXaxis()->SetTitle("Bias voltage (V)");
gr2->GetYaxis()->SetTitle("Peak separation");
gr2->GetYaxis()->CenterTitle();
gr2->Fit("pol1","Q");
TF1 *fit2 = gr2->GetFunction("pol1");
fparam[0] = fit2->GetParameter(0);
fparamerr[0] = fit2->GetParError(0);
fparam[1] = fit2->GetParameter(1);
fparamerr[1] = fit2->GetParError(1);
meanval = -fparam[0]/fparam[1];
if(!cleanPlots)
{
sprintf(ctemp, "#splitline{#Delta_{p}(U) = (%.2lf #pm %.2lf)#timesU + (%.2lf #pm %.3lf)}{U_{0} = %.2lf #pm %.3lf}", fparam[0], fparamerr[0], fparam[1], fparamerr[1], meanval, meanval*(TMath::Abs(fparamerr[0]/fparam[0]) + TMath::Abs(fparamerr[1]/fparam[1])) );
latex = new TLatex();
latex->SetTextSize(0.039);
latex->DrawLatex(volt[0], 0.97*psep2[sortindex[nrp-1]], ctemp);
}
else
printf("#Delta_p(U) = (%.2lf #pm %.2lf)*U + (%.2lf #pm %.3lf)\nU_0 = %.2lf #pm %.3lf", fparam[0], fparamerr[0], fparam[1], fparamerr[1], meanval, meanval*(TMath::Abs(fparamerr[0]/fparam[0]) + TMath::Abs(fparamerr[1]/fparam[1])) );
}
else
printf("#Delta_p(U) = (%.2lf #pm %.2lf)*U + (%.2lf #pm %.3lf)\nU_0 = %.2lf #pm %.3lf", fparam[0], fparamerr[0], fparam[1], fparamerr[1], meanval, meanval*(TMath::Abs(fparamerr[0]/fparam[0]) + TMath::Abs(fparamerr[1]/fparam[1])) );
 
// Plotting the third breakdown voltage plot
canvas->cd(3);
gPad->SetGridx(1);
gPad->SetGridy(1);
 
gr3->Draw("AP");
gr3->GetXaxis()->SetTitle("Bias voltage (V)");
gr3->GetYaxis()->SetTitle("Peak separation");
gr3->GetYaxis()->CenterTitle();
gr3->Fit("pol1","Q");
TF1 *fit3 = gr3->GetFunction("pol1");
fparam[0] = fit3->GetParameter(0);
fparamerr[0] = fit3->GetParError(0);
fparam[1] = fit3->GetParameter(1);
fparamerr[1] = fit3->GetParError(1);
 
meanval = -fparam[0]/fparam[1];
if(!cleanPlots)
// Third graph
if(separations > 2)
{
sprintf(ctemp, "#splitline{#Delta_{p}(U) = (%.2lf #pm %.2lf)#timesU + (%.2lf #pm %.3lf)}{U_{0} = %.2lf #pm %.3lf}", fparam[0], fparamerr[0], fparam[1], fparamerr[1], meanval, meanval*(TMath::Abs(fparamerr[0]/fparam[0]) + TMath::Abs(fparamerr[1]/fparam[1])) );
latex = new TLatex();
latex->SetTextSize(0.039);
latex->DrawLatex(volt[0]-(volt[1]-volt[0]), 0.97*psep3[sortindex[nrp-1]], ctemp);
TGraphErrors *gr3 = new TGraphErrors(nrp, volt, psep3, volterr, pseperr3);
if(!cleanPlots)
gr3->SetTitle("3rd - 4th peak separation");
else
gr3->SetTitle();
gr3->SetLineColor(kGreen);
gr3->SetMarkerColor(kGreen);
gr3->SetMarkerStyle(22);
gr3->SetMarkerSize(0.4);
// Plotting the third breakdown voltage plot
canvas->cd(3);
gPad->SetGridx(1);
gPad->SetGridy(1);
gr3->Draw("AP");
gr3->GetXaxis()->SetTitle("Bias voltage (V)");
gr3->GetYaxis()->SetTitle("Peak separation");
gr3->GetYaxis()->CenterTitle();
gr3->Fit("pol1","Q");
TF1 *fit3 = gr3->GetFunction("pol1");
fparam[0] = fit3->GetParameter(0);
fparamerr[0] = fit3->GetParError(0);
fparam[1] = fit3->GetParameter(1);
fparamerr[1] = fit3->GetParError(1);
meanval = -fparam[0]/fparam[1];
if(!cleanPlots)
{
sprintf(ctemp, "#splitline{#Delta_{p}(U) = (%.2lf #pm %.2lf)#timesU + (%.2lf #pm %.3lf)}{U_{0} = %.2lf #pm %.3lf}", fparam[0], fparamerr[0], fparam[1], fparamerr[1], meanval, meanval*(TMath::Abs(fparamerr[0]/fparam[0]) + TMath::Abs(fparamerr[1]/fparam[1])) );
latex = new TLatex();
latex->SetTextSize(0.039);
latex->DrawLatex(volt[0], 0.97*psep3[sortindex[nrp-1]], ctemp);
}
else
printf("#Delta_p(U) = (%.2lf #pm %.2lf)*U + (%.2lf #pm %.3lf)\nU_0 = %.2lf #pm %.3lf", fparam[0], fparamerr[0], fparam[1], fparamerr[1], meanval, meanval*(TMath::Abs(fparamerr[0]/fparam[0]) + TMath::Abs(fparamerr[1]/fparam[1])) );
}
else
printf("#Delta_p(U) = (%.2lf #pm %.2lf)*U + (%.2lf #pm %.3lf)\nU_0 = %.2lf #pm %.3lf", fparam[0], fparamerr[0], fparam[1], fparamerr[1], meanval, meanval*(TMath::Abs(fparamerr[0]/fparam[0]) + TMath::Abs(fparamerr[1]/fparam[1])) );
 
// Saving the produced plot
canvas->SaveAs(plotfile);
}
 
1582,21 → 1837,24
fp = fopen(paramname, "w");
fclose(fp);
 
int peaklimit = 5;
int peaklimit = minPeak->GetNumber()+1; // +1 to account for the pedestal peak
printf("The minimum peak limit is set to: %d\n", peaklimit);
int p = 0;
double dtemp;
double volt[files->GetSize()], volterr[files->GetSize()], sep[3][files->GetSize()], seperr[3][files->GetSize()];
int first = 1;
 
// Initialize all values
for(int m = 0; m < files->GetSize(); m++)
{
volt[m] = 0; volterr[m] = 0;
for(int i = 0; i < 3; i++)
{ sep[i][m] = 0; seperr[i][m] = 0; }
if(m < 20) { meanparam[m] = 0; meanparamerr[m] = 0; }
}
 
for(int m = 0; m < files->GetSize(); m++)
{
for(int i = 0; i < 20; i++) { meanparam[20] = 0; meanparamerr[20] = 0; }
 
DisplayHistogram( (char*)(files->At(m)->GetTitle()), 0);
dtemp = evtheader.biasvolt;
gCanvas->Modified();
1624,9 → 1882,7
float yp = h2->GetBinContent(bin);
par[3*i] = yp;
par[3*i+1] = xp;
// par[3*i+2] = 3;
par[3*i+2] = (double)fitSigma->GetNumber();
// printf("Peak %d: %f\n", i+1, xp);
}
// Fit the histogram
1642,6 → 1898,7
// Gather the parameters (mean peak value for now)
int j = 1;
int nrfit = 0;
bool errors = false;
while(1)
{
if( (fparam[j] < 1.E-30) || (fparamerr[j] < 1.E-10) )
1648,7 → 1905,7
break;
else
{
if(fparam[j] > 0)
if(fparam[j] > pedesLow->GetNumber())
{
meanparam[nrfit] = fparam[j];
meanparamerr[nrfit] = fparamerr[j];
1658,68 → 1915,125
j+=3;
}
printf("%d peaks fitted.\n",nrfit);
 
// Write out parameters to a file
fp = fopen(paramname, "a");
TMath::Sort(nrfit, meanparam, sortindex, kFALSE);
// Only save the ones that do not have a too large error on peak separation for the first three peaks
if( ((TMath::Abs(meanparamerr[sortindex[2]]) + TMath::Abs(meanparamerr[sortindex[1]]))/(meanparam[sortindex[2]] - meanparam[sortindex[1]]) < accError->GetNumber()) && ((TMath::Abs(meanparamerr[sortindex[3]]) + TMath::Abs(meanparamerr[sortindex[2]]))/(meanparam[sortindex[3]] - meanparam[sortindex[2]]) < accError->GetNumber()) && ((TMath::Abs(meanparamerr[sortindex[4]]) + TMath::Abs(meanparamerr[sortindex[3]]))/(meanparam[sortindex[4]] - meanparam[sortindex[3]]) < accError->GetNumber()) )
// if( (seperr[0][0]/sep[0][0] < accError->GetNumber()) && (seperr[1][0]/sep[1][0] < accError->GetNumber()) && (seperr[2][0]/sep[2][0] < accError->GetNumber()) )
if(nrfit >= peaklimit)
{
fprintf(fp, "%le\t%d\t", dtemp, nrfit);
TMath::Sort(nrfit, meanparam, sortindex, kFALSE);
 
for(int i = 0; i < nrfit; i++)
// Write out parameters to a file
// fp = fopen(paramname, "a");
// Only save the ones that do not have a too large error on peak separation for the first three peaks
// if( ((TMath::Abs(meanparamerr[sortindex[2]]) + TMath::Abs(meanparamerr[sortindex[1]]))/(meanparam[sortindex[2]] - meanparam[sortindex[1]]) < accError->GetNumber()) && ((TMath::Abs(meanparamerr[sortindex[3]]) + TMath::Abs(meanparamerr[sortindex[2]]))/(meanparam[sortindex[3]] - meanparam[sortindex[2]]) < accError->GetNumber()) && ((TMath::Abs(meanparamerr[sortindex[4]]) + TMath::Abs(meanparamerr[sortindex[3]]))/(meanparam[sortindex[4]] - meanparam[sortindex[3]]) < accError->GetNumber()) )
// if( (seperr[0][0]/sep[0][0] < accError->GetNumber()) && (seperr[1][0]/sep[1][0] < accError->GetNumber()) && (seperr[2][0]/sep[2][0] < accError->GetNumber()) )
// {
// fprintf(fp, "%le\t%d\t", dtemp, nrfit);
 
// for(int i = 0; i < nrfit; i++)
// {
// if(debug)
// printf("Peak %d (%lfV): %lf\t%lf\n", i+1, dtemp, meanparam[sortindex[i]], meanparamerr[sortindex[i]]);
// fprintf(fp, "%le\t%le\t", meanparam[sortindex[i]], meanparamerr[sortindex[i]]);
// }
// printf("\n");
// fprintf(fp, "\n");
// }
 
// fclose(fp);
h2->SetStats(0);
gCanvas->Modified();
gCanvas->Update();
// Save each fitting plot
if(exfitplots->IsDown())
{
if(debug)
printf("Peak %d (%lfV): %lf\t%lf\n", i+1, dtemp, meanparam[sortindex[i]], meanparamerr[sortindex[i]]);
fprintf(fp, "%le\t%le\t", meanparam[sortindex[i]], meanparamerr[sortindex[i]]);
remove_ext((char*)files->At(m)->GetTitle(), ctemp);
sprintf(exportname, "%s_fit.pdf", ctemp);
gCanvas->SaveAs(exportname);
}
printf("\n");
fprintf(fp, "\n");
}
volt[p] = dtemp;
volterr[p] = 1.e-4;
 
fclose(fp);
if(nrfit == 3)
{
sep[0][p] = meanparam[sortindex[2]] - meanparam[sortindex[1]];
seperr[0][p] = TMath::Abs(meanparamerr[sortindex[2]]) + TMath::Abs(meanparamerr[sortindex[1]]);
 
h2->SetStats(0);
gCanvas->Modified();
gCanvas->Update();
errors = (seperr[0][p]/sep[0][p] < accError->GetNumber());
 
// Save each fitting plot
if(exfitplots->IsDown())
{
remove_ext((char*)files->At(m)->GetTitle(), ctemp);
sprintf(exportname, "%s_fit.pdf", ctemp);
gCanvas->SaveAs(exportname);
}
if(debug)
printf("p=%d:\t%lf\t%lf\t%lf\n", p, volt[p], sep[0][p], seperr[0][p]);
}
else if(nrfit == 4)
{
sep[0][p] = meanparam[sortindex[2]] - meanparam[sortindex[1]];
sep[1][p] = meanparam[sortindex[3]] - meanparam[sortindex[2]];
seperr[0][p] = TMath::Abs(meanparamerr[sortindex[2]]) + TMath::Abs(meanparamerr[sortindex[1]]);
seperr[1][p] = TMath::Abs(meanparamerr[sortindex[3]]) + TMath::Abs(meanparamerr[sortindex[2]]);
 
// Get points for mean peak values and create a breakdown voltage plot
if(nrfit >= peaklimit)
{
sep[0][p] = meanparam[sortindex[2]] - meanparam[sortindex[1]];
sep[1][p] = meanparam[sortindex[3]] - meanparam[sortindex[2]];
sep[2][p] = meanparam[sortindex[4]] - meanparam[sortindex[3]];
seperr[0][p] = TMath::Abs(meanparamerr[sortindex[2]]) + TMath::Abs(meanparamerr[sortindex[1]]);
seperr[1][p] = TMath::Abs(meanparamerr[sortindex[3]]) + TMath::Abs(meanparamerr[sortindex[2]]);
seperr[2][p] = TMath::Abs(meanparamerr[sortindex[4]]) + TMath::Abs(meanparamerr[sortindex[3]]);
volt[p] = dtemp;
volterr[p] = 1.e-4;
if(debug)
printf("p=%d:\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n", p, volt[p], sep[0][p], seperr[0][p], sep[1][p], seperr[1][p], sep[2][p], seperr[2][p]);
errors = ((seperr[0][p]/sep[0][p] < accError->GetNumber()) && (seperr[1][p]/sep[1][p] < accError->GetNumber()));
 
if(debug)
printf("p=%d:\t%lf\t%lf\t%lf\t%lf\t%lf\n", p, volt[p], sep[0][p], seperr[0][p], sep[1][p], seperr[1][p]);
}
else if(nrfit > 4)
{
sep[0][p] = meanparam[sortindex[2]] - meanparam[sortindex[1]];
sep[1][p] = meanparam[sortindex[3]] - meanparam[sortindex[2]];
sep[2][p] = meanparam[sortindex[4]] - meanparam[sortindex[3]];
seperr[0][p] = TMath::Abs(meanparamerr[sortindex[2]]) + TMath::Abs(meanparamerr[sortindex[1]]);
seperr[1][p] = TMath::Abs(meanparamerr[sortindex[3]]) + TMath::Abs(meanparamerr[sortindex[2]]);
seperr[2][p] = TMath::Abs(meanparamerr[sortindex[4]]) + TMath::Abs(meanparamerr[sortindex[3]]);
 
errors = ((seperr[0][p]/sep[0][p] < accError->GetNumber()) && (seperr[1][p]/sep[1][p] < accError->GetNumber()) && (seperr[2][p]/sep[2][p] < accError->GetNumber()));
 
if(debug)
printf("p=%d:\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n", p, volt[p], sep[0][p], seperr[0][p], sep[1][p], seperr[1][p], sep[2][p], seperr[2][p]);
}
 
// Write out parameters to a file
fp = fopen(paramname, "a");
 
// Accept only the points with a small enough error
if( (seperr[0][p]/sep[0][p] < accError->GetNumber()) && (seperr[1][p]/sep[1][p] < accError->GetNumber()) && (seperr[2][p]/sep[2][p] < accError->GetNumber()) )
if( errors )
{
if(first == 1)
{
fprintf(fp, "%le\t%d\t", dtemp, nrfit);
 
for(int i = 0; i < nrfit; i++)
{
if(debug)
printf("Peak %d (%lfV): %lf\t%lf\n", i+1, dtemp, meanparam[sortindex[i]], meanparamerr[sortindex[i]]);
fprintf(fp, "%le\t%le\t", meanparam[sortindex[i]], meanparamerr[sortindex[i]]);
}
printf("\n");
fprintf(fp, "\n");
first = 0;
}
 
p++;
}
else
printf("Point (at %.2lfV) rejected due to errors: %lf, %lf, %lf\n", volt[p], seperr[0][p]/sep[0][p], seperr[1][p]/sep[1][p], seperr[2][p]/sep[2][p]);
{
if(nrfit == 3)
printf("Point (at %.2lfV) rejected due to too large errors: %lf\n", volt[p], seperr[0][p]/sep[0][p]);
else if(nrfit == 4)
printf("Point (at %.2lfV) rejected due to too large errors: %lf, %lf\n", volt[p], seperr[0][p]/sep[0][p], seperr[1][p]/sep[1][p]);
else if(nrfit > 4)
printf("Point (at %.2lfV) rejected due to too large errors: %lf, %lf, %lf\n", volt[p], seperr[0][p]/sep[0][p], seperr[1][p]/sep[1][p], seperr[2][p]/sep[2][p]);
}
 
fclose(fp);
}
 
if(q == 1) break;
 
first = 1;
}
 
// Plot & fit breakdown voltage plots
1727,7 → 2041,7
{
remove_from_last((char*)files->At(0)->GetTitle(), '_', ctemp);
sprintf(paramname, "%s_breakdown.pdf", ctemp);
MakeBreakdownPlot(p, volt, volterr, sep[0], seperr[0], sep[1], seperr[1], sep[2], seperr[2], paramname);
MakeBreakdownPlot(p, volt, volterr, sep[0], seperr[0], sep[1], seperr[1], sep[2], seperr[2], paramname, peaklimit-2);
}
}
 
1905,6 → 2219,7
*/
integralCount[i] += ((double)m)/((double)k);
inroot->Close();
delete inroot;
}
}
2149,24 → 2464,22
char ctemp[256];
int j, k = 0, m = 0, n = 0, k2 = 0, m2 = 0;
 
// TCanvas *gCanvas = new TCanvas("canv","canv",900,900);
TCanvas *gCanvas;
TTree *header_data, *meas_data;
double *integralCount, *integralPedestal;
integralCount = new double[nrfiles];
integralPedestal = new double[nrfiles];
// double xsurfmin, ysurfmin, zsurfmin;
double *angle;
double *pdeval;
double *muval;
angle = new double[nrfiles];
pdeval = new double[nrfiles];
muval = new double[nrfiles];
for(int i = 0; i < (int)nrfiles; i++) {integralCount[i] = 0; integralPedestal[i] = 0; }
 
// TGraph *gScan[2]; // graph for angle dependence
int nrentries;
// double minInteg, maxInteg;
 
// char exportname[256];
 
TSpectrum *spec;
TH1F *histtemp;
TH1 *histback;
2291,8 → 2604,16
inroot->GetObject("meas_data", meas_data);
// Reading the header
// header_data->SetBranchAddress("angle", &evtheader.angle);
// header_data->GetEntry(0);
if( header_data->FindBranch("angle") )
{
header_data->SetBranchAddress("angle", &evtheader.angle);
header_data->GetEntry(0);
}
else
{
printf("Error! Selected file has no angle header value. Please edit header to add the angle header value.\n");
break;
}
char rdc[256];
j = selectCh->GetNumber();
2332,9 → 2653,7
}
}
 
// angle[i] = (double)(evtheader.angle);
angle[i] = (double)(i*15.*TMath::ACos(-1.)/180.); // angle in radians
cout << "Angle = " << angle[i] << endl;
angle[i] = (double)(evtheader.angle); // angle in radians
 
// integralCount[i] += ((double)m)/((double)k);
integralCount[i] += (double)m;
2344,8 → 2663,10
cout << "Integral (" << k2 << " evts) = " << integralPedestal[i] << endl;
 
muval[i] = -TMath::Log((double)k2/(double)k);
cout << "Mu = " << muval[i] << endl;
 
pdeval[i] = muval[i]/(muval[0]*TMath::Cos(angle[i]*TMath::ACos(-1.)/180.));
inroot->Close();
delete inroot;
}
}
2357,12 → 2678,45
for(int i = 0; i < (int)files->GetSize(); i++)
{
// Relative PDE calculation
cout << angle[i] << "\t" << muval[i] << "\t" << muval[i]/(muval[0]*TMath::Cos(angle[i])) << endl;
cout << angle[i] << "\t" << muval[i] << "\t" << pdeval[i] << endl;
}
 
// Plot mu and PDE angle dependance plots
gCanvas = new TCanvas("canv","canv",1200,900);
gCanvas->SetGrid();
 
TGraph *pde = new TGraph(nrentries, angle, pdeval);
pde->SetMarkerStyle(21);
pde->SetMarkerSize(1.0);
pde->SetMarkerColor(2);
pde->SetLineWidth(2);
pde->SetLineColor(2);
pde->GetXaxis()->SetLabelSize(0.030);
pde->GetXaxis()->CenterTitle();
pde->GetXaxis()->SetRange(-5,90);
pde->GetXaxis()->SetRangeUser(-5,90);
pde->GetYaxis()->SetTitleOffset(1.2);
pde->GetYaxis()->SetLabelSize(0.030);
pde->GetYaxis()->CenterTitle();
pde->GetYaxis()->SetRangeUser(0.3, 1.18);
pde->Draw("ALP");
 
pde->SetTitle(";Incidence angle (#circ);Relative PDE(#theta) / #mu(#theta)");
 
TGraph *mugr = new TGraph(nrentries, angle, muval);
mugr->SetMarkerStyle(20);
mugr->SetMarkerSize(1.0);
mugr->SetMarkerColor(4);
mugr->SetLineWidth(2);
mugr->SetLineColor(4);
mugr->Draw("SAME;LP");
 
gCanvas->Modified();
gCanvas->Update();
}
}
 
void TGAppMainFrame::RunMeas(void *ptr, int runCase, int zaxisscan)
void TGAppMainFrame::RunMeas(void *ptr, int runCase, int zaxisscan, int &scanon)
{
printf("Start of Run, run case %d\n", runCase);
float progVal;
2553,6 → 2907,11
 
if (gDaq)
{
if(scanon == 0)
{
gDaq->init(evtheader.nrch);
scanon = 1;
}
gDaq->fStop=0;
// Start gathering
gDaq->start();
2643,6 → 3002,9
// Start the acquisition
void TGAppMainFrame::StartAcq()
{
// Variable that will initialize camac only once (for scans)
int scanon = 0;
 
// Determine the type of measurement to perform
int vscan = 0, pscan = 0, zscan = 0;
if(voltscanOn->IsOn()) vscan = 1;
2715,7 → 3077,7
printf("Continuing...\n");
// Here comes function to start histogramming <<<<<<<<<<<<<<<<<<<<<<<<
RunMeas((void*)0, i, 0);
RunMeas((void*)0, i, 0, scanon);
fflush(stdout);
}
2828,7 → 3190,7
// for (k=0;k<(NTDCCH+NADCCH)/2;k++) gHisto2D[k]->Reset();
// Here comes function to start histogramming <<<<<<<<<<<<<<<<<<<<<<<<
RunMeas((void*)0, (j*repetX + i), zscan );
RunMeas((void*)0, (j*repetX + i), zscan , scanon);
fflush(stdout);
}
2893,7 → 3255,7
started = kTRUE;
 
printf("Running a single scan...\n");
RunMeas((void*)0, 0, 0);
RunMeas((void*)0, 0, 0, scanon);
printf("Measurement finished...\n");
printf("\n");
}
3035,6 → 3397,12
}
}
 
// Open the header edit window when pressing on editHeader button
void TGAppMainFrame::HeaderEdit()
{
OpenWindow(2);
}
 
// Display the currently selected histogram in file list
void TGAppMainFrame::DisplayHistogram(char* histfile, int histtype)
{
3064,8 → 3432,11
header_data->GetEntry(0);
header_data->SetBranchAddress("temperature", &evtheader.temperature);
header_data->GetEntry(0);
header_data->SetBranchAddress("angle", &evtheader.angle);
header_data->GetEntry(0);
if( header_data->FindBranch("angle") )
{
header_data->SetBranchAddress("angle", &evtheader.angle);
header_data->GetEntry(0);
}
header_data->SetBranchAddress("laserinfo", &evtheader.laserinfo);
header_data->GetEntry(0);
 
3082,8 → 3453,10
printf("- Table position (X,Y,Z): %d, %d, %d\n", evtheader.xpos, evtheader.ypos, evtheader.zpos);
if(evtheader.temperature)
printf("- Temperature: %lf\n", evtheader.temperature);
if(evtheader.angle)
if( header_data->FindBranch("angle") )
printf("- Incidence angle: %lf\n", evtheader.angle);
else
printf("- Incidence angle: No angle information!\n");
printf("- Laser and filter settings: %s\n", evtheader.laserinfo);
}
 
3096,7 → 3469,7
disptemp->SetNumber(evtheader.temperature);
else
disptemp->SetNumber(0.0);
if(evtheader.angle)
if( header_data->FindBranch("angle") )
dispangle->SetNumber(evtheader.angle);
else
dispangle->SetNumber(0.0);
3386,6 → 3759,7
printf("Progress = %lf\n", progVal);
}*/
 
inroot->Close();
delete inroot;
}
}
3836,6 → 4210,11
fMenuBar->AddPopup(new TGHotString("&Tools"),fMenuTools,fMenuBarItemLayout);
fMenuBar->AddPopup(new TGHotString("&Windows"),fMenuWindow,fMenuBarItemLayout);
fMenuBar->AddPopup(new TGHotString("&Help"), fMenuHelp, fMenuBarItemLayout);
 
// Disable fieldpoint if we are not connected to the IJS network
#if IJSNET == 0
fMenuTools->DisableEntry(M_TOOLS_FIELDPOINT);
#endif
}
 
//---------------------------------------------------------------
4426,7 → 4805,7
fileList->Resize(300, (3*subwin[1]/7)-10 );
mdiFrame->AddFrame(fileList, f2);
 
// Multiple file selection toggle, previous/next controls and clear list
// Multiple file selection toggle, previous/next controls, clear list and edit header
fH1 = new TGHorizontalFrame(mdiFrame, subgroup[0], 30);
multiSelect = new TGCheckButton(fH1, "Multiple file select");
multiSelect->Resize(50,22);
4444,6 → 4823,12
clearList->Resize(80,22);
fH1->AddFrame(clearList, f0right);
 
TGTextButton *editHeader = new TGTextButton(fH1, "Edit header");
editHeader->SetTextJustify(36);
editHeader->SetWrapLength(-1);
editHeader->Resize(80,22);
fH1->AddFrame(editHeader, f0right);
 
nextFile = new TGTextButton(fH1, ">>");
nextFile->SetTextJustify(36);
nextFile->SetWrapLength(-1);
4521,7 → 4906,7
mdiFrame = histogramPaneCtr->GetMdiFrame();
 
// Control for histogram X range
subgroup[0] = subwin[0]-10;
subgroup[0] = subwin[0]-6;
fG1 = new TGGroupFrame(mdiFrame, "Histogram display");
fH1 = new TGHorizontalFrame(fG1, subgroup[0], 30);
lab = new TGLabel(fH1, "ADC range (min, max):");
4620,37 → 5005,57
// Fitting controls for ADC spectrum
fG1 = new TGGroupFrame(mdiFrame, "Fit Settings");
fH1 = new TGHorizontalFrame(fG1, subgroup[0], 30);
lab = new TGLabel(fH1, "Peak sigma:");
fH1->AddFrame(lab, f0centery);
fitSigma = new TGNumberEntry(fH1, 1.2, 3, 999, TGNumberFormat::kNESRealThree, TGNumberFormat::kNEANonNegative);
fH2 = new TGHorizontalFrame(fH1, subgroup[0], 30);
lab = new TGLabel(fH2, "Peak sigma:");
fH2->AddFrame(lab, f0centery);
fitSigma = new TGNumberEntry(fH2, 1.2, 3, 999, TGNumberFormat::kNESRealThree, TGNumberFormat::kNEANonNegative);
fitSigma->Resize(60,22);
fH1->AddFrame(fitSigma, f0centery);
fG1->AddFrame(fH1, f2);
fH2->AddFrame(fitSigma, f0centery);
 
fH1 = new TGHorizontalFrame(fG1, subgroup[0], 30);
lab = new TGLabel(fH1, "Signal/Noise treshold:");
fH1->AddFrame(lab, f0centery);
fitTresh = new TGNumberEntry(fH1, 5.0E-3, 3, 999, TGNumberFormat::kNESReal, TGNumberFormat::kNEANonNegative);
lab = new TGLabel(fH2, " Signal/Noise treshold:");
fH2->AddFrame(lab, f0centery);
fitTresh = new TGNumberEntry(fH2, 5.0E-3, 3, 999, TGNumberFormat::kNESReal, TGNumberFormat::kNEANonNegative);
fitTresh->Resize(60,22);
fH1->AddFrame(fitTresh, f0centery);
fH2->AddFrame(fitTresh, f0centery);
fH1->AddFrame(fH2, f0centerx);
fG1->AddFrame(fH1, f2);
 
fH1 = new TGHorizontalFrame(fG1, subgroup[0], 30);
lab = new TGLabel(fH1, "Background interpolation:");
fH1->AddFrame(lab, f0centery);
fitInter = new TGNumberEntry(fH1, 7, 3, 999, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
fH2 = new TGHorizontalFrame(fH1, subgroup[0], 30);
lab = new TGLabel(fH2, "Background interpolation:");
fH2->AddFrame(lab, f0centery);
fitInter = new TGNumberEntry(fH2, 7, 3, 999, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);
fitInter->Resize(60,22);
fH1->AddFrame(fitInter, f0centery);
fH2->AddFrame(fitInter, f0centery);
fH1->AddFrame(fH2, f0centerx);
fG1->AddFrame(fH1, f2);
 
fH1 = new TGHorizontalFrame(fG1, subgroup[0], 30);
lab = new TGLabel(fH1, "Peak fit max. acceptable error:");
fH1->AddFrame(lab, f0centery);
accError = new TGNumberEntry(fH1, 0.15, 3, 999, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative);
fH2 = new TGHorizontalFrame(fH1, subgroup[0], 30);
lab = new TGLabel(fH2, "Peak fit max. acceptable error:");
fH2->AddFrame(lab, f0centery);
accError = new TGNumberEntry(fH2, 0.15, 3, 999, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative);
accError->Resize(60,22);
fH1->AddFrame(accError, f0centery);
fH2->AddFrame(accError, f0centery);
fH1->AddFrame(fH2, f0centerx);
fG1->AddFrame(fH1, f2);
 
fH1 = new TGHorizontalFrame(fG1, subgroup[0], 30);
fH2 = new TGHorizontalFrame(fH1, subgroup[0], 30);
lab = new TGLabel(fH2, "Peak min. limit:");
fH2->AddFrame(lab, f0centery);
minPeak = new TGNumberEntry(fH2, 4, 3, 999, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 2, 20);
minPeak->Resize(50,22);
fH2->AddFrame(minPeak, f0centery);
 
lab = new TGLabel(fH2, " Pedestal lower limit:");
fH2->AddFrame(lab, f0centery);
pedesLow = new TGNumberEntry(fH2, 0.00, 3, 999, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative);
pedesLow->Resize(60,22);
fH2->AddFrame(pedesLow, f0centery);
fH1->AddFrame(fH2, f0centerx);
fG1->AddFrame(fH1, f2);
 
exfitplots = new TGCheckButton(fG1, "Export fitting plots ON/OFF");
exfitplots->Resize(50,22);
exfitplots->SetState(kButtonUp);
4686,6 → 5091,7
selectDir->Connect("Clicked()", "TGAppMainFrame", this, "SelectDirectory()");
multiSelect->Connect("Clicked()", "TGAppMainFrame", this, "ListMultiSelect()");
multiSelectAll->Connect("Clicked()", "TGAppMainFrame", this, "ListSelectAll()");
editHeader->Connect("Clicked()", "TGAppMainFrame", this, "HeaderEdit()");
prevFile->Connect("Clicked()", "TGAppMainFrame", this, "FileListNavigation(=-2)");
nextFile->Connect("Clicked()", "TGAppMainFrame", this, "FileListNavigation(=-3)");
fileList->Connect("DoubleClicked(Int_t)", "TGAppMainFrame", this, "FileListNavigation(Int_t)");
4741,6 → 5147,7
{
/* WinID:
* - 1 = fieldpoint temperature sensor
* - 2 = file header editor
*/
 
TGMdiFrame *mdiFrame;
4762,8 → 5169,8
int yearrange[2];
 
subwin[0] = 3*((winWidth/4)-5); subwin[1] = (int)(2*((winHeight/3)-5))+10;
histogramPaneCtr = new TGMdiSubwindow(fMainFrame, subwin[0], subwin[1]);
mdiFrame = histogramPaneCtr->GetMdiFrame();
fieldpointPane = new TGMdiSubwindow(fMainFrame, subwin[0], subwin[1]);
mdiFrame = fieldpointPane->GetMdiFrame();
subgroup[0] = subwin[0]-10;
subgroup[1] = 7*subwin[1]/12;
5068,6 → 5475,117
// closeTemp->Connect("Clicked()", "TGAppMainFrame", this, "UpdateTempPlot()");
}
// Fieldpoint pane -------------------------------------------------------------------------
//
// Header editor pane ----------------------------------------------------------------------
else if(winid == 2)
{
subwin[0] = 12*((winWidth/16)-5); subwin[1] = (int)(1*((winHeight/3)-10));
headerPane = new TGMdiSubwindow(fMainFrame, subwin[0], subwin[1]);
mdiFrame = headerPane->GetMdiFrame();
subgroup[0] = subwin[0]-10;
subgroup[1] = 7*subwin[1]/12;
 
// Changing header info (no timestamp change possible)
fG1 = new TGGroupFrame(mdiFrame, "Header edit information");
fH1 = new TGHorizontalFrame(fG1, subgroup[0], 30);
biasedittick = new TGCheckButton(fH1, "Bias voltage edit: ");
biasedittick->Resize(80,22);
biasedittick->SetState(kButtonUp);
fH1->AddFrame(biasedittick, f0centerx);
biasedit = new TGNumberEntry(fH1, 0.00, 4, 999, TGNumberFormat::kNESRealThree, TGNumberFormat::kNEANonNegative);
biasedit->Resize(80,22);
biasedit->SetState(kFALSE);
fH1->AddFrame(biasedit, f0centery);
fG1->AddFrame(fH1, f0);
 
fH1 = new TGHorizontalFrame(fG1, subgroup[0], 30);
posedittick = new TGCheckButton(fH1, "Table position edit (X, Y, Z): ");
posedittick->Resize(80,22);
posedittick->SetState(kButtonUp);
fH1->AddFrame(posedittick, f0centerx);
for(int i = 0; i < 3; i++)
{
posedit[i] = new TGNumberEntry(fH1, 0, 6, 999, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAAnyNumber);
posedit[i]->Resize(80,22);
posedit[i]->SetState(kFALSE);
fH1->AddFrame(posedit[i], f0centery);
}
fG1->AddFrame(fH1, f0);
 
fH1 = new TGHorizontalFrame(fG1, subgroup[0], 30);
tempedittick = new TGCheckButton(fH1, "Chamber temperature edit: ");
tempedittick->Resize(80,22);
tempedittick->SetState(kButtonUp);
fH1->AddFrame(tempedittick, f0centerx);
tempedit = new TGNumberEntry(fH1, 0.00, 6, 999, TGNumberFormat::kNESRealOne, TGNumberFormat::kNEAAnyNumber);
tempedit->Resize(80,22);
tempedit->SetState(kFALSE);
fH1->AddFrame(tempedit, f0centery);
fG1->AddFrame(fH1, f0);
 
fH1 = new TGHorizontalFrame(fG1, subgroup[0], 30);
angleedittick = new TGCheckButton(fH1, "Incidence angle edit: ");
angleedittick->Resize(80,22);
angleedittick->SetState(kButtonUp);
fH1->AddFrame(angleedittick, f0centerx);
angleedit = new TGNumberEntry(fH1, 0.00, 6, 999, TGNumberFormat::kNESRealOne, TGNumberFormat::kNEAAnyNumber);
angleedit->Resize(80,22);
angleedit->SetState(kFALSE);
fH1->AddFrame(angleedit, f0centery);
fG1->AddFrame(fH1, f0);
 
fH1 = new TGHorizontalFrame(fG1, subgroup[0], 30);
laseredittick = new TGCheckButton(fH1, "Laser settings edit: ");
laseredittick->Resize(80,22);
laseredittick->SetState(kButtonUp);
fH1->AddFrame(laseredittick, f0centerx);
laseredit = new TGTextEntry(fH1, "");
laseredit->Resize(440,22);
laseredit->SetState(kFALSE);
fH1->AddFrame(laseredit, f0centery);
fG1->AddFrame(fH1, f0);
 
ULong_t fcolor;
gClient->GetColorByName("red", fcolor);
 
lab = new TGLabel(fG1, "Note: Tick checkbox in front of each header information you wish to change (for security, they are unticked by default).");
fG1->AddFrame(lab, f0centerx);
lab = new TGLabel(fG1, "Warning: Using button \"Edit header\" will edit headers in all files currently selected in the Histogram file selection window.");
lab->SetTextColor(fcolor);
fG1->AddFrame(lab, f0centerx);
 
mdiFrame->AddFrame(fG1, f2);
 
editHead = new TGTextButton(mdiFrame, "Edit header");
editHead->SetTextJustify(36);
editHead->SetWrapLength(-1);
editHead->Resize(80,22);
mdiFrame->AddFrame(editHead, f0centerx);
mdiFrame->SetMdiHints(kMdiMinimize | kMdiMaximize | kMdiClose);
mdiFrame->SetWindowName("Edit datafile header");
mdiFrame->MapSubwindows();
mdiFrame->Layout();
mdiFrame->Move(1*((winWidth/12)-5)-30,(int)(1*((winHeight/12)-5)));
 
// Action connections
biasedittick->Connect("Clicked()", "TGAppMainFrame", this, "EditTickToggle(=1)");
posedittick->Connect("Clicked()", "TGAppMainFrame", this, "EditTickToggle(=2)");
tempedittick->Connect("Clicked()", "TGAppMainFrame", this, "EditTickToggle(=3)");
angleedittick->Connect("Clicked()", "TGAppMainFrame", this, "EditTickToggle(=4)");
laseredittick->Connect("Clicked()", "TGAppMainFrame", this, "EditTickToggle(=5)");
editHead->Connect("Clicked()", "TGAppMainFrame", this, "headeredit()");
/* updateTemp->Connect("Clicked()", "TGAppMainFrame", this, "UpdateTempPlot()");
tempEndOn->Connect("Clicked()", "TGAppMainFrame", this, "TempEndToggle()");
exportTemp->Connect("Clicked()", "TGAppMainFrame", this, "ExportTempPlot()");
tempFile[0]->Connect("Clicked()", "TGAppMainFrame", this, "GetTempFile(=0)");
tempFile[1]->Connect("Clicked()", "TGAppMainFrame", this, "GetTempFile(=1)");
*/ }
// Header editor pane ----------------------------------------------------------------------
//
else
printf("Window not implemented yet.\n");
}
 
//---------------------------------------------------------------
5107,19 → 5625,15
 
Bool_t TGMdiSubwindow::CloseWindow()
{
int ret = 0;
/* int ret = 0;
 
// if(noq == 0)
// {
new TGMsgBox(gClient->GetRoot(), fMdiFrame,
fMdiFrame->GetWindowName(), "Really want to close the window?",
kMBIconExclamation, kMBYes | kMBNo, &ret);
if (ret == kMBYes) return fMdiFrame->CloseWindow();
new TGMsgBox(gClient->GetRoot(), fMdiFrame,
fMdiFrame->GetWindowName(), "Really want to close the window?",
kMBIconExclamation, kMBYes | kMBNo, &ret);
if (ret == kMBYes) return fMdiFrame->CloseWindow();
 
return kFALSE;
// }
// else
// return fMdiFrame->CloseWindow();
return kFALSE;*/
return fMdiFrame->CloseWindow();
}
 
//---------------------------------------------------------------