397 if (hits.empty())
return false;
399 std::vector<std::vector<Pt2D>> pts;
400 std::vector<TVector3> dirs;
406 double minz[3] = {+1e9, +1e9, +1e9};
407 double maxz[3] = {-1e9, -1e9, -1e9};
408 for (
int view = 0; view < 3; ++view) {
409 for (
const Pt2D&
p : pts[view]) {
418 for (
int view = 0; view < 3; ++view) {
427 std::vector<float>
zs;
428 zs.reserve(pts[0].
size());
429 for (
const Pt2D&
p : pts[0])
431 auto mid = zs.begin() + zs.size() / 4;
432 if (mid != zs.end()) {
433 std::nth_element(zs.begin(), mid, zs.end());
437 std::vector<HeatMap> hms;
439 for (
int view = 0; view < 3; ++view) {
440 if (pts[view].
empty())
return false;
442 std::vector<Line2D>
lines;
445 if (lines.empty())
return false;
448 hms.emplace_back(maxz[view] - minz[view], minz[view], maxz[view], maxx - minx, minx, maxx);
454 std::vector<HeatMap> hms_zoom;
456 for (
int view = 0; view < 3; ++view) {
457 const double x0 = vtx.X();
458 const double z0 = vtx.Dot(dirs[view]);
460 std::vector<Line2D>
lines;
463 if (lines.empty())
return false;
466 hms_zoom.emplace_back(50, z0 - 2.5, z0 + 2.5, 50, x0 - 2.5, x0 + 2.5);
474 art::TFileDirectory evt_dir =
477 for (
int view = 0; view < 3; ++view) {
480 TGraph* gpts = view_dir.makeAndRegister<TGraph>(
"hits",
"");
481 for (
const Pt2D&
p : pts[view])
482 gpts->SetPoint(gpts->GetN(),
p.z,
p.x);
484 view_dir.makeAndRegister<TH2F>(
"hmap",
"", *hms[view].AsTH2());
486 view_dir.makeAndRegister<TH2F>(
"hmap_zoom",
"", *hms_zoom[view].AsTH2());
488 const double x = vtx.X();
489 const double z = vtx.Dot(dirs[view]);
490 view_dir.makeAndRegister<TGraph>(
"vtx3d",
"", 1, &
z, &
x);
void GetPts2D(const detinfo::DetectorPropertiesData &detProp, const std::vector< recob::Hit > &hits, std::vector< std::vector< Pt2D >> &pts, std::vector< TVector3 > &dirs, const geo::GeometryCore *geom)
TVector3 FindPeak3D(const std::vector< HeatMap > &hs, const std::vector< TVector3 > &dirs) noexcept
def mkdir(path, mode=0o777)
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
void MapFromLines(const std::vector< Line2D > &lines, HeatMap &hm)
static int max(int a, int b)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
void LinesFromPoints(const std::vector< Pt2D > &pts, std::vector< Line2D > &lines, float z0=0, float x0=0, float R=-1)
static constexpr double zs
const geo::GeometryCore * geom
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.