OpenGATE / Gate

Official public repository of Gate
http://www.opengatecollaboration.org
GNU Lesser General Public License v3.0
231 stars 261 forks source link

All Crystal IDs are the same with multiple crystals attached #684

Open matthew-ricks opened 1 week ago

matthew-ricks commented 1 week ago

I am building a simulation for a dual layer PET detector. Each detector panel is made of an inner LYSO layer that is 48x48 crystals and a BGO layer that is 32x32 crystals. The crystals are sized so that the layers are the same size. (see picture)

image

There does not seem to be the functionality to define a crystal repeater that has different sizes. What I have done instead is create two crystals and attach them separately (see setup from macro below). When I run this simulation, all of the events from the second crystal that I attach are assigned to a single crystalID. (below are screenshots of the crystalID for hits on both crystals)

image image

Thank you so much for looking into this!

# CYLINDRICAL /gate/world/daughters/name cylindricalPET /gate/world/daughters/insert cylinder /gate/cylindricalPET/placement/setTranslation 0.0 0.0 0.0 cm /gate/cylindricalPET/geometry/setRmax 12 cm /gate/cylindricalPET/geometry/setRmin 6.95 cm /gate/cylindricalPET/geometry/setHeight 12 cm /gate/cylindricalPET/setMaterial Air /gate/cylindricalPET/vis/forceWireframe /gate/cylindricalPET/vis/setVisible 0 /gate/cylindricalPET/vis/setColor white

# HEAD /gate/cylindricalPET/daughters/name head /gate/cylindricalPET/daughters/insert box /gate/head/placement/setTranslation 8.61 0.0 0.0 cm /gate/head/geometry/setXLength 17.8 mm /gate/head/geometry/setYLength 52.32 mm /gate/head/geometry/setZLength 104.64 mm /gate/head/setMaterial Air /gate/head/vis/setVisible 0 /gate/head/vis/setColor cyan

# BLOCK /gate/head/daughters/name block /gate/head/daughters/insert box /gate/block/placement/setTranslation 0.0 0.0 0.0 mm /gate/block/geometry/setXLength 17.8 mm /gate/block/geometry/setYLength 52.32 mm /gate/block/geometry/setZLength 52.32 mm /gate/block/setMaterial Air /gate/block/vis/setVisible 0 /gate/block/vis/setColor white

# CRYSTAL 0 (LYSO 48x48 inner) /gate/block/daughters/name crystal0 /gate/block/daughters/insert box /gate/crystal0/placement/setTranslation -3.05 0.0 0.0 mm /gate/crystal0/geometry/setXLength 6.1 mm /gate/crystal0/geometry/setYLength 1.09 mm /gate/crystal0/geometry/setZLength 1.09 mm /gate/crystal0/setMaterial Air /gate/crystal0/vis/setVisible 1 /gate/crystal0/vis/setColor blue

# CRYSTAL 1 (BGO 32x32 outer) /gate/block/daughters/name crystal1 /gate/block/daughters/insert box /gate/crystal1/placement/setTranslation 4.45 0.0 0.0 mm /gate/crystal1/geometry/setXLength 8.9 mm /gate/crystal1/geometry/setYLength 1.635 mm /gate/crystal1/geometry/setZLength 1.635 mm /gate/crystal1/setMaterial Air /gate/crystal1/vis/setVisible 1 /gate/crystal1/vis/setColor green

# LYSO layer /gate/crystal0/daughters/name LYSO /gate/crystal0/daughters/insert box /gate/LYSO/placement/setTranslation 0.0 0.0 0.0 mm /gate/LYSO/geometry/setXLength 6.1 mm /gate/LYSO/geometry/setYLength 1.01 mm /gate/LYSO/geometry/setZLength 1.01 mm /gate/LYSO/setMaterial LYSO /gate/LYSO/vis/setVisible 1 /gate/LYSO/vis/setColor red

# BGO layer /gate/crystal1/daughters/name BGO /gate/crystal1/daughters/insert box /gate/BGO/placement/setTranslation 0.0 0.0 0.0 mm /gate/BGO/geometry/setXLength 8.9 mm /gate/BGO/geometry/setYLength 1.55 mm /gate/BGO/geometry/setZLength 1.55 mm /gate/BGO/setMaterial BGO /gate/BGO/vis/setVisible 1 /gate/BGO/vis/setColor yellow

# REPEAT CRYSTAL 0 /gate/crystal0/repeaters/insert cubicArray /gate/crystal0/cubicArray/setRepeatNumberX 1 /gate/crystal0/cubicArray/setRepeatNumberY 48 /gate/crystal0/cubicArray/setRepeatNumberZ 48 /gate/crystal0/cubicArray/setRepeatVector 6.1 1.09 1.09 mm

# REPEAT CRYSTAL 1 /gate/crystal1/repeaters/insert cubicArray /gate/crystal1/cubicArray/setRepeatNumberX 1 /gate/crystal1/cubicArray/setRepeatNumberY 32 /gate/crystal1/cubicArray/setRepeatNumberZ 32 /gate/crystal1/cubicArray/setRepeatVector 8.9 1.635 1.635 mm

# REPEAT BLOCK /gate/block/repeaters/insert cubicArray /gate/block/cubicArray/setRepeatNumberX 1 /gate/block/cubicArray/setRepeatNumberY 1 /gate/block/cubicArray/setRepeatNumberZ 2 /gate/block/cubicArray/setRepeatVector 0.0 0.0 53.32 mm

# REPEAT HEAD /gate/head/repeaters/insert ring /gate/head/ring/setRepeatNumber 10

# ATTACH SYSTEM /gate/systems/cylindricalPET/rsector/attach head /gate/systems/cylindricalPET/module/attach block /gate/systems/cylindricalPET/crystal/attach crystal0 /gate/systems/cylindricalPET/crystal/attach crystal1 /gate/systems/cylindricalPET/layer0/attach LYSO /gate/systems/cylindricalPET/layer1/attach BGO

# ATTACH CRYSTAL SD /gate/LYSO/attachCrystalSD /gate/BGO/attachCrystalSD

MaxTousss commented 1 week ago

From looking at the doc., cylindricalPET only allow one definition of "crystal" and it is only the layer part that can have up to 4 parts. So... "crystal1" might be ignored since already defined with " crystal0"? The simulation log might show that.

Looking at the documentation, it would seems that the following could work: Note that Module and submodule are not required in cylindricalPET, but crystal is. So, attach your "block" as a "crystal" (i.e., your system no longer have a "module" componnent). Remove "crystal0" and "crystal1". Apply "crystal0" and "crystal1" repeater to " LYSO" and "BGO", respectivly.

I have never made that kind of system, so I might be completely wrong about the above.