22 #include "StSVTReader.h"
23 #include "StDaqLib/SVT/SVTV1P0_Reader.hh"
35 fZeroSuppressedReader = 0;
38 fPedestalRMSReader = 0;
41 fBadChannelReader = 0;
45 void StSVTReader::Update()
50 StSVTReader::~StSVTReader()
55 int StSVTReader::close()
59 delete fSVTImpReader; fSVTImpReader =0;
60 delete fZeroSuppressedReader; fZeroSuppressedReader =0;
61 delete fADCRawReader; fADCRawReader =0;
62 delete fPedestalReader; fPedestalReader =0;
63 delete fPedestalRMSReader; fPedestalRMSReader =0;
64 delete fGainReader ; fGainReader =0;
65 delete fCPPReader ; fCPPReader =0;
66 delete fBadChannelReader; fBadChannelReader =0;
70 int StSVTReader::setWafer(
int barrel,
int ladder,
int wafer)
72 int waferIndex = getWaferIndex(barrel, ladder, wafer);
74 if (waferIndex == fWafer)
return waferIndex;
76 delete fZeroSuppressedReader; fZeroSuppressedReader =0;
77 delete fADCRawReader; fADCRawReader =0;
78 delete fPedestalReader; fPedestalReader =0;
79 delete fPedestalRMSReader; fPedestalRMSReader =0;
80 delete fGainReader ; fGainReader =0;
81 delete fCPPReader ; fCPPReader =0;
82 delete fBadChannelReader; fBadChannelReader =0;
84 if ((barrel == -1) && (ladder == -1) && (wafer == -1)) {
86 fSVTImpReader = ::getDetectorReader(fDAQReader->getEventReader(),
"SVT");
90 if ((barrel == -1) && (ladder == -1) && (wafer == -1))
return -1;
94 fZeroSuppressedReader = ((
SVTV1P0_Reader*)fSVTImpReader)->getZeroSuppressedReader(barrel, ladder, wafer);
95 fADCRawReader = ((
SVTV1P0_Reader*)fSVTImpReader)->getADCRawReader(barrel, ladder, wafer);
96 fPedestalReader = ((
SVTV1P0_Reader*)fSVTImpReader)->getPedestalReader(barrel, ladder, wafer);
97 fPedestalRMSReader = ((
SVTV1P0_Reader*)fSVTImpReader)->getPedestalRMSReader(barrel, ladder, wafer);
99 fCPPReader = ((
SVTV1P0_Reader*)fSVTImpReader)->getCPPReader(barrel, ladder, wafer);
109 int StSVTReader::getWaferIndex(
int barrel,
int ladder,
int wafer)
112 int numberOfLadders[3] = {8,12,16};
113 int numberOfWafers[3] = {4,6,7};
114 int numberOfHybrids = 2;
if(numberOfHybrids) {}
119 index = (ladder-1)*numberOfWafers[barrel-1] + wafer;
123 index = numberOfLadders[barrel-2]*numberOfWafers[barrel-2] +
124 (ladder-1)*numberOfWafers[barrel-1] + wafer;
128 index = numberOfLadders[barrel-3]*numberOfWafers[barrel-3] +
129 numberOfLadders[barrel-2]*numberOfWafers[barrel-2] +
130 (ladder-1)*numberOfWafers[barrel-1] + wafer;
139 if ((index < 1) || (index > 216)) index = -1;
144 int StSVTReader::getAnodeList(
int barrel,
int ladder,
int wafer,
int hybrid,
unsigned char *&anodeList)
146 int waferIndex = setWafer(barrel, ladder, wafer);
147 if (waferIndex == -1)
return -1;
148 if (!fZeroSuppressedReader)
return -1;
149 return fZeroSuppressedReader->getPadList(hybrid, &anodeList);
152 int StSVTReader::getSequences(
int barrel,
int ladder,
int wafer,
int hybrid,
int Anode,
int &nSeq,
155 int waferIndex = setWafer(barrel, ladder, wafer);
156 if (waferIndex == -1)
return -1;
157 nSeq = 0; SeqData = 0;
158 if (!fZeroSuppressedReader)
return -1;
160 int iret = fZeroSuppressedReader->getSequences(hybrid,Anode,&nSeq,&seq);
167 int StSVTReader::getRawADC(
int barrel,
int ladder,
int wafer,
int hybrid,
int Anode,
int &nArray,
168 unsigned char *&Array)
170 int waferIndex = setWafer(barrel, ladder, wafer);
171 if (waferIndex == -1)
return -1;
173 if (!fADCRawReader)
return -1;
174 int status = fADCRawReader->getSequences(hybrid,Anode,&nArray,&Array);
180 int StSVTReader::getPedestals(
int barrel,
int ladder,
int wafer,
int hybrid,
int Anode,
int &nArray,
181 unsigned char *&Array)
183 int waferIndex = setWafer(barrel, ladder, wafer);
184 if (waferIndex == -1)
return -1;
186 if (!fPedestalReader)
return -1;
187 return fPedestalReader->getSequences(hybrid,Anode,&nArray,&Array);
190 int StSVTReader::getRMSPedestals(
int barrel,
int ladder,
int wafer,
int hybrid,
int Anode,
int &nArray,
191 unsigned char *&Array)
193 int waferIndex = setWafer(barrel, ladder, wafer);
194 if (waferIndex == -1)
return -1;
196 if (!fPedestalRMSReader)
return -1;
197 return fPedestalRMSReader->getSequences(hybrid,Anode,&nArray,&Array);
200 int StSVTReader::getGain(
int barrel,
int ladder,
int wafer,
int hybrid,
int Anode,
TPCGain *&gain)
202 int waferIndex = setWafer(barrel, ladder, wafer);
203 if (waferIndex == -1)
return -1;
205 if (!fGainReader)
return -1;
207 int iret = fGainReader->getGain(hybrid,Anode,&gainqq);
213 int StSVTReader::getClusters(
int barrel,
int ladder,
int wafer,
int hybrid,
int Anode,
int &nClusters,
216 int waferIndex = setWafer(barrel, ladder, wafer);
217 if (waferIndex == -1)
return -1;
218 nClusters=0; clusters=0;
219 if (!fCPPReader)
return -1;
221 int iret = fCPPReader->getClusters(hybrid,Anode,&nClusters,&clustersqq);
227 int StSVTReader::IsBad(
int barrel,
int ladder,
int wafer,
int hybrid,
int Anode)
229 int waferIndex = setWafer(barrel, ladder, wafer);
230 if (waferIndex == -1)
return -1;
231 if (!fBadChannelReader)
return 1;
232 return fBadChannelReader->IsBad(hybrid,Anode);