LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
Utils.cxx File Reference
#include "larreco/RecoAlg/TCAlg/Utils.h"
#include "larsim/MCCheater/ParticleInventoryService.h"
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include "art/Framework/Services/Registry/ServiceHandle.h"
#include "larcorealg/Geometry/GeometryCore.h"
#include "larcorealg/Geometry/TPCGeo.h"
#include "larcoreobj/SimpleTypesAndConstants/RawTypes.h"
#include "larcoreobj/SimpleTypesAndConstants/geo_types.h"
#include "lardataalg/DetectorInfo/DetectorClocks.h"
#include "lardataalg/DetectorInfo/DetectorPropertiesData.h"
#include "lardataobj/RecoBase/Hit.h"
#include "larevt/CalibrationDBI/Interface/ChannelStatusProvider.h"
#include "larevt/CalibrationDBI/Interface/ChannelStatusService.h"
#include "larreco/RecoAlg/TCAlg/DebugStruct.h"
#include "larreco/RecoAlg/TCAlg/PFPUtils.h"
#include "larreco/RecoAlg/TCAlg/StepUtils.h"
#include "larreco/RecoAlg/TCAlg/TCShower.h"
#include "larreco/RecoAlg/TCAlg/TCVertex.h"
#include "nusimdata/SimulationBase/MCParticle.h"
#include <algorithm>
#include <array>
#include <bitset>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>

Go to the source code of this file.

Namespaces

 tca
 

Functions

void tca::MakeHaloTj (TCSlice &slc, Trajectory &muTj, bool prt)
 
void tca::DefineTjParents (TCSlice &slc, bool prt)
 
float tca::MaxChargeAsymmetry (TCSlice &slc, std::vector< int > const &tjIDs)
 
int tca::PDGCodeVote (const TCSlice &slc, const std::vector< int > &tjIDs)
 
int tca::NeutrinoPrimaryTjID (const TCSlice &slc, const Trajectory &tj)
 
int tca::PrimaryID (const TCSlice &slc, const Trajectory &tj)
 
int tca::PrimaryUID (const PFPStruct &pfp)
 
bool tca::MergeTjIntoPFP (TCSlice &slc, int mtjid, PFPStruct &pfp, bool prt)
 
float tca::PointPull (Point2_t pos, float chg, const Trajectory &tj)
 
bool tca::CompatibleMerge (const TCSlice &slc, std::vector< int > const &tjIDs, bool prt)
 
bool tca::CompatibleMerge (const Trajectory &tj1, const Trajectory &tj2, bool prt)
 
float tca::OverlapFraction (const Trajectory &tj1, const Trajectory &tj2)
 
unsigned short tca::AngleRange (TrajPoint const &tp)
 
void tca::SetAngleCode (TrajPoint &tp)
 
unsigned short tca::AngleRange (float angle)
 
void tca::FitTraj (TCSlice const &slc, Trajectory &tj)
 
void tca::FitTraj (TCSlice const &slc, Trajectory &tj, unsigned short originPt, unsigned short npts, short fitDir, TrajPoint &tpFit)
 
unsigned short tca::GetPFPIndex (const TCSlice &slc, int tjID)
 
void tca::ReleaseHits (TCSlice &slc, Trajectory const &tj)
 
void tca::UnsetUsedHits (TCSlice &slc, TrajPoint &tp)
 
bool tca::StoreTraj (TCSlice &slc, Trajectory &tj)
 
void tca::FitPar (const Trajectory &tj, unsigned short originPt, unsigned short npts, short fitDir, ParFit &pFit, unsigned short usePar)
 
bool tca::InTrajOK (TCSlice &slc, std::string someText)
 
void tca::CheckTrajBeginChg (TCSlice &slc, unsigned short itj)
 
bool tca::BraggSplit (TCSlice &slc, unsigned short itj)
 
void tca::TrimHiChgEndPts (TCSlice &slc, Trajectory &tj, bool prt)
 
void tca::TrimEndPts (std::string fcnLabel, TCSlice &slc, Trajectory &tj, const std::vector< float > &fQualityCuts, bool prt)
 
void tca::ChkEndKink (TCSlice const &slc, Trajectory &tj, bool prt)
 
void tca::ChkChgAsymmetry (TCSlice &slc, Trajectory &tj, bool prt)
 
bool tca::SignalBetween (const TrajPoint &tp1, const TrajPoint &tp2, const float MinWireSignalFraction)
 
bool tca::SignalBetween (TrajPoint tp, float toPos0, const float MinWireSignalFraction)
 
float tca::ChgFracBetween (TrajPoint tp, float toPos0)
 
bool tca::TrajHitsOK (TCSlice const &slc, const std::vector< unsigned int > &iHitsInMultiplet, const std::vector< unsigned int > &jHitsInMultiplet)
 
bool tca::TrajHitsOK (TCSlice const &slc, const unsigned int iht, const unsigned int jht)
 
float tca::ExpectedHitsRMS (const TrajPoint &tp)
 
bool tca::SignalAtTpInSlc (const TCSlice &slc, const TrajPoint &tp)
 
bool tca::SignalAtTp (TrajPoint &tp)
 
bool tca::NearbySrcHit (geo::PlaneID plnID, unsigned int wire, float loTick, float hiTick)
 
float tca::TpSumHitChg (const TCSlice &slc, TrajPoint const &tp)
 
unsigned short tca::NumPtsWithCharge (const TCSlice &slc, const Trajectory &tj, bool includeDeadWires)
 
unsigned short tca::NumPtsWithCharge (const TCSlice &slc, const Trajectory &tj, bool includeDeadWires, unsigned short firstPt, unsigned short lastPt)
 
float tca::DeadWireCount (const TCSlice &slc, const TrajPoint &tp1, const TrajPoint &tp2)
 
float tca::DeadWireCount (const TCSlice &slc, const float &inWirePos1, const float &inWirePos2, CTP_t tCTP)
 
unsigned short tca::PDGCodeIndex (int PDGCode)
 
void tca::MakeTrajectoryObsolete (TCSlice &slc, unsigned int itj)
 
void tca::RestoreObsoleteTrajectory (TCSlice &slc, unsigned int itj)
 
void tca::MergeGhostTjs (TCSlice &slc, CTP_t inCTP)
 
bool tca::SplitTraj (detinfo::DetectorPropertiesData const &detProp, TCSlice &slc, unsigned short itj, float XPos, bool makeVx2, bool prt)
 
bool tca::SplitTraj (TCSlice &slc, unsigned short itj, unsigned short pos, unsigned short ivx, bool prt)
 
void tca::TrajPointTrajDOCA (TrajPoint const &tp, Trajectory const &tj, unsigned short &closePt, float &minSep)
 
bool tca::TrajTrajDOCA (const TCSlice &slc, const Trajectory &tj1, const Trajectory &tj2, unsigned short &ipt1, unsigned short &ipt2, float &minSep)
 
bool tca::TrajTrajDOCA (const TCSlice &slc, const Trajectory &tj1, const Trajectory &tj2, unsigned short &ipt1, unsigned short &ipt2, float &minSep, bool considerDeadWires)
 
float tca::HitSep2 (const TCSlice &slc, unsigned int iht, unsigned int jht)
 
unsigned short tca::CloseEnd (const Trajectory &tj, const Point2_t &pos)
 
float tca::PointTrajSep2 (float wire, float time, TrajPoint const &tp)
 
float tca::PointTrajDOCA (const TCSlice &slc, unsigned int iht, TrajPoint const &tp)
 
float tca::PointTrajDOCA (float wire, float time, TrajPoint const &tp)
 
float tca::PointTrajDOCA2 (float wire, float time, TrajPoint const &tp)
 
void tca::TrajIntersection (TrajPoint const &tp1, TrajPoint const &tp2, Point2_t &pos)
 
void tca::TrajIntersection (TrajPoint const &tp1, TrajPoint const &tp2, float &x, float &y)
 
float tca::MaxTjLen (const TCSlice &slc, std::vector< int > &tjIDs)
 
float tca::TrajLength (const Trajectory &tj)
 
float tca::PosSep (const Point2_t &pos1, const Point2_t &pos2)
 
float tca::PosSep2 (const Point2_t &pos1, const Point2_t &pos2)
 
float tca::TrajPointSeparation (const TrajPoint &tp1, const TrajPoint &tp2)
 
bool tca::TrajClosestApproach (Trajectory const &tj, float x, float y, unsigned short &closePt, float &DOCA)
 
float tca::TwoTPAngle (const TrajPoint &tp1, const TrajPoint &tp2)
 
std::vector< unsigned int > tca::PutHitsInVector (const TCSlice &slc, PFPStruct const &pfp, HitStatus_t hitRequest)
 
std::vector< unsigned int > tca::PutTrajHitsInVector (const Trajectory &tj, HitStatus_t hitRequest)
 
void tca::TagJunkTj (Trajectory &tj, bool prt)
 
bool tca::HasDuplicateHits (const TCSlice &slc, Trajectory const &tj, bool prt)
 
void tca::MoveTPToWire (TrajPoint &tp, float wire)
 
std::vector< unsigned int > tca::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)
 
bool tca::FindCloseHits (TCSlice const &slc, TrajPoint &tp, float const maxDelta, HitStatus_t hitRequest)
 
unsigned short tca::NearbyCleanPt (const Trajectory &tj, unsigned short end)
 
std::vector< int > tca::FindCloseTjs (const TCSlice &slc, const TrajPoint &fromTp, const TrajPoint &toTp, const float &maxDelta)
 
float tca::KinkSignificance (TCSlice const &slc, Trajectory const &tj1, unsigned short end1, Trajectory const &tj2, unsigned short end2, unsigned short nPtsFit, bool useChg, bool prt)
 
float tca::KinkSignificance (TCSlice const &slc, Trajectory &tj, unsigned short kinkPt, unsigned short nPtsFit, bool useChg, bool prt)
 
float tca::ElectronLikelihood (const TCSlice &slc, const Trajectory &tj)
 
float tca::ChgFracNearPos (const TCSlice &slc, const Point2_t &pos, const std::vector< int > &tjIDs)
 
float tca::MaxHitDelta (TCSlice &slc, Trajectory &tj)
 
void tca::ReverseTraj (Trajectory &tj)
 
bool tca::PointInsideEnvelope (const Point2_t &Point, const std::vector< Point2_t > &Envelope)
 
bool tca::SetMag (Vector2_t &v1, double mag)
 
void tca::FindAlongTrans (Point2_t pos1, Vector2_t dir1, Point2_t pos2, Point2_t &alongTrans)
 
double tca::DeltaAngle (const Point2_t &p1, const Point2_t &p2)
 
double tca::DeltaAngle2 (double Ang1, double Ang2)
 
double tca::DeltaAngle (double Ang1, double Ang2)
 
void tca::SetEndPoints (Trajectory &tj)
 
bool tca::TrajIsClean (Trajectory const &tj, bool prt)
 
short tca::MCSMom (const TCSlice &slc, const std::vector< int > &tjIDs)
 
short tca::MCSMom (const TCSlice &slc, const Trajectory &tj)
 
short tca::MCSMom (const TCSlice &slc, const Trajectory &tj, unsigned short firstPt, unsigned short lastPt)
 
unsigned short tca::NearestPtWithChg (const Trajectory &tj, unsigned short thePt)
 
float tca::MCSThetaRMS (const Trajectory &tj)
 
double tca::MCSThetaRMS (const Trajectory &tj, unsigned short firstPt, unsigned short lastPt)
 
void tca::TjDeltaRMS (const Trajectory &tj, unsigned short firstPt, unsigned short lastPt, double &rms, unsigned short &cnt)
 
void tca::SetTPEnvironment (TCSlice &slc, CTP_t inCTP)
 
void tca::UpdateTjChgProperties (std::string inFcnLabel, TCSlice const &slc, Trajectory &tj, bool prt)
 
void tca::UpdateVxEnvironment (TCSlice &slc)
 
void tca::UpdateVxEnvironment (TCSlice &slc, VtxStore &vx2, bool prt)
 
TrajPoint tca::MakeBareTP (detinfo::DetectorPropertiesData const &detProp, const Point3_t &pos, CTP_t inCTP)
 
TrajPoint tca::MakeBareTP (detinfo::DetectorPropertiesData const &detProp, const Point3_t &pos, const Vector3_t &dir, CTP_t inCTP)
 
bool tca::MakeBareTrajPoint (const TCSlice &slc, unsigned int fromHit, unsigned int toHit, TrajPoint &tp)
 
bool tca::MakeBareTrajPoint (float fromWire, float fromTick, float toWire, float toTick, CTP_t tCTP, TrajPoint &tp)
 
bool tca::MakeBareTrajPoint (const Point2_t &fromPos, const Point2_t &toPos, TrajPoint &tpOut)
 
bool tca::MakeBareTrajPoint (const TrajPoint &tpIn1, const TrajPoint &tpIn2, TrajPoint &tpOut)
 
unsigned short tca::FarEnd (const Trajectory &tj, const Point2_t &pos)
 
Vector2_t tca::PointDirection (const Point2_t p1, const Point2_t p2)
 
float tca::TPHitsRMSTime (const TCSlice &slc, const TrajPoint &tp, HitStatus_t hitRequest)
 
float tca::TPHitsRMSTick (const TCSlice &slc, const TrajPoint &tp, HitStatus_t hitRequest)
 
float tca::HitsRMSTime (const TCSlice &slc, const std::vector< unsigned int > &hitsInMultiplet, HitStatus_t hitRequest)
 
float tca::HitsRMSTick (const TCSlice &slc, const std::vector< unsigned int > &hitsInMultiplet, HitStatus_t hitRequest)
 
float tca::HitsPosTime (const TCSlice &slc, const std::vector< unsigned int > &hitsInMultiplet, float &sum, HitStatus_t hitRequest)
 
float tca::HitsPosTick (const TCSlice &slc, const std::vector< unsigned int > &hitsInMultiplet, float &sum, HitStatus_t hitRequest)
 
unsigned short tca::NumHitsInTP (const TrajPoint &tp, HitStatus_t hitRequest)
 
void tca::SetPDGCode (TCSlice &slc, unsigned short itj)
 
void tca::SetPDGCode (TCSlice const &slc, Trajectory &tj)
 
bool tca::AnalyzeHits ()
 
bool tca::LongPulseHit (const recob::Hit &hit)
 
void tca::FillWireHitRange (geo::TPCID inTPCID)
 
bool tca::FillWireHitRange (detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, TCSlice &slc)
 
bool tca::WireHitRangeOK (TCSlice const &slc, const CTP_t &inCTP)
 
bool tca::MergeAndStore (TCSlice &slc, unsigned int itj1, unsigned int itj2, bool doPrt)
 
std::vector< int > tca::GetAssns (TCSlice const &slc, std::string type1Name, int id, std::string type2Name)
 
bool tca::StartTraj (TCSlice const &slc, Trajectory &tj, unsigned int fromhit, unsigned int tohit, unsigned short pass)
 
bool tca::StartTraj (Trajectory &tj, float fromWire, float fromTick, float toWire, float toTick, CTP_t &tCTP, unsigned short pass)
 
std::pair< unsigned short, unsigned short > tca::GetSliceIndex (std::string typeName, int uID)
 
bool tca::Fit2D (short mode, Point2_t inPt, float &inPtErr, Vector2_t &outVec, Vector2_t &outVecErr, float &chiDOF)
 
bool tca::DecodeDebugString (std::string strng)
 
void tca::DumpTj ()
 
void tca::PrintDebugMode ()
 
void tca::PrintAll (detinfo::DetectorPropertiesData const &detProp, std::string someText)
 
void tca::PrintP (mf::LogVerbatim &myprt, PFPStruct const &pfp, bool &printHeader)
 
void tca::Print3V (detinfo::DetectorPropertiesData const &detProp, mf::LogVerbatim &myprt, Vtx3Store const &vx3, bool &printHeader)
 
void tca::Print2V (mf::LogVerbatim &myprt, VtxStore const &vx2, bool &printHeader)
 
void tca::Print3S (detinfo::DetectorPropertiesData const &detProp, mf::LogVerbatim &myprt, ShowerStruct3D const &ss3)
 
void tca::PrintT (mf::LogVerbatim &myprt, Trajectory const &tj, bool &printHeader)
 
void tca::PrintAllTraj (detinfo::DetectorPropertiesData const &detProp, std::string someText, TCSlice const &slc, unsigned short itj, unsigned short ipt, bool prtVtx)
 
void tca::PrintTrajectory (std::string someText, const TCSlice &slc, const Trajectory &tj, unsigned short tPoint)
 
void tca::PrintTPHeader (std::string someText)
 
void tca::PrintTP (std::string someText, const TCSlice &slc, unsigned short ipt, short dir, unsigned short pass, const TrajPoint &tp)
 
std::string tca::TPEnvString (const TrajPoint &tp)
 
void tca::PrintPFP (std::string someText, TCSlice const &slc, const PFPStruct &pfp, bool printHeader)
 
void tca::PrintPFPs (std::string someText, TCSlice const &slc)
 
std::string tca::PrintEndFlag (const PFPStruct &pfp, unsigned short end)
 
std::string tca::PrintEndFlag (const Trajectory &tj, unsigned short end)
 
std::string tca::PrintHitShort (const TCHit &tch)
 
std::string tca::PrintHit (const TCHit &tch)
 
std::string tca::PrintPos (const TrajPoint &tp)
 
std::string tca::PrintPos (const Point2_t &pos)