HitMap.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // \file HitMap.h
3 // \brief Efficient lookup of hits by plane and cell number
4 // \version $Id: HitMap.h,v 1.6 2012-05-11 00:39:30 bckhouse Exp $
5 // \author $Author: bckhouse $
6 ////////////////////////////////////////////////////////////////////////
7 #ifndef RBHITMAP_H
8 #define RBHITMAP_H
9 
10 #include <map>
11 
13 
15 
16 namespace rb {
17 
18  class CellHit;
19  class Cluster;
20 
21  /// \brief Provides efficient lookup of CellHits by plane and cell number
22  class HitMap
23  {
24  public:
25  HitMap();
26  HitMap(const art::PtrVector<rb::CellHit>& chits);
27  HitMap(const rb::Cluster* clust);
28  ~HitMap();
29 
30  void Add(const art::Ptr<rb::CellHit>& chit);
31  void Add(const art::PtrVector<rb::CellHit>& chits);
32  /// Add all the hits in a cluster, or derived class
33  void Add(const rb::Cluster* clust);
34 
35  void Remove(unsigned int planeIdx, unsigned int cellIdx);
36 
37  void Clear(){fMap.clear();}
38 
39  /// Does the map contain any cell at this position?
40  bool CellExists(unsigned int planeIdx,
41  unsigned int cellIdx) const;
42 
43  /// Return the cell at this position. Empty pointer if no match.
44  art::Ptr<rb::CellHit> Cell(unsigned int planeIdx,
45  unsigned int cellIdx) const;
46 
47  /// Syntactic sugar for \ref Cell
48  art::Ptr<rb::CellHit> operator()(unsigned int planeIdx,
49  unsigned int cellIdx) const;
50  protected:
51 
52  std::map<geo::OfflineChan, art::Ptr<rb::CellHit> > fMap;
53  };
54 
55 } // end namespace
56 
57 #endif
58 ///////////////////////////////////////////////////////////////////////
std::map< geo::OfflineChan, art::Ptr< rb::CellHit > > fMap
Definition: HitMap.h:52
A collection of associated CellHits.
Definition: Cluster.h:47
void Clear()
Definition: HitMap.h:37
Provides efficient lookup of CellHits by plane and cell number.
Definition: HitMap.h:22
void Remove(unsigned int planeIdx, unsigned int cellIdx)
Definition: HitMap.cxx:75
Perform a "2 point" Hough transform on a collection of hits.
art::Ptr< rb::CellHit > Cell(unsigned int planeIdx, unsigned int cellIdx) const
Return the cell at this position. Empty pointer if no match.
Definition: HitMap.cxx:88
art::Ptr< rb::CellHit > operator()(unsigned int planeIdx, unsigned int cellIdx) const
Syntactic sugar for Cell.
Definition: HitMap.cxx:100
bool CellExists(unsigned int planeIdx, unsigned int cellIdx) const
Does the map contain any cell at this position?
Definition: HitMap.cxx:81
Simple object representing a (plane, cell) pair.
void Add(const art::Ptr< rb::CellHit > &chit)
Definition: HitMap.cxx:37