Skip to content
Snippets Groups Projects
Verified Commit 6e5ed406 authored by Tamas Gal's avatar Tamas Gal :speech_balloon:
Browse files

Use the crossing point of PMT axes for module center

Only if the module position is not specified.
parent 5f624ae5
No related branches found
No related tags found
No related merge requests found
......@@ -21,7 +21,7 @@ Evt
## Online Format
## Hardware Components
## Hardware
```@docs
PMT
......@@ -31,6 +31,7 @@ Hydrophone
Tripod
piezoenabled
hydrophoneenabled
center
```
## Optical Data
......
......@@ -65,14 +65,16 @@ Base.getindex(d::DetectorModule, i) = d.pmts[i+1]
Calculate the centre of a module by fitting the crossing point of the PMT axes.
"""
function center(m::DetectorModule)
center(m::DetectorModule) = center(m.pmts)
function center(pmts::Vector{PMT})
x = 0.0
y = 0.0
z = 0.0
V = zeros(Float64, 3, 3)
for pmt m
for pmt pmts
xx = 1.0 - pmt.dir.x * pmt.dir.x
yy = 1.0 - pmt.dir.y * pmt.dir.y
zz = 1.0 - pmt.dir.z * pmt.dir.z
......@@ -357,10 +359,10 @@ function Detector(io::IO)
if ismissing(pos)
# Similar to the module t₀, the module position was introduced in DETX v4.
# If this is missing, it will be set to the averaged PMT positions. If it's
# a base module, the position is set to (0, 0, 0).
# If this is missing, it will be set to the crossing point of the PMT axes.
# If it's a base module, the position is set to (0, 0, 0).
if length(pmts) > 0
pos = mean([pmt.pos for pmt in pmts])
pos = center(pmts)
else
pos = Position(0, 0, 0)
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment