StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFstHitCollection.cxx
1 /***************************************************************************
2 * $Id: StFstHitCollection.cxx$
3 *
4 * Author: Shenghui Zhang, Oct. 2021
5 ****************************************************************************
6 * Description:
7 * See header file.
8 ***************************************************************************/
9 
10 #include "StFstHitCollection.h"
11 #include "StFstWedgeHitCollection.h"
12 #include "StFstSensorHitCollection.h"
13 #include "StFstHit.h"
14 
15 ClassImp(StFstHitCollection)
16 
17 StFstHitCollection::StFstHitCollection() : StObject() { /* no op */ }
18 
19 bool StFstHitCollection::addHit(StFstHit *hit)
20 {
21  unsigned int l, w;
22  l = (unsigned int)hit->getWedge() - 1;
23  w = (unsigned int)hit->getSensor();
24 
25  if (hit &&
26  l < kFstNumWedges &&
27  w < kFstNumSensorsPerWedge) {
28  mWedges[l].sensor(w)->hits().push_back(hit);
29  return kTRUE;
30  }
31  else {
32  return kFALSE;
33  }
34 }
35 
36 unsigned int StFstHitCollection::numberOfHits() const
37 {
38  unsigned int sum = 0;
39 
40  for (unsigned int i = 0; i < kFstNumWedges; i++)
41  for (unsigned int j = 0; j < kFstNumSensorsPerWedge; j++)
42  sum += mWedges[i].sensor(j)->hits().size();
43 
44  return sum;
45 }
46 
47 unsigned char StFstHitCollection::getClusteringType() const { return mClusteringType; }
48 void StFstHitCollection::setClusteringType(unsigned char clusteringType) { mClusteringType = clusteringType; }
49 
50 StFstWedgeHitCollection* StFstHitCollection::wedge(unsigned int i)
51 {
52  if (i < kFstNumWedges)
53  return &(mWedges[i]);
54  else
55  return 0;
56 }
57 
58 const StFstWedgeHitCollection* StFstHitCollection::wedge(unsigned int i) const
59 {
60  if (i < kFstNumWedges)
61  return &(mWedges[i]);
62  else
63  return 0;
64 }
65 
66 
67 /***************************************************************************
68 * StFstHitCollection.cxx,v 1.0
69 * Revision 1.0 2021/10/04 Shenghui Zhang
70 * Initial version
71 ****************************************************************************/