StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFtpcHitCollection.cxx
1 /***************************************************************************
2  *
3  * $Id: StFtpcHitCollection.cxx,v 2.4 2001/04/05 04:00:50 ullrich Exp $
4  *
5  * Author: Thomas Ullrich, July 1999
6  ***************************************************************************
7  *
8  * Description:
9  *
10  ***************************************************************************
11  *
12  * $Log: StFtpcHitCollection.cxx,v $
13  * Revision 2.4 2001/04/05 04:00:50 ullrich
14  * Replaced all (U)Long_t by (U)Int_t and all redundant ROOT typedefs.
15  *
16  * Revision 2.3 1999/12/13 20:16:17 ullrich
17  * Changed numbering scheme for hw_position unpack methods (STAR conventions).
18  *
19  * Revision 2.2 1999/10/28 22:25:22 ullrich
20  * Adapted new StArray version. First version to compile on Linux and Sun.
21  *
22  * Revision 2.1 1999/10/13 19:44:38 ullrich
23  * Initial Revision
24  *
25  **************************************************************************/
26 #include "StFtpcHitCollection.h"
27 #include "StFtpcSectorHitCollection.h"
28 #include "StFtpcHit.h"
29 
30 static const char rcsid[] = "$Id: StFtpcHitCollection.cxx,v 2.4 2001/04/05 04:00:50 ullrich Exp $";
31 
32 ClassImp(StFtpcHitCollection)
33 
35 
36 StFtpcHitCollection::~StFtpcHitCollection() { /* noop */ }
37 
38 bool
39 StFtpcHitCollection::addHit(StFtpcHit* hit)
40 {
41  unsigned int p, s;
42  if (hit &&
43  (p = hit->plane()-1) < mNumberOfPlanes &&
44  (s = hit->sector()-1) < mPlanes[p].numberOfSectors()) {
45  mPlanes[p].sector(s)->hits().push_back(hit);
46  return kTRUE;
47  }
48  else
49  return kFALSE;
50 }
51 
52 unsigned int
53 StFtpcHitCollection::numberOfPlanes() const { return mNumberOfPlanes; }
54 
55 unsigned int
56 StFtpcHitCollection::numberOfHits() const
57 {
58  unsigned int sum = 0;
59  for (unsigned int i=0; i<mNumberOfPlanes; i++) {
60  for (unsigned int j=0; j<mPlanes[i].numberOfSectors(); j++) {
61  sum += mPlanes[i].sector(j)->hits().size();
62  }
63  }
64  return sum;
65 }
66 
68 StFtpcHitCollection::plane(unsigned int i)
69 {
70  if (i < mNumberOfPlanes)
71  return &(mPlanes[i]);
72  else
73  return 0;
74 }
75 
77 StFtpcHitCollection::plane(unsigned int i) const
78 {
79  if (i < mNumberOfPlanes)
80  return &(mPlanes[i]);
81  else
82  return 0;
83 }