1 #include "StEvent/StEvent.h"
3 #include "StIstClusterMaker/StIstSimpleClusterAlgo.h"
4 #include "StIstUtil/StIstCollection.h"
5 #include "StIstUtil/StIstRawHitCollection.h"
6 #include "StIstUtil/StIstRawHit.h"
7 #include "StIstUtil/StIstClusterCollection.h"
8 #include "StIstUtil/StIstCluster.h"
9 #include "StIstUtil/StIstConsts.h"
26 unsigned char maxTb = UCHAR_MAX;
27 unsigned char ladder = 0, sensor = 0;
28 float meanRow = 0, meanColumn = 0;
29 float totCharge = 0., totChargeErr = 0.;
30 unsigned char clusterSize = 0;
unsigned char clusterSizeRPhi = 0;
31 unsigned char clusterSizeZ = 0;
32 unsigned char clusterType = kIstSimpleClusterAlgo;
34 float weightSplit = 0., weightSplit2 = 0., tmpSumChargeSplit = 0.;
38 rawHitPtr0 = rawHitPtr[0];
39 rawHitPtr1 = rawHitPtr[1];
40 rawHitPtr2 = rawHitPtr[2];
42 unsigned char tmpRawHitMaxTb0, tmpRawHitMaxTb1, tmpRawHitMaxTb2;
44 if (mTimeBin < numTimeBins) {
45 tmpRawHitMaxTb0 = tmpRawHitMaxTb1 = tmpRawHitMaxTb2 = mTimeBin;
48 tmpRawHitMaxTb0 = tmpRawHitMaxTb1 = tmpRawHitMaxTb2 = clusterIt->getMaxTimeBin();
51 float tmpRawHitMaxCharge0 = rawHitPtr0->getCharge(tmpRawHitMaxTb0);
52 float tmpRawHitMaxCharge1 = rawHitPtr1->getCharge(tmpRawHitMaxTb1);
53 float tmpRawHitMaxCharge2 = rawHitPtr2->getCharge(tmpRawHitMaxTb2);
56 tmpSumChargeSplit = tmpRawHitMaxCharge0 + tmpRawHitMaxCharge1 * tmpRawHitMaxCharge0 / (tmpRawHitMaxCharge0 + tmpRawHitMaxCharge2);
57 weightSplit = tmpRawHitMaxCharge0 / tmpSumChargeSplit;
59 clusterSize = clusterSizeList[0];
60 clusterSizeZ = clusterSizeList[1];
61 clusterSizeRPhi = clusterSizeList[2];
65 maxTb = tmpRawHitMaxTb0;
66 meanColumn = weightSplit * rawHitPtr0->
getColumn() + (1.0 - weightSplit) * rawHitPtr1->
getColumn();
67 meanRow = weightSplit * rawHitPtr0->
getRow() + (1.0 - weightSplit) * rawHitPtr1->
getRow();
68 totCharge = tmpSumChargeSplit;
69 totChargeErr = sqrt( (rawHitPtr0->getChargeErr(tmpRawHitMaxTb0) * rawHitPtr0->getChargeErr(tmpRawHitMaxTb0) + rawHitPtr1->getChargeErr(tmpRawHitMaxTb1) * rawHitPtr1->getChargeErr(tmpRawHitMaxTb1)) / clusterSize );
71 clusterIt->setLadder(ladder);
72 clusterIt->setSensor(sensor);
73 clusterIt->setMeanColumn(meanColumn);
74 clusterIt->setMeanRow(meanRow);
75 clusterIt->setTotCharge(totCharge);
76 clusterIt->setTotChargeErr(totChargeErr);
77 clusterIt->setNRawHits(clusterSize);
78 clusterIt->setNRawHitsRPhi(clusterSizeRPhi);
79 clusterIt->setNRawHitsZ(clusterSizeZ);
80 clusterIt->setMaxTimeBin(maxTb);
81 clusterIt->setClusteringType(clusterType);
83 std::vector< StIstRawHit * > &rawHitVecTmp = clusterIt->getRawHitVec();
84 std::vector< StIstRawHit * >::iterator rawHitIterator = rawHitVecTmp.end();
86 rawHitVecTmp.erase(rawHitIterator);
89 tmpSumChargeSplit = tmpRawHitMaxCharge2 + tmpRawHitMaxCharge1 * tmpRawHitMaxCharge2 / (tmpRawHitMaxCharge0 + tmpRawHitMaxCharge2);
90 weightSplit = tmpRawHitMaxCharge2 / tmpSumChargeSplit;
92 clusterSize = clusterSizeList[3];
93 clusterSizeZ = clusterSizeList[4];
94 clusterSizeRPhi = clusterSizeList[5];
98 maxTb = tmpRawHitMaxTb2;
99 meanColumn = weightSplit * rawHitPtr2->
getColumn() + (1.0 - weightSplit) * rawHitPtr1->
getColumn();
100 meanRow = weightSplit * rawHitPtr2->
getRow() + (1.0 - weightSplit) * rawHitPtr1->
getRow();
101 totCharge = tmpSumChargeSplit;
102 totChargeErr = sqrt( (rawHitPtr2->getChargeErr(tmpRawHitMaxTb2) * rawHitPtr2->getChargeErr(tmpRawHitMaxTb2) + rawHitPtr1->getChargeErr(tmpRawHitMaxTb1) * rawHitPtr1->getChargeErr(tmpRawHitMaxTb1)) / clusterSize );
104 newClusterTmp =
new StIstCluster((
int)ladder * 10000 + clusters.getClusterVec().size(), ladder, sensor, meanRow, meanColumn, totCharge, totChargeErr, clusterType);
105 newClusterTmp->setNRawHits(clusterSize);
106 newClusterTmp->setNRawHitsRPhi(clusterSizeRPhi);
107 newClusterTmp->setNRawHitsZ(clusterSizeZ);
108 newClusterTmp->setMaxTimeBin(maxTb);
110 std::vector< StIstRawHit * > &rawHitVecTmp2 = newClusterTmp->getRawHitVec();
111 rawHitVecTmp2.push_back(rawHitPtr1);
112 rawHitVecTmp2.push_back(rawHitPtr2);
114 clusters.getClusterVec().push_back(newClusterTmp);
119 rawHitPtr0 = rawHitPtr[0];
120 rawHitPtr1 = rawHitPtr[1];
121 rawHitPtr2 = rawHitPtr[2];
122 rawHitPtr3 = rawHitPtr[3];
124 unsigned char tmpRawHitMaxTb0, tmpRawHitMaxTb1, tmpRawHitMaxTb2, tmpRawHitMaxTb3;
126 if (mTimeBin < numTimeBins) {
127 tmpRawHitMaxTb0 = tmpRawHitMaxTb1 = tmpRawHitMaxTb2 = tmpRawHitMaxTb3 = mTimeBin;
130 tmpRawHitMaxTb0 = tmpRawHitMaxTb1 = tmpRawHitMaxTb2 = tmpRawHitMaxTb3 = clusterIt->getMaxTimeBin();
133 float tmpRawHitMaxCharge0 = rawHitPtr0->getCharge(tmpRawHitMaxTb0);
134 float tmpRawHitMaxCharge1 = rawHitPtr1->getCharge(tmpRawHitMaxTb1);
135 float tmpRawHitMaxCharge2 = rawHitPtr2->getCharge(tmpRawHitMaxTb2);
136 float tmpRawHitMaxCharge3 = rawHitPtr3->getCharge(tmpRawHitMaxTb3);
139 tmpSumChargeSplit = tmpRawHitMaxCharge0 + tmpRawHitMaxCharge1 * tmpRawHitMaxCharge0 / (tmpRawHitMaxCharge0 + tmpRawHitMaxCharge2 + tmpRawHitMaxCharge3);
140 weightSplit = tmpRawHitMaxCharge0 / tmpSumChargeSplit;
142 clusterSize = clusterSizeList[0];
143 clusterSizeZ = clusterSizeList[1];
144 clusterSizeRPhi = clusterSizeList[2];
148 maxTb = tmpRawHitMaxTb0;
149 meanColumn = weightSplit * rawHitPtr0->
getColumn() + (1.0 - weightSplit) * rawHitPtr1->
getColumn();
150 meanRow = weightSplit * rawHitPtr0->
getRow() + (1.0 - weightSplit) * rawHitPtr1->
getRow();
151 totCharge = tmpSumChargeSplit;
152 totChargeErr = sqrt( (rawHitPtr0->getChargeErr(tmpRawHitMaxTb0) * rawHitPtr0->getChargeErr(tmpRawHitMaxTb0) + rawHitPtr1->getChargeErr(tmpRawHitMaxTb1) * rawHitPtr1->getChargeErr(tmpRawHitMaxTb1)) / clusterSize );
154 clusterIt->setLadder(ladder);
155 clusterIt->setSensor(sensor);
156 clusterIt->setMeanColumn(meanColumn);
157 clusterIt->setMeanRow(meanRow);
158 clusterIt->setTotCharge(totCharge);
159 clusterIt->setTotChargeErr(totChargeErr);
160 clusterIt->setNRawHits(clusterSize);
161 clusterIt->setNRawHitsRPhi(clusterSizeRPhi);
162 clusterIt->setNRawHitsZ(clusterSizeZ);
163 clusterIt->setMaxTimeBin(maxTb);
164 clusterIt->setClusteringType(clusterType);
166 std::vector< StIstRawHit * > &rawHitVecTmp3 = clusterIt->getRawHitVec();
167 std::vector< StIstRawHit * >::iterator rawHitIterator = rawHitVecTmp3.end();
169 rawHitVecTmp3.erase(rawHitIterator);
171 rawHitVecTmp3.erase(rawHitIterator);
174 tmpSumChargeSplit = tmpRawHitMaxCharge2 + tmpRawHitMaxCharge3 + tmpRawHitMaxCharge1 * (tmpRawHitMaxCharge2 + tmpRawHitMaxCharge3) / (tmpRawHitMaxCharge0 + tmpRawHitMaxCharge2 + tmpRawHitMaxCharge3);
175 weightSplit = tmpRawHitMaxCharge2 / tmpSumChargeSplit;
176 weightSplit2 = tmpRawHitMaxCharge3 / tmpSumChargeSplit;
178 clusterSize = clusterSizeList[3];
179 clusterSizeZ = clusterSizeList[4];
180 clusterSizeRPhi = clusterSizeList[5];
184 maxTb = tmpRawHitMaxTb2;
185 meanColumn = weightSplit * rawHitPtr2->
getColumn() + weightSplit2 * rawHitPtr3->
getColumn() + (1.0 - weightSplit - weightSplit2) * rawHitPtr1->
getColumn();
186 meanRow = weightSplit * rawHitPtr2->
getRow() + weightSplit2 * rawHitPtr3->
getRow() + (1.0 - weightSplit - weightSplit2) * rawHitPtr1->
getRow();
187 totCharge = tmpSumChargeSplit;
188 totChargeErr = sqrt( (rawHitPtr3->getChargeErr(tmpRawHitMaxTb3) * rawHitPtr3->getChargeErr(tmpRawHitMaxTb3) + rawHitPtr2->getChargeErr(tmpRawHitMaxTb2) * rawHitPtr2->getChargeErr(tmpRawHitMaxTb2) + rawHitPtr1->getChargeErr(tmpRawHitMaxTb1) * rawHitPtr1->getChargeErr(tmpRawHitMaxTb1)) / clusterSize );
190 newClusterTmp =
new StIstCluster((
int)ladder * 10000 + clusters.getClusterVec().size(), ladder, sensor, meanRow, meanColumn, totCharge, totChargeErr, clusterType);
191 newClusterTmp->setNRawHits(clusterSize);
192 newClusterTmp->setNRawHitsRPhi(clusterSizeRPhi);
193 newClusterTmp->setNRawHitsZ(clusterSizeZ);
194 newClusterTmp->setMaxTimeBin(maxTb);
196 std::vector< StIstRawHit * > &rawHitVecTmp4 = newClusterTmp->getRawHitVec();
197 rawHitVecTmp4.push_back(rawHitPtr1);
198 rawHitVecTmp4.push_back(rawHitPtr2);
199 rawHitVecTmp4.push_back(rawHitPtr3);
201 clusters.getClusterVec().push_back(newClusterTmp);
210 for (std::vector< StIstCluster * >::iterator clusterIt = clusters.getClusterVec().begin(); clusterIt != clusters.getClusterVec().end(); clusterIt++) {
212 unsigned char tmpRawHitMaxTb[] = {0, 0, 0, 0};
213 float tmpRawHitMaxCharge[] = {0., 0., 0., 0.};
214 int tmpClusterSizeList[] = {1, 1, 1, 1, 1, 1};
217 if ( (*clusterIt)->getNRawHits() == 3 ) {
218 tmpClusterSizeList[0] = 2; tmpClusterSizeList[3] = 2;
221 for (std::vector< StIstRawHit * >::iterator rawHitVecIt = (*clusterIt)->getRawHitVec().begin(); index < 3 && rawHitVecIt != (*clusterIt)->getRawHitVec().end(); rawHitVecIt++) {
222 rawHitPtr[index] = *rawHitVecIt;
224 if (mTimeBin < numTimeBins) {
225 tmpRawHitMaxTb[index] = mTimeBin;
228 tmpRawHitMaxTb[index] = (*clusterIt)->getMaxTimeBin();
231 tmpRawHitMaxCharge[index] = rawHitPtr[index]->getCharge(tmpRawHitMaxTb[index]);
238 if ( ((*clusterIt)->getNRawHitsZ() == 3) || ((*clusterIt)->getNRawHitsRPhi() == 3) ||
239 (((*clusterIt)->getNRawHitsZ() == 2) && ((*clusterIt)->getNRawHitsRPhi() == 2) && (rawHitPtr[0]->getColumn() == rawHitPtr[2]->
getColumn() - 1) && (rawHitPtr[0]->getRow() == rawHitPtr[2]->
getRow() - 1)) ) {
240 if ( (tmpRawHitMaxCharge[1] <= tmpRawHitMaxCharge[0]) && (tmpRawHitMaxCharge[1] <= tmpRawHitMaxCharge[2]) ) {
241 if ( (*clusterIt)->getNRawHitsZ() == 3 ) {
242 tmpClusterSizeList[1] = 2; tmpClusterSizeList[2] = 1; tmpClusterSizeList[4] = 2; tmpClusterSizeList[5] = 1;
244 else if ( (*clusterIt)->getNRawHitsRPhi() == 3 ) {
245 tmpClusterSizeList[1] = 1; tmpClusterSizeList[2] = 2; tmpClusterSizeList[4] = 1; tmpClusterSizeList[5] = 2;
247 else if ( ((*clusterIt)->getNRawHitsZ() == 2) && (rawHitPtr[0]->getColumn() == rawHitPtr[1]->
getColumn()) ) {
248 tmpClusterSizeList[1] = 1; tmpClusterSizeList[2] = 2; tmpClusterSizeList[4] = 2; tmpClusterSizeList[5] = 1;
251 tmpClusterSizeList[1] = 2; tmpClusterSizeList[2] = 1; tmpClusterSizeList[4] = 1; tmpClusterSizeList[5] = 2;
254 Int_t split3_4_ierr = splitCluster(3, tmpClusterSizeList, rawHitPtr, *clusterIt, clusters, numTimeBins);
256 if (split3_4_ierr !=
kStOk)
257 LOG_WARN <<
"Cluster (ladder/sensor/meanColumn/meanRow: " << (*clusterIt)->getLadder() <<
"/" << (*clusterIt)->getSensor() <<
"/" << (*clusterIt)->getMeanColumn() <<
"/" << (*clusterIt)->getMeanRow() <<
") splitting failed! returned " << split3_4_ierr << endm;
263 else if ( ((*clusterIt)->getNRawHitsZ() == 2) && (rawHitPtr[0]->getColumn() == rawHitPtr[2]->
getColumn() - 1) && (rawHitPtr[0]->getRow() == rawHitPtr[2]->
getRow()) ) {
265 if ( (rawHitPtr[1]->getColumn() == rawHitPtr[2]->
getColumn()) && (tmpRawHitMaxCharge[2] <= tmpRawHitMaxCharge[0]) && (tmpRawHitMaxCharge[2] <= tmpRawHitMaxCharge[1]) ) {
266 tmpClusterSizeList[1] = 2; tmpClusterSizeList[2] = 1; tmpClusterSizeList[4] = 1; tmpClusterSizeList[5] = 2;
268 rawHitPtr[3] = rawHitPtr[2];
269 rawHitPtr[2] = rawHitPtr[1];
270 rawHitPtr[1] = rawHitPtr[3];
273 Int_t split3_5_ierr = splitCluster(3, tmpClusterSizeList, rawHitPtr, *clusterIt, clusters, numTimeBins);
275 if (split3_5_ierr !=
kStOk)
276 LOG_WARN <<
"Cluster (ladder/sensor/meanColumn/meanRow: " << (*clusterIt)->getLadder() <<
"/" << (*clusterIt)->getSensor() <<
"/" << (*clusterIt)->getMeanColumn() <<
"/" << (*clusterIt)->getMeanRow() <<
") splitting failed! returned " << split3_5_ierr << endm;
280 if ( (rawHitPtr[0]->getColumn() == rawHitPtr[1]->getColumn()) && (tmpRawHitMaxCharge[0] <= tmpRawHitMaxCharge[1]) && (tmpRawHitMaxCharge[0] <= tmpRawHitMaxCharge[2]) ) {
281 tmpClusterSizeList[1] = 1; tmpClusterSizeList[2] = 2; tmpClusterSizeList[4] = 2; tmpClusterSizeList[5] = 1;
283 rawHitPtr[3] = rawHitPtr[0];
284 rawHitPtr[0] = rawHitPtr[1];
285 rawHitPtr[1] = rawHitPtr[3];
288 Int_t split3_6_ierr = splitCluster(3, tmpClusterSizeList, rawHitPtr, *clusterIt, clusters, numTimeBins);
290 if (split3_6_ierr !=
kStOk)
291 LOG_WARN <<
"Cluster (ladder/sensor/meanColumn/meanRow: " << (*clusterIt)->getLadder() <<
"/" << (*clusterIt)->getSensor() <<
"/" << (*clusterIt)->getMeanColumn() <<
"/" << (*clusterIt)->getMeanRow() <<
") splitting failed! returned " << split3_6_ierr << endm;
297 if ( (*clusterIt)->getNRawHits() == 4 ) {
298 tmpClusterSizeList[0] = 2; tmpClusterSizeList[3] = 3;
301 for (std::vector< StIstRawHit * >::iterator rawHitVecIt = (*clusterIt)->getRawHitVec().begin(); index < 4 && rawHitVecIt != (*clusterIt)->getRawHitVec().end(); rawHitVecIt++) {
302 rawHitPtr[index] = *rawHitVecIt;
304 if (mTimeBin < numTimeBins) {
305 tmpRawHitMaxTb[index] = mTimeBin;
308 tmpRawHitMaxTb[index] = (*clusterIt)->getMaxTimeBin();
311 tmpRawHitMaxCharge[index] = rawHitPtr[index]->getCharge(tmpRawHitMaxTb[index]);
319 if ( ((*clusterIt)->getNRawHitsZ() == 4) ||
320 ((*clusterIt)->getNRawHitsRPhi() == 4) ||
321 (((*clusterIt)->getNRawHitsZ() == 3) && (rawHitPtr[1]->getColumn() == rawHitPtr[0]->
getColumn()) && (rawHitPtr[1]->getRow() == rawHitPtr[0]->
getRow() + 1) && (rawHitPtr[2]->getRow() == rawHitPtr[1]->
getRow()) && (rawHitPtr[3]->getRow() == rawHitPtr[2]->
getRow())) ||
322 (((*clusterIt)->getNRawHitsZ() == 3) && (rawHitPtr[3]->getColumn() == rawHitPtr[2]->
getColumn()) && (rawHitPtr[3]->getRow() == rawHitPtr[2]->
getRow() + 1) && (rawHitPtr[1]->getRow() == rawHitPtr[0]->
getRow()) && (rawHitPtr[2]->getRow() == rawHitPtr[1]->
getRow())) ||
323 (((*clusterIt)->getNRawHitsRPhi() == 3) && (rawHitPtr[3]->getColumn() == rawHitPtr[2]->
getColumn() + 1) && (rawHitPtr[3]->getRow() == rawHitPtr[2]->
getRow()) && (rawHitPtr[1]->getColumn() == rawHitPtr[0]->
getColumn()) && (rawHitPtr[2]->getColumn() == rawHitPtr[1]->
getColumn())) ||
324 (((*clusterIt)->getNRawHitsRPhi() == 3) && (rawHitPtr[1]->getColumn() == rawHitPtr[0]->
getColumn() + 1) && (rawHitPtr[1]->getRow() == rawHitPtr[0]->
getRow()) && (rawHitPtr[2]->getColumn() == rawHitPtr[1]->
getColumn()) && (rawHitPtr[3]->getColumn() == rawHitPtr[2]->
getColumn())) ||
325 (((*clusterIt)->getNRawHitsZ() == 3) && (rawHitPtr[1]->getColumn() == rawHitPtr[2]->
getColumn()) && (rawHitPtr[2]->getRow() == rawHitPtr[1]->
getRow() + 1) && (rawHitPtr[1]->getRow() == rawHitPtr[0]->
getRow()) && (rawHitPtr[3]->getRow() == rawHitPtr[2]->
getRow())) ||
326 (((*clusterIt)->getNRawHitsRPhi() == 3) && (rawHitPtr[1]->getRow() == rawHitPtr[2]->
getRow()) && (rawHitPtr[2]->getColumn() == rawHitPtr[1]->
getColumn() + 1) && (rawHitPtr[1]->getColumn() == rawHitPtr[0]->
getColumn()) && (rawHitPtr[3]->getColumn() == rawHitPtr[2]->
getColumn())) ) {
328 if ( (tmpRawHitMaxCharge[1] <= tmpRawHitMaxCharge[0]) && (tmpRawHitMaxCharge[1] <= tmpRawHitMaxCharge[2]) && (tmpRawHitMaxCharge[1] <= tmpRawHitMaxCharge[3]) ) {
330 if ( (*clusterIt)->getNRawHitsZ() == 4 ) {
331 tmpClusterSizeList[1] = 2; tmpClusterSizeList[2] = 1; tmpClusterSizeList[4] = 3; tmpClusterSizeList[5] = 1;
333 else if ( (*clusterIt)->getNRawHitsRPhi() == 4 ) {
334 tmpClusterSizeList[1] = 1; tmpClusterSizeList[2] = 2; tmpClusterSizeList[4] = 1; tmpClusterSizeList[5] = 3;
336 else if ( ((*clusterIt)->getNRawHitsZ() == 3) && (rawHitPtr[1]->getColumn() == rawHitPtr[0]->
getColumn()) && (rawHitPtr[1]->getRow() == rawHitPtr[0]->
getRow() + 1) && (rawHitPtr[2]->getRow() == rawHitPtr[1]->
getRow()) && (rawHitPtr[3]->getRow() == rawHitPtr[2]->
getRow()) ) {
337 tmpClusterSizeList[1] = 1; tmpClusterSizeList[2] = 2; tmpClusterSizeList[4] = 3; tmpClusterSizeList[5] = 1;
339 else if ( ((*clusterIt)->getNRawHitsZ() == 3) && (rawHitPtr[3]->getColumn() == rawHitPtr[2]->
getColumn()) && (rawHitPtr[3]->getRow() == rawHitPtr[2]->
getRow() + 1) && (rawHitPtr[1]->getRow() == rawHitPtr[0]->
getRow()) && (rawHitPtr[2]->getRow() == rawHitPtr[1]->
getRow()) ) {
340 tmpClusterSizeList[1] = 2; tmpClusterSizeList[2] = 1; tmpClusterSizeList[4] = 2; tmpClusterSizeList[5] = 2;
342 else if ( ((*clusterIt)->getNRawHitsRPhi() == 3) && (rawHitPtr[3]->getColumn() == rawHitPtr[2]->
getColumn() + 1) && (rawHitPtr[3]->getRow() == rawHitPtr[2]->
getRow()) && (rawHitPtr[1]->getColumn() == rawHitPtr[0]->
getColumn()) && (rawHitPtr[2]->getColumn() == rawHitPtr[1]->
getColumn()) ) {
343 tmpClusterSizeList[1] = 1; tmpClusterSizeList[2] = 2; tmpClusterSizeList[4] = 2; tmpClusterSizeList[5] = 2;
345 else if ( ((*clusterIt)->getNRawHitsRPhi() == 3) && (rawHitPtr[1]->getColumn() == rawHitPtr[0]->
getColumn() + 1) && (rawHitPtr[1]->getRow() == rawHitPtr[0]->
getRow()) && (rawHitPtr[2]->getColumn() == rawHitPtr[1]->
getColumn()) && (rawHitPtr[3]->getColumn() == rawHitPtr[2]->
getColumn()) ) {
346 tmpClusterSizeList[1] = 2; tmpClusterSizeList[2] = 1; tmpClusterSizeList[4] = 1; tmpClusterSizeList[5] = 3;
348 else if ( ((*clusterIt)->getNRawHitsZ() == 3) && (rawHitPtr[1]->getColumn() == rawHitPtr[2]->
getColumn()) && (rawHitPtr[2]->getRow() == rawHitPtr[1]->
getRow() + 1) && (rawHitPtr[1]->getRow() == rawHitPtr[0]->
getRow()) && (rawHitPtr[3]->getRow() == rawHitPtr[2]->
getRow()) ) {
349 tmpClusterSizeList[1] = 2; tmpClusterSizeList[2] = 1; tmpClusterSizeList[4] = 2; tmpClusterSizeList[5] = 2;
352 tmpClusterSizeList[1] = 1; tmpClusterSizeList[2] = 2; tmpClusterSizeList[4] = 2; tmpClusterSizeList[5] = 2;
355 Int_t split4_8_ierr = splitCluster(4, tmpClusterSizeList, rawHitPtr, *clusterIt, clusters, numTimeBins);
357 if (split4_8_ierr !=
kStOk)
358 LOG_WARN <<
"Cluster (ladder/sensor/meanColumn/meanRow: " << (*clusterIt)->getLadder() <<
"/" << (*clusterIt)->getSensor() <<
"/" << (*clusterIt)->getMeanColumn() <<
"/" << (*clusterIt)->getMeanRow() <<
") splitting failed! returned " << split4_8_ierr << endm;
362 if ( (tmpRawHitMaxCharge[2] <= tmpRawHitMaxCharge[0]) && (tmpRawHitMaxCharge[2] <= tmpRawHitMaxCharge[1]) && (tmpRawHitMaxCharge[2] <= tmpRawHitMaxCharge[3]) ) {
365 rawHitPtrTmp = rawHitPtr[0];
366 rawHitPtr[0] = rawHitPtr[3];
367 rawHitPtr[3] = rawHitPtrTmp;
368 rawHitPtrTmp = rawHitPtr[2];
369 rawHitPtr[2] = rawHitPtr[1];
370 rawHitPtr[1] = rawHitPtrTmp;
372 if ( (*clusterIt)->getNRawHitsZ() == 4 )
373 { tmpClusterSizeList[1] = 2; tmpClusterSizeList[2] = 1; tmpClusterSizeList[4] = 3; tmpClusterSizeList[5] = 1; }
374 else if ( (*clusterIt)->getNRawHitsRPhi() == 4 )
375 { tmpClusterSizeList[1] = 1; tmpClusterSizeList[2] = 2; tmpClusterSizeList[4] = 1; tmpClusterSizeList[5] = 3; }
376 else if ( ((*clusterIt)->getNRawHitsZ() == 3) && (rawHitPtr[1]->getColumn() == rawHitPtr[0]->
getColumn()) && (rawHitPtr[1]->getRow() == rawHitPtr[0]->
getRow() + 1) && (rawHitPtr[2]->getRow() == rawHitPtr[1]->
getRow()) && (rawHitPtr[3]->getRow() == rawHitPtr[2]->
getRow()) )
377 { tmpClusterSizeList[1] = 2; tmpClusterSizeList[2] = 1; tmpClusterSizeList[4] = 2; tmpClusterSizeList[5] = 2; }
378 else if ( ((*clusterIt)->getNRawHitsZ() == 3) && (rawHitPtr[3]->getColumn() == rawHitPtr[2]->
getColumn()) && (rawHitPtr[3]->getRow() == rawHitPtr[2]->
getRow() + 1) && (rawHitPtr[1]->getRow() == rawHitPtr[0]->
getRow()) && (rawHitPtr[2]->getRow() == rawHitPtr[1]->
getRow()) )
379 { tmpClusterSizeList[1] = 1; tmpClusterSizeList[2] = 2; tmpClusterSizeList[4] = 3; tmpClusterSizeList[5] = 1; }
380 else if ( ((*clusterIt)->getNRawHitsRPhi() == 3) && (rawHitPtr[3]->getColumn() == rawHitPtr[2]->
getColumn() + 1) && (rawHitPtr[3]->getRow() == rawHitPtr[2]->
getRow()) && (rawHitPtr[1]->getColumn() == rawHitPtr[0]->
getColumn()) && (rawHitPtr[2]->getColumn() == rawHitPtr[1]->
getColumn()) )
381 { tmpClusterSizeList[1] = 2; tmpClusterSizeList[2] = 1; tmpClusterSizeList[4] = 1; tmpClusterSizeList[5] = 3; }
382 else if ( ((*clusterIt)->getNRawHitsRPhi() == 3) && (rawHitPtr[1]->getColumn() == rawHitPtr[0]->
getColumn() + 1) && (rawHitPtr[1]->getRow() == rawHitPtr[0]->
getRow()) && (rawHitPtr[2]->getColumn() == rawHitPtr[1]->
getColumn()) && (rawHitPtr[3]->getColumn() == rawHitPtr[2]->
getColumn()) )
383 { tmpClusterSizeList[1] = 1; tmpClusterSizeList[2] = 2; tmpClusterSizeList[4] = 2; tmpClusterSizeList[5] = 2; }
384 else if ( ((*clusterIt)->getNRawHitsZ() == 3) && (rawHitPtr[1]->getColumn() == rawHitPtr[2]->
getColumn()) && (rawHitPtr[2]->getRow() == rawHitPtr[1]->
getRow() + 1) && (rawHitPtr[1]->getRow() == rawHitPtr[0]->
getRow()) && (rawHitPtr[3]->getRow() == rawHitPtr[2]->
getRow()) )
385 { tmpClusterSizeList[1] = 2; tmpClusterSizeList[2] = 1; tmpClusterSizeList[4] = 2; tmpClusterSizeList[5] = 2; }
387 { tmpClusterSizeList[1] = 1; tmpClusterSizeList[2] = 2; tmpClusterSizeList[4] = 2; tmpClusterSizeList[5] = 2; }
389 Int_t split4_8_ierr = splitCluster(4, tmpClusterSizeList, rawHitPtr, *clusterIt, clusters, numTimeBins);
391 if (split4_8_ierr !=
kStOk)
392 LOG_WARN <<
"Cluster (ladder/sensor/meanColumn/meanRow: " << (*clusterIt)->getLadder() <<
"/" << (*clusterIt)->getSensor() <<
"/" << (*clusterIt)->getMeanColumn() <<
"/" << (*clusterIt)->getMeanRow() <<
") splitting failed! returned " << split4_8_ierr << endm;
398 else if ( (((*clusterIt)->getNRawHitsZ() == 3) && (rawHitPtr[3]->getColumn() == rawHitPtr[2]->
getColumn()) && (rawHitPtr[3]->getRow() == rawHitPtr[2]->
getRow() + 1) && (rawHitPtr[3]->getRow() == rawHitPtr[1]->
getRow()) && (rawHitPtr[1]->getRow() == rawHitPtr[0]->
getRow())) ) {
400 if ( (tmpRawHitMaxCharge[1] <= tmpRawHitMaxCharge[0]) && (tmpRawHitMaxCharge[1] <= tmpRawHitMaxCharge[2]) && (tmpRawHitMaxCharge[1] <= tmpRawHitMaxCharge[3]) ) {
401 tmpClusterSizeList[1] = 2; tmpClusterSizeList[2] = 1; tmpClusterSizeList[4] = 2; tmpClusterSizeList[5] = 2;
404 rawHitPtrTmp = rawHitPtr[3];
405 rawHitPtr[3] = rawHitPtr[2];
406 rawHitPtr[2] = rawHitPtrTmp;
408 Int_t split4_9_ierr = splitCluster(4, tmpClusterSizeList, rawHitPtr, *clusterIt, clusters, numTimeBins);
410 if (split4_9_ierr !=
kStOk)
411 LOG_WARN <<
"Cluster (ladder/sensor/meanColumn/meanRow: " << (*clusterIt)->getLadder() <<
"/" << (*clusterIt)->getSensor() <<
"/" << (*clusterIt)->getMeanColumn() <<
"/" << (*clusterIt)->getMeanRow() <<
") splitting failed! returned " << split4_9_ierr << endm;
415 if ( (tmpRawHitMaxCharge[3] <= tmpRawHitMaxCharge[0]) && (tmpRawHitMaxCharge[3] <= tmpRawHitMaxCharge[1]) && (tmpRawHitMaxCharge[3] <= tmpRawHitMaxCharge[2]) ) {
416 tmpClusterSizeList[1] = 1; tmpClusterSizeList[2] = 2; tmpClusterSizeList[4] = 3; tmpClusterSizeList[5] = 1;
419 rawHitPtrTmp = rawHitPtr[0];
420 rawHitPtr[0] = rawHitPtr[2];
421 rawHitPtr[2] = rawHitPtr[1];
422 rawHitPtr[1] = rawHitPtr[3];
423 rawHitPtr[3] = rawHitPtrTmp;
425 Int_t split4_9_ierr = splitCluster(4, tmpClusterSizeList, rawHitPtr, *clusterIt, clusters, numTimeBins);
427 if (split4_9_ierr !=
kStOk)
428 LOG_WARN <<
"Cluster (ladder/sensor/meanColumn/meanRow: " << (*clusterIt)->getLadder() <<
"/" << (*clusterIt)->getSensor() <<
"/" << (*clusterIt)->getMeanColumn() <<
"/" << (*clusterIt)->getMeanRow() <<
") splitting failed! returned " << split4_9_ierr << endm;
434 else if ( (((*clusterIt)->getNRawHitsZ() == 3) && (rawHitPtr[1]->getColumn() == rawHitPtr[0]->
getColumn()) && (rawHitPtr[1]->getRow() == rawHitPtr[0]->
getRow() + 1) && (rawHitPtr[3]->getRow() == rawHitPtr[2]->
getRow()) && (rawHitPtr[2]->getRow() == rawHitPtr[0]->
getRow())) ) {
436 if ( (tmpRawHitMaxCharge[0] <= tmpRawHitMaxCharge[1]) && (tmpRawHitMaxCharge[0] <= tmpRawHitMaxCharge[2]) && (tmpRawHitMaxCharge[0] <= tmpRawHitMaxCharge[3]) ) {
437 tmpClusterSizeList[1] = 1; tmpClusterSizeList[2] = 2; tmpClusterSizeList[4] = 3; tmpClusterSizeList[5] = 1;
440 rawHitPtrTmp = rawHitPtr[0];
441 rawHitPtr[0] = rawHitPtr[1];
442 rawHitPtr[1] = rawHitPtrTmp;
444 Int_t split4_10_ierr = splitCluster(4, tmpClusterSizeList, rawHitPtr, *clusterIt, clusters, numTimeBins);
446 if (split4_10_ierr !=
kStOk)
447 LOG_WARN <<
"Cluster (ladder/sensor/meanColumn/meanRow: " << (*clusterIt)->getLadder() <<
"/" << (*clusterIt)->getSensor() <<
"/" << (*clusterIt)->getMeanColumn() <<
"/" << (*clusterIt)->getMeanRow() <<
") splitting failed! returned " << split4_10_ierr << endm;
451 if ( (tmpRawHitMaxCharge[2] <= tmpRawHitMaxCharge[0]) && (tmpRawHitMaxCharge[2] <= tmpRawHitMaxCharge[1]) && (tmpRawHitMaxCharge[2] <= tmpRawHitMaxCharge[3]) ) {
452 tmpClusterSizeList[1] = 2; tmpClusterSizeList[2] = 1; tmpClusterSizeList[4] = 2; tmpClusterSizeList[5] = 2;
455 rawHitPtrTmp = rawHitPtr[0];
456 rawHitPtr[0] = rawHitPtr[3];
457 rawHitPtr[3] = rawHitPtr[1];
458 rawHitPtr[1] = rawHitPtr[2];
459 rawHitPtr[2] = rawHitPtrTmp;
461 Int_t split4_10_ierr = splitCluster(4, tmpClusterSizeList, rawHitPtr, *clusterIt, clusters, numTimeBins);
463 if (split4_10_ierr !=
kStOk)
464 LOG_WARN <<
"Cluster (ladder/sensor/meanColumn/meanRow: " << (*clusterIt)->getLadder() <<
"/" << (*clusterIt)->getSensor() <<
"/" << (*clusterIt)->getMeanColumn() <<
"/" << (*clusterIt)->getMeanRow() <<
") splitting failed! returned " << split4_10_ierr << endm;
471 else if ( (((*clusterIt)->getNRawHitsRPhi() == 3) && (rawHitPtr[3]->getColumn() == rawHitPtr[0]->
getColumn() + 1) && (rawHitPtr[3]->getRow() == rawHitPtr[0]->
getRow()) && (rawHitPtr[2]->getColumn() == rawHitPtr[1]->
getColumn()) && (rawHitPtr[1]->getColumn() == rawHitPtr[0]->
getColumn())) ) {
473 if ( (tmpRawHitMaxCharge[0] <= tmpRawHitMaxCharge[1]) && (tmpRawHitMaxCharge[0] <= tmpRawHitMaxCharge[2]) && (tmpRawHitMaxCharge[0] <= tmpRawHitMaxCharge[3]) ) {
474 tmpClusterSizeList[1] = 2; tmpClusterSizeList[2] = 1; tmpClusterSizeList[4] = 1; tmpClusterSizeList[5] = 3;
477 rawHitPtrTmp = rawHitPtr[0];
478 rawHitPtr[0] = rawHitPtr[3];
479 rawHitPtr[3] = rawHitPtr[2];
480 rawHitPtr[2] = rawHitPtr[1];
481 rawHitPtr[1] = rawHitPtrTmp;
483 Int_t split4_11_ierr = splitCluster(4, tmpClusterSizeList, rawHitPtr, *clusterIt, clusters, numTimeBins);
485 if (split4_11_ierr !=
kStOk)
486 LOG_WARN <<
"Cluster (ladder/sensor/meanColumn/meanRow: " << (*clusterIt)->getLadder() <<
"/" << (*clusterIt)->getSensor() <<
"/" << (*clusterIt)->getMeanColumn() <<
"/" << (*clusterIt)->getMeanRow() <<
") splitting failed! returned " << split4_11_ierr << endm;
490 if ( (tmpRawHitMaxCharge[1] <= tmpRawHitMaxCharge[0]) && (tmpRawHitMaxCharge[1] <= tmpRawHitMaxCharge[2]) && (tmpRawHitMaxCharge[1] <= tmpRawHitMaxCharge[3]) ) {
491 tmpClusterSizeList[1] = 1; tmpClusterSizeList[2] = 2; tmpClusterSizeList[4] = 2; tmpClusterSizeList[5] = 2;
494 rawHitPtrTmp = rawHitPtr[0];
495 rawHitPtr[0] = rawHitPtr[2];
496 rawHitPtr[2] = rawHitPtrTmp;
498 Int_t split4_11_ierr = splitCluster(4, tmpClusterSizeList, rawHitPtr, *clusterIt, clusters, numTimeBins);
500 if (split4_11_ierr !=
kStOk)
501 LOG_WARN <<
"Cluster (ladder/sensor/meanColumn/meanRow: " << (*clusterIt)->getLadder() <<
"/" << (*clusterIt)->getSensor() <<
"/" << (*clusterIt)->getMeanColumn() <<
"/" << (*clusterIt)->getMeanRow() <<
") splitting failed! returned " << split4_11_ierr << endm;
508 else if ( (((*clusterIt)->getNRawHitsRPhi() == 3) && (rawHitPtr[3]->getRow() == rawHitPtr[0]->
getRow()) && (rawHitPtr[3]->getColumn() == rawHitPtr[0]->
getColumn() + 1) && (rawHitPtr[3]->getColumn() == rawHitPtr[2]->
getColumn()) && (rawHitPtr[2]->getColumn() == rawHitPtr[1]->
getColumn())) ) {
510 if ( (tmpRawHitMaxCharge[3] <= tmpRawHitMaxCharge[0]) && (tmpRawHitMaxCharge[3] <= tmpRawHitMaxCharge[1]) && (tmpRawHitMaxCharge[3] <= tmpRawHitMaxCharge[2]) ) {
511 tmpClusterSizeList[1] = 2; tmpClusterSizeList[2] = 1; tmpClusterSizeList[4] = 1; tmpClusterSizeList[5] = 3;
514 rawHitPtrTmp = rawHitPtr[1];
515 rawHitPtr[1] = rawHitPtr[3];
516 rawHitPtr[3] = rawHitPtrTmp;
518 Int_t split4_12_ierr = splitCluster(4, tmpClusterSizeList, rawHitPtr, *clusterIt, clusters, numTimeBins);
520 if (split4_12_ierr !=
kStOk)
521 LOG_WARN <<
"Cluster (ladder/sensor/meanColumn/meanRow: " << (*clusterIt)->getLadder() <<
"/" << (*clusterIt)->getSensor() <<
"/" << (*clusterIt)->getMeanColumn() <<
"/" << (*clusterIt)->getMeanRow() <<
") splitting failed! returned " << split4_12_ierr << endm;
525 if ( (tmpRawHitMaxCharge[2] <= tmpRawHitMaxCharge[0]) && (tmpRawHitMaxCharge[2] <= tmpRawHitMaxCharge[1]) && (tmpRawHitMaxCharge[2] <= tmpRawHitMaxCharge[3]) ) {
526 tmpClusterSizeList[1] = 1; tmpClusterSizeList[2] = 2; tmpClusterSizeList[4] = 2; tmpClusterSizeList[5] = 2;
529 rawHitPtrTmp = rawHitPtr[0];
530 rawHitPtr[0] = rawHitPtr[1];
531 rawHitPtr[1] = rawHitPtr[2];
532 rawHitPtr[2] = rawHitPtr[3];
533 rawHitPtr[3] = rawHitPtrTmp;
535 Int_t split4_12_ierr = splitCluster(4, tmpClusterSizeList, rawHitPtr, *clusterIt, clusters, numTimeBins);
537 if (split4_12_ierr !=
kStOk)
538 LOG_WARN <<
"Cluster (ladder/sensor/meanColumn/meanRow: " << (*clusterIt)->getLadder() <<
"/" << (*clusterIt)->getSensor() <<
"/" << (*clusterIt)->getMeanColumn() <<
"/" << (*clusterIt)->getMeanRow() <<
") splitting failed! returned " << split4_12_ierr << endm;
544 else if ( (((*clusterIt)->getNRawHitsZ() == 3) && (rawHitPtr[1]->getColumn() == rawHitPtr[2]->
getColumn()) && (rawHitPtr[2]->getRow() == rawHitPtr[1]->
getRow() + 1) && (rawHitPtr[3]->getRow() == rawHitPtr[1]->
getRow()) && (rawHitPtr[2]->getRow() == rawHitPtr[0]->
getRow())) ) {
546 if ( (tmpRawHitMaxCharge[2] <= tmpRawHitMaxCharge[0]) && (tmpRawHitMaxCharge[2] <= tmpRawHitMaxCharge[1]) && (tmpRawHitMaxCharge[2] <= tmpRawHitMaxCharge[3]) ) {
547 tmpClusterSizeList[1] = 2; tmpClusterSizeList[2] = 1; tmpClusterSizeList[4] = 2; tmpClusterSizeList[5] = 2;
550 rawHitPtrTmp = rawHitPtr[1];
551 rawHitPtr[1] = rawHitPtr[2];
552 rawHitPtr[2] = rawHitPtrTmp;
554 Int_t split4_13_ierr = splitCluster(4, tmpClusterSizeList, rawHitPtr, *clusterIt, clusters, numTimeBins);
556 if (split4_13_ierr !=
kStOk)
557 LOG_WARN <<
"Cluster (ladder/sensor/meanColumn/meanRow: " << (*clusterIt)->getLadder() <<
"/" << (*clusterIt)->getSensor() <<
"/" << (*clusterIt)->getMeanColumn() <<
"/" << (*clusterIt)->getMeanRow() <<
") splitting failed! returned " << split4_13_ierr << endm;
561 if ( (tmpRawHitMaxCharge[1] <= tmpRawHitMaxCharge[0]) && (tmpRawHitMaxCharge[1] <= tmpRawHitMaxCharge[2]) && (tmpRawHitMaxCharge[1] <= tmpRawHitMaxCharge[3]) ) {
562 tmpClusterSizeList[1] = 2; tmpClusterSizeList[2] = 1; tmpClusterSizeList[4] = 2; tmpClusterSizeList[5] = 2;
565 rawHitPtrTmp = rawHitPtr[0];
566 rawHitPtr[0] = rawHitPtr[3];
567 rawHitPtr[3] = rawHitPtrTmp;
569 Int_t split4_13_ierr = splitCluster(4, tmpClusterSizeList, rawHitPtr, *clusterIt, clusters, numTimeBins);
571 if (split4_13_ierr !=
kStOk)
572 LOG_WARN <<
"Cluster (ladder/sensor/meanColumn/meanRow: " << (*clusterIt)->getLadder() <<
"/" << (*clusterIt)->getSensor() <<
"/" << (*clusterIt)->getMeanColumn() <<
"/" << (*clusterIt)->getMeanRow() <<
") splitting failed! returned " << split4_13_ierr << endm;
579 else if ( (((*clusterIt)->getNRawHitsRPhi() == 3) && (rawHitPtr[3]->getRow() == rawHitPtr[0]->
getRow()) && (rawHitPtr[3]->getColumn() == rawHitPtr[0]->
getColumn() + 1) && (rawHitPtr[3]->getColumn() == rawHitPtr[2]->
getColumn()) && (rawHitPtr[0]->getColumn() == rawHitPtr[1]->
getColumn())) ) {
581 if ( (tmpRawHitMaxCharge[0] <= tmpRawHitMaxCharge[1]) && (tmpRawHitMaxCharge[0] <= tmpRawHitMaxCharge[2]) && (tmpRawHitMaxCharge[0] <= tmpRawHitMaxCharge[3]) ) {
582 tmpClusterSizeList[1] = 1; tmpClusterSizeList[2] = 2; tmpClusterSizeList[4] = 2; tmpClusterSizeList[5] = 2;
585 rawHitPtrTmp = rawHitPtr[0];
586 rawHitPtr[0] = rawHitPtr[1];
587 rawHitPtr[1] = rawHitPtrTmp;
588 rawHitPtrTmp = rawHitPtr[2];
589 rawHitPtr[2] = rawHitPtr[3];
590 rawHitPtr[3] = rawHitPtrTmp;
592 Int_t split4_14_ierr = splitCluster(4, tmpClusterSizeList, rawHitPtr, *clusterIt, clusters, numTimeBins);
594 if (split4_14_ierr !=
kStOk)
595 LOG_WARN <<
"Cluster (ladder/sensor/meanColumn/meanRow: " << (*clusterIt)->getLadder() <<
"/" << (*clusterIt)->getSensor() <<
"/" << (*clusterIt)->getMeanColumn() <<
"/" << (*clusterIt)->getMeanRow() <<
") splitting failed! returned " << split4_14_ierr << endm;
599 if ( (tmpRawHitMaxCharge[3] <= tmpRawHitMaxCharge[0]) && (tmpRawHitMaxCharge[3] <= tmpRawHitMaxCharge[1]) && (tmpRawHitMaxCharge[3] <= tmpRawHitMaxCharge[2]) ) {
600 tmpClusterSizeList[1] = 1; tmpClusterSizeList[2] = 2; tmpClusterSizeList[4] = 2; tmpClusterSizeList[5] = 2;
603 rawHitPtrTmp = rawHitPtr[0];
604 rawHitPtr[0] = rawHitPtr[2];
605 rawHitPtr[2] = rawHitPtrTmp;
606 rawHitPtrTmp = rawHitPtr[1];
607 rawHitPtr[1] = rawHitPtr[3];
608 rawHitPtr[3] = rawHitPtrTmp;
610 Int_t split4_14_ierr = splitCluster(4, tmpClusterSizeList, rawHitPtr, *clusterIt, clusters, numTimeBins);
612 if (split4_14_ierr !=
kStOk)
613 LOG_WARN <<
"Cluster (ladder/sensor/meanColumn/meanRow: " << (*clusterIt)->getLadder() <<
"/" << (*clusterIt)->getSensor() <<
"/" << (*clusterIt)->getMeanColumn() <<
"/" << (*clusterIt)->getMeanRow() <<
") splitting failed! returned " << split4_14_ierr << endm;
618 if ( (*clusterIt)->getNRawHits() > 4 || (*clusterIt)->getNRawHits() < 3 )
628 unsigned char maxTb = UCHAR_MAX, usedTb = UCHAR_MAX;
629 unsigned char ladder = 0, sensor = 0,
column = 0, row = 0;
630 float meanRow = 0., meanColumn = 0.;
631 float totCharge = 0., totChargeErr = 0.;
632 unsigned char clusterSize = 0, clusterSizeRPhi = 0, clusterSizeZ = 0;
633 unsigned char clusterType = kIstSimpleClusterAlgo;
636 static unsigned char nTimeBins = istCollection.getNumTimeBins();
638 rawHitsOriginal.sortByGeoId();
641 std::vector<StIstRawHit *> rawHits;
642 rawHits.reserve( rawHitsOriginal.getRawHitVec().size() );
644 for ( std::vector< StIstRawHit * >::iterator rawHitIt = rawHitsOriginal.getRawHitVec().begin(); rawHitIt != rawHitsOriginal.getRawHitVec().end(); ++rawHitIt)
646 rawHits.push_back(
new StIstRawHit( *(*rawHitIt)) );
650 if (rawHits.size() > 0) {
651 std::vector<StIstRawHit *>::iterator rawHitIt = rawHits.begin();
653 maxTb = (*rawHitIt)->getMaxTimeBin();
655 if (maxTb >= nTimeBins) maxTb = (*rawHitIt)->getDefaultTimeBin();
657 if (mTimeBin < nTimeBins) {
663 ladder = (*rawHitIt)->getLadder();
664 sensor = (*rawHitIt)->getSensor();
665 column = (*rawHitIt)->getColumn();
666 row = (*rawHitIt)->getRow();
667 totCharge = (*rawHitIt)->getCharge(usedTb);
668 totChargeErr = (*rawHitIt)->getChargeErr(usedTb);
676 StIstCluster *newCluster =
new StIstCluster((
int)ladder * 10000 + clusters.getClusterVec().size(), ladder, sensor, meanRow, meanColumn, totCharge, totChargeErr, clusterType);
677 newCluster->setNRawHits(clusterSize);
678 newCluster->setNRawHitsRPhi(clusterSizeRPhi);
679 newCluster->setNRawHitsZ(clusterSizeZ);
680 newCluster->setMaxTimeBin(maxTb);
682 std::vector< StIstRawHit * > &rawHitVec = newCluster->getRawHitVec();
683 rawHitVec.push_back(*rawHitIt);
685 clusters.getClusterVec().push_back(newCluster);
688 rawHits.erase( rawHitIt );
690 if ( rawHits.size() != 0 ) {
691 float weight, tempSumCharge;
692 std::vector< StIstCluster * >::iterator clusterIt = clusters.getClusterVec().begin();
695 while ( clusterIt != clusters.getClusterVec().end() && !rawHits.empty() ) {
697 for (std::vector< StIstRawHit * >::iterator rawHitVecIt = (*clusterIt)->getRawHitVec().begin(); rawHitVecIt != (*clusterIt)->getRawHitVec().end(); rawHitVecIt++) {
700 rawHitIt = rawHits.begin();
702 while ( rawHitIt != rawHits.end() ) {
704 if ( (((*rawHitIt)->getSensor() == rawHitPtr->
getSensor()) && ((*rawHitIt)->getRow() == rawHitPtr->
getRow()) && (((*rawHitIt)->getColumn() == rawHitPtr->
getColumn() + 1) || ((*rawHitIt)->getColumn() == rawHitPtr->
getColumn() - 1) )) ||
705 (((*rawHitIt)->getSensor() == rawHitPtr->
getSensor()) && ((*rawHitIt)->getColumn() == rawHitPtr->
getColumn()) && (((*rawHitIt)->getRow() == rawHitPtr->
getRow() + 1) || ((*rawHitIt)->getRow() == rawHitPtr->
getRow() - 1) )) ) {
706 clusterSize = (*clusterIt)->getNRawHits() + 1;
708 if ( ((*rawHitIt)->getRow() == rawHitPtr->
getRow()) )
709 clusterSizeZ = (*clusterIt)->getNRawHitsZ() + 1;
711 if ( ((*rawHitIt)->getColumn() == rawHitPtr->
getColumn()) )
712 clusterSizeRPhi = (*clusterIt)->getNRawHitsRPhi() + 1;
714 maxTb = (*clusterIt)->getMaxTimeBin();
716 if (mTimeBin < nTimeBins) {
722 float currentRawHitCharge = (*rawHitIt)->getCharge(usedTb);
723 tempSumCharge = (*clusterIt)->getTotCharge() + currentRawHitCharge;
724 weight = currentRawHitCharge / tempSumCharge;
726 ladder = (*clusterIt)->getLadder();
727 sensor = (*clusterIt)->getSensor();
728 meanColumn = (1.0 - weight) * (*clusterIt)->getMeanColumn() + weight * (*rawHitIt)->getColumn();
729 meanRow = (1.0 - weight) * (*clusterIt)->getMeanRow() + weight * (*rawHitIt)->getRow();
730 totCharge = tempSumCharge;
731 totChargeErr = sqrt( ( (*clusterIt)->getTotChargeErr() * (*clusterIt)->getTotChargeErr() + (*rawHitIt)->getChargeErr(usedTb) * (*rawHitIt)->getChargeErr(usedTb) ) / clusterSize );
733 (*clusterIt)->setLadder(ladder);
734 (*clusterIt)->setSensor(sensor);
735 (*clusterIt)->setMeanColumn(meanColumn);
736 (*clusterIt)->setMeanRow(meanRow);
737 (*clusterIt)->setTotCharge(totCharge);
738 (*clusterIt)->setTotChargeErr(totChargeErr);
739 (*clusterIt)->setNRawHits(clusterSize);
740 (*clusterIt)->setNRawHitsRPhi(clusterSizeRPhi);
741 (*clusterIt)->setNRawHitsZ(clusterSizeZ);
742 (*clusterIt)->setMaxTimeBin(maxTb);
743 (*clusterIt)->setClusteringType(clusterType);
746 int itPosition = std::distance((*clusterIt)->getRawHitVec().begin(), rawHitVecIt);
747 (*clusterIt)->getRawHitVec().push_back(*rawHitIt);
748 rawHitVecIt = (*clusterIt)->getRawHitVec().begin() + itPosition;
751 int distance = std::distance(rawHits.begin(), rawHitIt);
752 rawHits.erase( rawHitIt );
753 rawHitIt = rawHits.begin() + distance;
761 if (rawHits.size() < 1)
764 rawHitIt = rawHits.begin();
766 maxTb = (*rawHitIt)->getMaxTimeBin();
768 if (maxTb >= nTimeBins) maxTb = (*rawHitIt)->getDefaultTimeBin();
770 if (mTimeBin < nTimeBins) {
776 ladder = (*rawHitIt)->getLadder();
777 sensor = (*rawHitIt)->getSensor();
778 column = (*rawHitIt)->getColumn();
779 row = (*rawHitIt)->getRow();
780 totCharge = (*rawHitIt)->getCharge(usedTb);
781 totChargeErr = (*rawHitIt)->getChargeErr(usedTb);
788 StIstCluster *newCluster1 =
new StIstCluster((
int)ladder * 10000 + clusters.getClusterVec().size(), ladder, sensor, meanRow, meanColumn, totCharge, totChargeErr, clusterType);
789 newCluster1->setNRawHits(clusterSize);
790 newCluster1->setNRawHitsRPhi(clusterSizeRPhi);
791 newCluster1->setNRawHitsZ(clusterSizeZ);
792 newCluster1->setMaxTimeBin(maxTb);
794 int distanceCluster = std::distance(clusters.getClusterVec().begin(), clusterIt);
796 std::vector< StIstRawHit * > &rawHitVec1 = newCluster1->getRawHitVec();
797 rawHitVec1.push_back(*rawHitIt);
799 clusters.getClusterVec().push_back(newCluster1);
801 clusterIt = clusters.getClusterVec().begin() + distanceCluster;
804 rawHits.erase( rawHitIt );
811 Int_t loc_ierr = doSplitting(clusters, nTimeBins);
813 if (loc_ierr !=
kStOk) {
814 LOG_WARN <<
"StIstClusterMaker::Make(): Cluster splitting for ladder " << ladder <<
" returned " << loc_ierr << endm;
unsigned char getLadder() const
1-24
unsigned char getColumn() const
1-12
unsigned char getRow() const
1-64
unsigned char getSensor() const
1-6