37 #include <sys/types.h>
42 #include "StDaqLib/GENERIC/EventReader.hh"
43 #include "StDAQReader.h"
44 #include "StFTPCReader.h"
56 fZeroSuppressedReader = 0;
59 fPedestalRMSReader = 0;
62 fBadChannelReader = 0;
66 StFTPCReader::StFTPCReader(
unsigned short *fcl_ftpcsqndx,
int nSeq,
67 char *fcl_ftpcadc,
int nAdc)
70 m_ftpcsqndx=fcl_ftpcsqndx;
71 m_ftpcadc=fcl_ftpcadc;
80 void StFTPCReader::Update()
85 StFTPCReader::~StFTPCReader()
97 bool StFTPCReader::checkForData()
108 int StFTPCReader::close()
110 delete fZeroSuppressedReader; fZeroSuppressedReader = 0;
111 delete fADCRawReader ; fADCRawReader = 0;
112 delete fPedestalReader ; fPedestalReader = 0;
113 delete fPedestalRMSReader; fPedestalRMSReader = 0;
114 delete fGainReader; fGainReader = 0;
115 delete fCPPReader; fCPPReader = 0;
116 delete fBadChannelReader; fBadChannelReader = 0;
117 delete fFTPCImpReader; fFTPCImpReader = 0;
122 int StFTPCReader::setSector(
int sector)
124 if (sector == fSector)
return 0;
139 mSecReader =
new StFssSectorReader(fSector, m_ftpcsqndx, m_numSqndx, m_ftpcadc, m_numAdc);
140 mSecReader->initialize();
144 delete fZeroSuppressedReader; fZeroSuppressedReader = 0;
145 delete fADCRawReader ; fADCRawReader = 0;
146 delete fPedestalReader ; fPedestalReader = 0;
147 delete fPedestalRMSReader; fPedestalRMSReader = 0;
148 delete fGainReader; fGainReader = 0;
149 delete fCPPReader; fCPPReader = 0;
150 delete fBadChannelReader; fBadChannelReader = 0;
153 delete fFTPCImpReader;
154 fFTPCImpReader = ::getDetectorReader(fDAQReader->getEventReader(),
"FTPC");
156 if(!fFTPCImpReader)
return 1;
163 fZeroSuppressedReader = fFTPCImpReader->getZeroSuppressedReader(fSector);
164 fADCRawReader = fFTPCImpReader->getADCRawReader(fSector);
165 fPedestalReader = fFTPCImpReader->getPedestalReader(fSector);
166 fPedestalRMSReader = fFTPCImpReader->getPedestalRMSReader(fSector);
167 fGainReader = fFTPCImpReader->getGainReader(fSector);
168 fCPPReader = fFTPCImpReader->getCPPReader(fSector);
169 fBadChannelReader = fFTPCImpReader->getBadChannelReader(fSector);
174 int StFTPCReader::getPadList(
int Sector,
int PadRow,
unsigned char *&padList)
182 return mSecReader->getPadList(PadRow, &padList);
186 if (!fZeroSuppressedReader)
return -1;
187 return fZeroSuppressedReader->getPadList(PadRow, &padList);
191 int StFTPCReader::getSequences(
int Sector,
int PadRow,
int Pad,
int *nSeq,
195 *nSeq = 0; SeqData = 0;
203 iret = mSecReader->getSequences(PadRow,Pad,nSeq,&seq);
207 if (!fZeroSuppressedReader)
return -1;
208 iret = fZeroSuppressedReader->getSequences(PadRow,Pad,nSeq,&seq);
216 int StFTPCReader::getRawADC(
int Sector,
int PadRow,
int Pad,
int &nArray,
217 unsigned char *&Array)
227 if (!fADCRawReader)
return -1;
228 return fADCRawReader->getSequences(PadRow,Pad,&nArray,&Array);
232 int StFTPCReader::getPedestals(
int Sector,
int PadRow,
int Pad,
int &nArray,
233 unsigned char *&Array)
243 if (!fPedestalReader)
return -1;
244 return fPedestalReader->getSequences(PadRow,Pad,&nArray,&Array);
248 int StFTPCReader::getRMSPedestals(
int Sector,
int PadRow,
int Pad,
int &nArray,
249 unsigned char *&Array)
259 if (!fPedestalRMSReader)
return -1;
260 return fPedestalRMSReader->getSequences(PadRow,Pad,&nArray,&Array);
264 int StFTPCReader::getGain(
int Sector,
int PadRow,
int Pad,
TPCGain *&gain)
274 if (!fGainReader)
return -1;
276 int iret = fGainReader->getGain(PadRow,Pad,&gainqq);
283 int StFTPCReader::getClusters(
int Sector,
int PadRow,
int Pad,
int &nClusters,
293 nClusters=0; clusters=0;
294 if (!fCPPReader)
return -1;
296 int iret = fCPPReader->getClusters(PadRow,Pad,&nClusters,&clustersqq);
303 int StFTPCReader::IsBad(
int Sector,
int PadRow,
int Pad)
312 if (!fBadChannelReader)
return 1;
313 return fBadChannelReader->IsBad(PadRow,Pad);