StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMuFmsHit.cxx
1 /***************************************************************************
2  *
3  * $Id: StMuFmsHit.cxx,v 1.1 2010/01/25 03:57:39 tone421 Exp $
4  *
5  * Author: Jingguo Ma, Jan 2010
6  ***************************************************************************
7  *
8  * Description: StMuFmsHit is data for individual cell
9  *
10  ***************************************************************************
11  *
12  * $Log: StMuFmsHit.cxx,v $
13  * Revision 1.1 2010/01/25 03:57:39 tone421
14  * Added FMS and Roman pot arrays
15  *
16  **************************************************************************/
17 #include "StMuFmsHit.h"
18 
19 ClassImp(StMuFmsHit)
20 
22  mDetectorId = 0;
23  mChannel = 0;
24  mQTCrtSlotCh = 0;
25  mAdc = 0;
26  mTdc = 0;
27  mEnergy = 0;
28 }
29 
30 StMuFmsHit::StMuFmsHit(unsigned short det, unsigned short ch,
31  unsigned short qtcrate, unsigned short qtslot,
32  unsigned short qtch, unsigned short adc,
33  unsigned short tdc, float e)
34 {
35  setMuFmsHit(det, ch, qtcrate, qtslot, qtch, adc, tdc, e);
36 }
37 
38 StMuFmsHit::~StMuFmsHit() {/* no op */}
39 
40 unsigned short
41 StMuFmsHit::detectorId() const {return mDetectorId;}
42 
43 unsigned short
44 StMuFmsHit::channel() const {return mChannel;}
45 
46 unsigned short
47 StMuFmsHit::adc() const {return mAdc;}
48 
49 unsigned short
50 StMuFmsHit::tdc() const {return mTdc;}
51 
52 float
53 StMuFmsHit::energy() const {return mEnergy;}
54 
55 unsigned short
56 StMuFmsHit::qtCrate() const {return (mQTCrtSlotCh>>12) & 0x0f;}
57 
58 unsigned short
59 StMuFmsHit::qtSlot() const {return (mQTCrtSlotCh>>8 ) & 0x0f;}
60 
61 unsigned short
62 StMuFmsHit::qtChannel() const {return (mQTCrtSlotCh ) & 0xff;}
63 
64 void
65 StMuFmsHit::encodeQTCrtSlotCh(unsigned short qtcrate, unsigned short qtslot,
66  unsigned short qtch)
67 {
68  mQTCrtSlotCh = (qtcrate<<12) + (qtslot<<8) + qtch;
69 }
70 
71 void StMuFmsHit::setQtCrate(unsigned short val) { mQTCrtSlotCh |= (val<<12); }
72 void StMuFmsHit::setQtSlot(unsigned short val) { mQTCrtSlotCh |= (val<<8); }
73 void StMuFmsHit::setQtChannel(unsigned short val) { mQTCrtSlotCh |= val; }
74 void StMuFmsHit::setDetectorId(unsigned short val) { mDetectorId = val; }
75 void StMuFmsHit::setChannel(unsigned short val) { mChannel = val; }
76 void StMuFmsHit::setAdc(unsigned short val) { mAdc = val; }
77 void StMuFmsHit::setTdc(unsigned short val) { mTdc = val; }
78 void StMuFmsHit::setEnergy(float val) { mEnergy = val; }
79 void StMuFmsHit::setMuFmsHit(unsigned short det, unsigned short ch,
80  unsigned short qtcrate, unsigned short qtslot,
81  unsigned short qtch, unsigned short adc,
82  unsigned short tdc, Float_t e){
83  mDetectorId = det;
84  mChannel = ch;
85  mAdc = adc;
86  mTdc = tdc;
87  mEnergy = e;
88  encodeQTCrtSlotCh(qtcrate, qtslot, qtch);
89 }
90 
91 void StMuFmsHit::print(Option_t *option) const {cout<< *this <<endl;}
92 
93 ostream& operator<<(ostream& os, const StMuFmsHit& v)
94 {
95  return os <<"StMuFmsHit: mDetectorId\t"<<v.detectorId()
96  <<"\tmChannel\t" <<v.channel()
97  <<"\tQTCrate\t" <<v.qtCrate()
98  <<"\tQTSlot\t" <<v.qtSlot()
99  <<"\tQTCh\t" <<v.qtChannel()
100  <<"\tmAdc\t" <<v.adc()
101  <<"\tmTdc\t" <<v.tdc()
102  <<"\tmEnergy\t" <<v.energy();
103 }