9 #ifndef TRAJCLUSTERALGUTILS_H 10 #define TRAJCLUSTERALGUTILS_H 26 #include "larevt/CalibrationDBI/Interface/ChannelStatusService.h" 27 #include "larevt/CalibrationDBI/Interface/ChannelStatusProvider.h" 63 void WatchHit(std::string someText,
TjStuff& tjs,
const unsigned int& watchHit,
short& watchInTraj,
const unsigned short& tjID);
76 bool TrajHitsOK(
TjStuff& tjs,
const std::vector<unsigned int>& iHitsInMultiplet,
const std::vector<unsigned int>& jHitsInMultiplet);
92 bool SplitTraj(
TjStuff& tjs,
unsigned short itj,
unsigned short pos,
unsigned short ivx,
bool prt);
93 bool SplitTraj(
TjStuff& tjs,
unsigned short itj,
float XPos,
bool makeVx2,
bool prt);
104 std::vector<unsigned int>
FindCloseHits(
TjStuff const& tjs, std::array<int, 2>
const& wireWindow,
Point2_t const& timeWindow,
const unsigned short plane, HitStatus_t hitRequest,
bool usePeakTime,
bool& hitsNear);
151 float HitsRMSTick(
TjStuff& tjs,
const std::vector<unsigned int>& hitsInMultiplet, HitStatus_t hitRequest);
152 float HitsRMSTime(
TjStuff& tjs,
const std::vector<unsigned int>& hitsInMultiplet, HitStatus_t hitRequest);
153 float HitsPosTick(
TjStuff& tjs,
const std::vector<unsigned int>& hitsInMultiplet,
float& chg, HitStatus_t hitRequest);
154 float HitsPosTime(
TjStuff& tjs,
const std::vector<unsigned int>& hitsInMultiplet,
float& chg, HitStatus_t hitRequest);
159 short MCSMom(
const TjStuff& tjs,
const std::vector<int>& tjIDs);
189 std::vector<int>
GetAssns(
const TjStuff& tjs, std::string type1Name,
int id, std::string type2Name);
190 template <
typename T>
191 std::vector<T>
SetIntersection(
const std::vector<T>& set1,
const std::vector<T>& set2);
192 template <
typename T>
193 std::vector<T>
SetDifference(
const std::vector<T>& set1,
const std::vector<T>& set2);
197 void PrintAllTraj(std::string someText,
const TjStuff& tjs,
const DebugStuff& Debug,
unsigned short itj,
unsigned short ipt,
bool printVtx =
true);
213 template <
typename T>
214 std::vector<T>
SetIntersection(
const std::vector<T>& set1,
const std::vector<T>& set2)
220 std::vector<T> shared;
222 if(set1.empty())
return shared;
223 if(set2.empty())
return shared;
224 for(
auto element1 : set1) {
226 if(std::find(set2.begin(), set2.end(), element1) == set2.end())
continue;
228 if(std::find(shared.begin(), shared.end(), element1) != shared.end())
continue;
229 shared.push_back(element1);
235 template <
typename T>
236 std::vector<T>
SetDifference(
const std::vector<T>& set1,
const std::vector<T>& set2)
239 std::vector<T> different;
240 if(set1.empty() && set2.empty())
return different;
241 if(!set1.empty() && set2.empty())
return set1;
242 if(set1.empty() && !set2.empty())
return set2;
243 for(
auto element1 : set1) {
245 if(std::find(set2.begin(), set2.end(), element1) != set2.end())
continue;
247 if(std::find(different.begin(), different.end(), element1) != different.end())
continue;
248 different.push_back(element1);
250 for(
auto element2 : set2) {
252 if(std::find(set1.begin(), set1.end(), element2) != set1.end())
continue;
254 if(std::find(different.begin(), different.end(), element2) != different.end())
continue;
255 different.push_back(element2);
262 #endif // ifndef TRAJCLUSTERALGUTILS_H
int PrimaryID(const TjStuff &tjs, const Trajectory &tj)
unsigned short MatchVecIndex(const TjStuff &tjs, int tjID)
std::string PrintPos(const TjStuff &tjs, const TrajPoint &tp)
std::vector< unsigned int > FindCloseHits(TjStuff const &tjs, std::array< int, 2 > const &wireWindow, Point2_t const &timeWindow, const unsigned short plane, HitStatus_t hitRequest, bool usePeakTime, bool &hitsNear)
void ChkChgAsymmetry(TjStuff &tjs, Trajectory &tj, bool prt)
float TPHitsRMSTime(TjStuff &tjs, TrajPoint &tp, HitStatus_t hitRequest)
struct of temporary 2D vertices (end points)
void PrintTrajectory(std::string someText, const TjStuff &tjs, const Trajectory &tj, unsigned short tPoint)
float OverlapFraction(TjStuff &tjs, const Trajectory &tj1, const Trajectory &tj2)
float HitSep2(TjStuff &tjs, unsigned int iht, unsigned int jht)
std::array< double, 3 > Point3_t
void UpdateVxEnvironment(std::string inFcnLabel, TjStuff &tjs, VtxStore &vx2, bool prt)
void RestoreObsoleteTrajectory(TjStuff &tjs, unsigned int itj)
unsigned short AngleRange(TjStuff &tjs, TrajPoint const &tp)
void PrintAllTraj(std::string someText, const TjStuff &tjs, const DebugStuff &debug, unsigned short itj, unsigned short ipt, bool prtVtx)
bool HasDuplicateHits(TjStuff const &tjs, Trajectory const &tj, bool prt)
std::vector< unsigned int > PutTrajHitsInVector(Trajectory const &tj, HitStatus_t hitRequest)
void TagJunkTj(TjStuff const &tjs, Trajectory &tj, bool prt)
unsigned short NearestPtWithChg(TjStuff &tjs, Trajectory &tj, unsigned short thePt)
float ChgFracBetween(TjStuff &tjs, Point3_t pos1, Point3_t pos2, geo::TPCID tpcid)
unsigned short PDGCodeIndex(TjStuff &tjs, int PDGCode)
Declaration of signal hit object.
void FindAlongTrans(Point3_t pos1, Vector3_t dir1, Point3_t pos2, Point2_t &alongTrans)
float TpSumHitChg(TjStuff &tjs, TrajPoint const &tp)
bool TrajHitsOK(TjStuff &tjs, const std::vector< unsigned int > &iHitsInMultiplet, const std::vector< unsigned int > &jHitsInMultiplet)
float HitsRMSTime(TjStuff &tjs, const std::vector< unsigned int > &hitsInMultiplet, HitStatus_t hitRequest)
float HitsRMSTick(TjStuff &tjs, const std::vector< unsigned int > &hitsInMultiplet, HitStatus_t hitRequest)
void TrimEndPts(std::string fcnLabel, TjStuff &tjs, Trajectory &tj, const std::vector< float > &fQualityCuts, bool prt)
bool TrajClosestApproach(Trajectory const &tj, float x, float y, unsigned short &closePt, float &DOCA)
float TrajPointSeparation(TrajPoint &tp1, TrajPoint &tp2)
void SetAngleCode(TjStuff &tjs, TrajPoint &tp)
double DeltaAngle(const Vector3_t v1, const Vector3_t v2)
bool MergeTjIntoPFP(TjStuff &tjs, int mtjid, PFPStruct &pfp, bool prt)
float DeadWireCount(const TjStuff &tjs, const TrajPoint &tp1, const TrajPoint &tp2)
bool CompatibleMerge(TjStuff &tjs, std::vector< int > &tjIDs, bool prt)
void MergeGhostTjs(TjStuff &tjs, CTP_t inCTP)
double DeltaAngle2(double Ang1, double Ang2)
std::vector< T > SetIntersection(const std::vector< T > &set1, const std::vector< T > &set2)
unsigned short FarEnd(const TjStuff &tjs, const PFPStruct &pfp, const Point3_t &pos)
bool SignalAtTp(TjStuff &tjs, const TrajPoint &tp)
void TagDeltaRays(TjStuff &tjs, const CTP_t &inCTP)
void CheckTrajBeginChg(TjStuff &tjs, unsigned short itj, bool prt)
bool TrajIsClean(TjStuff &tjs, Trajectory &tj, bool prt)
void ReleaseHits(TjStuff &tjs, Trajectory &tj)
void ReverseTraj(TjStuff &tjs, Trajectory &tj)
bool SplitTraj(TjStuff &tjs, unsigned short itj, float XPos, bool makeVx2, bool prt)
bool CheckWireHitRange(const TjStuff &tjs)
std::array< float, 2 > Point2_t
int PDGCodeVote(TjStuff &tjs, std::vector< int > &tjIDs, bool prt)
float PointTrajDOCA2(TjStuff const &tjs, float wire, float time, TrajPoint const &tp)
Vector3_t PointDirection(const Point3_t p1, const Point3_t p2)
float HitsPosTime(TjStuff &tjs, const std::vector< unsigned int > &hitsInMultiplet, float &sum, HitStatus_t hitRequest)
void UpdateTjChgProperties(std::string inFcnLabel, TjStuff &tjs, Trajectory &tj, bool prt)
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
unsigned short NumDeltaRays(const TjStuff &tjs, const Trajectory &tj)
bool SignalBetween(TjStuff &tjs, const TrajPoint &tp1, const TrajPoint &tp2, const float &MinWireSignalFraction, bool prt)
TrajPoint MakeBareTP(TjStuff &tjs, Point3_t &pos, Vector3_t &dir, CTP_t inCTP)
float MaxTjLen(TjStuff const &tjs, std::vector< int > &tjIDs)
unsigned short CloseEnd(TjStuff &tjs, const Trajectory &tj, const Point2_t &pos)
std::vector< int > FindCloseTjs(const TjStuff &tjs, const TrajPoint &fromTp, const TrajPoint &toTp, const float &maxDelta)
float TrajLength(Trajectory &tj)
bool PointInsideEnvelope(const Point2_t &Point, const std::vector< Point2_t > &Envelope)
void DefineTjParents(TjStuff &tjs, const geo::TPCID &tpcid, bool prt)
double PosSep2(const Point3_t &pos1, const Point3_t &pos2)
bool MakeBareTrajPoint(const TjStuff &tjs, unsigned int fromHit, unsigned int toHit, TrajPoint &tp)
std::string PrintHit(const TCHit &hit)
The data type to uniquely identify a TPC.
bool SetMag(Vector3_t &v1, double mag)
std::array< double, 2 > Vector2_t
Definition of data types for geometry description.
unsigned short NumHitsInTP(const TrajPoint &tp, HitStatus_t hitRequest)
void TagMuonDirections(TjStuff &tjs, short debugWorkID)
float PointTrajDOCA(TjStuff const &tjs, unsigned int iht, TrajPoint const &tp)
Detector simulation of raw signals on wires.
void TjDeltaRMS(TjStuff &tjs, Trajectory &tj, unsigned short firstPt, unsigned short lastPt, double &rms, unsigned short &cnt)
void WatchHit(std::string someText, TjStuff &tjs, const unsigned int &wHit, short &wInTraj, const unsigned short &tjID)
short MCSMom(const TjStuff &tjs, const std::vector< int > &tjIDs)
float ChgFracNearPos(TjStuff &tjs, const Point2_t &pos, const std::vector< int > &tjIDs)
float TwoTPAngle(TrajPoint &tp1, TrajPoint &tp2)
void TrajIntersection(TrajPoint const &tp1, TrajPoint const &tp2, Point2_t &pos)
double DotProd(const Vector3_t &v1, const Vector3_t &v2)
bool InTrajOK(TjStuff &tjs, std::string someText)
int NeutrinoPrimaryTjID(const TjStuff &tjs, const Trajectory &tj)
bool FillWireHitRange(TjStuff &tjs, const geo::TPCID &tpcid)
std::string PrintHitShort(const TCHit &hit)
float ExpectedHitsRMS(TjStuff &tjs, const TrajPoint &tp)
float MaxChargeAsymmetry(TjStuff &tjs, std::vector< int > &tjIDs)
double PosSep(const Point3_t &pos1, const Point3_t &pos2)
void SetEndPoints(TjStuff &tjs, Trajectory &tj)
unsigned short NumPtsWithCharge(const TjStuff &tjs, const Trajectory &tj, bool includeDeadWires)
bool MergeAndStore(TjStuff &tjs, unsigned int itj1, unsigned int itj2, bool doPrt)
float PointTrajSep2(float wire, float time, TrajPoint const &tp)
std::array< double, 3 > Vector3_t
float MaxHitDelta(TjStuff &tjs, Trajectory &tj)
bool WireHitRangeOK(const TjStuff &tjs, const CTP_t &inCTP)
unsigned short GetPFPIndex(const TjStuff &tjs, int tjID)
std::string PrintStopFlag(const Trajectory &tj, unsigned short end)
std::vector< T > SetDifference(const std::vector< T > &set1, const std::vector< T > &set2)
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
void MakeTrajectoryObsolete(TjStuff &tjs, unsigned int itj)
float TjDirFOM(const TjStuff &tjs, const Trajectory &tj, bool prt)
void PrintPFP(std::string someText, const TjStuff &tjs, const PFPStruct &pfp, bool printHeader)
void PrintPFPs(std::string someText, const TjStuff &tjs)
void UnsetUsedHits(TjStuff &tjs, TrajPoint &tp)
void SetPDGCode(TjStuff &tjs, unsigned short itj)
float HitsPosTick(TjStuff &tjs, const std::vector< unsigned int > &hitsInMultiplet, float &sum, HitStatus_t hitRequest)
void MoveTPToWire(TrajPoint &tp, float wire)
float MCSThetaRMS(TjStuff &tjs, Trajectory &tj)
bool TrajTrajDOCA(const TjStuff &tjs, const Trajectory &tj1, const Trajectory &tj2, unsigned short &ipt1, unsigned short &ipt2, float &minSep)
bool StoreTraj(TjStuff &tjs, Trajectory &tj)
float TPHitsRMSTick(TjStuff &tjs, TrajPoint &tp, HitStatus_t hitRequest)
void PrintTrajPoint(std::string someText, const TjStuff &tjs, unsigned short ipt, short dir, unsigned short pass, TrajPoint const &tp)
void PrintHeader(std::string someText)
void TrajPointTrajDOCA(TjStuff &tjs, TrajPoint const &tp, Trajectory const &tj, unsigned short &closePt, float &minSep)
std::vector< int > GetAssns(const TjStuff &tjs, std::string type1Name, int id, std::string type2Name)
unsigned short NumUsedHitsInTj(const TjStuff &tjs, const Trajectory &tj)
void FitTraj(TjStuff &tjs, Trajectory &tj)