Skip to content

Commit

Permalink
recon_test_pack: fix run_root_GATE.sh and associated files
Browse files Browse the repository at this point in the history
- the script itself was a bit garbled
- it failed because the num_tangential_poss in the .hroot was too small compared to the data,
such that counts didn't match
- the hroot and template.hs were inconsistent (max num non-arccorrected)

I've also made the template TOF.
  • Loading branch information
KrisThielemans committed Dec 27, 2023
1 parent 351c29d commit e3a4e28
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 35 deletions.
4 changes: 2 additions & 2 deletions recon_test_pack/root_header.hroot
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Inner ring diameter (cm) := 65.6
Average depth of interaction (cm) := 0.7
Distance between rings (cm) := 0.40625
Default bin size (cm) := 0.208626
Maximum number of non-arc-corrected bins := 344
Default number of arc-corrected bins := 344
Maximum number of non-arc-corrected bins := 501
Default number of arc-corrected bins := 501
View offset (degrees) := 0
Number of TOF time bins := 410
Size of timing bin (ps) := 10.00
Expand Down
39 changes: 10 additions & 29 deletions recon_test_pack/run_root_GATE.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# Author Nikos Efthimiou, Kris Thielemans

echo This script should work with STIR version 5.2. If you have
echo This script should work with STIR version 6.x. If you have
echo a later version, you might have to update your test pack.
echo Please check the web site.
echo
Expand Down Expand Up @@ -73,10 +73,7 @@ echo "GATE support detected!"
fi


echo Executing tests on ROOT files generated by GATE simulations, with cylindrical PET scanners



echo Executing tests on ROOT files generated by GATE simulations


# first delete any files remaining from a previous run
Expand All @@ -87,22 +84,12 @@ export INPUT_ROOT_FILE=test_PET_GATE.root
export INPUT=root_header.hroot
export TEMPLATE=template_for_ROOT_scanner.hs

#
# Get the number of events unlisted.
#
echo
echo ------------- Converting ROOT files to ProjData file -------------
echo
echo Making ProjData for all events
echo "------------------------------"
echo Running lm_to_projdata for all events

export OUT_PROJDATA_FILE=my_proj_from_lm_all_events
export EXCLUDE_SCATTERED=0
export EXCLUDE_RANDOM=0
lm_to_projdata ./lm_to_projdata.par 2>"./my_root_log_all.log"
all_events=`awk -F ":" '/Number of prompts/ {print $2}' my_root_log_all.log`
echo "Number of prompts stored in this time period:" ${all_events}

log=lm_to_projdata_from_ROOT_all_events.log
lm_to_projdata ./lm_to_projdata.par > ${log} 2>&1
if [ $? -ne 0 ]; then
Expand All @@ -114,17 +101,11 @@ else
all_events=$(cat ${log}|grep "Number of prompts stored in this time period" | grep -o -E '[0-9]+')

echo Number of prompts stored in this time period: ${all_events}
echo
fi
echo Reading all values from ROOT file

#
# Get the number of events directly from the ROOT file
#
echo
echo ------------- Reading values directly from ROOT file -------------
echo
cat << EOF > my_root.input
echo Reading values directly from ROOT file
log=root_output_all_events.log
${ROOT} -b -l ${INPUT_ROOT_FILE} << EOF >& ${log}
Coincidences->Draw(">>eventlist","","goff");
Int_t N = eventlist->GetN();
cout<<endl<<"Number of prompts stored in this time period:"<< N<<endl;
Expand All @@ -139,10 +120,10 @@ else
echo All events in ROOT file : ${all_root_num}
fi
if [ "$all_events" != "$all_root_num" ];then
echo "Mismatched number of events!"
ThereWereErrors=1
fi
echo
echo Making ProjData for true events only
echo "------------------------------"
echo Running lm_to_projdata *ONLY* for true events

export OUT_PROJDATA_FILE=my_proj_from_lm_true_events
Expand All @@ -160,11 +141,10 @@ else
true_events=$(cat ${log}| grep "Number of prompts stored in this time period" | grep -o -E '[0-9]+')
echo Number of prompts stored in this time period: ${true_events}
fi
echo
echo Reading true values from ROOT file ...

log=root_output_true_events.log
${ROOT} -b -l ${INPUT_ROOT_FILE} << EOF >& ${log}
${ROOT} -b -l ${INPUT_ROOT_FILE} << EOF >& ${log}
Coincidences->Draw(">>eventlist","eventID1 == eventID2 && comptonPhantom1 == 0 && comptonPhantom2 == 0","goff");
Int_t N = eventlist->GetN();
cout<<endl<<"Number of trues stored in this time period:"<< N<<endl;
Expand All @@ -179,6 +159,7 @@ else
echo True events in ROOT file : ${true_root_num}
fi
if [ "$true_events" != "$true_root_num" ]; then
echo "Mismatched number of events!"
ThereWereErrors=1
fi

Expand Down
10 changes: 6 additions & 4 deletions recon_test_pack/template_for_ROOT_scanner.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@ imagedata byte order := LITTLEENDIAN
applied corrections := {None}
!number format := float
!number of bytes per pixel := 4
number of dimensions := 4
number of dimensions := 5
matrix axis label [5] := timing positions
!matrix size [5] := 5
matrix axis label [4] := segment
!matrix size [4] := 7
matrix axis label [3] := view
!matrix size [3] := 252
matrix axis label [2] := axial coordinate
!matrix size [2] := { 1,2,3,4,3,2,1}
matrix axis label [1] := tangential coordinate
!matrix size [1] := 344
!matrix size [1] := 501
minimum ring difference per segment := { -3,-2,-1,0,1,2,3}
maximum ring difference per segment := { -3,-2,-1,0,1,2,3}
%TOF mashing factor:= 82
Expand All @@ -35,8 +37,8 @@ Average depth of interaction (cm) := 0.7
Distance between rings (cm) := 0.40625
Default bin size (cm) := 0.208626
View offset (degrees) := 0
Maximum number of non-arc-corrected bins := 344
Default number of arc-corrected bins := 344
Maximum number of non-arc-corrected bins := 501
Default number of arc-corrected bins := 501
Energy resolution := 0
Reference energy (in keV) := 511
Number of TOF time bins :=410
Expand Down

0 comments on commit e3a4e28

Please sign in to comment.