DisambigAlg.h
Go to the documentation of this file.
1 /////////////////////////////////////////////////////////////////
2 // \fileDisambigAlg.h
3 // tylerdalion@gmail.com
4 ////////////////////////////////////////////////////////////////////
5 #ifndef DisambigAlg_H
6 #define DisambigAlg_H
7 
8 #include <map>
9 #include <vector>
10 
14 #include "fhiclcpp/fwd.h"
15 
17 #include "larcoreobj/SimpleTypesAndConstants/RawTypes.h" // raw::ChannelID_t
22 namespace detinfo {
23  class DetectorClocksData;
24  class DetectorPropertiesData;
25 }
26 
27 namespace apa {
28 
29  //---------------------------------------------------------------
30  class DisambigAlg {
31  public:
32  explicit DisambigAlg(fhicl::ParameterSet const& pset);
33 
34  void RunDisambig(detinfo::DetectorClocksData const& clockData,
35  detinfo::DetectorPropertiesData const& detProp,
36  art::Handle<std::vector<recob::Hit>> GausHits);
37 
38  void TrivialDisambig(detinfo::DetectorClocksData const& clockData,
39  detinfo::DetectorPropertiesData const& detProp,
40  unsigned int apa); ///< Make the easiest and safest disambiguations in apa
41  void Crawl(unsigned int apa); ///< Extend what we disambiguation we do have in apa
42  unsigned int FindChanTimeEndPts(detinfo::DetectorPropertiesData const& detProp,
43  unsigned int apa); ///< Basic endpoint-hit finder per apa
44  void UseEndPts(detinfo::DetectorPropertiesData const& detProp,
45  unsigned int apa); ///< Try to associate endpoint hits and
46  ///< crawl from there
47  unsigned int CompareViews(
48  detinfo::DetectorPropertiesData const& detProp,
49  unsigned int apa); ///< Compare U and V to see if one says something about the other
50  void AssessDisambigSoFar(
51  unsigned int apa); ///< See how much disambiguation has been done in this apa so far
52 
53  std::map<unsigned int, double> fUeffSoFar;
54  std::map<unsigned int, double> fVeffSoFar;
55  std::map<unsigned int, unsigned int> fnUSoFar;
56  std::map<unsigned int, unsigned int> fnVSoFar;
57  std::map<unsigned int, unsigned int> fnDUSoFar;
58  std::map<unsigned int, unsigned int> fnDVSoFar;
59 
60  std::vector<std::pair<art::Ptr<recob::Hit>, geo::WireID>> fDisambigHits;
61  ///< The final list of hits to pass back to be made
62 
63  private:
64  // other classes we will use
67  // **temporarily** here to look at performance without noise hits
69 
70  // Hits organization
71  std::map<raw::ChannelID_t, std::vector<art::Ptr<recob::Hit>>> fChannelToHits;
72  std::map<unsigned int, std::vector<art::Ptr<recob::Hit>>> fAPAToUVHits, fAPAToZHits;
73  std::map<unsigned int, std::vector<art::Ptr<recob::Hit>>> fAPAToHits;
74  ///\ todo: Channel/APA to hits can be done in a unified way
75  std::map<unsigned int, std::vector<art::Ptr<recob::Hit>>> fAPAToEndPHits;
76  std::map<unsigned int, std::vector<std::pair<art::Ptr<recob::Hit>, geo::WireID>>> fAPAToDHits;
77  ///< Hold the disambiguations per APA
78 
79  // data/function to keep track of disambiguation along the way
80  std::map<std::pair<double, double>, geo::WireID> fChanTimeToWid;
81  ///< If a hit is disambiguated, map its chan and peak time to the chosen wireID
82  std::map<unsigned int, std::map<std::pair<double, double>, bool>> fHasBeenDisambiged;
83  ///< Convenient way to keep track of disambiguation so far
84  void MakeDisambigHit(art::Ptr<recob::Hit> const& hit, geo::WireID, unsigned int apa);
85  ///< Makes a disambiguated hit while keeping track of what has already been disambiguated
86 
87  // Functions that support disambiguation methods
88  unsigned int MakeCloseHits(int ext, geo::WireID wid, double Dmin, double Dmax);
89  ///< Having disambiguated a time range on a wireID, extend to neighboring channels
90  bool HitsOverlapInTime(detinfo::DetectorPropertiesData const& detProp,
91  recob::Hit const& hitA,
92  recob::Hit const& hitB);
93  bool HitsReasonablyMatch(art::Ptr<recob::Hit> hitA, art::Ptr<recob::Hit> hitB);
94  ///\ todo: Write function that compares hits more detailedly
95 
96  // Configure the disambiguation
97  bool fCrawl;
98  bool fUseEndP;
100  unsigned int fNChanJumps; ///< Number of channels the crawl can jump over
101  double fCloseHitsRadius; ///< Distance (cm) away from a hit to look when
102  ///< checking if it's an endpoint
103  double fMaxEndPDegRange; ///< Within the close hits radius, how spread can
104  ///< the majority of the activity be around a
105  ///< possible endpoint
106 
107  }; // class DisambigAlg
108 
109 } // namespace apa
110 
111 #endif // ifndef DisambigAlg_H
std::map< unsigned int, std::map< std::pair< double, double >, bool > > fHasBeenDisambiged
Convenient way to keep track of disambiguation so far.
Definition: DisambigAlg.h:82
std::map< raw::ChannelID_t, std::vector< art::Ptr< recob::Hit > > > fChannelToHits
Definition: DisambigAlg.h:71
double fCloseHitsRadius
Definition: DisambigAlg.h:101
std::map< unsigned int, std::vector< art::Ptr< recob::Hit > > > fAPAToZHits
Definition: DisambigAlg.h:72
std::map< unsigned int, unsigned int > fnDVSoFar
Definition: DisambigAlg.h:58
apa::APAGeometryAlg fAPAGeo
Definition: DisambigAlg.h:65
std::map< unsigned int, unsigned int > fnVSoFar
Definition: DisambigAlg.h:56
std::map< unsigned int, std::vector< art::Ptr< recob::Hit > > > fAPAToEndPHits
\ todo: Channel/APA to hits can be done in a unified way
Definition: DisambigAlg.h:75
art::ServiceHandle< geo::Geometry const > geom
Definition: DisambigAlg.h:66
art framework interface to geometry description
std::map< unsigned int, std::vector< art::Ptr< recob::Hit > > > fAPAToHits
Definition: DisambigAlg.h:73
std::map< unsigned int, double > fVeffSoFar
Definition: DisambigAlg.h:54
General LArSoft Utilities.
unsigned int fNChanJumps
Number of channels the crawl can jump over.
Definition: DisambigAlg.h:100
Definition of data types for geometry description.
Detector simulation of raw signals on wires.
Declaration of signal hit object.
Contains all timing reference information for the detector.
bool fCrawl
\ todo: Write function that compares hits more detailedly
Definition: DisambigAlg.h:97
art::ServiceHandle< cheat::BackTrackerService const > bt_serv
Definition: DisambigAlg.h:68
std::vector< std::pair< art::Ptr< recob::Hit >, geo::WireID > > fDisambigHits
The final list of hits to pass back to be made.
Definition: DisambigAlg.h:60
double fMaxEndPDegRange
Definition: DisambigAlg.h:103
std::map< unsigned int, double > fUeffSoFar
Definition: DisambigAlg.h:53
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:48
std::map< unsigned int, unsigned int > fnUSoFar
Definition: DisambigAlg.h:55
std::map< unsigned int, std::vector< std::pair< art::Ptr< recob::Hit >, geo::WireID > > > fAPAToDHits
Hold the disambiguations per APA.
Definition: DisambigAlg.h:76
std::map< std::pair< double, double >, geo::WireID > fChanTimeToWid
If a hit is disambiguated, map its chan and peak time to the chosen wireID.
Definition: DisambigAlg.h:80
std::map< unsigned int, unsigned int > fnDUSoFar
Definition: DisambigAlg.h:57