9 #ifndef TRAJCLUSTERALGUTILS_H 10 #define TRAJCLUSTERALGUTILS_H 25 class DetectorClocksData;
26 class DetectorPropertiesData;
68 unsigned short originPt,
77 unsigned short originPt,
81 unsigned short usePar);
90 const std::vector<float>& fQualityCuts,
97 const std::vector<unsigned int>& iHitsInMultiplet,
98 const std::vector<unsigned int>& jHitsInMultiplet);
99 bool TrajHitsOK(
TCSlice const& slc,
const unsigned int iht,
const unsigned int jht);
108 bool includeDeadWires,
109 unsigned short firstPt,
110 unsigned short lastPt);
113 const float& inWirePos1,
114 const float& inWirePos2,
136 unsigned short& closePt,
148 std::array<int, 2>
const& wireWindow,
150 const unsigned short plane,
151 HitStatus_t hitRequest,
158 const float& maxDelta);
165 unsigned short nPtsFit,
170 unsigned short kinkPt,
171 unsigned short nPtsFit,
186 unsigned short& closePt,
196 float HitSep2(
const TCSlice& slc,
unsigned int iht,
unsigned int jht);
201 unsigned short& ipt1,
202 unsigned short& ipt2,
207 unsigned short& ipt1,
208 unsigned short& ipt2,
210 bool considerDeadWires);
216 HitStatus_t hitRequest);
228 return v1[0] * v2[0] + v1[1] * v2[1];
239 const std::vector<unsigned int>& hitsInMultiplet,
240 HitStatus_t hitRequest);
242 const std::vector<unsigned int>& hitsInMultiplet,
243 HitStatus_t hitRequest);
245 const std::vector<unsigned int>& hitsInMultiplet,
247 HitStatus_t hitRequest);
249 const std::vector<unsigned int>& hitsInMultiplet,
251 HitStatus_t hitRequest);
255 short MCSMom(
const TCSlice& slc,
const std::vector<int>& tjIDs);
259 unsigned short FirstPt,
260 unsigned short lastPt);
266 unsigned short firstPt,
267 unsigned short lastPt,
269 unsigned short& cnt);
285 unsigned int fromHit,
310 std::string type1Name,
312 std::string type2Name);
316 unsigned int fromhit,
318 unsigned short pass);
325 unsigned short pass);
326 bool Fit2D(
short mode,
332 std::pair<unsigned short, unsigned short>
GetSliceIndex(std::string typeName,
int uID);
333 template <
typename T>
334 std::vector<T>
SetIntersection(
const std::vector<T>& set1,
const std::vector<T>& set2);
335 template <
typename T>
336 std::vector<T>
SetDifference(
const std::vector<T>& set1,
const std::vector<T>& set2);
355 unsigned short tPoint);
357 std::string someText,
361 bool printVtx =
true);
363 void PrintTP(std::string someText,
384 template <
typename T>
385 std::vector<T>
SetIntersection(
const std::vector<T>& set1,
const std::vector<T>& set2)
391 std::vector<T> shared;
393 if (set1.empty())
return shared;
394 if (set2.empty())
return shared;
395 for (
auto element1 : set1) {
397 if (std::find(set2.begin(), set2.end(), element1) == set2.end())
continue;
399 if (std::find(shared.begin(), shared.end(), element1) != shared.end())
continue;
400 shared.push_back(element1);
406 template <
typename T>
407 std::vector<T>
SetDifference(
const std::vector<T>& set1,
const std::vector<T>& set2)
410 std::vector<T> different;
411 if (set1.empty() && set2.empty())
return different;
412 if (!set1.empty() && set2.empty())
return set1;
413 if (set1.empty() && !set2.empty())
return set2;
414 for (
auto element1 : set1) {
416 if (std::find(set2.begin(), set2.end(), element1) != set2.end())
continue;
418 if (std::find(different.begin(), different.end(), element1) != different.end())
continue;
419 different.push_back(element1);
421 for (
auto element2 : set2) {
423 if (std::find(set1.begin(), set1.end(), element2) != set1.end())
continue;
425 if (std::find(different.begin(), different.end(), element2) != different.end())
continue;
426 different.push_back(element2);
433 #endif // ifndef TRAJCLUSTERALGUTILS_H
void PrintAll(detinfo::DetectorPropertiesData const &detProp, std::string someText)
float HitsPosTime(const TCSlice &slc, const std::vector< unsigned int > &hitsInMultiplet, float &sum, HitStatus_t hitRequest)
void CheckTrajBeginChg(TCSlice &slc, unsigned short itj)
short MCSMom(const TCSlice &slc, const std::vector< int > &tjIDs)
void FitTraj(TCSlice const &slc, Trajectory &tj)
void SetEndPoints(Trajectory &tj)
bool TrajHitsOK(TCSlice const &slc, const std::vector< unsigned int > &iHitsInMultiplet, const std::vector< unsigned int > &jHitsInMultiplet)
bool InTrajOK(TCSlice &slc, std::string someText)
Reconstruction base classes.
struct of temporary 2D vertices (end points)
std::vector< unsigned int > PutTrajHitsInVector(const Trajectory &tj, HitStatus_t hitRequest)
std::array< double, 3 > Point3_t
bool SignalAtTp(TrajPoint &tp)
void SetPDGCode(TCSlice &slc, unsigned short itj)
void FindAlongTrans(Point3_t pos1, Vector3_t dir1, Point3_t pos2, Point2_t &alongTrans)
void PrintTrajectory(std::string someText, const TCSlice &slc, const Trajectory &tj, unsigned short tPoint)
bool StartTraj(TCSlice const &slc, Trajectory &tj, unsigned int fromhit, unsigned int tohit, unsigned short pass)
void PrintTP(std::string someText, const TCSlice &slc, unsigned short ipt, short dir, unsigned short pass, const TrajPoint &tp)
The data type to uniquely identify a Plane.
void UnsetUsedHits(TCSlice &slc, TrajPoint &tp)
std::string PrintEndFlag(const PFPStruct &pfp, unsigned short end)
bool StoreTraj(TCSlice &slc, Trajectory &tj)
float TpSumHitChg(const TCSlice &slc, TrajPoint const &tp)
void ChkChgAsymmetry(TCSlice &slc, Trajectory &tj, bool prt)
bool TrajClosestApproach(Trajectory const &tj, float x, float y, unsigned short &closePt, float &DOCA)
void FillWireHitRange(geo::TPCID inTPCID)
float TrajPointSeparation(const TrajPoint &tp1, const TrajPoint &tp2)
bool CompatibleMerge(const TCSlice &slc, std::vector< int > const &tjIDs, bool prt)
void SetAngleCode(TrajPoint &tp)
float PointTrajDOCA(const TCSlice &slc, unsigned int iht, TrajPoint const &tp)
double DeltaAngle(const Vector3_t v1, const Vector3_t v2)
bool MakeBareTrajPoint(const TCSlice &slc, unsigned int fromHit, unsigned int toHit, TrajPoint &tp)
void Print2V(mf::LogVerbatim &myprt, VtxStore const &vx2, bool &printHeader)
bool LongPulseHit(const recob::Hit &hit)
void PrintPFPs(std::string someText, TCSlice const &slc)
float TPHitsRMSTime(const TCSlice &slc, const TrajPoint &tp, HitStatus_t hitRequest)
std::string TPEnvString(const TrajPoint &tp)
std::string PrintPos(const TrajPoint &tp)
float MaxTjLen(const TCSlice &slc, std::vector< int > &tjIDs)
bool MergeTjIntoPFP(TCSlice &slc, int mtjid, PFPStruct &pfp, bool prt)
void Print3S(detinfo::DetectorPropertiesData const &detProp, mf::LogVerbatim &myprt, ShowerStruct3D const &ss3)
double DeltaAngle2(double Ang1, double Ang2)
std::vector< T > SetIntersection(const std::vector< T > &set1, const std::vector< T > &set2)
bool SignalBetween(const TrajPoint &tp1, const TrajPoint &tp2, const float MinWireSignalFraction)
float MaxChargeAsymmetry(TCSlice &slc, std::vector< int > const &tjIDs)
float OverlapFraction(const Trajectory &tj1, const Trajectory &tj2)
std::string PrintHitShort(const TCHit &tch)
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
float HitsRMSTime(const TCSlice &slc, const std::vector< unsigned int > &hitsInMultiplet, HitStatus_t hitRequest)
void FitPar(const Trajectory &tj, unsigned short originPt, unsigned short npts, short fitDir, ParFit &pFit, unsigned short usePar)
std::vector< unsigned int > PutHitsInVector(const TCSlice &slc, PFPStruct const &pfp, HitStatus_t hitRequest)
float HitSep2(const TCSlice &slc, unsigned int iht, unsigned int jht)
int NeutrinoPrimaryTjID(const TCSlice &slc, const Trajectory &tj)
float HitsRMSTick(const TCSlice &slc, const std::vector< unsigned int > &hitsInMultiplet, HitStatus_t hitRequest)
struct of temporary 3D vertices
int PrimaryID(const TCSlice &slc, const Trajectory &tj)
unsigned short NearestPtWithChg(const Trajectory &tj, unsigned short thePt)
std::array< float, 2 > Point2_t
int PDGCodeVote(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, PFPStruct &pfp)
float DeadWireCount(const TCSlice &slc, const TrajPoint &tp1, const TrajPoint &tp2)
bool BraggSplit(TCSlice &slc, unsigned short itj)
Vector3_t PointDirection(const Point3_t p1, const Point3_t p2)
float PointTrajDOCA2(float wire, float time, TrajPoint const &tp)
float ElectronLikelihood(const TCSlice &slc, const Trajectory &tj)
float TwoTPAngle(const TrajPoint &tp1, const TrajPoint &tp2)
void TjDeltaRMS(const Trajectory &tj, unsigned short firstPt, unsigned short lastPt, double &rms, unsigned short &cnt)
float ChgFracNearPos(const TCSlice &slc, const Point2_t &pos, const std::vector< int > &tjIDs)
std::vector< unsigned int > FindCloseHits(const TCSlice &slc, std::array< int, 2 > const &wireWindow, Point2_t const &timeWindow, const unsigned short plane, HitStatus_t hitRequest, bool usePeakTime, bool &hitsNear)
float ChgFracBetween(detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, Point3_t pos1, Point3_t pos2)
void MakeHaloTj(TCSlice &slc, Trajectory &muTj, bool prt)
TrajPoint MakeBareTP(detinfo::DetectorPropertiesData const &detProp, const Point3_t &pos, CTP_t inCTP)
void PrintT(mf::LogVerbatim &myprt, Trajectory const &tj, bool &printHeader)
bool PointInsideEnvelope(const Point2_t &Point, const std::vector< Point2_t > &Envelope)
void MakeTrajectoryObsolete(TCSlice &slc, unsigned int itj)
double PosSep2(const Point3_t &pos1, const Point3_t &pos2)
unsigned short GetPFPIndex(const TCSlice &slc, int tjID)
std::string PrintHit(const TCHit &tch)
bool Fit2D(short mode, Point2_t inPt, float &inPtErr, Vector2_t &outVec, Vector2_t &outVecErr, float &chiDOF)
bool SplitTraj(detinfo::DetectorPropertiesData const &detProp, TCSlice &slc, unsigned short itj, float XPos, bool makeVx2, bool prt)
General LArSoft Utilities.
double DotProd(const Vector2_t &v1, const Vector2_t &v2)
The data type to uniquely identify a TPC.
void PrintP(mf::LogVerbatim &myprt, PFPStruct const &pfp, bool &printHeader)
float ExpectedHitsRMS(const TrajPoint &tp)
bool valsIncreasing(const SortEntry &c1, const SortEntry &c2)
void ReleaseHits(TCSlice &slc, Trajectory const &tj)
bool SetMag(Vector3_t &v1, double mag)
std::array< double, 2 > Vector2_t
unsigned short NumHitsInTP(const TrajPoint &tp, HitStatus_t hitRequest)
void TrimEndPts(std::string fcnLabel, TCSlice &slc, Trajectory &tj, const std::vector< float > &fQualityCuts, bool prt)
unsigned short FarEnd(const PFPStruct &pfp, const Point3_t &pos)
void DefineTjParents(TCSlice &slc, bool prt)
float HitsPosTick(const TCSlice &slc, const std::vector< unsigned int > &hitsInMultiplet, float &sum, HitStatus_t hitRequest)
Detector simulation of raw signals on wires.
float MCSThetaRMS(const Trajectory &tj)
unsigned short NearbyCleanPt(const Trajectory &tj, unsigned short end)
bool MergeAndStore(TCSlice &slc, unsigned int itj1, unsigned int itj2, bool doPrt)
void RestoreObsoleteTrajectory(TCSlice &slc, unsigned int itj)
void PrintPFP(std::string someText, TCSlice const &slc, const PFPStruct &pfp, bool printHeader)
std::vector< int > GetAssns(TCSlice const &slc, std::string type1Name, int id, std::string type2Name)
void TrajIntersection(TrajPoint const &tp1, TrajPoint const &tp2, Point2_t &pos)
int PrimaryUID(const PFPStruct &pfp)
void UpdateTjChgProperties(std::string inFcnLabel, TCSlice const &slc, Trajectory &tj, bool prt)
float KinkSignificance(TCSlice const &slc, Trajectory const &tj1, unsigned short end1, Trajectory const &tj2, unsigned short end2, unsigned short nPtsFit, bool useChg, bool prt)
void Print3V(detinfo::DetectorPropertiesData const &detProp, mf::LogVerbatim &myprt, Vtx3Store const &vx3, bool &printHeader)
bool DecodeDebugString(std::string strng)
Contains all timing reference information for the detector.
float MaxHitDelta(TCSlice &slc, Trajectory &tj)
float TrajLength(const Trajectory &tj)
void UpdateVxEnvironment(TCSlice &slc)
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
void TagJunkTj(Trajectory &tj, bool prt)
double PosSep(const Point3_t &pos1, const Point3_t &pos2)
void TrimHiChgEndPts(TCSlice &slc, Trajectory &tj, bool prt)
unsigned short PDGCodeIndex(int PDGCode)
float PointPull(const TP3D &tp3d)
bool valsDecreasing(const SortEntry &c1, const SortEntry &c2)
std::pair< unsigned short, unsigned short > GetSliceIndex(std::string typeName, int uID)
float PointTrajSep2(float wire, float time, TrajPoint const &tp)
std::array< double, 3 > Vector3_t
bool SignalAtTpInSlc(const TCSlice &slc, const TrajPoint &tp)
std::vector< T > SetDifference(const std::vector< T > &set1, const std::vector< T > &set2)
bool NearbySrcHit(geo::PlaneID plnID, unsigned int wire, float loTick, float hiTick)
IDparameter< geo::TPCID > TPCID
Member type of validated geo::TPCID parameter.
std::vector< int > FindCloseTjs(const TCSlice &slc, const TrajPoint &fromTp, const TrajPoint &toTp, const float &maxDelta)
2D representation of charge deposited in the TDC/wire plane
void PrintAllTraj(detinfo::DetectorPropertiesData const &detProp, std::string someText, TCSlice const &slc, unsigned short itj, unsigned short ipt, bool prtVtx)
void MoveTPToWire(TrajPoint &tp, float wire)
unsigned short NumPtsWithCharge(const TCSlice &slc, const Trajectory &tj, bool includeDeadWires)
unsigned short CloseEnd(const Trajectory &tj, const Point2_t &pos)
void MergeGhostTjs(TCSlice &slc, CTP_t inCTP)
bool TrajIsClean(Trajectory const &tj, bool prt)
bool TrajTrajDOCA(const TCSlice &slc, const Trajectory &tj1, const Trajectory &tj2, unsigned short &ipt1, unsigned short &ipt2, float &minSep)
Namespace collecting geometry-related classes utilities.
bool WireHitRangeOK(TCSlice const &slc, const CTP_t &inCTP)
void TrajPointTrajDOCA(TrajPoint const &tp, Trajectory const &tj, unsigned short &closePt, float &minSep)
float TPHitsRMSTick(const TCSlice &slc, const TrajPoint &tp, HitStatus_t hitRequest)
void PrintTPHeader(std::string someText)
void ChkEndKink(TCSlice const &slc, Trajectory &tj, bool prt)
unsigned short AngleRange(TrajPoint const &tp)
void SetTPEnvironment(TCSlice &slc, CTP_t inCTP)
bool HasDuplicateHits(const TCSlice &slc, Trajectory const &tj, bool prt)
void ReverseTraj(Trajectory &tj)