StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StPxlHit.cxx
1 
6 /***************************************************************************
7  *
8  * $Id: StPxlHit.cxx,v 2.3 2015/05/13 18:05:25 ullrich Exp $
9  *
10  * Author: S. MArgetis, J. Bouchet, Jan 2013
11  ***************************************************************************
12  *
13  * Description:
14  *
15  ***************************************************************************
16  *
17  * $Log: StPxlHit.cxx,v $
18  * Revision 2.3 2015/05/13 18:05:25 ullrich
19  * New constructors for setting local hit position, proper initialization
20  * of all data member, modified existing constructor, new getter and
21  * setter for local hit coordinates.
22  *
23  * Revision 2.2 2013/03/13 08:01:45 ullrich
24  * Set correct detector ID kPxlId in constructors,
25  *
26  * Revision 2.1 2013/03/05 14:40:40 ullrich
27  * Initial Revision.
28  *
29  **************************************************************************/
30 #include <algorithm>
31 #include "StPxlHit.h"
32 
33 ClassImp(StPxlHit)
34 
35 StMemoryPool StPxlHit::mPool(sizeof(StPxlHit));
36 
37 StPxlHit::~StPxlHit() { /* noop */ }
38 
39 StPxlHit::StPxlHit() : StHit(),
40  mSector(-1),
41  mLadder(-1),
42  mSensor(-1),
43  mMeanRow(-1),
44  mMeanColumn(-1),
45  mNRawHits(0),
46  mLocalPosition(),
47  mDetectorId(kPxlId)
48 { /* no op */ }
49 
50 
51 StPxlHit::StPxlHit(const double localPos[3], unsigned sector, unsigned ladder, unsigned sensor,
52  const StThreeVectorF& position, const StThreeVectorF& error,
53  unsigned int hwPosition, float charge, unsigned char trackRefCount,
54  unsigned short idTruth, unsigned short quality, unsigned short id) :
55  StHit(position, error, hwPosition, charge, trackRefCount, idTruth, quality, id),
56  mSector(sector),
57  mLadder(ladder),
58  mSensor(sensor),
59  mMeanRow(-1),
60  mMeanColumn(-1),
61  mNRawHits(0),
62  mLocalPosition(),
63  mDetectorId(kPxlId)
64 {
65  std::copy(localPos, localPos+3, mLocalPosition);
66 }
67 
68 
76 StPxlHit::StPxlHit(const double localPos[3], unsigned sector, unsigned ladder, unsigned sensor,
77  unsigned short idTruth) :
78  StHit(),
79  mSector(sector),
80  mLadder(ladder),
81  mSensor(sensor),
82  mMeanRow(-1),
83  mMeanColumn(-1),
84  mNRawHits(0),
85  mLocalPosition(),
86  mDetectorId(kPxlId)
87 {
88  mIdTruth = idTruth;
89  std::copy(localPos, localPos+3, mLocalPosition);
90 }
91 
92 
100 StPxlHit::StPxlHit(float meanRow, float meanColumn, unsigned int sector, unsigned int ladder,
101  unsigned sensor) :
102  StHit(),
103  mSector(sector),
104  mLadder(ladder),
105  mSensor(sensor),
106  mMeanRow(meanRow),
107  mMeanColumn(meanColumn),
108  mNRawHits(0),
109  mLocalPosition(),
110  mDetectorId(kPxlId)
111 {
112 }
113 
114 
115 StDetectorId StPxlHit::detector() const {return mDetectorId;}
116 
117 void StPxlHit::setDetectorId(StDetectorId id) {mDetectorId = id;}
118 
119 float StPxlHit::localPosition(unsigned int i) const
120 {
121  if (i<3)
122  return mLocalPosition[i];
123  else
124  return 0;
125 }
126 
127 void StPxlHit::setLocalPosition(float u, float v, float w)
128 {
129  mLocalPosition[0] = u;
130  mLocalPosition[1] = v;
131  mLocalPosition[2] = w;
132 }
133 
134 ostream& operator<<(ostream& os, const StPxlHit& hit)
135 {
136  os << "HFT Hit -I- \tSector:"<< static_cast<int>(hit.sector())
137  << " ladder: "<< static_cast<int>(hit.ladder())
138  << " sensor: "<< static_cast<int>(hit.sensor())
139  << " localPosition[0]/localPosition[1]/localPosition[2] : " << hit.localPosition(0)
140  << "/" << hit.localPosition(1)
141  << "/" << hit.localPosition(2)
142  << " kDetectorId : " << hit.detector()
143  << endl;
144  return os;
145 }
Definition: StHit.h:125