#include <ProjectionMatchingAlg.h>
Classes | |
struct | Config |
Public Member Functions | |
ProjectionMatchingAlg (const Config &config) | |
ProjectionMatchingAlg (const fhicl::ParameterSet &pset) | |
double | validate_on_adc (const detinfo::DetectorPropertiesData &detProp, const lariov::ChannelStatusProvider &channelStatus, const pma::Track3D &trk, const img::DataProviderAlg &adcImage, float thr) const |
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 53 of file ProjectionMatchingAlg.h.
pma::ProjectionMatchingAlg::ProjectionMatchingAlg | ( | const Config & | config | ) |
Definition at line 29 of file ProjectionMatchingAlg.cxx.
|
inline |
Definition at line 93 of file ProjectionMatchingAlg.h.
|
private |
Definition at line 1041 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 1292 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 258 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 504 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 899 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 929 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 952 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 616 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 451 of file ProjectionMatchingAlg.cxx.
|
private |
Definition at line 1004 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 974 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 697 of file ProjectionMatchingAlg.cxx.
|
private |
Definition at line 752 of file ProjectionMatchingAlg.cxx.
|
staticprivate |
Definition at line 443 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 1095 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 1202 of file ProjectionMatchingAlg.cxx.
|
private |
Definition at line 875 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 160 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 1334 of file ProjectionMatchingAlg.cxx.
void pma::ProjectionMatchingAlg::RemoveNotEnabledHits | ( | pma::Track3D & | trk | ) | const |
Definition at line 885 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 1376 of file ProjectionMatchingAlg.cxx.
|
private |
Definition at line 816 of file ProjectionMatchingAlg.cxx.
|
inline |
Count the number of hits that are closer than eps * fHitTestingDist2D to the track 2D projection.
Definition at line 149 of file ProjectionMatchingAlg.h.
|
private |
Definition at line 846 of file ProjectionMatchingAlg.cxx.
std::vector< pma::Hit3D * > pma::ProjectionMatchingAlg::trimTrackToVolume | ( | pma::Track3D & | trk, |
TVector3 | p0, | ||
TVector3 | p1 | ||
) | const |
Definition at line 1285 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 421 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 254 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).
double pma::ProjectionMatchingAlg::validate_on_adc | ( | const detinfo::DetectorPropertiesData & | detProp, |
const lariov::ChannelStatusProvider & | channelStatus, | ||
const pma::Track3D & | trk, | ||
const img::DataProviderAlg & | adcImage, | ||
float | thr | ||
) | const |
Calculate the fraction of the track that is close to non-empty pixel (above thr value) in the ADC image of the testView (a view that was not used to build the track).
Definition at line 46 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 127 of file ProjectionMatchingAlg.cxx.
|
private |
Definition at line 317 of file ProjectionMatchingAlg.h.
|
private |
Definition at line 329 of file ProjectionMatchingAlg.h.
|
private |
Definition at line 322 of file ProjectionMatchingAlg.h.
|
private |
Definition at line 325 of file ProjectionMatchingAlg.h.
|
private |
Definition at line 313 of file ProjectionMatchingAlg.h.
|
private |
Definition at line 320 of file ProjectionMatchingAlg.h.