70 float sclstartwire,
float sclstarttime,
71 float sclendwire,
float sclendtime,
72 float cl2startwire,
float cl2starttime,
73 float cl2endwire,
float cl2endtime
138 float StartWire()
const {
return fEndWires[ClusterEnds_t::clStart]; }
141 float StartTick()
const {
return fEndTicks[ClusterEnds_t::clStart]; }
150 float EndWire()
const {
return fEndWires[ClusterEnds_t::clEnd]; }
153 float EndTick()
const {
return fEndTicks[ClusterEnds_t::clEnd]; }
156 float SigmaEndWire()
const {
return fSigmaEndWires[ClusterEnds_t::clEnd]; }
159 float SigmaEndTick()
const {
return fSigmaEndTicks[ClusterEnds_t::clEnd]; }
179 float StartCharge()
const {
return fEndCharges[ClusterEnds_t::clStart]; }
182 float StartAngle()
const {
return fAngles[ClusterEnds_t::clStart]; }
188 float EndCharge()
const {
return fEndCharges[ClusterEnds_t::clEnd]; }
191 float EndAngle()
const {
return fAngles[ClusterEnds_t::clEnd]; }
210 float Width()
const {
return fWidth; }
225 float fEndWires[ClusterEnds_t::NEnds];
228 float fSigmaEndWires[ClusterEnds_t::NEnds];
231 float fEndTicks[ClusterEnds_t::NEnds];
234 float fSigmaEndTicks[ClusterEnds_t::NEnds];
237 float fEndCharges[ClusterEnds_t::NEnds];
240 float fAngles[ClusterEnds_t::NEnds];
243 float fOpeningAngles[ClusterEnds_t::NEnds];
252 unsigned int n_clusters = 0;
257 template <
typename T>
259 template <
typename T>
267 fEndWires[iDestEnd] = cluster.
WireCoord(iSrcEnd);
269 fEndTicks[iDestEnd] = cluster.
TickCoord(iSrcEnd);
271 fEndCharges[iDestEnd] = cluster.
EdgeCharge(iSrcEnd);
272 fAngles[iDestEnd] = cluster.
Angle(iSrcEnd);
273 fOpeningAngles[iDestEnd] = cluster.
OpeningAngle(iSrcEnd);
277 if (!cluster.
isValid())
return false;
279 if (n_clusters == 0) {
280 AdoptEnd(cluster, ClusterEnds_t::clStart);
281 AdoptEnd(cluster, ClusterEnds_t::clEnd);
282 fWidth = cluster.
Width();
283 fView = cluster.
View();
284 fPlaneID = cluster.
Plane();
289 if (cluster.
View() != View())
return false;
297 AdoptEnd(cluster, ClusterEnds_t::clStart);
299 if (cluster.
EndWire() < EndWire()) {
300 AdoptEnd(cluster, ClusterEnds_t::clEnd);
303 top(fWidth, cluster.
Width());
305 if (!hasPlane()) fPlaneID = cluster.
Plane();
324 { Add(cluster, cluster_hits); }
361 hits.insert(prepend? hits.begin(): hits.end(),
362 cluster_hits.begin(), cluster_hits.end());
373 AddHits(cluster_hits, prepend);
381 ,
fSlope (pset.get<double >(
"Slope"))
384 produces< std::vector<recob::Cluster> >();
385 produces< art::Assns<recob::Cluster, recob::Hit> >();
406 constexpr
size_t nViews = 3;
409 std::array< std::vector<size_t>, nViews > ClsIndices;
412 std::array< std::vector<int>, nViews > Cls_matches;
415 for(
size_t i = 0; i < clusterVecHandle->size(); ++i){
435 Cls_matches[view].push_back(0);
436 ClsIndices[view].push_back(i);
439 std::unique_ptr<std::vector<recob::Cluster> > SuperClusters(
new std::vector<recob::Cluster>);
449 for(
size_t i = 0; i < nViews; ++i){
451 int clustersfound = 0;
454 for(
size_t c = 0; c < ClsIndices[i].size(); ++c){
455 if(Cls_matches[i][clsnum1] == 1){
464 = clusterVecHandle->at(ClsIndices[i][c]);
468 Cls_matches[i][clsnum1] = 1;
472 for(
size_t c2 = 0;
c2 < ClsIndices[i].size(); ++
c2){
474 if(Cls_matches[i][clsnum2] == 1){
492 cl1.StartWire(), cl1.StartTick(),
493 cl1.EndWire(), cl1.EndTick(),
494 cl2.StartWire(), cl2.StartTick(),
495 cl2.EndWire(), cl2.EndTick()
501 if(sameSlope && (sameEndpoint != 0)) {
506 cl1.Add(cl2, fmh.at(ClsIndices[i][c2]), sameEndpoint == 1);
507 Cls_matches[i][clsnum2] = 1;
518 SuperClusters->emplace_back(
520 cl1.SigmaStartWire(),
522 cl1.SigmaStartTick(),
525 cl1.StartOpeningAngle(),
532 cl1.EndOpeningAngle(),
533 ClusterParamAlgo.Integral().value(),
534 ClusterParamAlgo.IntegralStdDev().value(),
535 ClusterParamAlgo.SummedADC().value(),
536 ClusterParamAlgo.SummedADCStdDev().value(),
537 ClusterParamAlgo.NHits(),
538 ClusterParamAlgo.MultipleHitDensity(),
546 util::CreateAssn(*
this, evt, *(SuperClusters.get()), cl1.Hits(), *(assn.get()));
552 mf::LogVerbatim(
"Summary") << std::setfill(
'-') << std::setw(175) <<
"-" << std::setfill(
' ');
554 for(
size_t i = 0; i < SuperClusters->size(); ++i)
557 evt.
put(std::move(SuperClusters));
558 evt.
put(std::move(assn));
568 double sl1 = atan(slope1);
569 double sl2 = atan(slope2);
572 bool comp = std::abs(sl1-sl2) <
fSlope ?
true :
false;
578 float sclstartwire,
float sclstarttime,
579 float sclendwire,
float sclendtime,
580 float cl2startwire,
float cl2starttime,
581 float cl2endwire,
float cl2endtime
585 float distance = std::sqrt((pow(sclendwire-cl2startwire,2)*13.5) + pow(sclendtime-cl2starttime,2));
588 float distance2 = 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.
float SigmaStartWire() const
Returns the uncertainty on wire coordinate of the start of the cluster.
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.
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.
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.
LineMerger(fhicl::ParameterSet const &pset)
ProductID put(std::unique_ptr< PROD > &&product)
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
Helper functions to create a cluster.
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.
bool CreateAssn(PRODUCER const &prod, art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t indx=UINT_MAX)
Creates a single one-to-one association.
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.
void produce(art::Event &evt)
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
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.
std::string value(boost::any const &)
geo::View_t fView
View for this cluster.
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.
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
ID_t ID() const
Identifier of this cluster.
void ImportHits(Iter begin, Iter end)
Calls SetHits() with the hits in the sequence.
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.
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.