StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StSstHitCollection.cxx
1 /***************************************************************************
2  *
3  * $Id: StSstHitCollection.cxx,v 2.1 2015/05/13 16:50:59 ullrich Exp $
4  *
5  * Author: Jonathan Bouchet, Thomas Ullrich, May 2015
6  ***************************************************************************
7  *
8  * Description:
9  *
10  ***************************************************************************
11  *
12  * $Log: StSstHitCollection.cxx,v $
13  * Revision 2.1 2015/05/13 16:50:59 ullrich
14  * Initial Revision.
15  *
16  **************************************************************************/
17 #include "StSstHitCollection.h"
18 #include "StSstLadderHitCollection.h"
19 #include "StSstHit.h"
20 
21 static const char rcsid[] = "$Id: StSstHitCollection.cxx,v 2.1 2015/05/13 16:50:59 ullrich Exp $";
22 
23 ClassImp(StSstHitCollection)
24 
25 StSstHitCollection::StSstHitCollection() { /* no op */ }
26 
27 StSstHitCollection::~StSstHitCollection() { /* no op */ }
28 
29 unsigned int
30 StSstHitCollection::numberOfLadders() const { return mNumberOfLadders; }
31 
32 bool
33 StSstHitCollection::addHit(StSstHit* hit)
34 {
35  unsigned int l, w;
36  if (hit &&
37  (l = hit->ladder()-1) < mNumberOfLadders &&
38  (w = hit->wafer()-1) < mLadders[l].numberOfWafers()) {
39  mLadders[l].wafer(w)->hits().push_back(hit);
40  return true;
41  }
42  else {
43  return false;
44  }
45 }
46 
47 unsigned int
48 StSstHitCollection::numberOfHits() const
49 {
50  unsigned int sum = 0;
51  for (int i=0; i<mNumberOfLadders; i++)
52  for (unsigned int j=0; j<mLadders[i].numberOfWafers(); j++)
53  sum += mLadders[i].wafer(j)->hits().size();
54  return sum;
55 }
56 
58 StSstHitCollection::ladder(unsigned int i)
59 {
60  if (i < mNumberOfLadders)
61  return &(mLadders[i]);
62  else
63  return 0;
64 }
65 
67 StSstHitCollection::ladder(unsigned int i) const
68 {
69  if (i < mNumberOfLadders)
70  return &(mLadders[i]);
71  else
72  return 0;
73 }
74