31 #include "StSequence.hh"
32 #include "StSvtClassLibrary/StSvtHybridData.hh"
33 #include "StSvtInverseProducts.hh"
36 StSvtInverseProducts::StSvtInverseProducts()
41 StSvtInverseProducts::~StSvtInverseProducts()
46 for(
int j = 0; j < MAX_ADC_COUNTS; j++)
47 mProbTable[j] = probValues->GetProbValue(j);
51 void StSvtInverseProducts::FindInvProducts(
StSvtHybridData* hybridData,
int anode,
int pedOffSet)
54 unsigned char* adcValue;
55 int mNumOfSequence,status;
56 int startTBin, length;
57 double mProdOfInvProb;
59 status = hybridData->getListSequences(anode,mNumOfSequence,mSequence);
61 for(
int mSeq = 0; mSeq < mNumOfSequence; mSeq++)
63 startTBin = mSequence[mSeq].startTimeBin;
64 length = mSequence[mSeq].length;
65 adcValue = mSequence[mSeq].firstAdc;
67 for(
int i = 0; i < length ; i++)
71 for(
int j = i - 1; j<= i+1; j++)
73 if(j == -1 || j == length)
76 k = (int)adcValue[j] - pedOffSet;
78 if( k >= 0 && k < (MAX_ADC_COUNTS-1)) mProdOfInvProb *= mProbTable[k];
79 else if(k >= -(MAX_ADC_COUNTS-1) && k < 0) mProdOfInvProb *= 1/(1 - 1/mProbTable[abs(k)]);
80 else if(k > (MAX_ADC_COUNTS-1) ) mProdOfInvProb *= mProbTable[MAX_ADC_COUNTS - 1];
81 else mProdOfInvProb *= 1/(1 - 1/mProbTable[MAX_ADC_COUNTS - 1]);
84 mBuffer[i + startTBin] = log10(mProdOfInvProb);
91 double StSvtInverseProducts::GetBuffer(
int timeBin)
93 return mBuffer[timeBin];
97 void StSvtInverseProducts::ResetBuffer()
99 for(
int mTBin = 0; mTBin <128; mTBin++)