46 Comment(
"tag of deconvoluted ADC on wires (recob::Wire)")};
49 Name(
"TrackModuleLabel"),
50 Comment(
"tag of tracks where decays points are to be found")};
54 Comment(
"search for decay points where the net output > ROI threshold")};
57 Name(
"PointThreshold"),
58 Comment(
"tag decay point if it is detected in at least two planes with net outputs product " 59 "> POINT threshold")};
62 Comment(
"use all views to find decays if -1, or skip the view with " 63 "provided index and use only the two other views")};
78 const std::vector<recob::Wire>& wires,
80 std::map<size_t, TVector3>& spoints,
103 produces<std::vector<recob::Vertex>>();
104 produces<art::Assns<recob::Vertex, recob::Track>>();
113 auto vtxs = std::make_unique<std::vector<recob::Vertex>>();
114 auto vtx2trk = std::make_unique<art::Assns<recob::Vertex, recob::Track>>();
120 art::FindManyP<recob::Hit> hitsFromTracks(trkListHandle, evt,
fTrackModuleLabel);
121 art::FindManyP<recob::SpacePoint> spFromTracks(trkListHandle, evt,
fTrackModuleLabel);
122 art::FindManyP<recob::Hit> hitsFromSPoints(spListHandle, evt,
fTrackModuleLabel);
128 std::vector<std::pair<TVector3, double>> decays;
129 for (
size_t i = 0; i < hitsFromTracks.size(); ++i) {
130 auto hits = hitsFromTracks.at(i);
131 auto spoints = spFromTracks.at(i);
132 if (hits.empty())
continue;
134 std::map<size_t, TVector3> trkSpacePoints;
135 for (
const auto&
p : spoints) {
136 auto sp_hits = hitsFromSPoints.at(
p.key());
137 for (
const auto&
h : sp_hits) {
138 trkSpacePoints[
h.key()] = TVector3(
p->XYZ()[0],
p->XYZ()[1],
p->XYZ()[2]);
142 DetectDecay(clockData, detProp, *wireHandle, hits, trkSpacePoints, decays);
146 for (
const auto& p3d : decays) {
148 xyz[0] = p3d.first.X();
149 xyz[1] = p3d.first.Y();
150 xyz[2] = p3d.first.Z();
151 std::cout <<
" detected: [" << xyz[0] <<
", " << xyz[1] <<
", " << xyz[2]
154 size_t vidx = vtxs->size();
172 const std::vector<recob::Wire>& wires,
174 std::map<size_t, TVector3>& spoints,
177 const size_t nviews = 3;
179 std::vector<art::Ptr<recob::Hit>> wire_drift[nviews];
180 for (
size_t i = 0; i < hits.size(); ++i)
182 wire_drift[hits[i]->View()].push_back(hits[i]);
185 std::vector<float>
outputs[nviews];
186 for (
size_t v = 0; v < nviews;
189 outputs[v].resize(wire_drift[v].
size(), 0);
190 for (
size_t i = 0; i < wire_drift[v].size(); ++i) {
191 int tpc = wire_drift[v][i]->WireID().TPC;
192 int cryo = wire_drift[v][i]->WireID().Cryostat;
197 wire_drift[v][i]->PeakTime())[0];
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) {
205 while (idx < outputs[v].
size()) {
208 float max = outputs[v][idx];
212 if (outputs[v][idx] > max) {
213 max = outputs[v][idx];
218 candidates2d[v].emplace_back(ci, max);
219 candidates3d[v].emplace_back(spoints[wire_drift[v][ci].
key()], max);
233 for (
size_t v = 0; v < nviews - 1; ++v) {
234 for (
size_t i = 0; i < candidates3d[v].size(); ++i) {
235 TVector3 c0(candidates3d[v][i].first);
236 float p0 = candidates3d[v][i].second;
238 for (
size_t u = v + 1; u < nviews; ++u) {
239 for (
size_t j = 0; j < candidates3d[v].size(); ++j) {
240 TVector3
c1(candidates3d[v][j].first);
241 float p1 = candidates3d[v][j].second;
243 if ((c0 - c1).Mag() < min_dist) {
245 if (p1 > p0) { c =
c1; }
249 double d, dmin = min_dist;
258 if (dmin < min_dist) {
268 result.emplace_back(c, p);
fhicl::Atom< double > RoiThreshold
EDProducer(fhicl::ParameterSet const &pset)
ChannelGroupService::Name Name
ParticleDecayId & operator=(ParticleDecayId const &)=delete
Definition of vertex object for LArSoft.
void produce(art::Event &e) override
art framework interface to geometry description
fhicl::Atom< int > SkipView
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
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
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
fhicl::Atom< art::InputTag > TrackModuleLabel
static int max(int a, int b)
Declaration of signal hit object.
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)
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)
Provides recob::Track data product.
EventNumber_t event() const
ParticleDecayId(Parameters const &p)
second_as<> second
Type of time stored in seconds, in double precision.
art::InputTag fWireProducerLabel
art::InputTag fTrackModuleLabel
QTextStream & endl(QTextStream &s)