Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions t25_offline_digit/mac/main1.mac
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@
#/gate/digitizer/Singles/insert readout
#/gate/digitizer/Singles/readout/setDepth 1

#/gate/digitizer/Singles/insert blurring
#/gate/digitizer/Singles/blurring/setResolution 0.26
#/gate/digitizer/Singles/blurring/setEnergyOfReference 511. keV
/gate/digitizer/Singles/insert blurring
/gate/digitizer/Singles/blurring/setResolution 0.26
/gate/digitizer/Singles/blurring/setEnergyOfReference 511. keV

/gate/digitizer/Singles/insert thresholder
/gate/digitizer/Singles/thresholder/setThreshold 350. keV
Expand All @@ -182,6 +182,8 @@
#=====================================================

/gate/digitizer/Coincidences/setWindow 10. ns
/gate/digitizer/Coincidences/minSectorDifference 1
/gate/digitizer/Coincidences/MultiplesPolicy killAll

#=====================================================
# P A R T I C L E S O U R C E
Expand Down
9 changes: 0 additions & 9 deletions t25_offline_digit/mac/main1_offline_digitizer.mac
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@

/gate/digitizer/layers/insert adder

#/gate/digitizer/layers/insert readout
#/gate/digitizer/layers/readout/setDepth 1

#/gate/digitizer/Singles/insert adder
#/gate/digitizer/Singles/insert readout
#/gate/digitizer/Singles/readout/setDepth 1

/gate/digitizer/layers/insert blurring
/gate/digitizer/layers/blurring/setResolution 0.26
Expand All @@ -26,9 +20,6 @@
# INITIALIZE is needed to recover volumeID from hits using DetectorConstruction
/gate/run/initialize

#=======================================================================
# how to include a R A N D O M E N G I N E A N D S E E D for offline digitizer ???
#=============================================================================================



9 changes: 9 additions & 0 deletions t25_offline_digit/mac/main1_offline_geom.mac
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@


# Geometry is needed to identify layer with volumeID of hits and to perform operations with pulses
/gate/geometry/setMaterialDatabase data/GateMaterials_pet.db
/control/execute mac/PET_CylindricalPET_geom.mac


# INITIALIZE is needed to recover volumeID from hits using DetectorConstruction
/gate/run/initialize
4 changes: 4 additions & 0 deletions t25_offline_digit/mac/main1_offline_sorter.mac
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@


/gate/digitizer/Coincidences/setWindow 10. ns
#/gate/digitizer/Coincidences/setAcceptancePolicy4CC keepIfMultipleVolumeIDsInvolved
/gate/digitizer/Coincidences/setAcceptancePolicy4CC keepAll
#why there are more coincidences in keepAll than in keepIfMultipleVolumeIDsInvolved ? Is it possible that in the semi head BGo and LSO same volume ID ?? To be checked,


# There may be problems since by default in PET there is this minSectorDifference.
# I do not know how this is read offline.
Expand Down
36 changes: 29 additions & 7 deletions t25_offline_digit/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,43 @@ Simple Cylindrical PET with 20 x 20 block, 5x5 crystal, LSO and BGO layer, 4 rin
- Source: back to back 511 keV, half-life of 1223 sec (C11)

```shell
Gate mac/main2.mac
Gate mac/main1.mac
```
This will generate ```output/output1.root``` with all hits only.
This will generate ```output/output1.root``` with hits, singles and coincidences


```shell
Offline digitizer
```shell
GateDigit_hits_digitizer output/output1.root output/output1-singles.root mac/main1_offline_digitizer.mac
```
This will generate ```output/output1-singles.root``` with the singles.
This will generate ```output/output1-singles.root``` with the singles. There is an error message since there are branches not found since it is designed for CCMod data and those branches are missing here

Offline sorter
```shell
GateDigit_singles_sorter output/output1-singles.root output/output1-coincCCMod.root mac/main1_offline_sorter.mac abs
GateDigit_singles_sorter output/output1.root output/output1-coincCCMod.root mac/main1_offline_sorter.mac abs
```
We can generate the coincidences either from the singles of simulation stored in ```output/output1.root``` or from the offline generated singles ```output/output1-singles.root```
This will generate ```output/output1-coincCCMod.root``` with the coincidences

Convert CCMod coincidences into PET/SPECT coincidences format ( On branch anetxe offlineDigitizer, not yet in OpenGate)
```shell
Convert_CCMod2PETCoinc output/output1-coincCCMod.root output/output1-coinc.root mac/main1_offline_geom.mac
```

test with gam_gate. test_main.py

## Example 1.b

Simple Cylindrical PET with 20 x 20 block, 5x5 crystal, LSO and BGO layer, 4 rings.
- No phantom.
- Physics list: emstandard_opt4
- Digitizer: adder, readout (depth 1 or head), threshold, coinc 10 ns
- Source: back to back 511 keV, half-life of 1223 sec (C11)

```shell
GateDigit_singles_sorter output/output1-singles.root output/output1-coinc.root mac/main1_offline_sorter.mac abs
Gate mac/main1b.mac
```
This will generate ```output/output1-coinc.root``` with the singles.
This will generate ```output/output1b.root``` with hits, singles and coincidences



Expand Down
29 changes: 17 additions & 12 deletions t25_offline_digit/test_main1.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,38 @@
is_ok = gam.compare_root3(root_ref, root_offline,
"Singles", "Singles",
checked_keys, checked_keys,
tols, scalings, scalings,
tols, scalings,
'output/main1_root_singles.png')
print(is_ok)


# ------------------------------------------------------
# not yet possible to compare

'''print()
print()
gam.warning('Compare root coinc')
root_ref = 'output/output1.root'
root_offline = 'output/output1-coinc.root'

checked_keys = ['time', 'energy',
'globalPosX', 'globalPosY', 'globalPosZ']
checked_keys = ['time1','time2', 'energy1','energy2',
'globalPosX1','globalPosX2', 'globalPosY1','globalPosY2', 'globalPosZ1','globalPosZ2']
scalings = [1] * len(checked_keys)
tols = [0.01] * len(checked_keys)
tols[0] = 0.02 # time
tols[1] = 0.001 # energy
tols[2] = 0.8 # globalPosX
tols[3] = 0.4 # globalPosY
tols[4] = 0.2 # globalPosZ
tols[0] = 0.02 # time1
tols[1] = 0.02
tols[2] = 0.001 # energy1
tols[3] = 0.001 # energy2
tols[4] = 0.8 # globalPosX1
tols[5] = 0.8 # globalPosX2
tols[6] = 0.8 # globalPosY1
tols[7] = 0.8 # globalPosY2
tols[8] = 0.2 # globalPosZ1
tols[9] = 0.2 # globalPosZ2

print(scalings, tols)
is_ok = gam.compare_root3(root_ref, root_offline,
"Coincidences", "Coincidences",
checked_keys, checked_keys,
tols, scalings, scalings,
'output/main1_root_singles.png')
print(is_ok)'''
tols, scalings,
'output/main1_root_coincidences.png')
print(is_ok)