116 float StartWire()
const {
return fEndWires[ClusterEnds_t::clStart]; }
119 float StartTick()
const {
return fEndTicks[ClusterEnds_t::clStart]; }
128 float EndWire()
const {
return fEndWires[ClusterEnds_t::clEnd]; }
131 float EndTick()
const {
return fEndTicks[ClusterEnds_t::clEnd]; }
134 float SigmaEndWire()
const {
return fSigmaEndWires[ClusterEnds_t::clEnd]; }
137 float SigmaEndTick()
const {
return fSigmaEndTicks[ClusterEnds_t::clEnd]; }
156 float StartCharge()
const {
return fEndCharges[ClusterEnds_t::clStart]; }
159 float StartAngle()
const {
return fAngles[ClusterEnds_t::clStart]; }
165 float EndCharge()
const {
return fEndCharges[ClusterEnds_t::clEnd]; }
168 float EndAngle()
const {
return fAngles[ClusterEnds_t::clEnd]; }
186 float Width()
const {
return fWidth; }
199 float fEndWires[ClusterEnds_t::NEnds];
202 float fSigmaEndWires[ClusterEnds_t::NEnds];
205 float fEndTicks[ClusterEnds_t::NEnds];
208 float fSigmaEndTicks[ClusterEnds_t::NEnds];
211 float fEndCharges[ClusterEnds_t::NEnds];
214 float fAngles[ClusterEnds_t::NEnds];
217 float fOpeningAngles[ClusterEnds_t::NEnds];
226 unsigned int n_clusters = 0;
231 template <
typename T>
234 if (value > var) var =
value;
236 template <
typename T>
239 if (value < var) var =
value;
246 fEndWires[iDestEnd] = cluster.
WireCoord(iSrcEnd);
248 fEndTicks[iDestEnd] = cluster.
TickCoord(iSrcEnd);
250 fEndCharges[iDestEnd] = cluster.
EdgeCharge(iSrcEnd);
251 fAngles[iDestEnd] = cluster.
Angle(iSrcEnd);
252 fOpeningAngles[iDestEnd] = cluster.
OpeningAngle(iSrcEnd);
257 if (!cluster.
isValid())
return false;
259 if (n_clusters == 0) {
260 AdoptEnd(cluster, ClusterEnds_t::clStart);
261 AdoptEnd(cluster, ClusterEnds_t::clEnd);
262 fWidth = cluster.
Width();
263 fView = cluster.
View();
264 fPlaneID = cluster.
Plane();
269 if (cluster.
View() != View())
return false;
276 AdoptEnd(cluster, ClusterEnds_t::clStart);
278 if (cluster.
EndWire() < EndWire()) {
279 AdoptEnd(cluster, ClusterEnds_t::clEnd);
282 top(fWidth, cluster.
Width());
284 if (!hasPlane()) fPlaneID = cluster.
Plane();
302 Add(cluster, cluster_hits);
336 hits.insert(prepend ? hits.begin() : hits.end(), cluster_hits.begin(), cluster_hits.end());
348 AddHits(cluster_hits, prepend);
356 ,
fSlope(pset.get<
double>(
"Slope"))
359 produces<std::vector<recob::Cluster>>();
360 produces<art::Assns<recob::Cluster, recob::Hit>>();
375 constexpr
size_t nViews = 3;
378 std::array<std::vector<size_t>, nViews> ClsIndices;
381 std::array<std::vector<int>, nViews> Cls_matches;
384 for (
size_t i = 0; i < clusterVecHandle->size(); ++i) {
390 switch (cl->
View()) {
397 Cls_matches[view].push_back(0);
398 ClsIndices[view].push_back(i);
401 auto SuperClusters = std::make_unique<std::vector<recob::Cluster>>();
402 auto assn = std::make_unique<art::Assns<recob::Cluster, recob::Hit>>();
411 for (
size_t i = 0; i < nViews; ++i) {
413 int clustersfound = 0;
416 for (
size_t c = 0; c < ClsIndices[i].size(); ++c) {
417 if (Cls_matches[i][clsnum1] == 1) {
425 recob::Cluster const& StartingCluster = clusterVecHandle->at(ClsIndices[i][c]);
429 Cls_matches[i][clsnum1] = 1;
433 for (
size_t c2 = 0;
c2 < ClsIndices[i].size(); ++
c2) {
435 if (Cls_matches[i][clsnum2] == 1) {
463 if (sameSlope && (sameEndpoint != 0)) {
468 cl1.Add(cl2, fmh.at(ClsIndices[i][c2]), sameEndpoint == 1);
469 Cls_matches[i][clsnum2] = 1;
477 ClusterParamAlgo.ImportHits(gser, cl1.Hits());
480 SuperClusters->emplace_back(cl1.StartWire(),
481 cl1.SigmaStartWire(),
483 cl1.SigmaStartTick(),
486 cl1.StartOpeningAngle(),
493 cl1.EndOpeningAngle(),
494 ClusterParamAlgo.Integral().value(),
495 ClusterParamAlgo.IntegralStdDev().value(),
496 ClusterParamAlgo.SummedADC().value(),
497 ClusterParamAlgo.SummedADCStdDev().value(),
498 ClusterParamAlgo.NHits(),
499 ClusterParamAlgo.MultipleHitDensity(),
513 mf::LogVerbatim(
"Summary") << std::setfill(
'-') << std::setw(175) <<
"-" << std::setfill(
' ');
515 for (
size_t i = 0; i < SuperClusters->size(); ++i)
518 evt.
put(std::move(SuperClusters));
519 evt.
put(std::move(assn));
526 double sl1 = atan(slope1);
527 double sl2 = atan(slope2);
545 std::sqrt((pow(sclendwire - cl2startwire, 2) * 13.5) + pow(sclendtime - cl2starttime, 2));
549 std::sqrt((pow(sclstartwire - cl2endwire, 2) * 13.5) + pow(sclstarttime - cl2endtime, 2));
float EndOpeningAngle() const
Returns the opening angle at the end of the cluster.
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
int EndpointCompatibility(float sclstartwire, float sclstarttime, float sclendwire, float sclendtime, float cl2startwire, float cl2starttime, float cl2endwire, float cl2endtime)
float EndWire() const
Returns the wire coordinate of the end of the cluster.
ClusterAndHitMerger(recob::Cluster const &cluster, HitVector_t const &cluster_hits)
float SigmaStartWire() const
Returns the uncertainty on wire coordinate of the start of the cluster.
Utilities related to art service access.
float StartAngle() const
Returns the starting angle of the cluster.
float SigmaWireCoord(ClusterEnds_t side) const
Returns the uncertainty on wire coordinate of one of the end sides of the cluster.
float EdgeCharge(ClusterEnds_t side) const
Returns the charge on the first or last wire of the cluster.
float Angle(ClusterEnds_t side) const
Returns the angle at either end of the cluster.
ClusterMerger(recob::Cluster const &cluster)
float SigmaTickCoord(ClusterEnds_t side) const
Returns the uncertainty on tick coordinate of one of the end sides of the cluster.
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
void AddHits(TCSlice &slc, Trajectory &tj, unsigned short ipt, bool &sigOK)
float TickCoord(ClusterEnds_t side) const
Returns the tick coordinate of one of the end sides of the cluster.
Declaration of signal hit object.
void produce(art::Event &evt) override
EDProducer(fhicl::ParameterSet const &pset)
The data type to uniquely identify a Plane.
float EdgeCharge(ClusterEnds_t side) const
Returns the charge on the first or last wire of the cluster.
float SigmaTickCoord(ClusterEnds_t side) const
Returns the uncertainty on tick coordinate of one of the end sides of the cluster.
constexpr auto abs(T v)
Returns the absolute value of the argument.
float StartWire() const
Returns the wire coordinate of the start of the cluster.
Planes which measure Z direction.
Set of hits with a 2D structure.
geo::PlaneID Plane() const
Returns the plane ID this cluster lies on.
Cluster finding and building.
static void bot(T &var, T value)
Data referring to start and end of the cluster.
float fWidth
A measure of the cluster width, in homogenized units.
bool isValid() const
Returns if the cluster is valid (that is, if its ID is not invalid)
float SigmaStartTick() const
Data referring to start and end of the cluster.
float StartWire() const
Returns the wire coordinate of the start of the cluster.
static const SentryArgument_t Sentry
An instance of the sentry object.
float StartOpeningAngle() const
Returns the opening angle at the start of the cluster.
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
LineMerger(fhicl::ParameterSet const &pset)
bool Add(recob::Cluster const &cluster, HitVector_t const &cluster_hits, bool prepend=false)
Merges a single cluster into this object.
float TickCoord(ClusterEnds_t side) const
Returns the tick coordinate of one of the end sides of the cluster.
#define DEFINE_ART_MODULE(klass)
static void top(T &var, T value)
Data referring to start and end of the cluster.
std::string fClusterModuleLabel
Wrapper for ClusterParamsAlgBase objects to accept diverse input.
void AdoptEnd(recob::Cluster const &cluster, ClusterEnds_t iEnd)
Imports all the member of the corresponding end.
float SigmaEndWire() const
Returns the uncertainty on wire coordinate of the end of the cluster.
float Width() const
A measure of the cluster width, in homogenized units.
float SigmaEndTick() const
Returns the uncertainty on tick coordinate of the end of the cluster.
Wrapper for ClusterParamsAlgBase objects to accept arbitrary input.
float Angle(ClusterEnds_t side) const
Returns the angle at either end of the cluster.
Declaration of cluster object.
float WireCoord(ClusterEnds_t side) const
Returns the wire coordinate of one of the end sides of the cluster.
Definition of data types for geometry description.
bool hasPlane() const
Returns whether geometry plane is valid.
float SigmaWireCoord(ClusterEnds_t side) const
Returns the uncertainty on wire coordinate of one of the end sides of the cluster.
float StartTick() const
Returns the tick coordinate of the start of the cluster.
Class merging clusters: recomputes start and end position and hit list.
float Width() const
A measure of the cluster width, in homogenized units.
HitVector_t hits
hits in the cluster
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.
HitVector_t const & Hits() const
Returns a constant reference to the current list of hits.
geo::View_t View() const
Returns the view for this cluster.
geo::View_t fView
View for this cluster.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
float StartCharge() const
Returns the charge on the first wire of the cluster.
Utility object to perform functions of association.
float OpeningAngle(ClusterEnds_t side) const
Returns the opening angle at either end of the cluster.
ID_t ID() const
Identifier of this cluster.
bool SlopeCompatibility(double slope1, double slope2)
unsigned int NHits() const
Number of hits in the cluster.
bool hasPlane() const
Returns whether geometry plane is valid.
geo::View_t View() const
Returns the view for this cluster.
Interface to class computing cluster parameters.
geo::PlaneID Plane() const
Returns the plane ID this cluster lies on.
std::vector< HitPtr_t > HitVector_t
vector of pointers to hits
recob::tracking::Plane Plane
Class merging clusters: recomputes start and end position and hit list.
float OpeningAngle(ClusterEnds_t side) const
Returns the opening angle at either end of the cluster.
float EndAngle() const
Returns the ending angle of the cluster.
recob::Cluster::ID_t ID_t
Type of cluster ID.
float WireCoord(ClusterEnds_t side) const
Returns the wire coordinate of one of the end sides of the cluster.
art framework interface to geometry description
int ID_t
Type of cluster ID.
void AddHits(HitVector_t const &cluster_hits, bool prepend)
geo::PlaneID fPlaneID
Location of the start of the cluster.
float EndCharge() const
Returns the charge on the last wire of the cluster.
float EndTick() const
Returns the tick coordinate of the end of the cluster.
bool Add(recob::Cluster const &cluster)
Merges a single cluster into this object.
float EndWire() const
Returns the wire coordinate of the end of the cluster.