89 auto const clock_data =
97 auto FinalHits = std::make_unique<std::vector<recob::Hit>>(
fCCAlg.
YieldHits());
105 std::vector<recob::Cluster> sccol;
106 std::vector<recob::Vertex> sv3col;
108 auto hc_assn = std::make_unique<art::Assns<recob::Cluster, recob::Hit>>();
109 auto cv_assn = std::make_unique<art::Assns<recob::Cluster, recob::Vertex, unsigned short>>();
116 for (
unsigned int icl = 0; icl < tcl.size(); ++icl) {
117 ClusterCrawlerAlg::ClusterStore
const& clstr = tcl[icl];
118 if (clstr.ID < 0)
continue;
120 unsigned short plane = planeID.
Plane;
121 for (
unsigned short ii = 0; ii < clstr.tclhits.size(); ++ii) {
122 unsigned int iht = clstr.tclhits[ii];
123 recob::Hit const& theHit = FinalHits->at(iht);
125 std::cout <<
"CC: cluster-hit plane mis-match " << theHit.
WireID().
Plane <<
" " << plane
126 <<
" in cluster " << clstr.ID <<
" WT " << clstr.BeginWir <<
":" 127 << (int)clstr.BeginTim <<
"\n";
130 if (inClus[iht] != clstr.ID) {
131 std::cout <<
"CC: InClus mis-match " << inClus[iht] <<
" ID " << clstr.ID
132 <<
" in cluster " << icl <<
"\n";
139 std::vector<ClusterCrawlerAlg::Vtx3Store>
const& Vertices =
fCCAlg.
GetVertices();
141 double xyz[3] = {0, 0, 0};
142 unsigned int vtxID = 0,
end;
143 for (ClusterCrawlerAlg::Vtx3Store
const& vtx3 : Vertices) {
145 if (vtx3.Ptr2D[0] < 0)
continue;
146 if (vtx3.Ptr2D[1] < 0)
continue;
147 if (vtx3.Ptr2D[2] < 0)
continue;
152 sv3col.emplace_back(xyz, vtxID);
155 std::unique_ptr<std::vector<recob::Vertex>> v3col(
156 new std::vector<recob::Vertex>(std::move(sv3col)));
159 float sumChg, sumADC;
160 unsigned int clsID = 0, nclhits;
161 for (
unsigned int icl = 0; icl < tcl.size(); ++icl) {
162 ClusterCrawlerAlg::ClusterStore
const& clstr = tcl[icl];
163 if (clstr.ID < 0)
continue;
168 unsigned short plane = planeID.
Plane;
169 nclhits = clstr.tclhits.size();
170 std::vector<unsigned int> clsHitIndices;
172 for (
unsigned int itt = 0; itt < nclhits; ++itt) {
173 unsigned int iht = clstr.tclhits[itt];
179 unsigned int iht = clstr.tclhits[0];
182 sccol.emplace_back((
float)clstr.BeginWir,
210 evt, *hc_assn, sccol.size() - 1, clstr.tclhits.begin(), clstr.tclhits.end())) {
212 <<
"Failed to associate hit " << iht <<
" with cluster " << icl;
215 if (clstr.BeginVtx >= 0) {
218 unsigned short vtxIndex = 0;
219 for (ClusterCrawlerAlg::Vtx3Store
const& vtx3 : Vertices) {
221 if (vtx3.Ptr2D[0] < 0)
continue;
222 if (vtx3.Ptr2D[1] < 0)
continue;
223 if (vtx3.Ptr2D[2] < 0)
continue;
224 if (vtx3.Ptr2D[plane] == clstr.BeginVtx) {
227 <<
"Failed to associate cluster " << icl <<
" with vertex";
234 if (clstr.EndVtx >= 0) {
237 unsigned short vtxIndex = 0;
238 for (ClusterCrawlerAlg::Vtx3Store
const& vtx3 : Vertices) {
240 if (vtx3.Ptr2D[0] < 0)
continue;
241 if (vtx3.Ptr2D[1] < 0)
continue;
242 if (vtx3.Ptr2D[2] < 0)
continue;
243 if (vtx3.Ptr2D[plane] == clstr.EndVtx) {
246 <<
"Failed to associate cluster " << icl <<
" with endpoint";
256 std::unique_ptr<std::vector<recob::Cluster>> ccol(
257 new std::vector<recob::Cluster>(std::move(sccol)));
259 shcol.use_hits(std::move(FinalHits));
266 evt.
put(std::move(ccol));
267 evt.
put(std::move(hc_assn));
268 evt.
put(std::move(v3col));
269 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.
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.
geo::WireID const & WireID() const
Initial tdc tick for hit.
static const SentryArgument_t Sentry
An instance of the sentry object.
static geo::PlaneID DecodeCTP(CTP_t CTP)
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
std::vector< recob::Hit > && YieldHits()
Returns (and loses) the collection of reconstructed hits.
A class handling a collection of hits and its associations.
PlaneID_t Plane
Index of the plane within its TPC.
Detector simulation of raw signals on wires.
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.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
std::string fCalDataModuleLabel
label of module producing input wires
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
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
Returns (and loses) the collection of reconstructed hits.
2D representation of charge deposited in the TDC/wire plane
std::vector< recob::Hit > && YieldHits()
Returns (and loses) the collection of reconstructed hits.
Namespace collecting geometry-related classes utilities.