111 auto const clock_data =
112 art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(
evt);
113 auto const det_prop =
114 art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(
evt, clock_data);
117 auto FinalHits = std::make_unique<std::vector<recob::Hit>>(std::move(
fCCAlg.
YieldHits()));
123 std::vector<recob::Cluster> sccol;
124 std::vector<recob::Vertex> sv3col;
125 std::vector<recob::EndPoint2D> sv2col;
127 std::unique_ptr<art::Assns<recob::Cluster, recob::Hit>> hc_assn(
128 new art::Assns<recob::Cluster, recob::Hit>);
129 std::unique_ptr<art::Assns<recob::Cluster, recob::Vertex, unsigned short>> cv_assn(
130 new art::Assns<recob::Cluster, recob::Vertex, unsigned short>);
131 std::unique_ptr<art::Assns<recob::Cluster, recob::EndPoint2D, unsigned short>> cep_assn(
132 new art::Assns<recob::Cluster, recob::EndPoint2D, unsigned short>);
134 std::vector<ClusterCrawlerAlg::ClusterStore>
const& Clusters =
fCCAlg.
GetClusters();
162 std::vector<unsigned int> indxToIndx(EndPts.size());
163 art::ServiceHandle<geo::Geometry const> geom;
164 unsigned short vtxID = 0,
end, wire, ivx;
165 for (ivx = 0; ivx < EndPts.size(); ++ivx) {
166 if (EndPts[ivx].NClusters == 0)
continue;
167 indxToIndx[ivx] = vtxID;
170 wire = (0.5 + EndPts[ivx].Wire);
174 sv2col.emplace_back((
double)EndPts[ivx].Time,
182 std::unique_ptr<std::vector<recob::EndPoint2D>> v2col(
183 new std::vector<recob::EndPoint2D>(std::move(sv2col)));
186 std::vector<ClusterCrawlerAlg::Vtx3Store>
const& Vertices =
fCCAlg.
GetVertices();
187 double xyz[3] = {0, 0, 0};
189 for (ClusterCrawlerAlg::Vtx3Store
const& vtx3 : Vertices) {
191 if (vtx3.Ptr2D[0] < 0)
continue;
192 if (vtx3.Ptr2D[1] < 0)
continue;
193 if (vtx3.Ptr2D[2] < 0)
continue;
198 sv3col.emplace_back(xyz, vtxID);
201 std::unique_ptr<std::vector<recob::Vertex>> v3col(
202 new std::vector<recob::Vertex>(std::move(sv3col)));
205 float sumChg, sumADC;
206 unsigned int clsID = 0, nclhits;
207 for (
unsigned int icl = 0; icl < Clusters.size(); ++icl) {
208 ClusterCrawlerAlg::ClusterStore
const& clstr = Clusters[icl];
209 if (clstr.ID < 0)
continue;
214 unsigned short plane = planeID.
Plane;
215 nclhits = clstr.tclhits.size();
216 std::vector<unsigned int> clsHitIndices;
218 for (
unsigned int itt = 0; itt < nclhits; ++itt) {
219 unsigned int iht = clstr.tclhits[itt];
225 unsigned int iht = clstr.tclhits[0];
228 sccol.emplace_back((
float)clstr.BeginWir,
256 *
this,
evt, *hc_assn, sccol.size() - 1, clstr.tclhits.begin(), clstr.tclhits.end())) {
257 throw art::Exception(art::errors::ProductRegistrationFailure)
258 <<
"Failed to associate hit " << iht <<
" with cluster " << icl;
261 if (clstr.BeginVtx >= 0) {
265 throw art::Exception(art::errors::ProductRegistrationFailure)
266 <<
"Failed to associate cluster " << clsID <<
" with EndPoint2D " << clstr.BeginVtx;
269 unsigned short vtxIndex = 0;
270 for (ClusterCrawlerAlg::Vtx3Store
const& vtx3 : Vertices) {
272 if (vtx3.Ptr2D[0] < 0)
continue;
273 if (vtx3.Ptr2D[1] < 0)
continue;
274 if (vtx3.Ptr2D[2] < 0)
continue;
275 if (vtx3.Ptr2D[plane] == clstr.BeginVtx) {
277 throw art::Exception(art::errors::ProductRegistrationFailure)
278 <<
"Failed to associate cluster " << icl <<
" with vertex";
285 if (clstr.EndVtx >= 0) {
289 throw art::Exception(art::errors::ProductRegistrationFailure)
290 <<
"Failed to associate cluster " << clsID <<
" with EndPoint2D " << clstr.BeginVtx;
293 unsigned short vtxIndex = 0;
294 for (ClusterCrawlerAlg::Vtx3Store
const& vtx3 : Vertices) {
296 if (vtx3.Ptr2D[0] < 0)
continue;
297 if (vtx3.Ptr2D[1] < 0)
continue;
298 if (vtx3.Ptr2D[2] < 0)
continue;
299 if (vtx3.Ptr2D[plane] == clstr.EndVtx) {
301 throw art::Exception(art::errors::ProductRegistrationFailure)
302 <<
"Failed to associate cluster " << icl <<
" with endpoint";
312 std::unique_ptr<std::vector<recob::Cluster>> ccol(
313 new std::vector<recob::Cluster>(std::move(sccol)));
315 shcol.use_hits(std::move(FinalHits));
322 evt.put(std::move(ccol));
323 evt.put(std::move(hc_assn));
324 evt.put(std::move(v2col));
325 evt.put(std::move(v3col));
326 evt.put(std::move(cv_assn));
327 evt.put(std::move(cep_assn));
bool CreateAssnD(art::Event &evt, art::Assns< T, U, D > &assn, size_t first_index, size_t second_index, typename art::Assns< T, U, D >::data_t &&data)
Creates a single one-to-one association with associated data.
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
The data type to uniquely identify a Plane.
std::vector< ClusterStore > const & GetClusters() const
Returns a constant reference to the clusters found.
CryostatID_t Cryostat
Index of cryostat.
float Integral() const
Integral under the calibrated signal waveform of the hit, in tick x ADC units.
static const SentryArgument_t Sentry
An instance of the sentry object.
static geo::PlaneID DecodeCTP(CTP_t CTP)
std::vector< recob::Hit > && YieldHits()
Returns (and loses) the collection of reconstructed hits.
std::vector< VtxStore > const & GetEndPoints() const
Returns a constant reference to the 2D end points found.
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
auto end(FixedBins< T, C > const &) noexcept
art::InputTag fHitFinderLabel
label of module producing input hits
A class handling a collection of hits and its associations.
PlaneID_t Plane
Index of the plane within its TPC.
bool CreateAssn(art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t index=UINT_MAX)
Creates a single one-to-one association.
std::vector< Vtx3Store > const & GetVertices() const
Returns a constant reference to the 3D vertices found.
void RunCrawler(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, std::vector< recob::Hit > const &srchits)
float SummedADC() const
The sum of calibrated ADC counts of the hit (0. by default)
2D representation of charge deposited in the TDC/wire plane
TPCID_t TPC
Index of the TPC within its cryostat.