StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StIstHitCollection.cxx
1 /***************************************************************************
2 *
3 * $Id: StIstHitCollection.cxx,v 2.1 2014/04/10 16:17:23 jeromel Exp $
4 *
5 * Author: Yaping Wang, August 2013
6 ****************************************************************************
7 * Description:
8 * See header file.
9 ***************************************************************************/
10 
11 #include "StIstHitCollection.h"
12 #include "StIstLadderHitCollection.h"
13 #include "StIstSensorHitCollection.h"
14 #include "StIstHit.h"
15 
16 static const char rcsid[] = "$Id: StIstHitCollection.cxx,v 2.1 2014/04/10 16:17:23 jeromel Exp $";
17 
18 ClassImp(StIstHitCollection)
19 
20 StIstHitCollection::StIstHitCollection() : StObject() { /* no op */ }
21 
22 StIstHitCollection::~StIstHitCollection() { /* no op */ }
23 
24 bool StIstHitCollection::addHit(StIstHit *hit)
25 {
26  unsigned int l, w;
27  l = (unsigned int)hit->getLadder() - 1;
28  w = (unsigned int)hit->getSensor() - 1;
29 
30  if (hit &&
31  l < kIstNumLadders &&
33  mLadders[l].sensor(w)->hits().push_back(hit);
34  return kTRUE;
35  }
36  else {
37  return kFALSE;
38  }
39 }
40 
41 unsigned int StIstHitCollection::numberOfHits() const
42 {
43  unsigned int sum = 0;
44 
45  for (unsigned int i = 0; i < kIstNumLadders; i++)
46  for (unsigned int j = 0; j < kIstNumSensorsPerLadder; j++)
47  sum += mLadders[i].sensor(j)->hits().size();
48 
49  return sum;
50 }
51 
52 unsigned char StIstHitCollection::getClusteringType() const { return mClusteringType; }
53 void StIstHitCollection::setClusteringType(unsigned char clusteringType) { mClusteringType = clusteringType; }
54 
55 StIstLadderHitCollection* StIstHitCollection::ladder(unsigned int i)
56 {
57  if (i < kIstNumLadders)
58  return &(mLadders[i]);
59  else
60  return 0;
61 }
62 
63 const StIstLadderHitCollection* StIstHitCollection::ladder(unsigned int i) const
64 {
65  if (i < kIstNumLadders)
66  return &(mLadders[i]);
67  else
68  return 0;
69 }
70 
71 
72 /***************************************************************************
73 *
74 * $Log: StIstHitCollection.cxx,v $
75 * Revision 2.1 2014/04/10 16:17:23 jeromel
76 * Add hit def for Ist (Thomas OK-ed)
77 *
78 * Revision 1.8 2014/03/17 20:27:57 ypwang
79 * remove numOfLadder() and numOfSensor() from StIstHitCollection.h and StIstLadderHitCollection.h, respectively
80 *
81 * Revision 1.7 2014/03/13 22:10:21 smirnovd
82 * Fixed constructor's initialization list
83 *
84 * Revision 1.6 2014/03/13 22:10:12 smirnovd
85 * Move some constants from StIstUtil/StIstConsts.h to StEvent/StEnumerations.h to avoid external dependance of StEvent on StIstUtil
86 *
87 * Revision 1.5 2014/03/13 22:05:24 smirnovd
88 * Style issue: Function return types on same line
89 *
90 * Revision 1.4 2014/02/26 21:18:08 smirnovd
91 * Style corrected with astyle -s3 -p -H -A3 -k3 -O -o -y -Y -f
92 *
93 * Revision 1.3 2014/02/25 17:08:49 ypwang
94 * add mClusteringType and its accessory/modifier functions
95 *
96 *
97 ****************************************************************************
98 * StIstHitCollection.cxx,v 1.0
99 * Revision 1.0 2013/11/04 15:25:30 Yaping
100 * Initial version
101 ****************************************************************************/
const int kIstNumLadders
24 IST Ladders
const int kIstNumSensorsPerLadder
6 sensor per one IST Ladder