Class CRTHitMatch¶
- Defined in File CRTHitMatch.h
Class Documentation¶
-
class
CRTHitMatch
: public larcv_base¶ match larflow track clusters with CRT hits and optical flashes
This algorithms relies on track candidate clusters to first have been made. There are algorithms in larflow/Reco/ for track reconstruction.
Given a track, it’s direction is used to project an intersection point with the Cosmic Ray Tagger (CRT). This intersection point is compared with the CRT hits to see if any are nearby.
A match of a track to a CRT hit allows us to assign the time of the CRT hit to the track. This time can be used to associate an optical flash to the track as well.
There are two ways to run this algorithm. The first is to input the ingredients to match using
- addIntimeOpFlashes
- addCosmicOpFlashes
- addCRThits
- addCRTtracks
- addLArFlowClusters
makeMatches()
. One can then save the output by callingsave_to_file(...)
.The second way is to use the
process(...)
method.Public Functions
-
CRTHitMatch
()¶
-
virtual
~CRTHitMatch
()¶
-
void
addIntimeOpFlashes
(const larlite::event_opflash &opflash_v)¶ copy flashes from input event container into container holding INTIME flashes
Fills
_intime_opflash_v
.- Parameters
opflash_v
: Input event container of optical flashes
-
void
addCosmicOpFlashes
(const larlite::event_opflash &opflash_v)¶ copy flashes from input event container into container holding OUT-OF-TIME flashes
Fills
_outtime_opflash_v
.- Parameters
opflash_v
: Input event container of optical flashes
-
void
addCRThits
(const larlite::event_crthit &crthit_v)¶ copy crt hits from input event container into member container
Fills
_crthit_v
.- Parameters
crthit_v
: Input event container of CRT hits
-
void
addCRTtracks
(const larlite::event_crttrack &crttrack_v)¶ copy crt tracks from input event container into member container
Fills
_crttrack_v
.- Parameters
crttrack_v
: Input event container of CRT hits
-
void
addLArFlowClusters
(const larlite::event_larflowcluster &lfcluster_v, const larlite::event_pcaxis &pcaxis)¶ copy track hit clusters and associated pcaxis into member container
Fills _lfcluster_v and _pcaxis_v.
- Parameters
lfcluster_v
: Input event container of track cluster spacepointspcaxis_v
: Input event container of track cluster principle component axes
-
void
clear
()¶ clear all input and output data containers
-
bool
process
(larcv::IOManager &iocv, larlite::storage_manager &ioll)¶ process event using data in larcv and larlite IO managers
This routine expects the IO managers to contain the following.
For the larcv IOManager:
- None
For the larlite storage_manager:
- larlite::opflash objects from containers { “simpleFlashBeam”, “simpleFlashCosmic” }
- larlite::larflowcluster objects from container: “pcacluster” – Need to change this to be settable
- larlite::pcaxis objects from continer: “pcacluster”
- Parameters
iolcv
: larcv::IOManager with event datallio
: larlite::storage_manager with event data
-
void
save_to_file
(larlite::storage_manager &outll, bool remove_if_no_flash = true)¶ save products to storage_manager
Stores:
- new crt object with updated hit positions (and old hit positions as well)
- matched opflash objects
- larflow3dhit clusters which store 3d pos and corresponding imgcoord locations for each track
- Parameters
outll
: larlite storage_manager where output products will be copiedremove_if_no_flash
: If true, crt hit-track matches without a match to a flash are not stored.
-
bool
makeMatches
()¶ make CRT hit matches to tracks and flashes using data already passed to class
Uses data from
- _crthit_v
- _lfcluster_v
- _pcaxis_v
- _intime_opflash_v
- _outtime_opflash_v
-
void
compilematches
()¶ run track match to crt hits
use add functions to provide inputs. need the following:
larlite products: opflash: typically ‘simpleFlashBeam’ and ‘simpleFlashCosmic’ larflowcluster: typically ‘pcacluster’ pcaxis: pc axis to larflowcluster above, typically ‘pcacluster’ crttrack: typically ‘crttrack’ crthit: typically ‘crthitcorr’
-
void
printHitInfo
()¶ Dump CRT Hit info, including match information to std out.
-
float
makeOneMatch
(const larlite::pcaxis &lfcluster_axis, const larlite::crthit &hit, std::vector<float> &panel_pos)¶ Calculate match info between one track cluster and one CRT hit.
The path from the intersection point to the CRT is constrained to follow the surface of the CRT.
- Return
- distance from intersection point to CRT hit position
- Parameters
lfcluster_axis
: The principle components of the clusterhit
: The CRT hit to be test withpanel_pos
: position on CRT panel where first PC axis intersects
-
float
getLength
(const larlite::pcaxis &pca)¶ calculates length of pc axis for cluster
- Return
- the length of the PC axis
- Parameters
pca
: Principle component data for one track
-
bool
was_cluster_used
(int idx)¶ Check if track cluster was used.
Checks the value of _used_tracks_v
- Parameters
idx
: Index of track to check
-
void
setInputClusterTreename
(std::string name)¶ set the name of the root tree from which we should get larlite::larflowcluster from
-
void
setInputPCAxisTreename
(std::string name)¶ set the name of the root tree from which we should get larlite::larflowcluster from
-
void
_matchOpflashes
(const std::vector<const larlite::opflash *> &flash_v, const std::vector<const larlite::crthit *> &hit_v, const std::vector<larlite::larflowcluster> &cluster_v, std::vector<larlite::opflash> &matched_opflash_v)¶ match opflashes to crttrack_t using closest time
ties are broken based on closest centroids based on pca-center of tracks and charge-weighted mean of flashes the crttrack_t objects are assumed to have been made in _find_optimal_track(…)
- Parameters
flash_v
: list of optical flashes to match tohit_v
: list of crt hits to match withcluster_v
: list of clusters to match withmatched_opflash_v
: list of flashes matched to hit_v+cluster_v. If no match found, a blank flash with PE=0 is stored for that hit-track pair.
-
larlite::larflowcluster
_merge_matched_cluster
(const std::vector<CRTHitMatch::match_t> &hit_match_v, std::vector<int> &used_in_merge, bool &merged)¶ using sorted match list per hit, we determine if we should merge the clusters
We merge clusters that point to the same hit. If the clusters are end-to-end, we merge.
- Parameters
hit_match_v
: list of potential match candidates represented as match_t instancesused_in_merge
: One entry per hit_match_v entry. Set to 1 if assigned to matched hit.merged
: True if any clusters are merged together.
Public Members
-
std::vector<larlite::opflash>
_intime_opflash_v
¶ flashes in unbiased beam readout
-
std::vector<larlite::opflash>
_outtime_opflash_v
¶ flashes from cosmic disc readout
-
std::vector<const larlite::opflash *>
_flash_v
¶ container holding pointers to all input flashes (from both in-time and out-of-time sets)
-
std::vector<larlite::crthit>
_crthit_v
¶ CRT hits in the event.
-
std::vector<larlite::crttrack>
_crttrack_v
¶ CRT tracks in the event.
-
std::string
_input_cluster_treename
¶ root tree name from which we get track clusters to match
-
std::string
_input_pcaxis_treename
¶ root tree name from which we get the principle component axes for clusters from _input_cluster_treename
-
std::vector<const larlite::larflowcluster *>
_lfcluster_v
¶ 3d space point clusters making up a track
-
std::vector<const larlite::pcaxis *>
_pcaxis_v
¶ the principle component axes for the clusters in _lfcluster_v
-
std::vector<std::vector<match_t>>
_hit2track_rank_v
¶ for each input crt hit (outer vector), match info to each track
-
std::vector<int>
_matched_hitidx
¶ indices of CRT hits in _crthit_v which found a good track match
-
std::vector<const larlite::crthit *>
_match_hit_v
¶ pointer to CRT hit object that was matched
-
std::vector<larlite::larflowcluster>
_matched_cluster
¶ matching cluster to the CRT hit
-
std::vector<larflow::reco::cluster_t>
_matched_cluster_t
¶ matching cluster in larflow::reco::cluster_t form
-
std::vector<larlite::opflash>
_matched_opflash_v
¶ matched opflash to CRT hit + track pair
-
std::vector<int>
_used_tracks_v
¶ flag indicating if track in _lfcluster_v has been matched. 1: matched, 0: unmatched