StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StPxlDigiHit.cxx
1 #include <algorithm>
2 
3 #include "StPxlDigiHit.h"
4 
5 
6 const double StPxlDigiHit::mFirstPixelX = (StPxlConsts::kPxlNumRowsPerSensor - 1) * StPxlConsts::kPixelSize / 2;
7 const double StPxlDigiHit::mFirstPixelZ = -(StPxlConsts::kPxlNumColumnsPerSensor - 1) * StPxlConsts::kPixelSize / 2;
8 
9 
10 StPxlDigiHit::StPxlDigiHit() : StPxlHit()
11 {
12 }
13 
14 
16 StPxlDigiHit::StPxlDigiHit(const double (&localPos)[3], unsigned sector, unsigned ladder, unsigned sensor,
17  unsigned short idTruth) :
18  StPxlHit(localPos, sector, ladder, sensor, idTruth)
19 {
20  // Update parents mMeanRow/mMeanColumn using the provided hit coordinates
21  mMeanRow = -(mLocalPosition[0] - mFirstPixelX) / StPxlConsts::kPixelSize;
22  mMeanColumn = (mLocalPosition[2] - mFirstPixelZ) / StPxlConsts::kPixelSize;
23 }
24 
25 
27 StPxlDigiHit::StPxlDigiHit(const StPxlCluster &cluster, unsigned sector, unsigned ladder, unsigned sensor) :
28  StPxlHit(cluster.rowCenter(), cluster.columnCenter(), sector, ladder, sensor)
29 {
30  mIdTruth = cluster.idTruth();
31  mNRawHits = cluster.nRawHits();
32 
33  mLocalPosition[0] = mFirstPixelX - StPxlConsts::kPixelSize * mMeanRow;
34  mLocalPosition[1] = 0;
35  mLocalPosition[2] = mFirstPixelZ + StPxlConsts::kPixelSize * mMeanColumn;
36 }
37 
38 
39 StPxlDigiHit::StPxlDigiHit(const double (&localPos)[3], unsigned sector, unsigned ladder, unsigned sensor,
40  const StThreeVectorF& position, const StThreeVectorF& error, unsigned int hwPosition,
41  float charge, unsigned char trackRefCount, unsigned short idTruth, unsigned short quality, unsigned short id) :
42  StPxlHit(localPos, sector, ladder, sensor, position, error,
43  hwPosition, charge, trackRefCount, idTruth, quality, id)
44 {
45  // Update parents mMeanRow/mMeanColumn using the provided hit coordinates
46  mMeanRow = -(mLocalPosition[0] - mFirstPixelX) / StPxlConsts::kPixelSize;
47  mMeanColumn = (mLocalPosition[2] - mFirstPixelZ) / StPxlConsts::kPixelSize;
48 }
49 
50 
52 void StPxlDigiHit::setMeanRow(double val)
53 {
54  mMeanRow = val;
55  mLocalPosition[0] = mFirstPixelX - StPxlConsts::kPixelSize * mMeanRow;
56 }
57 
58 
61 {
62  mMeanColumn = val;
63  mLocalPosition[2] = mFirstPixelZ + StPxlConsts::kPixelSize * mMeanColumn;
64 }
65 
66 
68 void StPxlDigiHit::setLocalPosition(const double (&coords)[3])
69 {
70  std::copy(coords, coords+3, mLocalPosition);
71 
72  mMeanRow = -(mLocalPosition[0] - mFirstPixelX) / StPxlConsts::kPixelSize;
73  mMeanColumn = (mLocalPosition[2] - mFirstPixelZ) / StPxlConsts::kPixelSize;
74 }
void setMeanColumn(double val)
void setMeanRow(double val)
Int_t idTruth() const
for embedding, 0 as background, most frequent raw hit idTruth as idTruth of the cluster ...
Definition: StPxlCluster.h:58
Int_t nRawHits() const
number of raw hits
void setLocalPosition(const double(&coords)[3])