36 struct PMTprojectorClass {
53 template <
typename T,
typename Src>
54 std::vector<T>& append(std::vector<T>& dest, Src&& src) {
60 dest.reserve(dest.size() +
size(src));
61 dest.insert(dest.end(),
62 std::make_move_iterator(
begin(src)), std::make_move_iterator(
end(src))
64 Src{ std::move(src) };
75 (std::string logCategory )
86 appendSlices(slices, getCryoPMTs(cryo), driftDir, widthDir);
93 -> std::vector<std::pair<double, PMTlist_t>>
95 return PMTwalls(getCryoPMTs(cryo), determineDriftDir(cryo.
IterateTPCs()));
102 -> std::vector<std::pair<double, PMTlist_t>>
104 return PMTwalls(getPMTs(geom), determineDriftDir(geom.
IterateTPCs()));
124 std::vector<PMTlist_t>
const PMTplanes =
clusterPMTby(PMTs, planeNorm);
129 log << PMTs.size() <<
" PMTs grouped into " << PMTplanes.size()
130 <<
" planes in direction " << planeNorm <<
":";
132 log <<
"\n [#" << iPlane <<
"] " << PMTplane.size() <<
" PMT:";
134 log <<
" <" << opDet->
ID() <<
">";
142 unsigned int NClusteredPMTs [[maybe_unused]] = 0U;
143 for (
auto const& PMTplane: PMTplanes) {
147 auto const& planeSlices = slices.back();
149 log << PMTplane.size() <<
" PMTs in the plane grouped into "
150 << planeSlices.size() <<
" towers in direction " << clusterDir <<
":";
152 NClusteredPMTs += slice.size();
153 log <<
"\n [#" << iSlice <<
"] " << slice.size() <<
" PMT:";
154 for (
geo::OpDetGeo const* opDet: slice) log <<
" <" << opDet->
ID() <<
">";
160 assert(NClusteredPMTs == PMTs.size());
168 -> std::vector<std::pair<double, PMTlist_t>>
171 std::vector<PMTlist_t> walls = clusterPMTby(PMTs, dir);
174 std::vector<std::pair<double, PMTlist_t>> posAndWalls;
175 posAndWalls.reserve(walls.size());
177 posAndWalls.emplace_back(PMTwallPosition(
wall, dir), std::move(
wall));
180 std::sort(posAndWalls.begin(), posAndWalls.end());
191 if (PMTs.empty())
return std::numeric_limits<double>::lowest();
193 PMTprojectorClass
const PMTcenterProjection { dir };
212 PMTprojectorClass
const PMTcenterProjection { dir };
215 constexpr
double tol = 5.0;
216 auto const closeEnough
217 = [](
double a,
double b){
return std::abs(a - b) <
tol; };
219 return util::clusterBy(PMTs, PMTcenterProjection, closeEnough, std::less<>());
230 opDets.push_back(&cryo.
OpDet(iOpDet));
241 append(opDets, getCryoPMTs(cryo));
251 return cmp.zero(a.Cross(b));
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
std::vector< geo::OpDetGeo const * > PMTlist_t
Type of optical detector list.
Encapsulate the construction of a single cyostat.
Class comparing 2D vectors.
PMTverticalSlicingAlg(std::string logCategory="PMTverticalSlicingAlg")
Constructor: no configuration parameters so far.
Definition of util::enumerate().
void appendSlices(Slices_t &slices, PMTlist_t const &PMTs, geo::Vector_t const &planeNorm, geo::Vector_t const &clusterDir) const
Computes slices and appends them to an existing list.
ElementIteratorBox IterateTPCs() const
Returns an object suitable for iterating through all TPCs.
static std::vector< PMTlist_t > clusterPMTby(PMTlist_t const &PMTs, geo::Vector_t const &dir)
Clusters the PMTs along the specified direction.
std::size_t size(FixedBins< T, C > const &) noexcept
static PMTlist_t getPMTs(geo::GeometryCore const &geom)
Returns a list of all geo::OpDetGeo in the whole geometry.
void GetCenter(double *xyz, double localz=0.0) const
Geometry information for a single cryostat.
Classes gathering simple statistics.
Class for approximate comparisons.
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Weight_t Average() const
Returns the value average.
Access the description of detector geometry.
auto counter(T begin, T end)
Returns an object to iterate values from begin to end in a range-for loop.
void appendCryoSlices(Slices_t &slices, geo::CryostatGeo const &cryo) const
Computes slices from all PMT in cryo and appends them to slices.
const OpDetGeo & OpDet(unsigned int iopdet) const
Return the iopdet'th optical detector in the cryostat.
IteratorBox< TPC_iterator,&GeometryCore::begin_TPC,&GeometryCore::end_TPC > IterateTPCs() const
Enables ranged-for loops on all TPCs of the detector.
auto end(FixedBins< T, C > const &) noexcept
Algorihtm to group PMTs into piling towers.
Test of util::counter and support utilities.
Description of geometry of one entire detector.
auto clusterBy(Coll const &objs, KeyOp keyFunc, CmpOp sameGroup, RefOp objRef, KeySortOp keySort)
Performs a simple clustering.
std::string fLogCategory
Category for message streaming.
std::vector< TCSlice > slices
static bool areParallel(geo::Vector_t const &a, geo::Vector_t const &b)
Returns whether a and b are parallel.
auto begin(FixedBins< T, C > const &) noexcept
Encapsulate the geometry of an optical detector.
IteratorBox< cryostat_iterator,&GeometryCore::begin_cryostat,&GeometryCore::end_cryostat > IterateCryostats() const
Enables ranged-for loops on all cryostats of the detector.
std::vector< std::pair< double, PMTlist_t > > PMTwalls(geo::CryostatGeo const &cryo) const
Groups optical detectors under the specified cryostat into walls.
unsigned int NOpDet() const
Number of optical detectors in this TPC.
Algorithms to cluster objects according to specified criteria.
static double PMTwallPosition(PMTlist_t const &PMTs, geo::Vector_t const &dir)
Returns an (arbitrary) coordinate along dir representing the PMT list.
geo::OpDetID const & ID() const
Returns the geometry ID of this optical detector.
std::vector< PMTtowerOnPlane_t > Slices_t
Type of PMT towers, per plane.
static PMTlist_t getCryoPMTs(geo::CryostatGeo const &cryo)
Returns a list of all geo::OpDetGeo in cryostat cryo.
constexpr Point origin()
Returns a origin position with a point of the specified type.
void add(Data_t value, Weight_t weight=Weight_t(1.0))
Adds one entry with specified value and weight.