81 art::ValidHandle<std::vector<recob::Wire>> wireVecHandle =
90 auto const clock_data =
91 art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(
evt);
93 art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(
evt, clock_data);
98 auto FinalHits = std::make_unique<std::vector<recob::Hit>>(
fCCAlg.
YieldHits());
100 art::ServiceHandle<geo::Geometry const> geo;
106 std::vector<recob::Cluster> sccol;
107 std::vector<recob::Vertex> sv3col;
109 auto hc_assn = std::make_unique<art::Assns<recob::Cluster, recob::Hit>>();
110 auto cv_assn = std::make_unique<art::Assns<recob::Cluster, recob::Vertex, unsigned short>>();
117 for (
unsigned int icl = 0; icl < tcl.size(); ++icl) {
118 ClusterCrawlerAlg::ClusterStore
const& clstr = tcl[icl];
119 if (clstr.ID < 0)
continue;
121 unsigned short plane = planeID.
Plane;
122 for (
unsigned short ii = 0; ii < clstr.tclhits.size(); ++ii) {
123 unsigned int iht = clstr.tclhits[ii];
124 recob::Hit const& theHit = FinalHits->at(iht);
127 <<
" in cluster " << clstr.ID <<
" WT " << clstr.BeginWir <<
":"
128 << (int)clstr.BeginTim <<
"\n";
131 if (inClus[iht] != clstr.ID) {
132 std::cout <<
"CC: InClus mis-match " << inClus[iht] <<
" ID " << clstr.ID
133 <<
" in cluster " << icl <<
"\n";
140 std::vector<ClusterCrawlerAlg::Vtx3Store>
const& Vertices =
fCCAlg.
GetVertices();
142 double xyz[3] = {0, 0, 0};
143 unsigned int vtxID = 0,
end;
144 for (ClusterCrawlerAlg::Vtx3Store
const& vtx3 : Vertices) {
146 if (vtx3.Ptr2D[0] < 0)
continue;
147 if (vtx3.Ptr2D[1] < 0)
continue;
148 if (vtx3.Ptr2D[2] < 0)
continue;
153 sv3col.emplace_back(xyz, vtxID);
156 std::unique_ptr<std::vector<recob::Vertex>> v3col(
157 new std::vector<recob::Vertex>(std::move(sv3col)));
160 float sumChg, sumADC;
161 unsigned int clsID = 0, nclhits;
162 for (
unsigned int icl = 0; icl < tcl.size(); ++icl) {
163 ClusterCrawlerAlg::ClusterStore
const& clstr = tcl[icl];
164 if (clstr.ID < 0)
continue;
169 unsigned short plane = planeID.
Plane;
170 nclhits = clstr.tclhits.size();
171 std::vector<unsigned int> clsHitIndices;
173 for (
unsigned int itt = 0; itt < nclhits; ++itt) {
174 unsigned int iht = clstr.tclhits[itt];
180 unsigned int iht = clstr.tclhits[0];
183 sccol.emplace_back((
float)clstr.BeginWir,
211 *
this,
evt, *hc_assn, sccol.size() - 1, clstr.tclhits.begin(), clstr.tclhits.end())) {
212 throw art::Exception(art::errors::ProductRegistrationFailure)
213 <<
"Failed to associate hit " << iht <<
" with cluster " << icl;
216 if (clstr.BeginVtx >= 0) {
219 unsigned short vtxIndex = 0;
220 for (ClusterCrawlerAlg::Vtx3Store
const& vtx3 : Vertices) {
222 if (vtx3.Ptr2D[0] < 0)
continue;
223 if (vtx3.Ptr2D[1] < 0)
continue;
224 if (vtx3.Ptr2D[2] < 0)
continue;
225 if (vtx3.Ptr2D[plane] == clstr.BeginVtx) {
227 throw art::Exception(art::errors::ProductRegistrationFailure)
228 <<
"Failed to associate cluster " << icl <<
" with vertex";
235 if (clstr.EndVtx >= 0) {
238 unsigned short vtxIndex = 0;
239 for (ClusterCrawlerAlg::Vtx3Store
const& vtx3 : Vertices) {
241 if (vtx3.Ptr2D[0] < 0)
continue;
242 if (vtx3.Ptr2D[1] < 0)
continue;
243 if (vtx3.Ptr2D[2] < 0)
continue;
244 if (vtx3.Ptr2D[plane] == clstr.EndVtx) {
246 throw art::Exception(art::errors::ProductRegistrationFailure)
247 <<
"Failed to associate cluster " << icl <<
" with endpoint";
257 std::unique_ptr<std::vector<recob::Cluster>> ccol(
258 new std::vector<recob::Cluster>(std::move(sccol)));
260 shcol.use_hits(std::move(FinalHits));
267 evt.put(std::move(ccol));
268 evt.put(std::move(hc_assn));
269 evt.put(std::move(v3col));
270 evt.put(std::move(cv_assn));
void RunCCHitFinder(std::vector< recob::Wire > const &Wires)
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.
geo::WireID WireID() const
hit::CCHitFinderAlg fCCHFAlg
The data type to uniquely identify a Plane.
std::vector< ClusterStore > const & GetClusters() const
Returns a constant reference to the clusters found.
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.
A class handling a collection of hits and its associations.
auto end(FixedBins< T, C > const &) noexcept
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::string fCalDataModuleLabel
label of module producing input wires
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)
std::vector< short > const & GetinClus() const
2D representation of charge deposited in the TDC/wire plane
std::vector< recob::Hit > && YieldHits()
Returns (and loses) the collection of reconstructed hits.
BEGIN_PROLOG could also be cout