StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMuETofDigi.cxx
1 /***************************************************************************
2  *
3  * $Id: StMuETofDigi.cxx,v 1.1 2019/02/21 13:32:54 jdb Exp $
4  *
5  * Author: Florian Seck, October 2018
6  ***************************************************************************
7  *
8  * Description: Data class for expanded digital eTOF information in MuDsts:
9  * eTOF digis capture the electronic response of each side of the MRPC
10  * counter read-out
11  *
12  ***************************************************************************
13  *
14  * $Log: StMuETofDigi.cxx,v $
15  * Revision 1.1 2019/02/21 13:32:54 jdb
16  * Inclusion of ETOF MuDst code. This code adds support for the full set of ETOF data which includes EtofDigi, EtofHit, EtofHeader. The code essentially copies similar structures from StEvent and additionally rebuilds the maps between Digis and Hits. Accessor methods are added based on the pattern from BTOF to provide access to data at various levels. The code for accessing the PID traits provided by ETOF is also provided
17  *
18  *
19  ***************************************************************************/
20 #include "StMuETofDigi.h"
21 #include "StETofDigi.h"
22 #include <cmath>
23 
24 
26 : mSector(0),
27  mZPlane(0),
28  mCounter(0),
29  mStrip(0),
30  mSide(0),
31  mRocId(0),
32  mGet4Id(0),
33  mElChan(0),
34  mRawTime(0),
35  mCalibTime(0),
36  mRawTot(-1),
37  mCalibTot(-1),
38  mAssociatedHitId( -1 )
39 {
40 
41 }
42 
43 
44 StMuETofDigi::StMuETofDigi( const unsigned int sector, const unsigned int zPlane, const unsigned int counter,
45  const unsigned int strip, const unsigned int side,
46  const double& time, const double& tot )
47 : mSector(sector),
48  mZPlane(zPlane),
49  mCounter(counter),
50  mStrip(strip),
51  mSide(side),
52  mRocId(0),
53  mGet4Id(0),
54  mElChan(0),
55  mRawTime(time),
56  mCalibTime(0),
57  mRawTot(tot),
58  mCalibTot(-1),
59  mAssociatedHitId( -1 )
60 {
61 
62 }
63 
64 
65 StMuETofDigi::StMuETofDigi( const unsigned int rocId, const unsigned int get4Id, const unsigned int elChan,
66  const double& time, const double& tot )
67 : mSector(0),
68  mZPlane(0),
69  mCounter(0),
70  mStrip(0),
71  mSide(0),
72  mRocId(rocId),
73  mGet4Id(get4Id),
74  mElChan(elChan),
75  mRawTime(time),
76  mCalibTime(0),
77  mRawTot(tot),
78  mCalibTot(-1),
79  mAssociatedHitId( -1 )
80 {
81 
82 }
83 
84 
86 : mSector(digiIn.mSector),
87  mZPlane(digiIn.mZPlane),
88  mCounter(digiIn.mCounter),
89  mStrip(digiIn.mStrip),
90  mSide(digiIn.mSide),
91  mRocId(digiIn.mRocId),
92  mGet4Id(digiIn.mGet4Id),
93  mElChan(digiIn.mElChan),
94  mRawTime(digiIn.mRawTime),
95  mCalibTime(digiIn.mCalibTime),
96  mRawTot(digiIn.mRawTot),
97  mCalibTot(digiIn.mCalibTot),
98  mAssociatedHitId( digiIn.mAssociatedHitId )
99 {
100 
101 }
102 
103 
105 : mSector( digiIn->sector() ),
106  mZPlane( digiIn->zPlane() ),
107  mCounter( digiIn->counter() ),
108  mStrip( digiIn->strip() ),
109  mSide( digiIn->side() ),
110  mRocId( digiIn->rocId() ),
111  mGet4Id( digiIn->get4Id() ),
112  mElChan( digiIn->elChan() ),
113  mRawTime( digiIn->rawTime() ),
114  mCalibTime( digiIn->calibTime() ),
115  mRawTot( digiIn->rawTot() ),
116  mCalibTot( digiIn->calibTot() ),
117  mAssociatedHitId( -1 )
118 {
119 
120 }
121 
122 
123 StMuETofDigi::StMuETofDigi( const StETofDigi* digiIn, const int assocHitId )
124 : mSector( digiIn->sector() ),
125  mZPlane( digiIn->zPlane() ),
126  mCounter( digiIn->counter() ),
127  mStrip( digiIn->strip() ),
128  mSide( digiIn->side() ),
129  mRocId( digiIn->rocId() ),
130  mGet4Id( digiIn->get4Id() ),
131  mElChan( digiIn->elChan() ),
132  mRawTime( digiIn->rawTime() ),
133  mCalibTime( digiIn->calibTime() ),
134  mRawTot( digiIn->rawTot() ),
135  mCalibTot( digiIn->calibTot() ),
136  mAssociatedHitId( assocHitId )
137 {
138 
139 }
140 
141 
142 
144 {
145 
146 }
147 
148 
149 //Ordering operators sorted by calibrated time.
150 bool
152 {
153  return ( this->calibTime() < rhs.calibTime() ) ? kTRUE : kFALSE;
154 }
155 
156 
157 int
158 StMuETofDigi::compare( const TObject* obj ) const
159 {
160  return compare( ( StMuETofDigi* ) obj );
161 }
162 
163 
164 int
165 StMuETofDigi::compare( const StMuETofDigi* digi ) const
166 {
167  if( mCalibTime < digi->calibTime() ) {
168  // this ... other
169  return -1;
170  }
171  else if( mCalibTime > digi->calibTime() ) {
172  // other ... this
173  return 1;
174  }
175  else {
176  // this = other
177  return 0;
178  }
179 }
180 
181 
182 void
183 StMuETofDigi::setHwAddress( const unsigned int iRocId, const unsigned int iGet4Id, const unsigned int iElChan )
184 {
185  mRocId = iRocId;
186  mGet4Id = iGet4Id;
187  mElChan = iElChan;
188 }
189 
190 
191 void
192 StMuETofDigi::setGeoAddress( const unsigned int iSector, const unsigned int iZPlane,
193  const unsigned int iCounter, const unsigned int iChannel, const unsigned int iSide )
194 {
195  mSector = iSector;
196  mZPlane = iZPlane;
197  mCounter = iCounter;
198  mStrip = iChannel;
199  mSide = iSide;
200 }
StMuETofDigi()
Default constructor.
double calibTime() const
calibrated time
Definition: StMuETofDigi.h:206
~StMuETofDigi()
Destructor.
void setGeoAddress(const unsigned int iSector, const unsigned int iZPlane, const unsigned int iCounter, const unsigned int iChannel, const unsigned int iSide)
bool operator<(const StMuETofDigi &rhs) const
Sorting using the time, assumes Digis are in same reference frame (e.g. same epoch).