StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMuETofHit.cxx
1 /***************************************************************************
2  *
3  * $Id: StMuETofHit.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 hits created out of 2 or more eTOF digis from different sides of the
10  * MRPC counters
11  *
12  ***************************************************************************
13  *
14  * $Log: StMuETofHit.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 "StMuETofHit.h"
21 #include "StETofHit.h"
22 #include "StTrack.h"
23 #include <cmath>
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  mAssociatedTrackId( -1 ),
35  mIndex2Primary(-1),
36  mIndex2Global(-1),
37  mIdTruth(0),
38  mQuality(0)
39 {
40 
41 }
42 
43 
44 StMuETofHit::StMuETofHit( const unsigned int sector, const unsigned int zPlane, const unsigned int counter,
45  const double& time, const double& tot, const unsigned int clusterSize,
46  const double& localX, const double& localY )
47 : mSector(sector),
48  mZPlane(zPlane),
49  mCounter(counter),
50  mTime(time),
51  mTotalTot(tot),
52  mClusterSize(clusterSize),
53  mLocalX(localX),
54  mLocalY(localY),
55  mAssociatedTrackId( -1 ),
56  mIndex2Primary(-1),
57  mIndex2Global(-1),
58  mIdTruth(0),
59  mQuality(0)
60 {
61 
62 }
63 
64 
66 : mSector(hitIn.mSector),
67  mZPlane(hitIn.mZPlane),
68  mCounter(hitIn.mCounter),
69  mTime(hitIn.mTime),
70  mTotalTot(hitIn.mTotalTot),
71  mClusterSize(hitIn.mClusterSize),
72  mLocalX(hitIn.mLocalX),
73  mLocalY(hitIn.mLocalY),
74  mAssociatedTrackId(hitIn.mAssociatedTrackId),
75  mIndex2Primary(hitIn.mIndex2Primary),
76  mIndex2Global(hitIn.mIndex2Global),
77  mIdTruth(hitIn.mIdTruth),
78  mQuality(hitIn.mQuality)
79 {
80 
81 }
82 
83 
85 : mSector( hitIn->sector() ),
86  mZPlane( hitIn->zPlane() ),
87  mCounter( hitIn->counter() ),
88  mTime( hitIn->time() ),
89  mTotalTot( hitIn->totalTot() ),
90  mClusterSize( hitIn->clusterSize() ),
91  mLocalX( hitIn->localX() ),
92  mLocalY( hitIn->localY() ),
93  mAssociatedTrackId( -1 ),
94  mIndex2Primary( -1 ),
95  mIndex2Global( -1 ),
96  mIdTruth( hitIn->idTruth() ),
97  mQuality( hitIn->qaTruth() )
98 {
99  if( hitIn->associatedTrack() != 0 ) {
100  mAssociatedTrackId = hitIn->associatedTrack()->key();
101  }
102 
103  //mAssociatedTrackId = ( hitIn->associatedTrack() ) ? hitIn->associatedTrack()->key() : -1;
104 }
105 
106 
108 {
109 
110 }
111 
112 
114 bool
116 {
117  return ( this->time() < rhs.time() ) ? kTRUE : kFALSE;
118 }
119 
120 
121 int
122 StMuETofHit::compare( const TObject* obj ) const
123 {
124  return compare( ( StMuETofHit* ) obj );
125 }
126 
127 
128 int
129 StMuETofHit::compare( const StMuETofHit* hit ) const
130 {
131  if( this->time() < hit->time() ) {
132  // this ... other
133  return -1;
134  }
135  else if( this->time() > hit->time() ) {
136  // other ... hit
137  return 1;
138  }
139  else {
140  // this = other
141  return 0;
142  }
143 }
144 
145 
146 void
147 StMuETofHit::setHwAddress( const unsigned int sector, const unsigned int zPlane, const unsigned int counter )
148 {
149  mSector = sector;
150  mZPlane = zPlane;
151  mCounter = counter;
152 }
153 
154 void
155 StMuETofHit::setIdTruth( unsigned short idtruth, unsigned short qatruth )
156 {
157  if( qatruth==0 ) qatruth = ( idtruth>>16 );
158  idtruth = idtruth&((1<<16)-1);
159  mIdTruth = static_cast< UShort_t >( idtruth );
160  mQuality = static_cast< UShort_t >( qatruth );
161 }
unsigned int zPlane() const
ZPlane.
Definition: StMuETofHit.h:194
double time() const
Time.
Definition: StMuETofHit.h:197
unsigned int counter() const
Counter.
Definition: StMuETofHit.h:195
unsigned int sector() const
Sector.
Definition: StMuETofHit.h:193
void setHwAddress(const unsigned int iSector, const unsigned int iZPlane, const unsigned int iCounter)
~StMuETofHit()
Destructor.
StMuETofHit()
Default constructor.
Definition: StMuETofHit.cxx:25
StTrack * associatedTrack()
pointer to the track which has been matched to this hit
Definition: StETofHit.h:201
bool operator<(const StMuETofHit &rhs) const
Sorting using the time, assumes Digis are in same reference frame (e.g. same epoch).