112 std::vector<art::Ptr<recob::Hit>> hits =
collectHits(event);
117 auto clusters = std::make_unique<std::vector<recob::Cluster>>();
119 = std::make_unique<art::Assns<recob::Hit, recob::Cluster>>();
127 art::PtrMaker<recob::Cluster> ptrMaker(event);
129 for (
unsigned int i = 0; i < nClusters; ++i) {
134 std::vector<art::Ptr<recob::Hit>> clusterHits;
135 std::size_t iHit = i;
136 while (iHit < hits.size()) {
137 clusterHits.push_back(hits[iHit]);
144 clusters->emplace_back(
145 float(clusterHits.front()->WireID().Wire),
147 clusterHits.front()->PeakTime(),
148 clusterHits.front()->SigmaPeakTime(),
149 clusterHits.front()->Integral(),
152 float(clusterHits.back()->WireID().Wire),
154 clusterHits.back()->PeakTime(),
155 clusterHits.back()->SigmaPeakTime(),
156 clusterHits.back()->Integral(),
159 std::accumulate(clusterHits.cbegin(), clusterHits.cend(), 0.0,
160 [](
float sum, art::Ptr<recob::Hit>
const&
hit)
161 {
return sum +
hit->Integral(); }
163 std::sqrt(std::accumulate(clusterHits.cbegin(), clusterHits.cend(), 0.0,
164 [](
float sum, art::Ptr<recob::Hit>
const&
hit)
165 {
return sum +
sqr(
hit->SigmaIntegral()); }
167 std::accumulate(clusterHits.cbegin(), clusterHits.cend(), 0.0,
168 [](
float sum, art::Ptr<recob::Hit>
const&
hit)
169 {
return sum +
hit->SummedADC(); }
171 std::sqrt(std::accumulate(clusterHits.cbegin(), clusterHits.cend(), 0.0,
172 [](
float sum, art::Ptr<recob::Hit>
const&
hit)
173 {
return sum +
hit->SummedADC(); }
179 clusterHits.front()->View(),
180 clusterHits.front()->WireID().asPlaneID(),
187 auto const clusterPtr = ptrMaker(i);
188 for (art::Ptr<recob::Hit>
const&
hit: clusterHits)
189 hitClusterAssns->addSingle(
hit, clusterPtr);
193 mf::LogInfo(
"AssnsChainClusterMaker")
194 <<
"Created " << clusters->size() <<
" clusters with about "
195 <<
nHitsPerCluster <<
" hits each from " << hits.size() <<
" hits and "
196 << hitClusterAssns->size() <<
" associations from "
197 <<
hitTags.size() <<
" collections";
199 event.put(std::move(clusters));
200 event.put(std::move(hitClusterAssns));
std::vector< art::InputTag > hitTags
List of hit tags for clustering.
std::vector< art::Ptr< recob::Hit > > collectHits(art::Event const &event) const
Returns a list of hits to be clustered.
static const SentryArgument_t Sentry
An instance of the sentry object.
unsigned int nHitsPerCluster
Maximum number of hits per cluster.
int ID_t
Type of cluster ID.