LDMX Software
CLUE3D.h
Go to the documentation of this file.
1
9#ifndef ECAL_CLUE3D_H_
10#define ECAL_CLUE3D_H_
11
12#include <vector>
13
14#include "Ecal/Event/EcalHit.h"
15
16namespace ecal {
17
18class CLUE3D {
19 public:
20 struct Params {
21 // hits below this are ignored [MeV]
22 double hit_ecut_{0.};
23 // 2D: density radius, seed and outlier separation [mm]
24 double dc2d_{10.};
25 // 2D: weight of neighbors in the density
26 double kernel2d_{0.2};
27 double deltas2d_{10.};
28 double deltao2d_{25.};
29 // 2D: min seed density [MeV]
30 double rhoc2d_{5.};
31 // 3D: layers looked at on each side
32 int sibling_layers_{2};
33 // 3D: density radius [mm], kernel weight of other layers
34 double dens_xy3d_{15.};
35 double kernel3d_{0.5};
36 // 3D: seed separation [mm], min density [MeV], min self fraction
37 double crit_xy3d_{10.};
38 double crit_rho3d_{50.};
39 double self_frac3d_{0.05};
40 // 3D: outlier separation in units of crit_xy3d
41 double outlier_mult3d_{2.};
42 // orphan layer clusters within this of an axis are attached [mm]
43 double attach_radius_{40.};
44 // satellites below sc_ratio of a cluster within sc_radius merge [mm]
45 double sc_ratio_{0.06};
46 double sc_radius_{150.};
47 // clusters spanning fewer layers merge regardless of energy
48 int sc_min_layers_{5};
49 // clusters below this are dropped [MeV]
50 double min_cluster_energy_{20.};
51 // energy sharing between clusters above share_min_energy [MeV]
52 bool share_{true};
53 int share_iters_{30};
54 double share_min_energy_{300.};
55 // shared clusters closer than this are merged [mm]
56 double coincide_dist_{4.};
57 // smaller than ghost_ratio of a cluster within ghost_dist merges [mm]
58 double ghost_ratio_{0.15};
59 double ghost_dist_{12.};
60 // exponential transverse profile slope per layer [mm]
61 std::vector<double> profile_lambda_{};
62 // log weight W0 and window around the max cell [mm]
63 double w0_{4.};
64 double pos_window_{15.};
65 };
66
67 struct LayerCluster {
68 double e_{0}, x_{0}, y_{0}, z_{0};
69 int layer_{0};
70 std::vector<int> hits_;
71 double rho_{0}, delta_{0};
72 int nh_{-1};
73 int cid_{-1};
74 };
75
76 struct Cluster {
77 double e_{0};
78 // energy weighted centroid, on the fitted axis in x,y
79 double x_{0}, y_{0}, z_{0};
80 double dxdz_{0}, dydz_{0};
81 double rms_x_{0}, rms_y_{0}, rms_z_{0};
82 // first layer centroid
83 double x0_{0}, y0_{0}, z0_{0};
84 std::vector<int> hits_;
85 std::vector<double> frac_;
86 // x,y of the axis at z
87 double axisX(double zz) const { return x_ + dxdz_ * (zz - z_); }
88 double axisY(double zz) const { return y_ + dydz_ * (zz - z_); }
89 };
90
91 CLUE3D() = default;
92 explicit CLUE3D(const Params& p) : p_{p} {}
93
95 std::vector<Cluster> cluster(const std::vector<ldmx::EcalHit>& hits);
96
97 const std::vector<LayerCluster>& layerClusters() const { return lcs_; }
98
100 double lambda(int layer) const;
101
102 private:
103 void cluster2D(const std::vector<int>& layer_hits);
104 void cluster3D();
105 void fitAxis(Cluster& c, const std::vector<int>& hit_idx,
106 const std::vector<double>& frac) const;
107
108 Params p_{};
109 const std::vector<ldmx::EcalHit>* hits_{nullptr};
110 std::vector<int> layer_of_;
111 std::vector<char> core_;
112 std::vector<LayerCluster> lcs_;
113};
114
115} // namespace ecal
116
117#endif // ECAL_CLUE3D_H_
double lambda(int layer) const
Profile slope used at a layer [mm].
Definition CLUE3D.cxx:47
std::vector< Cluster > cluster(const std::vector< ldmx::EcalHit > &hits)
Run on all hits; returned hit indices refer to the input vector.
Definition CLUE3D.cxx:233