108 float StartWire()
const {
return fEndWires[ClusterEnds_t::clStart]; }
111 float StartTick()
const {
return fEndTicks[ClusterEnds_t::clStart]; }
120 float EndWire()
const {
return fEndWires[ClusterEnds_t::clEnd]; }
123 float EndTick()
const {
return fEndTicks[ClusterEnds_t::clEnd]; }
126 float SigmaEndWire()
const {
return fSigmaEndWires[ClusterEnds_t::clEnd]; }
129 float SigmaEndTick()
const {
return fSigmaEndTicks[ClusterEnds_t::clEnd]; }
144 float StartCharge()
const {
return fEndCharges[ClusterEnds_t::clStart]; }
147 float StartAngle()
const {
return fAngles[ClusterEnds_t::clStart]; }
153 float EndCharge()
const {
return fEndCharges[ClusterEnds_t::clEnd]; }
156 float EndAngle()
const {
return fAngles[ClusterEnds_t::clEnd]; }
171 float Width()
const {
return fWidth; }
184 float fEndWires[ClusterEnds_t::NEnds];
187 float fSigmaEndWires[ClusterEnds_t::NEnds];
190 float fEndTicks[ClusterEnds_t::NEnds];
193 float fSigmaEndTicks[ClusterEnds_t::NEnds];
196 float fEndCharges[ClusterEnds_t::NEnds];
199 float fAngles[ClusterEnds_t::NEnds];
202 float fOpeningAngles[ClusterEnds_t::NEnds];
211 unsigned int n_clusters = 0;
216 template <
typename T>
219 if (value > var) var =
value;
221 template <
typename T>
224 if (value < var) var =
value;
231 fEndWires[iDestEnd] = cluster.
WireCoord(iSrcEnd);
233 fEndTicks[iDestEnd] = cluster.
TickCoord(iSrcEnd);
235 fEndCharges[iDestEnd] = cluster.
EdgeCharge(iSrcEnd);
236 fAngles[iDestEnd] = cluster.
Angle(iSrcEnd);
237 fOpeningAngles[iDestEnd] = cluster.
OpeningAngle(iSrcEnd);
242 if (!cluster.
isValid())
return false;
244 if (n_clusters == 0) {
245 AdoptEnd(cluster, ClusterEnds_t::clStart);
246 AdoptEnd(cluster, ClusterEnds_t::clEnd);
247 fWidth = cluster.
Width();
248 fView = cluster.
View();
249 fPlaneID = cluster.
Plane();
254 if (cluster.
View() != View())
return false;
261 AdoptEnd(cluster, ClusterEnds_t::clStart);
263 if (cluster.
EndWire() < EndWire()) {
264 AdoptEnd(cluster, ClusterEnds_t::clEnd);
267 top(fWidth, cluster.
Width());
269 if (!hasPlane()) fPlaneID = cluster.
Plane();
287 Add(cluster, cluster_hits);
321 hits.insert(prepend ? hits.begin() : hits.end(), cluster_hits.begin(), cluster_hits.end());
333 AddHits(cluster_hits, prepend);
341 ,
fSlope(pset.get<
double>(
"Slope"))
344 produces<std::vector<recob::Cluster>>();
345 produces<art::Assns<recob::Cluster, recob::Hit>>();
363 constexpr
size_t nViews = 3;
366 std::array<std::vector<size_t>, nViews> ClsIndices;
369 std::array<std::vector<int>, nViews> Cls_matches;
372 for (
size_t i = 0; i < clusterVecHandle->size(); ++i) {
378 switch (cl->
View()) {
385 Cls_matches[view].push_back(0);
386 ClsIndices[view].push_back(i);
389 auto SuperClusters = std::make_unique<std::vector<recob::Cluster>>();
390 auto assn = std::make_unique<art::Assns<recob::Cluster, recob::Hit>>();
399 for (
size_t i = 0; i < nViews; ++i) {
401 int clustersfound = 0;
404 for (
size_t c = 0; c < ClsIndices[i].size(); ++c) {
405 if (Cls_matches[i][clsnum1] == 1) {
413 recob::Cluster const& StartingCluster = clusterVecHandle->at(ClsIndices[i][c]);
417 Cls_matches[i][clsnum1] = 1;
421 for (
size_t c2 = 0;
c2 < ClsIndices[i].size(); ++
c2) {
423 if (Cls_matches[i][clsnum2] == 1) {
451 if (sameSlope && (sameEndpoint != 0)) {
456 cl1.Add(cl2, fmh.at(ClsIndices[i][c2]), sameEndpoint == 1);
457 Cls_matches[i][clsnum2] = 1;
465 ClusterParamAlgo.ImportHits(gser, cl1.Hits());
468 SuperClusters->emplace_back(cl1.StartWire(),
469 cl1.SigmaStartWire(),
471 cl1.SigmaStartTick(),
474 cl1.StartOpeningAngle(),
481 cl1.EndOpeningAngle(),
482 ClusterParamAlgo.Integral().value(),
483 ClusterParamAlgo.IntegralStdDev().value(),
484 ClusterParamAlgo.SummedADC().value(),
485 ClusterParamAlgo.SummedADCStdDev().value(),
486 ClusterParamAlgo.NHits(),
487 ClusterParamAlgo.MultipleHitDensity(),
501 mf::LogVerbatim(
"Summary") << std::setfill(
'-') << std::setw(175) <<
"-" << std::setfill(
' ');
503 for (
size_t i = 0; i < SuperClusters->size(); ++i)
506 evt.
put(std::move(SuperClusters));
507 evt.
put(std::move(assn));
514 double sl1 = atan(slope1);
515 double sl2 = atan(slope2);
533 std::sqrt((pow(sclendwire - cl2startwire, 2) * 13.5) + pow(sclendtime - cl2starttime, 2));
537 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.