StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StTofCell.cxx
1 /***************************************************************************
2  *
3  * $Id: StTofCell.cxx,v 2.5 2007/09/19 17:32:02 ullrich Exp $
4  *
5  * Author: F. Geurts, May 2003
6  ***************************************************************************
7  *
8  * Description:
9  *
10  ***************************************************************************
11  *
12  * $Log: StTofCell.cxx,v $
13  * Revision 2.5 2007/09/19 17:32:02 ullrich
14  * New member (mLeadingEdgeTime, mTrailingEdgeTime) and related functions and updates added.
15  *
16  * Revision 2.4 2004/02/05 17:59:30 ullrich
17  * Changed $LINK to StLink mechanism and add new member.
18  *
19  * Revision 2.3 2003/08/28 23:24:17 jeromel
20  * Modif in class
21  *
22  * Revision 2.2 2003/08/05 17:12:32 ullrich
23  * Added position() methods and member.
24  *
25  * Revision 2.1 2003/05/21 18:24:20 ullrich
26  * Initial Revision.
27  *
28  **************************************************************************/
29 #include "StTofCell.h"
30 #include "StTrack.h"
31 #include "StThreeVectorD.hh"
32 
33 static const char rcsid[] = "$Id: StTofCell.cxx,v 2.5 2007/09/19 17:32:02 ullrich Exp $";
34 
35 ClassImp(StTofCell)
36 
38  : mTrayIndex(0), mModuleIndex(0), mCellIndex(0), mDaqIndex(0), mAdc(0), mTdc(0),
39  mLeadingEdgeTime(0), mTrailingEdgeTime(0), mAssociatedTrack(0), mZhit(0),
40  mMatchFlag(0)
41 { /* noop */ }
42 
43 StTofCell::StTofCell(int trayId, int moduleId, int cellId, int daqId,
44  int rawAdc, int rawTdc, StTrack *track, float zhit,
45  int flag, const StThreeVectorD& pos)
46  : mTrayIndex(trayId), mModuleIndex(moduleId), mCellIndex(cellId),
47  mDaqIndex(daqId), mAdc(rawAdc), mTdc(rawTdc),
48  mLeadingEdgeTime(0.), mTrailingEdgeTime(0.),
49  mAssociatedTrack(track), mZhit(zhit), mMatchFlag(flag), mPosition(pos)
50 { /* noop */ }
51 
52 StTofCell::StTofCell(int trayId, int moduleId, int cellId, int daqId,
53  StTrack *track, float zhit,
54  int flag, const StThreeVectorD& pos)
55  : mTrayIndex(trayId), mModuleIndex(moduleId), mCellIndex(cellId),
56  mDaqIndex(daqId), mAdc(0), mTdc(0),
57  mLeadingEdgeTime(0.), mTrailingEdgeTime(0.),
58  mAssociatedTrack(track), mZhit(zhit), mMatchFlag(flag), mPosition(pos)
59 { /* noop */ }
60 
61 StTofCell::~StTofCell() { /* noop */ }
62 
63 void
64 StTofCell::setAssociatedTrack(StTrack* val)
65 {
66  mAssociatedTrack = val;
67 }
68 
69 StTrack*
70 StTofCell::associatedTrack() {return mAssociatedTrack;}
71 
72 const StTrack*
73 StTofCell::associatedTrack() const {return mAssociatedTrack;}
74 
75 void
76 StTofCell::setPosition(const StThreeVectorD& p) {mPosition = p;}
77 
78 const StThreeVectorD&
79 StTofCell::position() const {return mPosition;}
80 
81 int
82 StTofCell::operator==(const StTofCell& p) const
83 {
84  return ( (p.mTrayIndex == mTrayIndex && p.mModuleIndex == mModuleIndex &&
85  p.mCellIndex == mCellIndex && p.mDaqIndex == mDaqIndex &&
86  p.mAdc == mAdc && p.mTdc == mTdc &&
87  p.mAssociatedTrack == mAssociatedTrack &&
88  p.mZhit == mZhit &&
89  p.mMatchFlag == mMatchFlag) ||
90  (p.mTrayIndex == mTrayIndex && p.mModuleIndex == mModuleIndex &&
91  p.mCellIndex == mCellIndex && p.mDaqIndex == mDaqIndex &&
92  p.mLeadingEdgeTime == mLeadingEdgeTime &&
93  p.mTrailingEdgeTime == mTrailingEdgeTime &&
94  p.mAssociatedTrack == mAssociatedTrack &&
95  p.mZhit == mZhit &&
96  p.mMatchFlag == mMatchFlag) );
97 }
98 
99 int
100 StTofCell::operator!=(const StTofCell& p) const
101 {
102  return !(*this == p); // use operator==()
103 }