LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
DisambigAlg.h
Go to the documentation of this file.
1 // \fileDisambigAlg.h
3 // tylerdalion@gmail.com
5 #ifndef DisambigAlg_H
6 #define DisambigAlg_H
7 
8 #include <map>
9 #include <utility> // std::pair<>
10 #include <vector>
11 
15 
16 namespace fhicl {
17  class ParamterSet;
18 }
19 
21 #include "larcoreobj/SimpleTypesAndConstants/RawTypes.h" // raw::ChannelID_t
26 namespace detinfo {
27  class DetectorClocksData;
28  class DetectorPropertiesData;
29 }
30 
31 namespace apa {
32 
33  //---------------------------------------------------------------
34  class DisambigAlg {
35  public:
36  explicit DisambigAlg(fhicl::ParameterSet const& pset);
37 
38  void RunDisambig(detinfo::DetectorClocksData const& clockData,
39  detinfo::DetectorPropertiesData const& detProp,
40  art::Handle<std::vector<recob::Hit>> GausHits);
41 
42  void TrivialDisambig(detinfo::DetectorClocksData const& clockData,
43  detinfo::DetectorPropertiesData const& detProp,
44  unsigned int apa);
45  void Crawl(unsigned int apa);
46  unsigned int FindChanTimeEndPts(detinfo::DetectorPropertiesData const& detProp,
47  unsigned int apa);
48  void UseEndPts(detinfo::DetectorPropertiesData const& detProp,
49  unsigned int apa);
50  unsigned int CompareViews(
52  detinfo::DetectorPropertiesData const& detProp,
53  unsigned int apa);
54  void AssessDisambigSoFar(
55  unsigned int apa);
56 
57  std::map<unsigned int, double> fUeffSoFar;
58  std::map<unsigned int, double> fVeffSoFar;
59  std::map<unsigned int, unsigned int> fnUSoFar;
60  std::map<unsigned int, unsigned int> fnVSoFar;
61  std::map<unsigned int, unsigned int> fnDUSoFar;
62  std::map<unsigned int, unsigned int> fnDVSoFar;
63 
64  std::vector<std::pair<art::Ptr<recob::Hit>, geo::WireID>> fDisambigHits;
66 
67  private:
68  // other classes we will use
71  // **temporarily** here to look at performance without noise hits
73 
74  // Hits organization
75  std::map<raw::ChannelID_t, std::vector<art::Ptr<recob::Hit>>> fChannelToHits;
76  std::map<unsigned int, std::vector<art::Ptr<recob::Hit>>> fAPAToUVHits, fAPAToZHits;
77  std::map<unsigned int, std::vector<art::Ptr<recob::Hit>>> fAPAToHits;
79  std::map<unsigned int, std::vector<art::Ptr<recob::Hit>>> fAPAToEndPHits;
80  std::map<unsigned int, std::vector<std::pair<art::Ptr<recob::Hit>, geo::WireID>>> fAPAToDHits;
82 
83  // data/function to keep track of disambiguation along the way
84  std::map<std::pair<double, double>, geo::WireID> fChanTimeToWid;
86  std::map<unsigned int, std::map<std::pair<double, double>, bool>> fHasBeenDisambiged;
88  void MakeDisambigHit(art::Ptr<recob::Hit> const& hit, geo::WireID, unsigned int apa);
90 
91  // Functions that support disambiguation methods
92  unsigned int MakeCloseHits(int ext, geo::WireID wid, double Dmin, double Dmax);
94  bool HitsOverlapInTime(detinfo::DetectorPropertiesData const& detProp,
95  recob::Hit const& hitA,
96  recob::Hit const& hitB);
97  bool HitsReasonablyMatch(art::Ptr<recob::Hit> hitA, art::Ptr<recob::Hit> hitB);
99 
100  // Configure the disambiguation
101  bool fCrawl;
102  bool fUseEndP;
104  unsigned int fNChanJumps;
106  double fMaxEndPDegRange;
108 
111  }; // class DisambigAlg
112 
113 } // namespace apa
114 
115 #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:86
std::map< raw::ChannelID_t, std::vector< art::Ptr< recob::Hit > > > fChannelToHits
Definition: DisambigAlg.h:75
double fCloseHitsRadius
Definition: DisambigAlg.h:105
std::map< unsigned int, std::vector< art::Ptr< recob::Hit > > > fAPAToZHits
Definition: DisambigAlg.h:76
std::map< unsigned int, unsigned int > fnDVSoFar
Definition: DisambigAlg.h:62
apa::APAGeometryAlg fAPAGeo
Definition: DisambigAlg.h:69
Declaration of signal hit object.
std::map< unsigned int, unsigned int > fnVSoFar
Definition: DisambigAlg.h:60
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:79
art::ServiceHandle< geo::Geometry const > geom
Definition: DisambigAlg.h:70
parameter set interface
std::map< unsigned int, std::vector< art::Ptr< recob::Hit > > > fAPAToHits
Definition: DisambigAlg.h:77
std::map< unsigned int, double > fVeffSoFar
Definition: DisambigAlg.h:58
General LArSoft Utilities.
unsigned int fNChanJumps
Number of channels the crawl can jump over.
Definition: DisambigAlg.h:104
Definition of data types for geometry description.
Detector simulation of raw signals on wires.
Contains all timing reference information for the detector.
bool fCrawl
\ todo: Write function that compares hits more detailedly
Definition: DisambigAlg.h:101
art::ServiceHandle< cheat::BackTrackerService const > bt_serv
Definition: DisambigAlg.h:72
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:64
std::map< unsigned int, double > fUeffSoFar
Definition: DisambigAlg.h:57
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:46
std::map< unsigned int, unsigned int > fnUSoFar
Definition: DisambigAlg.h:59
std::map< unsigned int, std::vector< std::pair< art::Ptr< recob::Hit >, geo::WireID > > > fAPAToDHits
Hold the disambiguations per APA.
Definition: DisambigAlg.h:80
art framework interface to geometry description
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:84
std::map< unsigned int, unsigned int > fnDUSoFar
Definition: DisambigAlg.h:61