202 for (
int iposition = 0; iposition < 3 ; iposition ++) {
204 for (
int icluster = 0; icluster < Ncluster; icluster++) {
216 ClusterArray[m_hitNum]->setEventId(m_nEvent);
217 ClusterArray[m_hitNum]->setClusterId(clusterId);
218 ClusterArray[m_hitNum]->setMaxTCId(
m_MaxTCId[iposition][icluster]);
219 ClusterArray[m_hitNum]->setMaxThetaId(
m_TCMap->getTCThetaIdFromTCId(
m_MaxTCId[iposition][icluster]));
220 ClusterArray[m_hitNum]->setMaxPhiId(
m_TCMap->getTCPhiIdFromTCId(
m_MaxTCId[iposition][icluster]));
221 ClusterArray[m_hitNum]->setNofTCinCluster(
m_NofTCinCluster[iposition][icluster]);
222 ClusterArray[m_hitNum]->setEnergyDep(
m_ClusterEnergy[iposition][icluster]);
223 ClusterArray[m_hitNum]->setTimeAve(
m_ClusterTiming[iposition][icluster]);
240 std::vector<int> TCFire;
241 std::vector<double> TCFireEnergy;
242 std::vector<double> TCFireTiming;
243 std::vector<std::vector<double>> TCFirePosition;
246 TCFireEnergy.clear();
247 TCFireTiming.clear();
248 TCFirePosition.clear();
250 TCFire.resize(432, 0);
251 TCFireEnergy.resize(432, 0.);
252 TCFireTiming.resize(432, 0.);
253 TCFirePosition.resize(432, std::vector<double>(3, 0.));
255 const int hit_size =
m_TCId.size();
256 for (
int ihit = 0 ; ihit < hit_size ; ihit++) {
270 int tc_upper_right = 0;
272 int tc_lower_right = 0;
274 int tc_lower_left = 0;
276 int tc_upper_left = 0;
278 for (
int iii = 0 ; iii < 432 ; iii++) {
280 if (TCFire[iii] == 0) {
continue; }
293 if (!(tc_upper != 0 || tc_left != 0)) {
294 if (!(tc_lower != 0 && tc_lower_left != 0)) {
299 double maxTCEnergy = 0;
300 for (
int iTC = 0; iTC < 9; iTC++) {
320 if ((maxTCid - 81) % 12 == 0) {
325 if ((maxTCid - 81) % 12 == 11) {
331 if (maxTCid > 92 && maxTCid < 501) {
343 if ((maxTCid - 81) % 12 == 0) {
348 if ((maxTCid - 81) % 12 == 11) {
364 if ((maxTCid - 81) % 12 == 0) {
369 if ((maxTCid - 81) % 12 == 11) {
377 for (
int iNearTC = 1; iNearTC < 9; iNearTC ++) {
378 for (
int jNearTC = 1; jNearTC < 9; jNearTC ++) {
380 if (iNearTC == jNearTC) {
continue;}
388 double clusterenergy = 0;
389 double clustertiming = 0;
390 double clusterpositionX = 0;
391 double clusterpositionY = 0;
392 double clusterpositionZ = 0;
393 int noftcincluster = 0;
394 for (
int iNearTC = 0; iNearTC < 9; iNearTC ++) {
396 else {noftcincluster++;}
406 clustertiming /= clusterenergy;
408 clusterpositionX /= clusterenergy;
409 clusterpositionY /= clusterenergy;
410 clusterpositionZ /= clusterenergy;
412 clustertiming = TCFireTiming[maxTCId - 81];
413 clusterpositionX = TCFirePosition[maxTCId - 81][0];
414 clusterpositionY = TCFirePosition[maxTCId - 81][1];
415 clusterpositionZ = TCFirePosition[maxTCId - 81][2];
417 if (clustertiming == 0 && clusterenergy == 0) {
continue;}
439 std::vector<int> TCFire;
440 std::vector<double> TCFireEnergy;
441 std::vector<double> TCFireTiming;
442 std::vector<std::vector<double>> TCFirePosition;
444 std::vector<double> TempClusterEnergy;
445 std::vector<double> TempClusterTiming;
446 std::vector<double> TempClusterPositionX;
447 std::vector<double> TempClusterPositionY;
448 std::vector<double> TempClusterPositionZ;
449 std::vector<double> Sort1D;
450 std::vector<std::vector<double>> Sort2D;
452 std::vector<int> TempNofTCinCluster;
453 std::vector<int> TempMaxTCId;
455 int TempICNTCId = 0;;
457 TempClusterEnergy.clear();
458 TempClusterTiming.clear();
459 TempClusterPositionX.clear();
460 TempClusterPositionY.clear();
461 TempClusterPositionZ.clear();
462 TempNofTCinCluster.clear();
469 TCFireEnergy.clear();
470 TCFireTiming.clear();
471 TCFirePosition.clear();
473 TCFire.resize(96, 0);
474 TCFireEnergy.resize(96, 0.);
475 TCFireTiming.resize(96, 0.);
477 TCFirePosition.resize(96, std::vector<double>(3, 0.));
480 const int hit_size =
m_TCId.size();
481 for (
int ihit = 0 ; ihit < hit_size ; ihit++) {
482 if (
m_TCId[ihit] > 80) {
continue;}
506 int iTCId0 =
m_TCId[ihit] - 1;
508 if (iTCId0 % 5 == 0) {
509 kkk = (iTCId0 / 5) * 2;
510 TCFire[kkk] =
m_TCId[ihit];
511 TCFire[kkk + 1] =
m_TCId[ihit];
514 switch (iTCId0 % 5) {
516 TCFire[32 + 2 * kkk] =
m_TCId[ihit];
break;
518 TCFire[64 + 2 * kkk] =
m_TCId[ihit];
break;
520 TCFire[64 + 2 * kkk + 1] =
m_TCId[ihit];
break;
522 TCFire[32 + 2 * kkk + 1] =
m_TCId[ihit];
break;
529 for (
int iii = 0 ; iii < 96 ; iii++) {
536 for (
int iinit = 0; iinit < 9; iinit ++)
538 if (TCFire[iii] == 0)
553 }
else if (iii == 30) {
584 }
else if (iii < 64) {
596 }
else if (iii == 33) {
610 else if (iii == 62) {
622 }
else if (iii == 63) {
669 }
else if (iii == 95) {
702 TempICNTCId = TCFire[iii];
706 double maxTCEnergy = 0;
707 for (
int iTC = 0; iTC < 9; iTC++) {
724 kkk = 64 + 1 + 2 * kkk;
726 kkk = 32 + 1 + 2 * kkk;
741 }
else if (kkk == 30) {
765 }
else if (kkk < 64) {
777 }
else if (kkk == 33) {
791 else if (kkk == 62) {
803 }
else if (kkk == 63) {
847 }
else if (kkk == 95) {
872 for (
int iNearTC = 1; iNearTC < 9; iNearTC ++) {
873 for (
int jNearTC = 1; jNearTC < 9; jNearTC ++) {
875 if (iNearTC == jNearTC)
continue;
883 double clusterenergy = 0;
884 double clustertiming = 0;
885 double clusterpositionX = 0;
886 double clusterpositionY = 0;
887 double clusterpositionZ = 0;
888 int noftcincluster = 0;
889 for (
int iNearTC = 0; iNearTC < 9; iNearTC ++) {
891 else {noftcincluster++;}
903 clustertiming /= clusterenergy;
905 clusterpositionX /= clusterenergy;
906 clusterpositionY /= clusterenergy;
907 clusterpositionZ /= clusterenergy;
909 clustertiming = TCFireTiming[maxTCId - 1];
910 clusterpositionX = TCFirePosition[maxTCId - 1][0];
911 clusterpositionY = TCFirePosition[maxTCId - 1][1];
912 clusterpositionZ = TCFirePosition[maxTCId - 1][2];
914 if (clustertiming == 0 && clusterenergy == 0) {
continue;}
916 TempClusterEnergy.push_back(clusterenergy);
917 TempClusterTiming.push_back(clustertiming);
918 TempClusterPositionX.push_back(clusterpositionX);
919 TempClusterPositionY.push_back(clusterpositionY);
920 TempClusterPositionZ.push_back(clusterpositionZ);
921 TempNofTCinCluster.push_back(noftcincluster);
922 TempMaxTCId.push_back(maxTCId);
924 Sort1D.push_back(TempICNTCId);
925 Sort1D.push_back(clusterenergy);
926 Sort1D.push_back(clustertiming);
927 Sort1D.push_back(clusterpositionX);
928 Sort1D.push_back(clusterpositionY);
929 Sort1D.push_back(clusterpositionZ);
930 Sort1D.push_back(noftcincluster);
931 Sort1D.push_back(maxTCId);
933 Sort2D.push_back(Sort1D);
942 sort(Sort2D.begin(), Sort2D.end(),
943 [](
const vector<double>& aa1,
const vector<double>& aa2) {return aa1[0] < aa2[0];});
945 const int clustersize = Sort2D.size();
946 for (
int jtc = 0; jtc < clustersize; jtc++) {
964 std::vector<int> TCFire;
965 std::vector<double> TCFireEnergy;
966 std::vector<double> TCFireTiming;
967 std::vector<std::vector<double>> TCFirePosition;
970 std::vector<double> TempClusterEnergy;
971 std::vector<double> TempClusterTiming;
972 std::vector<double> TempClusterPositionX;
973 std::vector<double> TempClusterPositionY;
974 std::vector<double> TempClusterPositionZ;
975 std::vector<int> TempNofTCinCluster;
976 std::vector<int> TempMaxTCId;
978 std::vector<double> Sort1D;
979 std::vector<std::vector<double>> Sort2D;
983 TempClusterEnergy.clear();
984 TempClusterTiming.clear();
985 TempClusterPositionX.clear();
986 TempClusterPositionY.clear();
987 TempClusterPositionZ.clear();
988 TempNofTCinCluster.clear();
994 TCFireEnergy.clear();
995 TCFireTiming.clear();
996 TCFirePosition.clear();
998 TCFire.resize(64, 0);
999 TCFireEnergy.resize(64, 0.);
1000 TCFireTiming.resize(64, 0.);
1001 TCFirePosition.resize(64, std::vector<double>(3, 0.));
1003 const int hit_size =
m_TCId.size();
1004 for (
int ihit = 0 ; ihit < hit_size ; ihit++) {
1005 if (
m_TCId[ihit] < 513) {
continue;}
1028 int iTCId0 =
m_TCId[ihit] - 1;
1030 if ((iTCId0 - 512) % 4 == 2) {
1031 kkk = (iTCId0 - 512) / 2 - 1;
1033 if ((iTCId0 - 512) % 4 == 1) {
1034 kkk = ((iTCId0 - 512) + 1) / 2;
1036 if ((iTCId0 - 512) % 4 == 3) {
1037 kkk = 32 + ((iTCId0 - 512) - 3) / 2;
1039 if ((iTCId0 - 512) % 4 == 0) {
1040 kkk = 33 + ((iTCId0 - 512)) / 2;
1043 TCFire[kkk] = iTCId0 + 1;
1048 for (
int iii = 0 ; iii < 64 ; iii ++) {
1050 if (TCFire[iii] == 0) {
continue; }
1052 for (
int iinit = 0; iinit < 9; iinit ++) {
m_TempCluster[iinit] = 0;}
1064 }
else if (iii == 31) {
1096 }
else if (iii == 63) {
1122 TempICNTCId = TCFire[iii];
1126 double maxTCEnergy = 0;
1127 for (
int iTC = 0; iTC < 9; iTC++) {
1160 }
else if (kkk == 31) {
1192 }
else if (kkk == 63) {
1217 for (
int iNearTC = 1; iNearTC < 9; iNearTC ++) {
1218 for (
int jNearTC = 1; jNearTC < 9; jNearTC ++) {
1220 if (iNearTC == jNearTC) {
continue;}
1228 double clusterenergy = 0;
1229 double clustertiming = 0;
1230 double clusterpositionX = 0;
1231 double clusterpositionY = 0;
1232 double clusterpositionZ = 0;
1233 int noftcincluster = 0;
1234 for (
int iNearTC = 0; iNearTC < 9; iNearTC ++) {
1236 else {noftcincluster++;}
1238 clusterenergy += TCFireEnergy[
m_TempCluster[iNearTC] - 513];
1250 clustertiming /= clusterenergy;
1252 clusterpositionX /= clusterenergy;
1253 clusterpositionY /= clusterenergy;
1254 clusterpositionZ /= clusterenergy;
1256 clustertiming = TCFireTiming[maxTCId - 513];
1257 clusterpositionX = TCFirePosition[maxTCId - 513][0];
1258 clusterpositionY = TCFirePosition[maxTCId - 513][1];
1259 clusterpositionZ = TCFirePosition[maxTCId - 513][2];
1262 if (clustertiming == 0 && clusterenergy == 0) {
continue;}
1263 TempClusterEnergy.push_back(clusterenergy);
1264 TempClusterTiming.push_back(clustertiming);
1265 TempClusterPositionX.push_back(clusterpositionX);
1266 TempClusterPositionY.push_back(clusterpositionY);
1267 TempClusterPositionZ.push_back(clusterpositionZ);
1268 TempNofTCinCluster.push_back(noftcincluster);
1269 TempMaxTCId.push_back(maxTCId);
1272 Sort1D.push_back(TempICNTCId);
1273 Sort1D.push_back(clusterenergy);
1274 Sort1D.push_back(clustertiming);
1275 Sort1D.push_back(clusterpositionX);
1276 Sort1D.push_back(clusterpositionY);
1277 Sort1D.push_back(clusterpositionZ);
1278 Sort1D.push_back(noftcincluster);
1279 Sort1D.push_back(maxTCId);
1281 Sort2D.push_back(Sort1D);
1289 sort(Sort2D.begin(), Sort2D.end(),
1290 [](
const vector<double>& aa1,
const vector<double>& aa2) {return aa1[0] < aa2[0];});
1292 const int clustersize = Sort2D.size();
1293 for (
int jtc = 0; jtc < clustersize; jtc++) {
1379 std::vector<int> TCFire,
1381 int& tc_upper_right,
1383 int& tc_lower_right,
1390 int offset_upper = 0;
1391 int offset_lower = 0;
1396 }
else if (iii <= 419) {
1403 offset_lower = -432;
1407 if (iii % 12 == 0) {
1409 tc_upper = TCFire[iii - 12 + offset_upper];
1413 tc_lower = TCFire[iii + 12 + offset_lower];
1414 tc_lower_left = TCFire[iii + 13 + offset_lower];
1415 tc_left = TCFire[iii + 1];
1416 tc_upper_left = TCFire[iii - 11 + offset_upper];
1417 }
else if (iii % 12 == 11) {
1419 tc_upper = TCFire[iii - 12 + offset_upper];
1420 tc_upper_right = TCFire[iii - 13 + offset_upper];
1421 tc_right = TCFire[iii - 1];
1422 tc_lower_right = TCFire[iii + 11 + offset_lower];
1423 tc_lower = TCFire[iii + 12 + offset_lower];
1428 tc_upper = TCFire[iii - 12 + offset_upper];
1429 tc_upper_right = TCFire[iii - 13 + offset_upper];
1430 tc_right = TCFire[iii - 1];
1431 tc_lower_right = TCFire[iii + 11 + offset_lower];
1432 tc_lower = TCFire[iii + 12 + offset_lower];
1433 tc_lower_left = TCFire[iii + 13 + offset_lower];
1434 tc_left = TCFire[iii + 1];
1435 tc_upper_left = TCFire[iii - 11 + offset_upper];
1607 std::vector<int> TCFire;
1612 TCFire.resize(64, 0);
1616 const int hit_size =
m_TCId.size();
1617 for (
int ihit = 0 ; ihit < hit_size ; ihit++) {
1618 if (
m_TCId[ihit] < 513) {
continue;}
1637 int iTCId0 =
m_TCId[ihit] - 1;
1639 if ((iTCId0 - 512) % 4 == 2) {
1640 kkk = (iTCId0 - 512) / 2 - 1;
1642 if ((iTCId0 - 512) % 4 == 1) {
1643 kkk = ((iTCId0 - 512) + 1) / 2;
1645 if ((iTCId0 - 512) % 4 == 3) {
1646 kkk = 32 + ((iTCId0 - 512) - 3) / 2;
1648 if ((iTCId0 - 512) % 4 == 0) {
1649 kkk = 33 + ((iTCId0 - 512)) / 2;
1652 TCFire[kkk] = iTCId0 + 1;
1657 for (
int iii = 0 ; iii < 64 ; iii ++) {
1659 if (TCFire[iii] == 0) {
continue; }
1661 for (
int iinit = 0; iinit < 9; iinit ++) {
m_TempCluster[iinit] = 0;}
1673 }
else if (iii == 31) {
1705 }
else if (iii == 63) {
1732 int phiid =
m_TCMap->getTCPhiIdFromTCId(TCFire[iii]);
1734 if (phiid == 32 || (phiid > 0 && phiid < 10)) {
1737 if (phiid > 7 && phiid < 18) {
1740 if (phiid > 15 && phiid < 26) {
1743 if ((phiid > 22 && phiid < 33) || phiid == 1) {