19 #include "StFtpcSequencer.hh"
24 #include "StMessMgr.h"
28 St_fcl_ftpcsqndx *ftpcsqndxIn,
29 St_fcl_ftpcadc *ftpcadcIn)
32 if ((!ftpcndxIn)||(!ftpcsqndxIn)||(!ftpcadcIn)) {
33 LOG_WARN <<
"StFtpcSequencer: Output sequences missing, bailing out!" << endm;
38 ftpcsqndx=ftpcsqndxIn;
41 ndx=ftpcndx->GetTable();
42 numNdx=ftpcndx->GetNRows();
43 maxNdx=ftpcndx->GetTableSize();
44 sqndx=ftpcsqndx->GetTable();
45 numSqndx=ftpcsqndx->GetNRows();
46 maxSqndx=ftpcsqndx->GetTableSize();
47 adc=ftpcadc->GetTable();
48 numAdc=ftpcadc->GetNRows();
49 maxAdc=ftpcadc->GetTableSize();
56 ftpcndx->SetNRows(numNdx);
57 ftpcsqndx->SetNRows(numSqndx);
58 ftpcadc->SetNRows(numAdc);
60 LOG_INFO <<
"FTPC Sequencer finishing: Setting NRows ndx " << numNdx <<
" sqndx " << numSqndx <<
" adc " << numAdc << endm;
66 const int numberPadrows,
67 const int numberSectors,
69 const int numberTimebins)
74 LOG_WARN <<
"FtpcSequencer: ADC array does not exist, bailing out!" << endm;
77 if ((!ftpcndx)||(!ftpcsqndx)||(!ftpcadc)) {
78 LOG_WARN <<
"StFtpcSequencer: Output sequences missing, bailing out!" << endm;
95 Int_t minAboveLow = 2;
101 Int_t highReached = 0;
108 LOG_INFO <<
"FtpcSequencer using threshold high:" << thHigh <<
" and threshold low "<< thLow<<endm;
114 for (
int row=0; row<numberPadrows; row++) {
115 for (
int sec=0; sec<numberSectors; sec++) {
117 for (
int pad=0; pad<numberPads; pad++) {
120 for (
int bin=0; bin<numberTimebins; bin++) {
123 +numberTimebins*numberPads*sec
124 +numberTimebins*numberPads*numberSectors*row;
126 if((
int) cArray[i] < thLow) {
132 if((
int) cArray[i] >= thLow) {
136 for (
int t = bin; t < numberTimebins; t ++) {
139 +numberTimebins*numberPads*sec
140 +numberTimebins*numberPads*numberSectors*row;
141 if (cArray[s]>= thLow) nAboveLow++;
142 if (cArray[s]>= thHigh) highReached = 1;
143 if (highReached && (nAboveLow >= minAboveLow)) {
147 if (cArray[s]< thLow) {
157 if (!validSeq)
continue;
160 if(row>=10 && ndx[1].index==0) {
162 LOG_WARN <<
"ndx overflow!" << endm;
166 ndx[1].index=seqIndex;
171 if(seqFlag == 0 || pixelPerSeq == 32) {
173 if(pixelPerSeq > 0) {
175 sqndx[seqIndex++].index = (pixelPerSeq-1) + (startPixel<<6);
176 if(seqIndex >= maxSqndx) {
178 seqIndex=maxSqndx -1;
179 LOG_WARN <<
"sqndx overflow!" << endm;
193 sqndx[seqIndex-1].index += 32;
195 if(pad != lastPad+1) {
197 sqndx[seqIndex++].index = 32768 + pad + 256*(6*row + sec);
198 if(seqIndex >= maxSqndx) {
201 LOG_WARN <<
"sqndx overflow!" << endm;
209 adc[adcIndex++].data=(char) cArray[i];
210 if(adcIndex >= maxAdc) {
213 LOG_WARN <<
"adc overflow!" << endm;
228 if(pixelPerSeq > 0) {
230 sqndx[seqIndex++].index = (pixelPerSeq-1) + (startPixel<<6)+32;
238 LOG_WARN <<
"Error! No sequences filled!" << endm;
241 LOG_INFO <<
"FtpcSequencer done, getting table sizes: NRows ndx " << numNdx <<
" sqndx " << numSqndx <<
" adc " << numAdc << endm;
int writeArray(const int *cArray, const int numberPadrows, const int numberSectors, const int numberPads, const int numberTimebins)
writeArray method, fills zero-suppressed sequences from ADC array
~StFtpcSequencer()
destructor, sets size of sequence arrays
StFtpcSequencer(St_fcl_ftpcndx *ftpcndxIn, St_fcl_ftpcsqndx *ftpcsqndxIn, St_fcl_ftpcadc *ftpcadcIn)
constructor, checks the existence of output sequences