57 #include "StZdcTriggerDetector.h"
58 #include "tables/St_dst_TrgDet_Table.h"
59 #include "StTriggerData.h"
60 #if !defined(ST_NO_NAMESPACES)
65 static const char rcsid[] =
"$Id: StZdcTriggerDetector.cxx,v 2.14 2006/09/14 00:02:53 ullrich Exp $";
71 fill_n(mAdc, static_cast<int>(mMaxZdcWords), 0);
72 fill_n(mTdc, static_cast<int>(mMaxZdcWords), 0);
73 fill_n(mZdcSmdEast, static_cast<int>(mMaxZdcWords), 0);
74 fill_n(mZdcSmdWest, static_cast<int>(mMaxZdcWords), 0);
75 fill_n(mSumAdc, 2, 0);
80 StZdcTriggerDetector::StZdcTriggerDetector(
const dst_TrgDet_st& t)
82 copy(t.adcZDC+0, t.adcZDC+mMaxZdcWords, mAdc);
83 copy(t.tdcZDC+0, t.tdcZDC+mMaxZdcWords, mTdc);
84 fill_n(mZdcSmdEast, static_cast<int>(mMaxZdcWords), 0);
85 fill_n(mZdcSmdWest, static_cast<int>(mMaxZdcWords), 0);
86 mSumAdc[east] = t.adcZDCEast;
87 mSumAdc[west] = t.adcZDCWest;
89 mVertexZ = t.ZDCvertexZ;
92 StZdcTriggerDetector::StZdcTriggerDetector(
const StTriggerData& t)
104 mAdc[0] = t.zdcUnAttenuated(west);
105 mAdc[1] = t.zdcADC(west, 3);
106 mAdc[2] = t.zdcADC(west, 2);
107 mAdc[3] = t.zdcADC(west, 1);
108 mAdc[4] = t.zdcUnAttenuated(east);
109 mAdc[5] = t.zdcADC(east, 3);
110 mAdc[6] = t.zdcADC(east, 2);
111 mAdc[7] = t.zdcADC(east, 1);
113 mAdc[8] = t.zdcTDC(east);
114 mAdc[9] = t.zdcTDC(west);
116 mAdc[10] = t.zdcAttenuated(west);
117 mAdc[11] = t.zdcAtAddress(11);
118 mAdc[12] = t.zdcAtAddress(12);
119 mAdc[13] = t.zdcAttenuated(east);
120 mAdc[14] = t.zdcAtAddress(14);
121 mAdc[15] = t.zdcAtAddress(15);
122 mVertexZ = t.zdcVertexZ();
124 mSumAdc[east] = t.zdcAttenuated(east);
125 mSumAdc[west] = t.zdcAttenuated(west);
126 mSum = t.zdcAtAddress(14);
128 for (
int i=0; i<mMaxZdcWords; i++)
129 mZdcSmdEast[i] = t.zdcSMD(east, ((i>7) ? 1 : 0), ((i>7) ? (i-7) : (i+1)));
130 for (
int i=0; i<mMaxZdcWords; i++)
131 mZdcSmdWest[i] = t.zdcSMD(west, ((i>7) ? 1 : 0), ((i>7) ? (i-7) : (i+1)));
133 fill_n(mTdc, static_cast<int>(mMaxZdcWords), 0);
136 StZdcTriggerDetector::~StZdcTriggerDetector() {}
139 StZdcTriggerDetector::numberOfZdcCounters()
const {
return mMaxZdcWords;}
142 StZdcTriggerDetector::numberOfZdcWords()
const {
return mMaxZdcWords;}
145 StZdcTriggerDetector::adc(
unsigned int i)
const
147 if (i < mMaxZdcWords)
154 StZdcTriggerDetector::tdc(
unsigned int i)
const
156 if (i < mMaxZdcWords)
163 StZdcTriggerDetector::adcSum(StBeamDirection dir)
const
170 StZdcTriggerDetector::zdcSmd(StBeamDirection eastwest,
int verthori,
int strip)
const
173 if (eastwest<0 || eastwest>1)
return 0.;
174 if (verthori<0 || verthori>1)
return 0.;
175 if (strip > 8)
return 0.;
177 return ((eastwest<1) ? (mZdcSmdEast[strip -1 + verthori*8]) : (mZdcSmdWest[strip-1 + verthori*8]));
182 StZdcTriggerDetector::adcSum()
const {
return mSum;}
185 StZdcTriggerDetector::vertexZ()
const {
return mVertexZ;}
188 StZdcTriggerDetector::setAdc(
unsigned int i,
float val)
190 if (i < mMaxZdcWords)
195 StZdcTriggerDetector::setTdc(
unsigned int i,
float val)
197 if (i < mMaxZdcWords)
202 StZdcTriggerDetector::setAdcSum(StBeamDirection dir,
float val)
208 StZdcTriggerDetector::setAdcSum(
float val)
214 StZdcTriggerDetector::setVertexZ(
float val)
220 StZdcTriggerDetector::setZdcSmd(StBeamDirection eastwest,
int verthori,
int strip,
float val)
222 if (eastwest<0 || eastwest>1) return ;
223 if (verthori<0 || verthori>1) return ;
224 if (strip > 8) return ;
226 if (eastwest==0) mZdcSmdEast[strip -1 + verthori*8] = val;
227 else if (eastwest==1) mZdcSmdWest[strip -1 + verthori*8] = val;