58 Comment(
"collections of hits to be clustered")
62 Name(
"hitsPerCluster"),
63 Comment(
"number of hits associated with each cluster"),
75 produces<std::vector<recob::Cluster>>();
76 produces<art::Assns<recob::Hit, recob::Cluster>>();
101 template <
typename T>
102 inline T sqr(
T v) {
return v*v; }
117 auto clusters = std::make_unique<std::vector<recob::Cluster>>();
119 = std::make_unique<art::Assns<recob::Hit, recob::Cluster>>();
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,
161 {
return sum +
hit->Integral(); }
163 std::sqrt(std::accumulate(clusterHits.cbegin(), clusterHits.cend(), 0.0,
165 {
return sum +
sqr(
hit->SigmaIntegral()); }
167 std::accumulate(clusterHits.cbegin(), clusterHits.cend(), 0.0,
169 {
return sum +
hit->SummedADC(); }
171 std::sqrt(std::accumulate(clusterHits.cbegin(), clusterHits.cend(), 0.0,
173 {
return sum +
hit->SummedADC(); }
179 clusterHits.front()->View(),
180 clusterHits.front()->WireID().asPlaneID(),
187 auto const clusterPtr = ptrMaker(i);
189 hitClusterAssns->addSingle(
hit, clusterPtr);
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";
210 std::vector<art::Ptr<recob::Hit>> allHits;
213 auto hits =
event.getValidHandle<std::vector<recob::Hit>>(
tag);
215 std::size_t
const nHits =
hits->
size();
216 for (std::size_t i = 0; i < nHits; ++i)
217 allHits.emplace_back(
hits, i);
std::vector< art::InputTag > hitTags
List of hit tags for clustering.
std::size_t size() const noexcept
Creates some dummy clusters and associations to hits.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
EDProducer(fhicl::ParameterSet const &pset)
ChannelGroupService::Name Name
AssnsChainClusterMaker(Parameters const &config)
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.
#define DEFINE_ART_MODULE(klass)
fhicl::Atom< unsigned int > hitsPerCluster
virtual void produce(art::Event &event) override
Definition of data types for geometry description.
Detector simulation of raw signals on wires.
fhicl::Sequence< art::InputTag > hits
Declaration of signal hit object.
LArSoft-specific namespace.
unsigned int nHitsPerCluster
Maximum number of hits per cluster.
int ID_t
Type of cluster ID.
Event finding and building.