StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StETofHit.cxx
1 /***************************************************************************
2  *
3  * $Id: StETofHit.cxx,v 2.2 2019/02/11 18:53:09 ullrich Exp $
4  *
5  * Author: Philipp Weidenkaff, April 2018
6  ***************************************************************************
7  *
8  * Description: Data class for expanded digital eTOF information:
9  * eTOF hits created out of 2 or more eTOF digis from different sides of the
10  * MRPC counters
11  *
12  ***************************************************************************
13  *
14  * $Log: StETofHit.cxx,v $
15  * Revision 2.2 2019/02/11 18:53:09 ullrich
16  * Added additional access functions to get the associated track & idTruth and qaTruth variables for simulated Hits.
17  *
18  * Revision 2.1 2018/07/09 14:53:48 ullrich
19  * Initial Revision.
20  *
21  *
22  ***************************************************************************/
23 #include "StETofHit.h"
24 
26 : mSector(0),
27  mZPlane(0),
28  mCounter(0),
29  mTime(0),
30  mTotalTot(0),
31  mClusterSize(0),
32  mLocalX(0),
33  mLocalY(0),
34  mAssociatedTrack(0),
35  mIdTruth(0),
36  mQuality(0)
37 {
38  /* no op */
39 }
40 
41 
42 StETofHit::StETofHit( const unsigned int sector, const unsigned int zPlane, const unsigned int counter,
43  const double& time, const double& tot, const unsigned int clusterSize,
44  const double& localX, const double& localY )
45 : mSector(sector),
46  mZPlane(zPlane),
47  mCounter(counter),
48  mTime(time),
49  mTotalTot(tot),
50  mClusterSize(clusterSize),
51  mLocalX(localX),
52  mLocalY(localY),
53  mAssociatedTrack(0),
54  mIdTruth(0),
55  mQuality(0)
56 {
57  /* no op */
58 }
59 
60 
62 : mSector(hitIn.mSector),
63  mZPlane(hitIn.mZPlane),
64  mCounter(hitIn.mCounter),
65  mTime(hitIn.mTime),
66  mTotalTot(hitIn.mTotalTot),
67  mClusterSize(hitIn.mClusterSize),
68  mLocalX(hitIn.mLocalX),
69  mLocalY(hitIn.mLocalY),
70  mAssociatedTrack(hitIn.mAssociatedTrack),
71  mIdTruth(hitIn.mIdTruth),
72  mQuality(hitIn.mQuality)
73 {
74  /* no op */
75 }
76 
77 
79 {
80  /* no op */
81 }
82 
83 
85 bool
86 StETofHit::operator <( const StETofHit& rhs ) const
87 {
88  return ( this->time() < rhs.time() ) ? kTRUE : kFALSE;
89 }
90 
91 
92 int
93 StETofHit::compare( const StObject* obj ) const
94 {
95  return compare( ( StETofHit* ) obj );
96 }
97 
98 
99 int
100 StETofHit::compare( const StETofHit* hit ) const
101 {
102  if( this->time() < hit->time() ) {
103  // this ... other
104  return -1;
105  }
106  else if( this->time() > hit->time() ) {
107  // other ... hit
108  return 1;
109  }
110  else {
111  // this = other
112  return 0;
113  }
114 }
115 
116 
117 void
118 StETofHit::setHwAddress( const unsigned int sector, const unsigned int zPlane, const unsigned int counter )
119 {
120  mSector = sector;
121  mZPlane = zPlane;
122  mCounter = counter;
123 }
124 
125 void
126 StETofHit::setIdTruth( unsigned short idtruth, unsigned short qatruth )
127 {
128  if (qatruth==0) qatruth = (idtruth>>16);
129  idtruth = idtruth&((1<<16)-1);
130  mIdTruth = static_cast<UShort_t>(idtruth);
131  mQuality = static_cast<UShort_t>(qatruth);
132 }
133 
134 
135 ostream&
136 operator<<( ostream &os, const StETofHit& hit )
137 {
138  os << " Time " << hit.time() << endl
139  << " TotalTot " << hit.totalTot() << endl
140  << " Clustersize " << hit.clusterSize() << endl
141  << " Sector " << hit.sector() << endl
142  << " Plane " << hit.zPlane() << endl
143  << " Counter " << hit.counter() << endl
144  << " LocalX " << hit.localX() << endl
145  << " LocalY " << hit.localY() << endl
146  << " idTruth " << hit.idTruth() << endl
147  << " qaTruth " << hit.qaTruth() << endl;
148  return os;
149 }
unsigned int qaTruth() const
quality of this information (percentage of charge produced by mIdTruth)
Definition: StETofHit.h:205
~StETofHit()
Destructor.
Definition: StETofHit.cxx:78
double time() const
Time.
Definition: StETofHit.h:193
unsigned int clusterSize() const
Cluster size.
Definition: StETofHit.h:196
void setHwAddress(const unsigned int iSector, const unsigned int iZPlane, const unsigned int iCounter)
Definition: StETofHit.cxx:118
unsigned int counter() const
Counter.
Definition: StETofHit.h:191
StETofHit()
Default constructor.
Definition: StETofHit.cxx:25
bool operator<(const StETofHit &rhs) const
Sorting using the time, assumes Digis are in same reference frame (e.g. same epoch).
Definition: StETofHit.cxx:86
unsigned int zPlane() const
ZPlane.
Definition: StETofHit.h:190
double localX() const
X-position.
Definition: StETofHit.h:198
unsigned int idTruth() const
mc-true associated track id in simulation
Definition: StETofHit.h:204
double totalTot() const
Total Tot.
Definition: StETofHit.h:194
double localY() const
Y-position.
Definition: StETofHit.h:199
unsigned int sector() const
Sector.
Definition: StETofHit.h:189