StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StETofDigi.cxx
1 /***************************************************************************
2  *
3  * $Id: StETofDigi.cxx,v 2.1 2018/07/09 14:53:48 ullrich Exp $
4  *
5  * Author: Philipp Weidenkaff, April 2018
6  ***************************************************************************
7  *
8  * Description: Data class for expanded digital eTOF information:
9  * eTOF digis capture the electronic response of each side of the MRPC
10  * counter read-out
11  *
12  ***************************************************************************
13  *
14  * $Log: StETofDigi.cxx,v $
15  * Revision 2.1 2018/07/09 14:53:48 ullrich
16  * Initial Revision.
17  *
18  *
19  ***************************************************************************/
20 #include "StETofDigi.h"
21 #include <cmath>
22 
23 
25 : mSector(0),
26  mZPlane(0),
27  mCounter(0),
28  mStrip(0),
29  mSide(0),
30  mRocId(0),
31  mGet4Id(0),
32  mElChan(0),
33  mRawTime(0),
34  mCalibTime(0),
35  mRawTot(-1),
36  mCalibTot(-1),
37  mAssociatedHit(0)
38 {
39 
40 }
41 
42 
43 StETofDigi::StETofDigi( const unsigned int sector, const unsigned int zPlane, const unsigned int counter,
44  const unsigned int strip, const unsigned int side,
45  const double& time, const double& tot )
46 : mSector(sector),
47  mZPlane(zPlane),
48  mCounter(counter),
49  mStrip(strip),
50  mSide(side),
51  mRocId(0),
52  mGet4Id(0),
53  mElChan(0),
54  mRawTime(time),
55  mCalibTime(0),
56  mRawTot(tot),
57  mCalibTot(-1),
58  mAssociatedHit(0)
59 {
60 
61 }
62 
63 
64 StETofDigi::StETofDigi( const unsigned int rocId, const unsigned int get4Id, const unsigned int elChan,
65  const double& time, const double& tot )
66 : mSector(0),
67  mZPlane(0),
68  mCounter(0),
69  mStrip(0),
70  mSide(0),
71  mRocId(rocId),
72  mGet4Id(get4Id),
73  mElChan(elChan),
74  mRawTime(time),
75  mCalibTime(0),
76  mRawTot(tot),
77  mCalibTot(-1),
78  mAssociatedHit(0)
79 {
80 
81 }
82 
83 
85 : mSector(digiIn.mSector),
86  mZPlane(digiIn.mZPlane),
87  mCounter(digiIn.mCounter),
88  mStrip(digiIn.mStrip),
89  mSide(digiIn.mSide),
90  mRocId(digiIn.mRocId),
91  mGet4Id(digiIn.mGet4Id),
92  mElChan(digiIn.mElChan),
93  mRawTime(digiIn.mRawTime),
94  mCalibTime(digiIn.mCalibTime),
95  mRawTot(digiIn.mRawTot),
96  mCalibTot(digiIn.mCalibTot),
97  mAssociatedHit(digiIn.mAssociatedHit)
98 {
99 
100 }
101 
102 
104 {
105 
106 }
107 
108 
109 //Ordering operators sorted by calibrated time.
110 bool
112 {
113  return ( this->calibTime() < rhs.calibTime() ) ? kTRUE : kFALSE;
114 }
115 
116 
117 int
118 StETofDigi::compare( const StObject* obj ) const
119 {
120  return compare( ( StETofDigi* ) obj );
121 }
122 
123 
124 int
125 StETofDigi::compare( const StETofDigi* digi ) const
126 {
127  if( mCalibTime < digi->calibTime() ) {
128  // this ... other
129  return -1;
130  }
131  else if( mCalibTime > digi->calibTime() ) {
132  // other ... this
133  return 1;
134  }
135  else {
136  // this = other
137  return 0;
138  }
139 }
140 
141 
142 void
143 StETofDigi::setHwAddress( const unsigned int iRocId, const unsigned int iGet4Id, const unsigned int iElChan )
144 {
145  mRocId = iRocId;
146  mGet4Id = iGet4Id;
147  mElChan = iElChan;
148 }
149 
150 
151 void
152 StETofDigi::setGeoAddress( const unsigned int iSector, const unsigned int iZPlane,
153  const unsigned int iCounter, const unsigned int iChannel, const unsigned int iSide )
154 {
155  mSector = iSector;
156  mZPlane = iZPlane;
157  mCounter = iCounter;
158  mStrip = iChannel;
159  mSide = iSide;
160 }
161 
162 
163 ostream&
164 operator<<( ostream &os, const StETofDigi& digi )
165 {
166  os << " RawTime " << digi.rawTime() << endl
167  << " RawTot " << digi.rawTot() << endl
168  << " CalibTime " << digi.calibTime() << endl
169  << " CalibTot " << digi.calibTot() << endl
170  << " Sector " << digi.sector() << endl
171  << " Plane " << digi.zPlane() << endl
172  << " Counter " << digi.counter() << endl
173  << " Strip " << digi.strip() << endl
174  << " Side " << digi.side() << endl;
175 
176  return os;
177 }
double calibTime() const
calibrated time
Definition: StETofDigi.h:206
unsigned int zPlane() const
ZPlane.
Definition: StETofDigi.h:213
unsigned int sector() const
Sector.
Definition: StETofDigi.h:212
bool operator<(const StETofDigi &rhs) const
Sorting using the time, assumes Digis are in same reference frame (e.g. same epoch).
Definition: StETofDigi.cxx:111
unsigned int strip() const
Strip.
Definition: StETofDigi.h:215
double rawTime() const
Raw Time.
Definition: StETofDigi.h:205
~StETofDigi()
Destructor.
Definition: StETofDigi.cxx:103
double rawTot() const
Getter for uncalibrated Tot.
Definition: StETofDigi.h:208
unsigned int counter() const
Counter.
Definition: StETofDigi.h:214
StETofDigi()
Default constructor.
Definition: StETofDigi.cxx:24
double calibTot() const
Getter for calibrated Tot.
Definition: StETofDigi.h:210
unsigned int side() const
Side.
Definition: StETofDigi.h:217
void setGeoAddress(const unsigned int iSector, const unsigned int iZPlane, const unsigned int iCounter, const unsigned int iChannel, const unsigned int iSide)
Definition: StETofDigi.cxx:152