57 Comment(
"tag of deconvoluted ADC on wires (recob::Wire)")};
60 Name(
"TrackModuleLabel"),
61 Comment(
"tag of tracks where decays points are to be found")};
65 Comment(
"search for decay points where the net output > ROI threshold")};
68 Name(
"PointThreshold"),
69 Comment(
"tag decay point if it is detected in at least two planes with net outputs product " 70 "> POINT threshold")};
73 Comment(
"use all views to find decays if -1, or skip the view with " 74 "provided index and use only the two other views")};
89 const std::vector<recob::Wire>& wires,
91 std::map<size_t, TVector3>& spoints,
114 produces<std::vector<recob::Vertex>>();
115 produces<art::Assns<recob::Vertex, recob::Track>>();
121 std::cout << std::endl <<
"event " << evt.
id().
event() << std::endl;
123 auto vtxs = std::make_unique<std::vector<recob::Vertex>>();
124 auto vtx2trk = std::make_unique<art::Assns<recob::Vertex, recob::Track>>();
138 std::vector<std::pair<TVector3, double>> decays;
139 for (
size_t i = 0; i < hitsFromTracks.size(); ++i) {
140 auto hits = hitsFromTracks.at(i);
141 auto spoints = spFromTracks.at(i);
142 if (
hits.empty())
continue;
144 std::map<size_t, TVector3> trkSpacePoints;
145 for (
const auto& p : spoints) {
146 auto sp_hits = hitsFromSPoints.at(p.key());
147 for (
const auto& h : sp_hits) {
148 trkSpacePoints[h.key()] = TVector3(p->XYZ()[0], p->XYZ()[1], p->XYZ()[2]);
152 DetectDecay(clockData, detProp, *wireHandle,
hits, trkSpacePoints, decays);
156 for (
const auto& p3d : decays) {
158 xyz[0] = p3d.first.X();
159 xyz[1] = p3d.first.Y();
160 xyz[2] = p3d.first.Z();
161 std::cout <<
" detected: [" << xyz[0] <<
", " << xyz[1] <<
", " << xyz[2]
162 <<
"] p:" << p3d.second << std::endl;
164 size_t vidx = vtxs->size();
174 evt.
put(std::move(vtxs));
175 evt.
put(std::move(vtx2trk));
181 const std::vector<recob::Wire>& wires,
183 std::map<size_t, TVector3>& spoints,
186 const size_t nviews = 3;
188 std::vector<art::Ptr<recob::Hit>> wire_drift[nviews];
189 for (
size_t i = 0; i <
hits.size(); ++i)
191 wire_drift[
hits[i]->View()].push_back(
hits[i]);
194 std::vector<float> outputs[nviews];
195 for (
size_t v = 0; v < nviews;
198 outputs[v].resize(wire_drift[v].
size(), 0);
199 for (
size_t i = 0; i < wire_drift[v].size(); ++i) {
200 int tpc = wire_drift[v][i]->WireID().TPC;
201 int cryo = wire_drift[v][i]->WireID().Cryostat;
206 wire_drift[v][i]->PeakTime())[0];
210 std::vector<std::pair<size_t, float>> candidates2d[nviews];
211 std::vector<std::pair<TVector3, float>> candidates3d[nviews];
212 for (
size_t v = 0; v < nviews; ++v) {
214 while (idx < outputs[v].
size()) {
217 float max = outputs[v][idx];
221 if (outputs[v][idx] > max) {
222 max = outputs[v][idx];
227 candidates2d[v].emplace_back(ci, max);
228 candidates3d[v].emplace_back(spoints[wire_drift[v][ci].key()], max);
242 for (
size_t v = 0; v < nviews - 1; ++v) {
243 for (
size_t i = 0; i < candidates3d[v].size(); ++i) {
244 TVector3 c0(candidates3d[v][i].first);
245 float p0 = candidates3d[v][i].second;
247 for (
size_t u = v + 1; u < nviews; ++u) {
248 for (
size_t j = 0; j < candidates3d[v].size(); ++j) {
249 TVector3
c1(candidates3d[v][j].first);
250 float p1 = candidates3d[v][j].second;
252 if ((c0 - c1).Mag() < min_dist) {
254 if (p1 > p0) { c =
c1; }
258 double d, dmin = min_dist;
260 for (
size_t k = 0; k < result.size(); ++k) {
261 d = (result[k].first - c).Mag();
267 if (dmin < min_dist) {
268 if (result[kmin].
second < p)
270 result[kmin].first = c;
271 result[kmin].second = p;
277 result.emplace_back(c, p);
fhicl::Atom< double > RoiThreshold
Declaration of signal hit object.
EDProducer(fhicl::ParameterSet const &pset)
ParticleDecayId & operator=(ParticleDecayId const &)=delete
Definition of vertex object for LArSoft.
void produce(art::Event &e) override
fhicl::Atom< int > SkipView
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
std::vector< float > predictIdVector(unsigned int wire, float drift) const
calculate multi-class probabilities for [wire, drift] point
fhicl::Atom< art::InputTag > WireLabel
#define DEFINE_ART_MODULE(klass)
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
fhicl::Atom< double > PointThreshold
Provides recob::Track data product.
fhicl::Atom< art::InputTag > TrackModuleLabel
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
bool setWireDriftData(const detinfo::DetectorClocksData &clock_data, const detinfo::DetectorPropertiesData &det_prop, const std::vector< recob::Wire > &wires, unsigned int plane, unsigned int tpc, unsigned int cryo)
Utility object to perform functions of association.
Contains all timing reference information for the detector.
bool DetectDecay(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const std::vector< recob::Wire > &wires, const std::vector< art::Ptr< recob::Hit >> &hits, std::map< size_t, TVector3 > &spoints, std::vector< std::pair< TVector3, double >> &result)
EventNumber_t event() const
Declaration of basic channel signal object.
ParticleDecayId(Parameters const &p)
second_as<> second
Type of time stored in seconds, in double precision.
art::InputTag fWireProducerLabel
art::InputTag fTrackModuleLabel