20 Img::BlobSolving::~BlobSolving()
38 const auto&
activity = islice->activity();
39 for (
const auto& ich : *(imeas.get())) {
56 const double default_weight = 9;
57 const double reduction = 3;
58 const size_t homer = 2;
61 std::unordered_set<int>
slices;
63 for (
auto oblob : blobs) {
64 for (
auto oslice : neighbors_oftype<ISlice::pointer>(grind, oblob)) {
65 slices.insert(oslice->ident());
68 return default_weight /
pow(reduction,
std::min(homer, slices.size()));
74 std::vector< std::vector<int> > b2minds;
75 IndexedSet<IBlob::pointer>
blobs;
76 IndexedSet<IChannel::shared_vector> measures;
77 for (
IBlob::pointer iblob : neighbors_oftype<IBlob::pointer>(grind, islice)) {
79 std::vector<int> minds;
80 for (
auto neigh : grind.neighbors(iblob)) {
81 if (neigh.code() ==
'm') {
82 IChannel::shared_vector imeas = std::get<IChannel::shared_vector>(neigh.ptr);
83 int mind = measures(imeas);
84 minds.push_back(mind);
88 b2minds.push_back(minds);
92 const size_t nmeasures = measures.size();
95 for (
size_t mind=0; mind<nmeasures; ++mind) {
96 const auto& imeas = measures.collection[mind];
99 const double sig = sqrt(value);
101 meas(mind) = value/sig;
105 const size_t nblobs = blobs.size();
110 for (
size_t bind = 0; bind < nblobs; ++bind) {
112 init(bind) = iblob->value();
114 const auto& minds = b2minds[bind];
115 for (
int mind : minds) {
116 const double sig = sigma(mind);
118 geom(mind, bind) = 1.0/sig;
127 for (
size_t ind=0; ind < nblobs; ++ind) {
128 auto oblob = blobs.collection[ind];
129 const double value = solved[ind];
130 const double unc = 0.0;
132 oblob->shape(), islice, oblob->face());
133 grind.replace(oblob, nblob);
148 for (
auto islice : oftype<ISlice::pointer>(grind)) {
152 out = std::make_shared<SimpleCluster>(grind.graph());
IndexedGraph< cluster_node_t > cluster_indexed_graph_t
vector_t solve(matrix_t response, vector_t measured, const Params ¶ms=Params(), vector_t source=Eigen::VectorXd(), vector_t weights=Eigen::VectorXd())
WIRECELL_FACTORY(BlobSolving, WireCell::Img::BlobSolving, WireCell::IClusterFilter, WireCell::IConfigurable) using namespace WireCell
def activity(output, slices, slice_line, cluster_tap_file)
std::shared_ptr< const ICluster > input_pointer
std::shared_ptr< const ICluster > output_pointer
std::vector< TCSlice > slices
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
const GenericPointer< typename T::ValueType > T2 value
Json::Value Configuration
static double blob_weight(IBlob::pointer iblob, ISlice::pointer islice, const cluster_indexed_graph_t &grind)
static void solve_slice(cluster_indexed_graph_t &grind, ISlice::pointer islice)
const GenericPointer< typename T::ValueType > & pointer
static double measure_sum(const IChannel::shared_vector &imeas, const ISlice::pointer &islice)