68 #include "StSvtAnalysis.hh"
69 #include "StSvtAnalysedHybridClusters.hh"
70 #include "StDbUtilities/StSvtWaferCoordinate.hh"
71 #include "tables/St_scs_spt_Table.h"
73 StSvtAnalysedHybridClusters::StSvtAnalysedHybridClusters(
int barrel,
int ladder,
int wafer,
int hybrid):
StSvtHybridObject(barrel,ladder,wafer,hybrid)
76 mHardWarePosition = 0;
82 StSvtAnalysedHybridClusters::~StSvtAnalysedHybridClusters()
84 if (mSvtHitData)
delete [] mSvtHitData;
85 if (mSvtHit)
delete [] mSvtHit;
86 if (mPos)
delete [] mPos;
89 void StSvtAnalysedHybridClusters::setMembers(
int numOfClu,
int index)
96 mNumOfHits = numOfClu;
98 HitSize = ( numOfClu < 10) ? 10 : mNumOfHits;
99 mHardWarePosition = index;
100 assert( !mSvtHitData && !mSvtHit && !mPos);
112 void StSvtAnalysedHybridClusters::ReSize(){
114 int hitSize = mNumOfHits+10;
116 for (
int i=0; i<(mNumOfHits); i++) tmp[i] = mSvtHitData[i];
117 delete [] mSvtHitData;
121 for (
int i=0; i<(mNumOfHits); i++) tmp2[i] = mSvtHit[i];
126 for (
int i=0; i<(mNumOfHits-1); i++) tmp3[i] = mPos[i];
131 int StSvtAnalysedHybridClusters::setSvtHit(
StSvtAnalysis* mSvtAnalysis,
137 for(
int hit = 0;
hit < mNumOfHits;
hit++)
139 mSvtHitData[
hit].id = mSvtAnalysis->GetCluID(
hit);
140 mSvtHitData[
hit].id_cluster = mSvtAnalysis->GetCluDeconvID(
hit);
141 mSvtHitData[
hit].id_globtrk = 0;
142 mSvtHitData[
hit].id_track = 0;
143 mSvtHitData[
hit].id_match = 0;
146 mSvtHit[
hit].setFlag((
unsigned char)(mSvtAnalysis->GetCluFlag(
hit)));
147 mSvtHit[
hit].setHardwarePosition((
long)mHardWarePosition<<4);
148 mSvtHit[
hit].setCharge(mSvtAnalysis->GetCluCharge(
hit));
149 mSvtHit[
hit].setIdTruth(mSvtAnalysis->GetTruth(
hit));
152 mPos[
hit].setX((
float)mSvtAnalysis->GetMeanClusterTimeBin(
hit)+T0Jitter);
153 mPos[
hit].setY((
float)mSvtAnalysis->GetMeanClusterAnode(
hit));
156 mGlobalPos.setX(::sqrt(mSvtAnalysis->GetCluXCov(
hit)));
157 mGlobalPos.setY(::sqrt(mSvtAnalysis->GetCluYCov(
hit)));
158 mGlobalPos.setZ(0.0042);
160 mGlobalPos.setX(-9999.0);
161 mGlobalPos.setY(-9999.0);
162 mGlobalPos.setZ(-9999.0);
163 mSvtHit[
hit].setPosition(mGlobalPos);
166 mSvtHitData[
hit].peakAdc = mSvtAnalysis->GetCluPeakAdc(
hit);
167 mSvtHitData[
hit].numOfAnodesInClu = mSvtAnalysis->GetCluNumAnodes(
hit);
168 mSvtHitData[
hit].numOfPixelsInClu = mSvtAnalysis->GetCluNumPixels(
hit);
169 mSvtHitData[
hit].mom2[0] = mSvtAnalysis->GetSecondMomClusterTimeBin(
hit);
170 mSvtHitData[
hit].mom2[1] = mSvtAnalysis->GetSecondMomClusterAnode(
hit);
178 int StSvtAnalysedHybridClusters::setSvtHit(scs_spt_st* mSrsHit,
184 mSvtHitData[mNumOfHits].id = mSrsHit->id;
185 mSvtHitData[mNumOfHits].id_cluster = 0;
186 mSvtHitData[mNumOfHits].id_globtrk = 0;
187 mSvtHitData[mNumOfHits].id_track = 0;
188 mSvtHitData[mNumOfHits].id_match = 0;
191 mSvtHit[mNumOfHits].setFlag((
unsigned char)(mSrsHit->flag));
192 mSvtHit[mNumOfHits].setHardwarePosition(mHardWarePosition<<4);
193 mSvtHit[mNumOfHits].setCharge(mSrsHit->de[0]*300000);
194 mSvtHit[mNumOfHits].setIdTruth(mSrsHit->id_mctrack,100);
196 mPos[mNumOfHits].setX(WaferCoord->timebucket());
197 mPos[mNumOfHits].setY(WaferCoord->anode());
198 mPos[mNumOfHits].setZ(0.0);
200 mGlobalPos.setX(mSrsHit->x[0]);
201 mGlobalPos.setY(mSrsHit->x[1]);
202 mGlobalPos.setZ(mSrsHit->x[2]);
203 mSvtHit[mNumOfHits].setPosition(mGlobalPos);
206 mSvtHitData[mNumOfHits].peakAdc =(int) (mSvtHit[mNumOfHits].charge()/4.);
207 mSvtHitData[mNumOfHits].numOfAnodesInClu = 0;
208 mSvtHitData[mNumOfHits].numOfPixelsInClu = 0;
209 mSvtHitData[mNumOfHits].mom2[0] = mSrsHit->mom2[0];
210 mSvtHitData[mNumOfHits].mom2[1] = mSrsHit->mom2[1];