#include <ProjectionMatchingAlg.h>
Classes | |
struct | Config |
Public Member Functions | |
ProjectionMatchingAlg (const Config &config) | |
ProjectionMatchingAlg (const fhicl::ParameterSet &pset) | |
double | validate_on_adc_test (const detinfo::DetectorPropertiesData &detProp, const lariov::ChannelStatusProvider &channelStatus, const pma::Track3D &trk, const img::DataProviderAlg &adcImage, const std::vector< art::Ptr< recob::Hit >> &hits, TH1F *histoPassing, TH1F *histoRejected) const |
double | validate (const detinfo::DetectorPropertiesData &detProp, const lariov::ChannelStatusProvider &channelStatus, const pma::Track3D &trk, const std::vector< art::Ptr< recob::Hit >> &hits) const |
double | validate (const detinfo::DetectorPropertiesData &detProp, const lariov::ChannelStatusProvider &channelStatus, const TVector3 &p0, const TVector3 &p1, const std::vector< art::Ptr< recob::Hit >> &hits, unsigned int testView, unsigned int tpc, unsigned int cryo) const |
double | twoViewFraction (pma::Track3D &trk) const |
unsigned int | testHits (detinfo::DetectorPropertiesData const &detProp, const pma::Track3D &trk, const std::vector< art::Ptr< recob::Hit >> &hits, double eps=1.0) const |
Count the number of hits that are closer than eps * fHitTestingDist2D to the track 2D projection. More... | |
bool | isContained (const pma::Track3D &trk, float margin=0.0F) const |
pma::Track3D * | buildTrack (const detinfo::DetectorPropertiesData &detProp, const std::vector< art::Ptr< recob::Hit >> &hits_1, const std::vector< art::Ptr< recob::Hit >> &hits_2={}) const |
pma::Track3D * | buildMultiTPCTrack (const detinfo::DetectorPropertiesData &clockData, const std::vector< art::Ptr< recob::Hit >> &hits) const |
pma::Track3D * | buildShowerSeg (const detinfo::DetectorPropertiesData &detProp, const std::vector< art::Ptr< recob::Hit >> &hits, const pma::Vector3D &vtx) const |
pma::Track3D * | buildSegment (const detinfo::DetectorPropertiesData &clockData, const std::vector< art::Ptr< recob::Hit >> &hits_1, const std::vector< art::Ptr< recob::Hit >> &hits_2={}) const |
pma::Track3D * | buildSegment (const detinfo::DetectorPropertiesData &clockData, const std::vector< art::Ptr< recob::Hit >> &hits_1, const std::vector< art::Ptr< recob::Hit >> &hits_2, const TVector3 &point) const |
pma::Track3D * | buildSegment (const detinfo::DetectorPropertiesData &detProp, const std::vector< art::Ptr< recob::Hit >> &hits, const TVector3 &point) const |
void | FilterOutSmallParts (const detinfo::DetectorPropertiesData &detProp, double r2d, const std::vector< art::Ptr< recob::Hit >> &hits_in, std::vector< art::Ptr< recob::Hit >> &hits_out, const TVector2 &vtx2d) const |
void | RemoveNotEnabledHits (pma::Track3D &trk) const |
pma::Track3D * | extendTrack (const detinfo::DetectorPropertiesData &clockData, const pma::Track3D &trk, const std::vector< art::Ptr< recob::Hit >> &hits, bool add_nodes) const |
Add more hits to an existing track, reoptimize, optionally add more nodes. More... | |
void | guideEndpoints (const detinfo::DetectorPropertiesData &clockData, pma::Track3D &trk, const std::map< unsigned int, std::vector< art::Ptr< recob::Hit >>> &hits) const |
void | guideEndpoints (const detinfo::DetectorPropertiesData &clockData, pma::Track3D &trk, pma::Track3D::ETrackEnd endpoint, const std::map< unsigned int, std::vector< art::Ptr< recob::Hit >>> &hits) const |
Add 3D reference points to clean endpoint of a track. More... | |
std::vector< pma::Hit3D * > | trimTrackToVolume (pma::Track3D &trk, TVector3 p0, TVector3 p1) const |
bool | alignTracks (pma::Track3D &first, pma::Track3D &second) const |
void | mergeTracks (const detinfo::DetectorPropertiesData &detProp, pma::Track3D &dst, pma::Track3D &src, bool reopt) const |
void | autoFlip (pma::Track3D &trk, pma::Track3D::EDirection dir=Track3D::kForward, double thr=0.0, unsigned int n=0) const |
double | selectInitialHits (pma::Track3D &trk, unsigned int view=geo::kZ, unsigned int *nused=0) const |
Private Member Functions | |
bool | chkEndpointHits_ (const detinfo::DetectorPropertiesData &detProp, int wire, int wdir, double drift_x, int view, unsigned int tpc, unsigned int cryo, const pma::Track3D &trk, const std::vector< art::Ptr< recob::Hit >> &hits) const |
bool | addEndpointRef_ (const detinfo::DetectorPropertiesData &detProp, pma::Track3D &trk, const std::map< unsigned int, std::vector< art::Ptr< recob::Hit >>> &hits, std::pair< int, int > const *wires, double const *xPos, unsigned int tpc, unsigned int cryo) const |
bool | GetCloseHits_ (const detinfo::DetectorPropertiesData &detProp, double r2d, const std::vector< art::Ptr< recob::Hit >> &hits_in, std::vector< size_t > &used, std::vector< art::Ptr< recob::Hit >> &hits_out) const |
bool | Has_ (const std::vector< size_t > &v, size_t idx) const |
void | ShortenSeg_ (const detinfo::DetectorPropertiesData &detProp, pma::Track3D &trk, const geo::TPCGeo &tpcgeom) const |
bool | TestTrk_ (pma::Track3D &trk, const geo::TPCGeo &tpcgeom) const |
Static Private Member Functions | |
static size_t | getSegCount_ (size_t trk_size) |
Private Attributes | |
double const | fOptimizationEps |
double const | fFineTuningEps |
double const | fTrkValidationDist2D |
double const | fHitTestingDist2D |
double const | fMinTwoViewFraction |
geo::GeometryCore const * | fGeom |
Definition at line 62 of file ProjectionMatchingAlg.h.
pma::ProjectionMatchingAlg::ProjectionMatchingAlg | ( | const Config & | config | ) |
Definition at line 30 of file ProjectionMatchingAlg.cxx.
|
inline |
Definition at line 102 of file ProjectionMatchingAlg.h.
|
private |
Definition at line 1042 of file ProjectionMatchingAlg.cxx.
bool pma::ProjectionMatchingAlg::alignTracks | ( | pma::Track3D & | first, |
pma::Track3D & | second | ||
) | const |
Flip tracks to get second as a continuation of first; returns false if not possible (tracks in reversed order).
Definition at line 1293 of file ProjectionMatchingAlg.cxx.
|
inline |
Try to correct track direction of the stopping particle: dir: kForward - particle stop is at the end of the track; kBackward - particle stop is at the beginning of the track; dQ/dx difference has to be above thr to actually flip the track; compares dQ/dx of n hits at each end of the track (default is based on the track length).
Definition at line 267 of file ProjectionMatchingAlg.h.
pma::Track3D * pma::ProjectionMatchingAlg::buildMultiTPCTrack | ( | const detinfo::DetectorPropertiesData & | clockData, |
const std::vector< art::Ptr< recob::Hit >> & | hits | ||
) | const |
Build a track from sets of hits, multiple TPCs are OK (like taken from PFParticles), as far as hits origin from at least two wire planes.
Definition at line 505 of file ProjectionMatchingAlg.cxx.
pma::Track3D * pma::ProjectionMatchingAlg::buildSegment | ( | const detinfo::DetectorPropertiesData & | clockData, |
const std::vector< art::Ptr< recob::Hit >> & | hits_1, | ||
const std::vector< art::Ptr< recob::Hit >> & | hits_2 = {} |
||
) | const |
Build a straight segment from two sets of hits (they should origin from two wire planes); method is intendet for short tracks or shower initial parts, where only a few hits per plane are available and there is no chance to see a curvature or any other features.
Definition at line 900 of file ProjectionMatchingAlg.cxx.
pma::Track3D * pma::ProjectionMatchingAlg::buildSegment | ( | const detinfo::DetectorPropertiesData & | clockData, |
const std::vector< art::Ptr< recob::Hit >> & | hits_1, | ||
const std::vector< art::Ptr< recob::Hit >> & | hits_2, | ||
const TVector3 & | point | ||
) | const |
Build a straight segment from two sets of hits (they should origin from two wire planes), starting from a given point (like vertex known from another algorithm); method is intendet for short tracks or shower initial parts, where only a few hits per plane are available and there is no chance to see a curvature or any other features.
Definition at line 930 of file ProjectionMatchingAlg.cxx.
pma::Track3D * pma::ProjectionMatchingAlg::buildSegment | ( | const detinfo::DetectorPropertiesData & | detProp, |
const std::vector< art::Ptr< recob::Hit >> & | hits, | ||
const TVector3 & | point | ||
) | const |
Build a straight segment from set of hits (they should origin from two wire planes at least), starting from a given point.
Definition at line 953 of file ProjectionMatchingAlg.cxx.
pma::Track3D * pma::ProjectionMatchingAlg::buildShowerSeg | ( | const detinfo::DetectorPropertiesData & | detProp, |
const std::vector< art::Ptr< recob::Hit >> & | hits, | ||
const pma::Vector3D & | vtx | ||
) | const |
Build a shower segment from sets of hits and attached to the provided vertex.
Definition at line 617 of file ProjectionMatchingAlg.cxx.
pma::Track3D * pma::ProjectionMatchingAlg::buildTrack | ( | const detinfo::DetectorPropertiesData & | detProp, |
const std::vector< art::Ptr< recob::Hit >> & | hits_1, | ||
const std::vector< art::Ptr< recob::Hit >> & | hits_2 = {} |
||
) | const |
Build a track from two sets of hits from single TPC, hits should origin from at least two wire planes; number of segments used to create the track depends on the number of hits.
Definition at line 452 of file ProjectionMatchingAlg.cxx.
|
private |
Definition at line 1005 of file ProjectionMatchingAlg.cxx.
pma::Track3D * pma::ProjectionMatchingAlg::extendTrack | ( | const detinfo::DetectorPropertiesData & | clockData, |
const pma::Track3D & | trk, | ||
const std::vector< art::Ptr< recob::Hit >> & | hits, | ||
bool | add_nodes | ||
) | const |
Add more hits to an existing track, reoptimize, optionally add more nodes.
Definition at line 975 of file ProjectionMatchingAlg.cxx.
void pma::ProjectionMatchingAlg::FilterOutSmallParts | ( | const detinfo::DetectorPropertiesData & | detProp, |
double | r2d, | ||
const std::vector< art::Ptr< recob::Hit >> & | hits_in, | ||
std::vector< art::Ptr< recob::Hit >> & | hits_out, | ||
const TVector2 & | vtx2d | ||
) | const |
Get rid of small groups of hits around cascades; used to calculate cascade starting direction using the compact core cluster.
Definition at line 698 of file ProjectionMatchingAlg.cxx.
|
private |
Definition at line 753 of file ProjectionMatchingAlg.cxx.
|
staticprivate |
Definition at line 444 of file ProjectionMatchingAlg.cxx.
void pma::ProjectionMatchingAlg::guideEndpoints | ( | const detinfo::DetectorPropertiesData & | clockData, |
pma::Track3D & | trk, | ||
const std::map< unsigned int, std::vector< art::Ptr< recob::Hit >>> & | hits | ||
) | const |
Add 3D reference points to clean endpoints of a track (both need to be in the same TPC).
Definition at line 1096 of file ProjectionMatchingAlg.cxx.
void pma::ProjectionMatchingAlg::guideEndpoints | ( | const detinfo::DetectorPropertiesData & | clockData, |
pma::Track3D & | trk, | ||
pma::Track3D::ETrackEnd | endpoint, | ||
const std::map< unsigned int, std::vector< art::Ptr< recob::Hit >>> & | hits | ||
) | const |
Add 3D reference points to clean endpoint of a track.
Definition at line 1203 of file ProjectionMatchingAlg.cxx.
|
private |
Definition at line 876 of file ProjectionMatchingAlg.cxx.
|
inline |
Test if hits at the track endpoinds do not stick out of TPC which they belong to. Here one can implement some configurable margin if needed for real data imeprfections.
Definition at line 169 of file ProjectionMatchingAlg.h.
void pma::ProjectionMatchingAlg::mergeTracks | ( | const detinfo::DetectorPropertiesData & | detProp, |
pma::Track3D & | dst, | ||
pma::Track3D & | src, | ||
bool | reopt | ||
) | const |
Add src to dst as it was its continuation; nodes of src are added to dst after its own nodes, hits of src are added to hits of dst, then dst is reoptimized.
Definition at line 1335 of file ProjectionMatchingAlg.cxx.
void pma::ProjectionMatchingAlg::RemoveNotEnabledHits | ( | pma::Track3D & | trk | ) | const |
Definition at line 886 of file ProjectionMatchingAlg.cxx.
double pma::ProjectionMatchingAlg::selectInitialHits | ( | pma::Track3D & | trk, |
unsigned int | view = geo::kZ , |
||
unsigned int * | nused = 0 |
||
) | const |
Intendet to calculate dQ/dx in the initial part of EM cascade; collection view is used by default, but it works also with other projections.
Definition at line 1377 of file ProjectionMatchingAlg.cxx.
|
private |
Definition at line 817 of file ProjectionMatchingAlg.cxx.
|
inline |
Count the number of hits that are closer than eps * fHitTestingDist2D to the track 2D projection.
Definition at line 158 of file ProjectionMatchingAlg.h.
|
private |
Definition at line 847 of file ProjectionMatchingAlg.cxx.
std::vector< pma::Hit3D * > pma::ProjectionMatchingAlg::trimTrackToVolume | ( | pma::Track3D & | trk, |
TVector3 | p0, | ||
TVector3 | p1 | ||
) | const |
Definition at line 1286 of file ProjectionMatchingAlg.cxx.
double pma::ProjectionMatchingAlg::twoViewFraction | ( | pma::Track3D & | trk | ) | const |
Calculate the fraction of trajectory seen by two 2D projections at least; even a prfect track starts/stops with the hit from one 2D view, then hits from other views come, which results with the fraction value high, but always < 1.0; wrong cluster matchings or incomplete tracks give significantly lower values.
Definition at line 422 of file ProjectionMatchingAlg.cxx.
double pma::ProjectionMatchingAlg::validate | ( | const detinfo::DetectorPropertiesData & | detProp, |
const lariov::ChannelStatusProvider & | channelStatus, | ||
const pma::Track3D & | trk, | ||
const std::vector< art::Ptr< recob::Hit >> & | hits | ||
) | const |
Calculate the fraction of the track that is closer than fTrkValidationDist2D to any hit from hits in their plane (a plane that was not used to build the track). Hits should be preselected, so all belong to the same plane.
Definition at line 255 of file ProjectionMatchingAlg.cxx.
double pma::ProjectionMatchingAlg::validate | ( | const detinfo::DetectorPropertiesData & | detProp, |
const lariov::ChannelStatusProvider & | channelStatus, | ||
const TVector3 & | p0, | ||
const TVector3 & | p1, | ||
const std::vector< art::Ptr< recob::Hit >> & | hits, | ||
unsigned int | testView, | ||
unsigned int | tpc, | ||
unsigned int | cryo | ||
) | const |
Calculate the fraction of the 3D segment that is closer than fTrkValidationDist2D to any hit from hits in the testPlane of TPC/Cryo. Hits from the testPlane are preselected by this function among all provided (so a bit slower than fn above).
Definition at line 364 of file ProjectionMatchingAlg.cxx.
double pma::ProjectionMatchingAlg::validate_on_adc_test | ( | const detinfo::DetectorPropertiesData & | detProp, |
const lariov::ChannelStatusProvider & | channelStatus, | ||
const pma::Track3D & | trk, | ||
const img::DataProviderAlg & | adcImage, | ||
const std::vector< art::Ptr< recob::Hit >> & | hits, | ||
TH1F * | histoPassing, | ||
TH1F * | histoRejected | ||
) | const |
Calculate the fraction of the track that is closer than fTrkValidationDist2D to any hit from hits in the testView (a view that was not used to build the track). Creates also histograms of values in pixels for the passing and rejected points on the track, so the threshold value for the ADC-based calibration can be estimated.
Definition at line 128 of file ProjectionMatchingAlg.cxx.
|
private |
Definition at line 326 of file ProjectionMatchingAlg.h.
|
private |
Definition at line 338 of file ProjectionMatchingAlg.h.
|
private |
Definition at line 331 of file ProjectionMatchingAlg.h.
|
private |
Definition at line 334 of file ProjectionMatchingAlg.h.
|
private |
Definition at line 322 of file ProjectionMatchingAlg.h.
|
private |
Definition at line 329 of file ProjectionMatchingAlg.h.