StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StSstHit.cxx
1 /***************************************************************************
2  *
3  * $Id: StSstHit.cxx,v 2.2 2015/05/21 14:11:43 ullrich Exp $
4  *
5  * Author: Jonathan Bouchet, Thomas Ullrich, May 2015
6  ***************************************************************************
7  *
8  * Description:
9  *
10  ***************************************************************************
11  *
12  * $Log: StSstHit.cxx,v $
13  * Revision 2.2 2015/05/21 14:11:43 ullrich
14  * Changed mADC from int to unsigned short.
15  *
16  * Revision 2.1 2015/05/13 16:50:59 ullrich
17  * Initial Revision.
18  *
19  *
20  **************************************************************************/
21 #include "StSstHit.h"
22 #include "StTrack.h"
23 
24 static const char rcsid[] = "$Id: StSstHit.cxx,v 2.2 2015/05/21 14:11:43 ullrich Exp $";
25 
26 StMemoryPool StSstHit::mPool(sizeof(StSstHit));
27 
28 ClassImp(StSstHit)
29 
31 {
32  mLocalPosition[0] = 0;
33  mLocalPosition[1] = 0;
34  mLocalPosition[2] = 0;
35 }
36 
37 
38 StSstHit::StSstHit(const StThreeVectorF& p,
39  const StThreeVectorF& e,
40  unsigned int hw, float q, unsigned char c)
41  : StHit(p, e, hw, q, c)
42 {
43  mLocalPosition[0] = 0;
44  mLocalPosition[1] = 0;
45  mLocalPosition[2] = 0;
46 }
47 
48 
49 StSstHit::~StSstHit() {/* no op */}
50 
51 unsigned int
52 StSstHit::ladder() const
53 {
54  unsigned long numwaf = (mHardwarePosition>>4) & ~(~0UL<<9);
55  return (numwaf/mWaferPerLadder+1);
56 }
57 
58 unsigned int
59 StSstHit::wafer() const
60 {
61  unsigned long numwaf = (mHardwarePosition>>4) & ~(~0UL<<9);
62  return (numwaf-(numwaf/mWaferPerLadder)*mWaferPerLadder+1);
63 }
64 
65 unsigned int
66 StSstHit::centralStripNSide() const
67 {
68  return bits(13, 10); // bits 13-22
69 }
70 
71 unsigned int
72 StSstHit::centralStripPSide() const
73 {
74  return (bits(23, 5)+bits(13,10)-15); // bits 23-27
75 }
76 
77 unsigned int
78 StSstHit::clusterSizeNSide() const
79 {
80  return bits(28, 2)+1; // bits 28-29
81 }
82 
83 unsigned int
84 StSstHit::clusterSizePSide() const
85 {
86  return bits(30, 2)+1; // bits 30-31
87 }
88 
89 float
90 StSstHit::localPosition(unsigned int i) const
91 {
92  if (i<3)
93  return mLocalPosition[i];
94  else
95  return 0;
96 }
97 
98 void
99 StSstHit::setLocalPosition(float u, float v, float w)
100 {
101  mLocalPosition[0] = u;
102  mLocalPosition[1] = v;
103  mLocalPosition[2] = w;
104 }
105 
106 void StSstHit::setADC(unsigned short adcp, unsigned short adcn)
107 {
108  mADC[0] = adcp;
109  mADC[1] = adcn;
110 }
111 
112 int StSstHit::getADC(unsigned int i) const
113 {
114  if (i<2)
115  return mADC[i];
116  else
117  return 0;
118 }
119 
120 int
121 StSstHit::volumeID() const {return 10000 * sector() + 7000 + 100 * wafer() + ladder();}
122 
123 ostream& operator<<(ostream& os, const StSstHit& v)
124 {
125  return os << Form("Sst l:%2i w:%2i",v.ladder(), v.wafer())
126  << *((StHit *)&v)
127  << Form(" Luv: %8.3f %8.3f %8.3f",v.localPosition(0),v.localPosition(1),v.localPosition(2));
128 }
129 
130 void StSstHit::Print(const Option_t *option) const { cout << *this << endl;}
Definition: StHit.h:125