17 #include <string_view> 25 bool starts_with(std::string_view
const s, std::string_view
const key)
27 return s.compare(0, key.size(), key) == 0;
30 bool isAuxDetNode(TGeoNode
const& node)
32 return starts_with(node.GetName(),
"volAuxDet"sv);
34 bool isAuxDetSensitiveNode(TGeoNode
const& node)
36 return std::string_view(node.GetName()).find(
"Sensitive") != std::string_view::npos;
38 bool isCryostatNode(TGeoNode
const& node)
40 return starts_with(node.GetName(),
"volCryostat"sv);
43 bool isOpDetNode(TGeoNode
const& node, std::string_view
const opDetGeoName)
45 return starts_with(node.GetName(), opDetGeoName);
47 bool isTPCNode(TGeoNode
const& node)
49 return starts_with(node.GetName(),
"volTPC"sv);
51 bool isPlaneNode(TGeoNode
const& node)
53 return starts_with(node.GetName(),
"volTPCPlane"sv);
63 std::vector<geo::PlaneGeo>
const& planes)
65 auto const PlaneCenter = planes[0].GetBoxCenter();
67 auto const driftVector = PlaneCenter - TPCcenter;
96 std::vector<geo::WireGeo>{}};
101 TGeoBBox
const* active_volume_box,
104 auto const [axis,
sign] = drift_axis_with_sign;
105 auto const [offX, offY, offZ] = std::tuple{
106 active_volume_box->GetDX(), active_volume_box->GetDY(), active_volume_box->GetDZ()};
110 double const cathode_x = result.X() -
to_int(
sign) * offX;
111 return std::abs(cathode_x - last_plane_box_center.X());
114 double const cathode_y = result.Y() -
to_int(
sign) * offY;
115 return std::abs(cathode_y - last_plane_box_center.Y());
118 double const cathode_z = result.Z() -
to_int(
sign) * offZ;
119 return std::abs(cathode_z - last_plane_box_center.Z());
130 : fExtractObjects(config().extractor()), fOpDetGeoName(config().opDetGeoName())
136 std::vector<AuxDetGeo> result;
138 path, isAuxDetNode, [&result,
this](
Path_t& path) { result.push_back(
makeAuxDet(path)); });
153 std::vector<AuxDetSensitiveGeo> result;
155 result.push_back(makeAuxDetSensitive(path));
163 std::vector<CryostatGeo> result;
165 path, isCryostatNode, [&result,
this](
Path_t& path) { result.push_back(
makeCryostat(path)); });
181 std::vector<OpDetGeo> result;
184 [
this](
auto const& node) {
return isOpDetNode(node,
fOpDetGeoName); },
185 [&result](
Path_t const& path) { result.push_back(makeOpDet(path)); });
192 std::vector<TPCGeo> result;
194 path, isTPCNode, [&result,
this](
Path_t& path) { result.push_back(
makeTPC(path)); });
204 std::vector<PlaneGeo> planes;
206 path, isPlaneNode, [&planes](
Path_t& path) { planes.push_back(
makePlane(path)); });
210 assert(active_volume_node);
212 auto const daughter_matrix =
214 auto const active_volume_center =
217 auto const driftAxisWithSign = DriftAxisWithSign(active_volume_center, planes);
218 auto const driftAxis =
vect::normalize(planes[0].GetBoxCenter() - active_volume_center);
219 double distance_to_last_plane{std::numeric_limits<double>::min()};
221 for (
auto const& plane : planes) {
222 double const distance =
vect::dot(plane.GetBoxCenter() - active_volume_center, driftAxis);
223 if (distance > distance_to_last_plane) {
224 distance_to_last_plane = distance;
229 auto const* active_volume_box =
230 static_cast<TGeoBBox const*
>(active_volume_node->GetVolume()->GetShape());
231 auto const drift_distance = driftDistance(
232 active_volume_center, driftAxisWithSign, active_volume_box, last_plane->
GetBoxCenter());
234 return {tpc, hash_value, std::move(tpc_matrix), driftAxisWithSign, drift_distance};
CryostatGeo makeCryostat(Path_t &path) const
Constructs a geo::CryostatGeo from the current node of the path.
TGeoNode const * current() const
Returns the current node. Undefined if the path is empty.
GeoColl_t< AuxDetSensitiveGeo > AuxDetSensitive_t
Geometry information for a single TPC.
TPCs_t extractTPCs(Path_t &path) const
Looks for all TPCs under the specified path.
constexpr auto abs(T v)
Returns the absolute value of the argument.
GeoColl_t< AuxDetGeo > AuxDets_t
Collection of auxiliary detector information objects.
AuxDetGeo makeAuxDet(Path_t &path) const
Constructs a geo::AuxDetGeo from the current node of the path.
Geometry information for a single cryostat.
OpDets_t extractOpDets(Path_t &path) const
Looks for all optical detectors under the specified path.
GeoColl_t< CryostatGeo > Cryostats_t
Collection of cryostat information objects.
GeoColl_t< OpDetGeo > OpDets_t
GeometryBuilderStandard(fhicl::Table< Config > const &config)
Point_t GetBoxCenter() const
Returns the centre of the box representing the plane.
GeometryExtractor fExtractObjects
std::string fOpDetGeoName
Drift towards negative values.
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
Cryostats_t doExtractCryostats(Path_t &path) const override
constexpr int to_int(Coordinate const coord) noexcept
Enumerate the possible plane projections.
Plane makePlane(recob::tracking::Point_t const &pos, recob::tracking::Vector_t const &dir)
helper function to construct a recob::tracking::Plane from a Point_t and a Vector_t; the point is on ...
decltype(auto) makeTransformationMatrix(Trans &&trans)
Converts a transformation matrix into a geo::TransformationMatrix.
Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
static TGeoNode const * NodeForActiveVolume(TGeoNode const *tpc)
constexpr auto dot(Vector const &a, OtherVector const &b)
Return cross product of two vectors.
Entry current_entry() const
Returns the current node. Undefined if the path is empty.
Matrix currentTransformation() const
Returns the total transformation to the current node, as a Matrix.
GeoColl_t< TPCGeo > TPCs_t
AuxDets_t doExtractAuxiliaryDetectors(Path_t &path) const override
Encapsulate the geometry of a wire .
Drift towards positive values.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
DriftSign
Drift sign: positive or negative.
AuxDetSensitive_t extractAuxDetSensitive(Path_t &path) const
Looks for all auxiliary detectors under the specified path.
Encapsulate the construction of a single detector plane .
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
Representation of a node and its ancestry.
Vector normalize(Vector const &v)
Returns a vector parallel to v and with norm 1.
TPCGeo makeTPC(Path_t &path) const
Constructs a geo::TPCGeo from the current node of the path.
ROOT::Math::Transform3D TransformationMatrix
Type of transformation matrix used in geometry.