StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StTpcHitCollection.h
1 
5 /***************************************************************************
6  *
7  * $Id: StTpcHitCollection.h,v 2.7 2019/04/02 15:32:49 smirnovd Exp $
8  *
9  * Author: Thomas Ullrich, July 1999
10  ***************************************************************************
11  *
12  * Description:
13  *
14  ***************************************************************************
15  *
16  * $Log: StTpcHitCollection.h,v $
17  * Revision 2.7 2019/04/02 15:32:49 smirnovd
18  * Add iterator to loop over StTpcHits in StTpcHitContainer
19  *
20  * Revision 2.6 2019/04/02 15:32:42 smirnovd
21  * Add accessors to StTpcHitContainer
22  *
23  * Revision 2.5 2019/04/02 15:32:33 smirnovd
24  * Remove commented code
25  *
26  * Revision 2.4 2009/11/23 16:34:07 fisyak
27  * Cleanup, remove dependence on dst tables, clean up software monitors
28  *
29  * Revision 2.3 2002/02/22 22:56:52 jeromel
30  * Doxygen basic documentation in all header files. None of this is required
31  * for QM production.
32  *
33  * Revision 2.2 2001/04/05 04:00:44 ullrich
34  * Replaced all (U)Long_t by (U)Int_t and all redundant ROOT typedefs.
35  *
36  * Revision 2.1 1999/10/13 19:44:00 ullrich
37  * Initial Revision
38  *
39  **************************************************************************/
40 #ifndef StTpcHitCollection_hh
41 #define StTpcHitCollection_hh
42 
43 #include <iterator>
44 
45 #include "StObject.h"
46 #include "StTpcSectorHitCollection.h"
47 
48 class StTpcHit;
49 
50 class StTpcHitCollection : public StObject {
51 public:
54 
55  bool addHit(StTpcHit*);
56  unsigned int numberOfHits() const;
57  unsigned int numberOfSectors() const {return mNumberOfSectors; }
58  unsigned int numberOfPadrows(int sectorId) const { return sector(sectorId) ? sector(sectorId)->numberOfPadrows() : 0; }
59 
60  StTpcSectorHitCollection* sector(unsigned int);
61  const StTpcSectorHitCollection* sector(unsigned int) const;
62 
63  const StSPtrVecTpcHit* hits(int sectorId, int padrowId) const;
64 
66  class StTpcHitIter : public std::iterator<std::input_iterator_tag, StTpcHit*>
67  {
68  public:
69  static StTpcHitIter begin(StTpcHitCollection& c);
70  static StTpcHitIter end(StTpcHitCollection& c);
71 
72  StTpcHitIter& operator++();
73  bool operator==(const StTpcHitIter &other) const;
74  bool operator!=(const StTpcHitIter &other) const;
75  const StTpcHit* operator*() const;
76 
77  private:
78  StTpcHitIter(StTpcHitCollection& c, int l1=0, int l2=0) : coll(c), iSector(l1), iPadrow(l2), iHit(0) {}
79 
80  StTpcHitCollection& coll;
81  std::size_t iSector = 0;
82  std::size_t iPadrow = 0;
83  std::size_t iHit = 0;
84  };
85 
86  StTpcHitIter begin() { return StTpcHitIter::begin(*this); }
87  StTpcHitIter end() { return StTpcHitIter::end(*this); }
88 
89 private:
90  enum { mNumberOfSectors = 24 };
91  StTpcSectorHitCollection mSectors[mNumberOfSectors];
92 
93  ClassDef(StTpcHitCollection,1)
94 };
95 #endif
An iterator over StTpcHits in a StTpcHitCollection.