9 #ifndef TRAJCLUSTERALGUTILS_H 10 #define TRAJCLUSTERALGUTILS_H 25 class DetectorClocksData;
26 class DetectorPropertiesData;
66 unsigned short originPt,
76 unsigned short originPt,
80 unsigned short usePar);
89 const std::vector<float>& fQualityCuts,
96 const float& MinWireSignalFraction);
100 const float& MinWireSignalFraction);
103 const std::vector<unsigned int>& iHitsInMultiplet,
104 const std::vector<unsigned int>& jHitsInMultiplet);
114 bool includeDeadWires,
115 unsigned short firstPt,
116 unsigned short lastPt);
119 const float& inWirePos1,
120 const float& inWirePos2,
142 unsigned short& closePt,
154 std::array<int, 2>
const& wireWindow,
156 const unsigned short plane,
157 HitStatus_t hitRequest,
164 const float& maxDelta);
171 unsigned short nPtsFit,
176 unsigned short kinkPt,
177 unsigned short nPtsFit,
193 unsigned short& closePt,
203 float HitSep2(
const TCSlice& slc,
unsigned int iht,
unsigned int jht);
208 unsigned short& ipt1,
209 unsigned short& ipt2,
214 unsigned short& ipt1,
215 unsigned short& ipt2,
217 bool considerDeadWires);
223 HitStatus_t hitRequest);
236 return v1[0] * v2[0] + v1[1] * v2[1];
247 const std::vector<unsigned int>& hitsInMultiplet,
248 HitStatus_t hitRequest);
250 const std::vector<unsigned int>& hitsInMultiplet,
251 HitStatus_t hitRequest);
253 const std::vector<unsigned int>& hitsInMultiplet,
255 HitStatus_t hitRequest);
257 const std::vector<unsigned int>& hitsInMultiplet,
259 HitStatus_t hitRequest);
264 short MCSMom(
const TCSlice& slc,
const std::vector<int>& tjIDs);
268 unsigned short FirstPt,
269 unsigned short lastPt);
273 unsigned short firstPt,
274 unsigned short lastPt);
279 unsigned short firstPt,
280 unsigned short lastPt,
282 unsigned short& cnt);
300 unsigned int fromHit,
332 unsigned int fromhit,
334 unsigned short pass);
342 unsigned short pass);
343 bool Fit2D(
short mode,
350 template <
typename T>
351 std::vector<T>
SetIntersection(
const std::vector<T>& set1,
const std::vector<T>& set2);
352 template <
typename T>
353 std::vector<T>
SetDifference(
const std::vector<T>& set1,
const std::vector<T>& set2);
374 unsigned short tPoint);
380 bool printVtx =
true);
403 template <
typename T>
411 std::vector<T> shared;
413 if (set1.empty())
return shared;
414 if (set2.empty())
return shared;
415 for (
auto element1 : set1) {
417 if (std::find(set2.begin(), set2.end(), element1) == set2.end())
continue;
419 if (std::find(shared.begin(), shared.end(), element1) != shared.end())
continue;
420 shared.push_back(element1);
426 template <
typename T>
431 std::vector<T> different;
432 if (set1.empty() && set2.empty())
return different;
433 if (!set1.empty() && set2.empty())
return set1;
434 if (set1.empty() && !set2.empty())
return set2;
435 for (
auto element1 : set1) {
437 if (std::find(set2.begin(), set2.end(), element1) != set2.end())
continue;
439 if (std::find(different.begin(), different.end(), element1) != different.end())
continue;
440 different.push_back(element1);
442 for (
auto element2 : set2) {
444 if (std::find(set1.begin(), set1.end(), element2) != set1.end())
continue;
446 if (std::find(different.begin(), different.end(), element2) != different.end())
continue;
447 different.push_back(element2);
454 #endif // ifndef TRAJCLUSTERALGUTILS_H void PrintAll(detinfo::DetectorPropertiesData const &detProp, std::string someText)
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
float HitsPosTime(const TCSlice &slc, const std::vector< unsigned int > &hitsInMultiplet, float &sum, HitStatus_t hitRequest)
void CheckTrajBeginChg(TCSlice &slc, unsigned short itj)
void ReleaseHits(TCSlice &slc, Trajectory &tj)
short MCSMom(const TCSlice &slc, const std::vector< int > &tjIDs)
unsigned short FarEnd(const TCSlice &slc, const PFPStruct &pfp, const Point3_t &pos)
void SetEndPoints(Trajectory &tj)
void FitPar(const TCSlice &slc, const Trajectory &tj, unsigned short originPt, unsigned short npts, short fitDir, ParFit &pFit, unsigned short usePar)
bool TrajHitsOK(TCSlice &slc, const std::vector< unsigned int > &iHitsInMultiplet, const std::vector< unsigned int > &jHitsInMultiplet)
bool InTrajOK(TCSlice &slc, std::string someText)
unsigned short CloseEnd(const TCSlice &slc, const Trajectory &tj, const Point2_t &pos)
Reconstruction base classes.
struct of temporary 2D vertices (end points)
std::vector< int > GetAssns(TCSlice &slc, std::string type1Name, int id, std::string type2Name)
std::vector< unsigned int > PutTrajHitsInVector(const Trajectory &tj, HitStatus_t hitRequest)
double rms(sqlite3 *db, std::string const &table_name, std::string const &column_name)
std::array< double, 3 > Point3_t
bool SignalAtTp(TrajPoint &tp)
void SetPDGCode(TCSlice &slc, unsigned short itj)
void Print2V(std::string someText, mf::LogVerbatim &myprt, VtxStore &vx2, bool &printHeader)
void Print3V(detinfo::DetectorPropertiesData const &detProp, std::string someText, mf::LogVerbatim &myprt, Vtx3Store &vx3, bool &printHeader)
void PrintPFP(std::string someText, TCSlice &slc, const PFPStruct &pfp, bool printHeader)
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)
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.
bool WireHitRangeOK(TCSlice &slc, const CTP_t &inCTP)
void UnsetUsedHits(TCSlice &slc, TrajPoint &tp)
std::string PrintEndFlag(const PFPStruct &pfp, unsigned short end)
void PrintT(std::string someText, mf::LogVerbatim &myprt, Trajectory &tj, bool &printHeader)
bool StoreTraj(TCSlice &slc, Trajectory &tj)
float TpSumHitChg(const TCSlice &slc, TrajPoint const &tp)
std::string PrintPos(const TCSlice &slc, const TrajPoint &tp)
void ChkChgAsymmetry(TCSlice &slc, Trajectory &tj, bool prt)
float ExpectedHitsRMS(TCSlice &slc, const TrajPoint &tp)
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)
void SetAngleCode(TrajPoint &tp)
void PrintP(std::string someText, mf::LogVerbatim &myprt, PFPStruct &pfp, bool &printHeader)
float PointTrajDOCA(const TCSlice &slc, unsigned int iht, TrajPoint const &tp)
double DeltaAngle(const Vector3_t v1, const Vector3_t v2)
bool StartTraj(TCSlice &slc, Trajectory &tj, unsigned int fromhit, unsigned int tohit, unsigned short pass)
bool MakeBareTrajPoint(const TCSlice &slc, unsigned int fromHit, unsigned int toHit, TrajPoint &tp)
bool LongPulseHit(const recob::Hit &hit)
float MCSThetaRMS(const TCSlice &slc, const Trajectory &tj)
float TPHitsRMSTime(const TCSlice &slc, const TrajPoint &tp, HitStatus_t hitRequest)
unsigned short NumUsedHitsInTj(const TCSlice &slc, const Trajectory &tj)
std::string TPEnvString(const TrajPoint &tp)
void PrintPFPs(std::string someText, TCSlice &slc)
float MaxTjLen(const TCSlice &slc, std::vector< int > &tjIDs)
void Print3S(detinfo::DetectorPropertiesData const &detProp, std::string someText, mf::LogVerbatim &myprt, ShowerStruct3D &ss3)
bool MergeTjIntoPFP(TCSlice &slc, int mtjid, PFPStruct &pfp, bool prt)
double DeltaAngle2(double Ang1, double Ang2)
std::vector< T > SetIntersection(const std::vector< T > &set1, const std::vector< T > &set2)
std::string PrintHitShort(const TCHit &tch)
TrajPoint MakeBareTP(detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, const Point3_t &pos, CTP_t inCTP)
float OverlapFraction(const TCSlice &slc, const Trajectory &tj1, const Trajectory &tj2)
float HitsRMSTime(const TCSlice &slc, const std::vector< unsigned int > &hitsInMultiplet, HitStatus_t hitRequest)
bool CompatibleMerge(const TCSlice &slc, std::vector< int > &tjIDs, bool prt)
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
void PrintAllTraj(detinfo::DetectorPropertiesData const &detProp, std::string someText, TCSlice &slc, unsigned short itj, unsigned short ipt, bool prtVtx)
int PrimaryID(const TCSlice &slc, const Trajectory &tj)
std::array< float, 2 > Point2_t
int PDGCodeVote(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, PFPStruct &pfp)
bool TrajIsClean(TCSlice &slc, Trajectory &tj, bool prt)
float DeadWireCount(const TCSlice &slc, const TrajPoint &tp1, const TrajPoint &tp2)
bool BraggSplit(TCSlice &slc, unsigned short itj)
unsigned short NearbyCleanPt(const TCSlice &slc, const Trajectory &tj, unsigned short end)
Vector3_t PointDirection(const Point3_t p1, const Point3_t p2)
float ElectronLikelihood(const TCSlice &slc, const Trajectory &tj)
float TwoTPAngle(const TrajPoint &tp1, const TrajPoint &tp2)
float KinkSignificance(TCSlice &slc, Trajectory &tj1, unsigned short end1, Trajectory &tj2, unsigned short end2, unsigned short nPtsFit, bool useChg, bool prt)
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)
bool PointInsideEnvelope(const Point2_t &Point, const std::vector< Point2_t > &Envelope)
void ChkEndKink(TCSlice &slc, Trajectory &tj, bool prt)
void TagJunkTj(TCSlice &slc, Trajectory &tj, bool prt)
void MakeTrajectoryObsolete(TCSlice &slc, unsigned int itj)
float PointTrajDOCA2(const TCSlice &slc, float wire, float time, TrajPoint const &tp)
double PosSep2(const Point3_t &pos1, const Point3_t &pos2)
unsigned short GetPFPIndex(const TCSlice &slc, int tjID)
void FitTraj(TCSlice &slc, Trajectory &tj)
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)
void TrajPointTrajDOCA(const TCSlice &slc, TrajPoint const &tp, Trajectory const &tj, unsigned short &closePt, float &minSep)
bool valsDecreasing(const SortEntry &c1, const SortEntry &c2)
General LArSoft Utilities.
double DotProd(const Vector2_t &v1, const Vector2_t &v2)
The data type to uniquely identify a TPC.
float MaxChargeAsymmetry(TCSlice &slc, std::vector< int > &tjIDs)
unsigned short NearestPtWithChg(const TCSlice &slc, const Trajectory &tj, unsigned short thePt)
bool SetMag(Vector3_t &v1, double mag)
std::array< double, 2 > Vector2_t
void ReverseTraj(TCSlice &slc, Trajectory &tj)
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)
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.
void UpdateTjChgProperties(std::string inFcnLabel, TCSlice &slc, Trajectory &tj, bool prt)
bool MergeAndStore(TCSlice &slc, unsigned int itj1, unsigned int itj2, bool doPrt)
float PointPull(const PFPStruct &pfp, const TP3D &tp3d)
void RestoreObsoleteTrajectory(TCSlice &slc, unsigned int itj)
void TrajIntersection(TrajPoint const &tp1, TrajPoint const &tp2, Point2_t &pos)
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)
bool valsIncreasing(const SortEntry &c1, const SortEntry &c2)
double PosSep(const Point3_t &pos1, const Point3_t &pos2)
void TrimHiChgEndPts(TCSlice &slc, Trajectory &tj, bool prt)
unsigned short PDGCodeIndex(int PDGCode)
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)
void TjDeltaRMS(const TCSlice &slc, const Trajectory &tj, unsigned short firstPt, unsigned short lastPt, double &rms, unsigned short &cnt)
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)
bool SignalBetween(const TCSlice &slc, const TrajPoint &tp1, const TrajPoint &tp2, const float &MinWireSignalFraction)
2D representation of charge deposited in the TDC/wire plane
void MoveTPToWire(TrajPoint &tp, float wire)
unsigned short NumPtsWithCharge(const TCSlice &slc, const Trajectory &tj, bool includeDeadWires)
void MergeGhostTjs(TCSlice &slc, CTP_t inCTP)
int PrimaryUID(const TCSlice &slc, const PFPStruct &pfp)
bool TrajTrajDOCA(const TCSlice &slc, const Trajectory &tj1, const Trajectory &tj2, unsigned short &ipt1, unsigned short &ipt2, float &minSep)
LArSoft geometry interface.
float TPHitsRMSTick(const TCSlice &slc, const TrajPoint &tp, HitStatus_t hitRequest)
void PrintTPHeader(std::string someText)
unsigned short AngleRange(TrajPoint const &tp)
void SetTPEnvironment(TCSlice &slc, CTP_t inCTP)
bool HasDuplicateHits(const TCSlice &slc, Trajectory const &tj, bool prt)
void ChkMissedKink(TCSlice &slc, Trajectory &tj, bool prt)