48 Comment(
"tag of deconvoluted ADC on wires (recob::Wire)")
52 Name(
"TrackModuleLabel"),
53 Comment(
"tag of tracks where decays points are to be found")
58 Comment(
"search for decay points where the net output > ROI threshold")
62 Name(
"PointThreshold"),
63 Comment(
"tag decay point if it is detected in at least two planes with net outputs product > POINT threshold")
68 Comment(
"use all views to find decays if -1, or skip the view with provided index and use only the two other views")
83 const std::vector<recob::Wire> & wires,
85 std::map< size_t, TVector3 > & spoints,
108 produces< std::vector<recob::Vertex> >();
109 produces< art::Assns<recob::Vertex, recob::Track> >();
117 auto vtxs = std::make_unique< std::vector< recob::Vertex > >();
118 auto vtx2trk = std::make_unique< art::Assns< recob::Vertex, recob::Track > >();
126 art::FindManyP< recob::Hit > hitsFromTracks(trkListHandle, evt,
fTrackModuleLabel);
127 art::FindManyP< recob::SpacePoint > spFromTracks(trkListHandle, evt,
fTrackModuleLabel);
128 art::FindManyP< recob::Hit > hitsFromSPoints(spListHandle, evt,
fTrackModuleLabel);
130 std::vector< std::pair<TVector3, double> > decays;
131 for (
size_t i = 0; i < hitsFromTracks.size(); ++i)
133 auto hits = hitsFromTracks.at(i);
134 auto spoints = spFromTracks.at(i);
135 if (hits.empty())
continue;
137 std::map< size_t, TVector3 > trkSpacePoints;
138 for (
const auto &
p : spoints)
140 auto sp_hits = hitsFromSPoints.at(
p.key());
141 for (
const auto &
h : sp_hits)
143 trkSpacePoints[
h.key()] = TVector3(
p->XYZ()[0],
p->XYZ()[1],
p->XYZ()[2]);
147 DetectDecay(*wireHandle, hits, trkSpacePoints, decays);
151 for (
const auto & p3d : decays)
154 xyz[0] = p3d.first.X(); xyz[1] = p3d.first.Y(); xyz[2] = p3d.first.Z();
155 std::cout <<
" detected: [" << xyz[0] <<
", " << xyz[1] <<
", " << xyz[2] <<
"] p:" << p3d.second <<
std::endl;
157 size_t vidx = vtxs->size();
173 const std::vector<recob::Wire> & wires,
175 std::map< size_t, TVector3 > & spoints,
178 const size_t nviews = 3;
180 std::vector< art::Ptr<recob::Hit> > wire_drift[nviews];
181 for (
size_t i = 0; i < hits.size(); ++i)
183 wire_drift[hits[i]->View()].push_back(hits[i]);
186 std::vector< float >
outputs[nviews];
187 for (
size_t v = 0; v < nviews; ++v)
189 outputs[v].resize(wire_drift[v].
size(), 0);
190 for (
size_t i = 0; i < wire_drift[v].size(); ++i)
192 int tpc = wire_drift[v][i]->WireID().TPC;
193 int cryo = wire_drift[v][i]->WireID().Cryostat;
201 std::vector< std::pair<size_t, float> > candidates2d[nviews];
202 std::vector< std::pair<TVector3, float> > candidates3d[nviews];
203 for (
size_t v = 0; v < nviews; ++v)
206 while (idx < outputs[v].
size())
211 float max = outputs[v][idx];
216 if (outputs[v][idx] > max) { max = outputs[v][idx]; ci = idx; }
219 candidates2d[v].emplace_back(ci, max);
220 candidates3d[v].emplace_back(spoints[wire_drift[v][ci].
key()], max);
226 double min_dist = 2.0;
232 for (
size_t v = 0; v < nviews - 1; ++v)
234 for (
size_t i = 0; i < candidates3d[v].size(); ++i)
236 TVector3 c0(candidates3d[v][i].first);
237 float p0 = candidates3d[v][i].second;
239 for (
size_t u = v + 1; u < nviews; ++u)
241 for (
size_t j = 0; j < candidates3d[v].size(); ++j)
243 TVector3
c1(candidates3d[v][j].first);
244 float p1 = candidates3d[v][j].second;
246 if ((c0 - c1).Mag() < min_dist)
249 if (p1 > p0) { c =
c1; }
254 double d, dmin = min_dist;
275 result.emplace_back(c, p);
fhicl::Atom< double > RoiThreshold
bool DetectDecay(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)
fhicl::Atom< art::InputTag > TrackModuleLabel
Declaration of signal hit object.
EDProducer(fhicl::ParameterSet const &pset)
fhicl::Atom< int > SkipView
ParticleDecayId & operator=(ParticleDecayId const &)=delete
Definition of vertex object for LArSoft.
void produce(art::Event &e) override
bool setWireDriftData(const std::vector< recob::Wire > &wires, unsigned int plane, unsigned int tpc, unsigned int cryo)
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
std::vector< float > predictIdVector(unsigned int wire, float drift) const
calculate multi-class probabilities for [wire, drift] point
#define DEFINE_ART_MODULE(klass)
fhicl::Atom< double > PointThreshold
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
static int max(int a, int b)
Provides recob::Track data product.
Utility object to perform functions of association.
EventNumber_t event() const
ParticleDecayId(Parameters const &p)
fhicl::Atom< art::InputTag > WireLabel
second_as<> second
Type of time stored in seconds, in double precision.
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
art::InputTag fWireProducerLabel
art::InputTag fTrackModuleLabel
QTextStream & endl(QTextStream &s)
h
training ###############################