Inconsistent location of wire plane reported by TPCGeo
Let's see if I can break a record here.
Premise: GEANT4 deals with volumes, and the wire plane is in fact not a geometric plane, but rather a box volume with its depth, which contains all the volumes associates with the wires on the plane. On the detector, though, there is no such a box and the wire plane is defined by the wires (GEANT4 "tubes").
geo::TPCGeo::PlaneLocation(p) attempts to provide the location of the plane
p of the TPC. Matter of fact, it returns the center of the geometry box describing the plane and containing the wires. In this sense, it is equivalent to the more modern
PlaneLocation() is used to calculate the drift distance, which only works under the assumption that it returns a coordinate on the wire plane.
Matter of another fact, that is not necessarily the case. In ArgoNeuT geometry, for example, the wires are on one side of the plane box, say at x 0 cm for the front plane, while the plane box goes from -0.4 to 0 cm. The code using this feature, which includes
LArG4 and some reconstruction, considers ArgoNeuT wire planes 2 mm off. I haven't checked the geometry of the other detectors.
My recommendation is to just ditch
geo::TPCGeo::PlaneLocation() and all what is related to it, and to replace it with a call to
geo::PlaneGeo::GetCenter() where needed. In alternative,
geo::TPCGeo::PlaneLocation() can be reimplemented to do that internally. My personal preference goes to the first option though. Note that
geo::PlaneGeo is well aware of the distinction, and it provides two different methods,
GetBoxCenter(), for the two different quantities.
I discovered this while refreshing the code of larsim:source:larsim/LArG4/LArVoxelReadout.cxx (
feature/gp_refreshLArVoxelReadout), when I noticed one of ArgoNeuT integration tests showing different results. DUNE appeared to like the changes better, so maybe their wires are in the middle of the plane box. I can't swear for other experiments, though.
For what it's worth, for the drift distance I recommend the use of
This feature was introduced, together with its implicit defect, with larcorealg:505c223 (that's the record-breaker).
#3 Updated by Gianluca Petrillo 25 days ago
So, what about a twofold solution:
geo::TPCGeo::PlaneLocation() to give a consistent result
2. deprecate it (in the sense of C++
[[deprecate("use `geo::PlaneGeo::DistanceFromPlane()` or `geo::PlaneGeo::GetCenter()` instead")]]); I can provide LArSoft feature branches, but I will not chase the uses of it in foreign experiment code.
3. present the change when it's ready to go in, including a update guide