9 #ifndef TRAJCLUSTERALGUTILS_H 10 #define TRAJCLUSTERALGUTILS_H 26 #include "larevt/CalibrationDBI/Interface/ChannelStatusService.h" 27 #include "larevt/CalibrationDBI/Interface/ChannelStatusProvider.h" 71 void ChgSlope(
TCSlice& slc,
Trajectory& tj,
unsigned short fromPt,
unsigned short toPt,
float& slope,
float& slopeErr,
float& chiDOF);
79 bool TrajHitsOK(
TCSlice& slc,
const std::vector<unsigned int>& iHitsInMultiplet,
const std::vector<unsigned int>& jHitsInMultiplet);
94 bool SplitTraj(
TCSlice& slc,
unsigned short itj,
unsigned short pos,
unsigned short ivx,
bool prt);
95 bool SplitTraj(
TCSlice& slc,
unsigned short itj,
float XPos,
bool makeVx2,
bool prt);
106 std::vector<unsigned int>
FindCloseHits(
TCSlice& slc, std::array<int, 2>
const& wireWindow,
Point2_t const& timeWindow,
const unsigned short plane, HitStatus_t hitRequest,
bool usePeakTime,
bool& hitsNear);
153 float HitsRMSTick(
TCSlice& slc,
const std::vector<unsigned int>& hitsInMultiplet, HitStatus_t hitRequest);
154 float HitsRMSTime(
TCSlice& slc,
const std::vector<unsigned int>& hitsInMultiplet, HitStatus_t hitRequest);
155 float HitsPosTick(
TCSlice& slc,
const std::vector<unsigned int>& hitsInMultiplet,
float& chg, HitStatus_t hitRequest);
156 float HitsPosTime(
TCSlice& slc,
const std::vector<unsigned int>& hitsInMultiplet,
float& chg, HitStatus_t hitRequest);
194 std::vector<int>
GetAssns(
TCSlice& slc, std::string type1Name,
int id, std::string type2Name);
199 std::pair<unsigned short, unsigned short>
GetSliceIndex(std::string typeName,
int uID);
200 template <
typename T>
201 std::vector<T>
SetIntersection(
const std::vector<T>& set1,
const std::vector<T>& set2);
202 template <
typename T>
203 std::vector<T>
SetDifference(
const std::vector<T>& set1,
const std::vector<T>& set2);
207 void PrintAll(std::string someText,
const std::vector<simb::MCParticle*>& mcpList);
214 void PrintAllTraj(std::string someText,
TCSlice& slc,
unsigned short itj,
unsigned short ipt,
bool printVtx =
true);
230 template <
typename T>
231 std::vector<T>
SetIntersection(
const std::vector<T>& set1,
const std::vector<T>& set2)
237 std::vector<T> shared;
239 if(set1.empty())
return shared;
240 if(set2.empty())
return shared;
241 for(
auto element1 : set1) {
243 if(std::find(set2.begin(), set2.end(), element1) == set2.end())
continue;
245 if(std::find(shared.begin(), shared.end(), element1) != shared.end())
continue;
246 shared.push_back(element1);
252 template <
typename T>
253 std::vector<T>
SetDifference(
const std::vector<T>& set1,
const std::vector<T>& set2)
256 std::vector<T> different;
257 if(set1.empty() && set2.empty())
return different;
258 if(!set1.empty() && set2.empty())
return set1;
259 if(set1.empty() && !set2.empty())
return set2;
260 for(
auto element1 : set1) {
262 if(std::find(set2.begin(), set2.end(), element1) != set2.end())
continue;
264 if(std::find(different.begin(), different.end(), element1) != different.end())
continue;
265 different.push_back(element1);
267 for(
auto element2 : set2) {
269 if(std::find(set1.begin(), set1.end(), element2) != set1.end())
continue;
271 if(std::find(different.begin(), different.end(), element2) != different.end())
continue;
272 different.push_back(element2);
279 #endif // ifndef TRAJCLUSTERALGUTILS_H
void PrintTrajectory(std::string someText, TCSlice &slc, const Trajectory &tj, unsigned short tPoint)
float HitsRMSTime(TCSlice &slc, const std::vector< unsigned int > &hitsInMultiplet, HitStatus_t hitRequest)
void CheckTrajBeginChg(TCSlice &slc, unsigned short itj)
void ReleaseHits(TCSlice &slc, Trajectory &tj)
float HitsRMSTick(TCSlice &slc, const std::vector< unsigned int > &hitsInMultiplet, HitStatus_t hitRequest)
int PDGCodeVote(TCSlice &slc, std::vector< int > &tjIDs, bool prt)
void SetEndPoints(Trajectory &tj)
bool MakeBareTrajPoint(TCSlice &slc, unsigned int fromHit, unsigned int toHit, TrajPoint &tp)
bool TrajHitsOK(TCSlice &slc, const std::vector< unsigned int > &iHitsInMultiplet, const std::vector< unsigned int > &jHitsInMultiplet)
bool InTrajOK(TCSlice &slc, std::string someText)
float TjDirFOM(TCSlice &slc, const Trajectory &tj, bool prt)
struct of temporary 2D vertices (end points)
std::vector< int > GetAssns(TCSlice &slc, std::string type1Name, int id, std::string type2Name)
void TrajPointTrajDOCA(TCSlice &slc, TrajPoint const &tp, Trajectory const &tj, unsigned short &closePt, float &minSep)
std::array< double, 3 > Point3_t
short MCSMom(TCSlice &slc, const std::vector< int > &tjIDs)
void PrintPFP(std::string someText, TCSlice &slc, const PFPStruct &pfp, bool printHeader)
std::vector< unsigned int > PutTrajHitsInVector(Trajectory const &tj, HitStatus_t hitRequest)
int NeutrinoPrimaryTjID(TCSlice &slc, const Trajectory &tj)
Declaration of signal hit object.
void FindAlongTrans(Point3_t pos1, Vector3_t dir1, Point3_t pos2, Point2_t &alongTrans)
bool WireHitRangeOK(TCSlice &slc, const CTP_t &inCTP)
void UnsetUsedHits(TCSlice &slc, TrajPoint &tp)
void TjDeltaRMS(TCSlice &slc, Trajectory &tj, unsigned short firstPt, unsigned short lastPt, double &rms, unsigned short &cnt)
void PrintT(std::string someText, mf::LogVerbatim &myprt, Trajectory &tj, bool &printHeader)
bool StoreTraj(TCSlice &slc, Trajectory &tj)
void ChkChgAsymmetry(TCSlice &slc, Trajectory &tj, bool prt)
float ExpectedHitsRMS(TCSlice &slc, const TrajPoint &tp)
void PrintAllTraj(std::string someText, TCSlice &slc, unsigned short itj, unsigned short ipt, bool prtVtx)
bool TrajClosestApproach(Trajectory const &tj, float x, float y, unsigned short &closePt, float &DOCA)
unsigned short MatchVecIndex(TCSlice &slc, int tjID)
float TrajPointSeparation(TrajPoint &tp1, TrajPoint &tp2)
void SetAngleCode(TrajPoint &tp)
void PrintP(std::string someText, mf::LogVerbatim &myprt, PFPStruct &pfp, bool &printHeader)
void Print3V(std::string someText, mf::LogVerbatim &myprt, Vtx3Store &vx3)
double DeltaAngle(const Vector3_t v1, const Vector3_t v2)
void TagDeltaRays(TCSlice &slc, const CTP_t &inCTP)
bool StartTraj(TCSlice &slc, Trajectory &tj, unsigned int fromhit, unsigned int tohit, unsigned short pass)
bool LongPulseHit(const recob::Hit &hit)
float DeadWireCount(TCSlice &slc, const TrajPoint &tp1, const TrajPoint &tp2)
void PrintPFPs(std::string someText, TCSlice &slc)
bool MergeTjIntoPFP(TCSlice &slc, int mtjid, PFPStruct &pfp, bool prt)
int PrimaryID(TCSlice &slc, const Trajectory &tj)
double DeltaAngle2(double Ang1, double Ang2)
std::vector< T > SetIntersection(const std::vector< T > &set1, const std::vector< T > &set2)
bool TrajTrajDOCA(TCSlice &slc, const Trajectory &tj1, const Trajectory &tj2, unsigned short &ipt1, unsigned short &ipt2, float &minSep)
void UpdateVxEnvironment(std::string inFcnLabel, TCSlice &slc, VtxStore &vx2, bool prt)
float HitsPosTick(TCSlice &slc, const std::vector< unsigned int > &hitsInMultiplet, float &sum, HitStatus_t hitRequest)
TrajPoint MakeBareTP(TCSlice &slc, Point3_t &pos, Vector3_t &dir, CTP_t inCTP)
std::string PrintHitShort(const TCHit &tch)
float MaxTjLen(TCSlice &slc, std::vector< int > &tjIDs)
std::vector< unsigned int > FindCloseHits(TCSlice &slc, std::array< int, 2 > const &wireWindow, Point2_t const &timeWindow, const unsigned short plane, HitStatus_t hitRequest, bool usePeakTime, bool &hitsNear)
struct of temporary 3D vertices
std::array< float, 2 > Point2_t
unsigned short NearestPtWithChg(TCSlice &slc, Trajectory &tj, unsigned short thePt)
bool TrajIsClean(TCSlice &slc, Trajectory &tj, bool prt)
void Print2V(std::string someText, mf::LogVerbatim &myprt, VtxStore &vx2)
Vector3_t PointDirection(const Point3_t p1, const Point3_t p2)
unsigned short NumDeltaRays(TCSlice &slc, const Trajectory &tj)
bool SignalBetween(TCSlice &slc, const TrajPoint &tp1, const TrajPoint &tp2, const float &MinWireSignalFraction)
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
unsigned short GetPFPIndex(TCSlice &slc, int tjID)
std::vector< int > FindCloseTjs(TCSlice &slc, const TrajPoint &fromTp, const TrajPoint &toTp, const float &maxDelta)
float TrajLength(Trajectory &tj)
void MakeHaloTj(TCSlice &slc, Trajectory &muTj, bool prt)
float PointTrajDOCA2(TCSlice &slc, float wire, float time, TrajPoint const &tp)
bool SignalAtTp(TCSlice &slc, const TrajPoint &tp)
bool PointInsideEnvelope(const Point2_t &Point, const std::vector< Point2_t > &Envelope)
void TagJunkTj(TCSlice &slc, Trajectory &tj, bool prt)
void MakeTrajectoryObsolete(TCSlice &slc, unsigned int itj)
double PosSep2(const Point3_t &pos1, const Point3_t &pos2)
void FitTraj(TCSlice &slc, Trajectory &tj)
unsigned short CloseEnd(TCSlice &slc, const Trajectory &tj, const Point2_t &pos)
std::string PrintHit(const TCHit &tch)
void SetPDGCode(TCSlice &slc, unsigned short itj, bool tjDone)
bool Fit2D(short mode, Point2_t inPt, float &inPtErr, Vector2_t &outVec, Vector2_t &outVecErr, float &chiDOF)
float TpSumHitChg(TCSlice &slc, TrajPoint const &tp)
float MaxChargeAsymmetry(TCSlice &slc, std::vector< int > &tjIDs)
unsigned short FarEnd(TCSlice &slc, const PFPStruct &pfp, const Point3_t &pos)
bool SetMag(Vector3_t &v1, double mag)
std::array< double, 2 > Vector2_t
Definition of data types for geometry description.
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 TPHitsRMSTime(TCSlice &slc, TrajPoint &tp, HitStatus_t hitRequest)
Detector simulation of raw signals on wires.
void PrintAll(std::string someText, const std::vector< simb::MCParticle * > &mcpList)
void UpdateTjChgProperties(std::string inFcnLabel, TCSlice &slc, Trajectory &tj, bool prt)
unsigned short NumPtsWithCharge(TCSlice &slc, const Trajectory &tj, bool includeDeadWires)
float TwoTPAngle(TrajPoint &tp1, TrajPoint &tp2)
bool MergeAndStore(TCSlice &slc, unsigned int itj1, unsigned int itj2, bool doPrt)
void RestoreObsoleteTrajectory(TCSlice &slc, unsigned int itj)
float ChgFracNearPos(TCSlice &slc, const Point2_t &pos, const std::vector< int > &tjIDs)
void TrajIntersection(TrajPoint const &tp1, TrajPoint const &tp2, Point2_t &pos)
double DotProd(const Vector3_t &v1, const Vector3_t &v2)
float ElectronLikelihood(TCSlice &slc, Trajectory &tj, float &asym)
bool DecodeDebugString(std::string strng)
float MCSThetaRMS(TCSlice &slc, Trajectory &tj)
bool HasDuplicateHits(TCSlice &slc, Trajectory const &tj, bool prt)
void ChgSlope(TCSlice &slc, Trajectory &tj, float &slope, float &slopeErr, float &chiDOF)
float MaxHitDelta(TCSlice &slc, Trajectory &tj)
unsigned short NumUsedHitsInTj(TCSlice &slc, const Trajectory &tj)
void Print3S(std::string someText, mf::LogVerbatim &myprt, ShowerStruct3D &ss3)
double PosSep(const Point3_t &pos1, const Point3_t &pos2)
unsigned short PDGCodeIndex(int PDGCode)
std::string PrintPos(TCSlice &slc, const TrajPoint &tp)
std::pair< unsigned short, unsigned short > GetSliceIndex(std::string typeName, int uID)
float HitSep2(TCSlice &slc, unsigned int iht, unsigned int jht)
float OverlapFraction(TCSlice &slc, const Trajectory &tj1, const Trajectory &tj2)
float TPHitsRMSTick(TCSlice &slc, TrajPoint &tp, HitStatus_t hitRequest)
float PointTrajDOCA(TCSlice &slc, unsigned int iht, TrajPoint const &tp)
float HitsPosTime(TCSlice &slc, const std::vector< unsigned int > &hitsInMultiplet, float &sum, HitStatus_t hitRequest)
float PointTrajSep2(float wire, float time, TrajPoint const &tp)
std::array< double, 3 > Vector3_t
bool FillWireHitRange(TCSlice &slc)
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)
2D representation of charge deposited in the TDC/wire plane
void MoveTPToWire(TrajPoint &tp, float wire)
void MergeGhostTjs(TCSlice &slc, CTP_t inCTP)
float ChgFracBetween(TCSlice &slc, Point3_t pos1, Point3_t pos2)
bool SplitTraj(TCSlice &slc, unsigned short itj, float XPos, bool makeVx2, bool prt)
void PrintHeader(std::string someText)
void PrintTrajPoint(std::string someText, TCSlice &slc, unsigned short ipt, short dir, unsigned short pass, TrajPoint const &tp)
int PrimaryUID(TCSlice &slc, const PFPStruct &pfp)
unsigned short AngleRange(TrajPoint const &tp)
bool CompatibleMerge(TCSlice &slc, std::vector< int > &tjIDs, bool prt)