StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StSsdHitCollection.cxx
1 /***************************************************************************
2  *
3  * $Id: StSsdHitCollection.cxx,v 2.2 2001/04/05 04:00:54 ullrich Exp $
4  *
5  * Author: Lilian Martin, Thomas Ullrich, Dec 1999
6  ***************************************************************************
7  *
8  * Description:
9  *
10  ***************************************************************************
11  *
12  * $Log: StSsdHitCollection.cxx,v $
13  * Revision 2.2 2001/04/05 04:00:54 ullrich
14  * Replaced all (U)Long_t by (U)Int_t and all redundant ROOT typedefs.
15  *
16  * Revision 2.1 2000/01/05 16:00:04 ullrich
17  * Initial Revision.
18  *
19  **************************************************************************/
20 #include "StSsdHitCollection.h"
21 #include "StSsdLadderHitCollection.h"
22 #include "StSsdHit.h"
23 
24 static const char rcsid[] = "$Id: StSsdHitCollection.cxx,v 2.2 2001/04/05 04:00:54 ullrich Exp $";
25 
26 ClassImp(StSsdHitCollection)
27 
28 StSsdHitCollection::StSsdHitCollection() { /* noop */ }
29 
30 StSsdHitCollection::~StSsdHitCollection() { /* noop */ }
31 
32 unsigned int
33 StSsdHitCollection::numberOfLadders() const { return mNumberOfLadders; }
34 
35 bool
36 StSsdHitCollection::addHit(StSsdHit* hit)
37 {
38  unsigned int l, w;
39  if (hit &&
40  (l = hit->ladder()-1) < mNumberOfLadders &&
41  (w = hit->wafer()-1) < mLadders[l].numberOfWafers()) {
42  mLadders[l].wafer(w)->hits().push_back(hit);
43  return kTRUE;
44  }
45  else {
46  return kFALSE;
47  }
48 }
49 
50 unsigned int
51 StSsdHitCollection::numberOfHits() const
52 {
53  unsigned int sum = 0;
54  for (int i=0; i<mNumberOfLadders; i++)
55  for (unsigned int j=0; j<mLadders[i].numberOfWafers(); j++)
56  sum += mLadders[i].wafer(j)->hits().size();
57  return sum;
58 }
59 
61 StSsdHitCollection::ladder(unsigned int i)
62 {
63  if (i < mNumberOfLadders)
64  return &(mLadders[i]);
65  else
66  return 0;
67 }
68 
70 StSsdHitCollection::ladder(unsigned int i) const
71 {
72  if (i < mNumberOfLadders)
73  return &(mLadders[i]);
74  else
75  return 0;
76 }
77