Belle II Software development
TrgEclCluster.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9//---------------------------------------------------------------
10// Description :
11// -A class to make cluster from TC Hit
12// -ICN Logic ( function name : setICN(tcid) )
13// Isolate cluster counting logic used in Belle for 3x3 TCs
14//
15// |5|1|6|
16// |2|0|3| ICN = [ 0 and !(1 or 2) and !(4 and 7) ]
17// |7|4|8|
18//
19// 3x3 TC
20//
21// -Clustering Logic (Function name : setICN(tcid, tcenergy, tctiming) )
22// 1.Find TC Hit (0) satisfying ICN logic
23// 2.Find the most energetic TC Hit in the neghbor TCs with 0 (9 TCs)
24// 3.Bind neighbor TC hits with the most energetic TC (Center TC) as a Cluster
25// 4.Cluster energy : Total energy in Cluster
26// 5.Timing : Timing of the most energetic TC in a cluster or Energy weighted timing in a cluster
27//
28// -The limit number of Cluster is 6 due to hardware limitation (ETM)
29// -The cluster information (energy, timing) is saved in the order of barrel, forward endcap and backwrd endcap
30//---------------------------------------------------------------
31
32#define TRG_SHORT_NAMES
33#define TRGECLCLUSTER_SHORT_NAMES
34
35#include <framework/datastore/StoreArray.h>
36#include <framework/logging/Logger.h>
37
38#include <trg/ecl/TrgEclCluster.h>
39#include "trg/ecl/dataobjects/TRGECLCluster.h"
40
41using namespace std;
42using namespace Belle2;
43//
44//
45//
56//
57//
58//
63//
64//
65//
67{
68 m_icnfwbrbw.clear();
69 m_BrCluster.clear();
70 m_FwCluster.clear();
71 m_BwCluster.clear();
72 m_Quadrant.clear();
73
74 m_TCId.clear();
75 m_Timing.clear();
76 m_Energy.clear();
77
78 m_ClusterTiming.clear();
79 m_ClusterEnergy.clear();
80 m_ClusterPositionX.clear();
81 m_ClusterPositionY.clear();
82 m_ClusterPositionZ.clear();
83 m_NofTCinCluster.clear();
84 m_MaxTCId.clear();
85 m_TempCluster.clear();
86
87 m_icnfwbrbw.resize(3, 0);
88 m_TempCluster.resize(9);
89 m_Quadrant.resize(3, std::vector<int>(4, 0.0));
90
91 m_ClusterTiming.resize(3);
92 m_ClusterEnergy.resize(3);
93 m_ClusterPositionX.resize(3);
94 m_ClusterPositionY.resize(3);
95 m_ClusterPositionZ.resize(3);
96 m_NofTCinCluster.resize(3);
97 m_MaxTCId.resize(3);
98}
99//
100//
101//
102int
104{
105 // get ICN in Barrel and Forward Endcap except for the most inner (=Physics region : Theta Id 2 ~ 15)
106 return m_icnfwbrbw[0] + m_icnfwbrbw[1];
107
108}
109//
110//
111//
112int
114{
115 // get ICN in Barrel and Backward endcap, Forward Endcap except for the most inner (=Physics region : Theta Id 2 ~ 15)
116
117 return m_icnfwbrbw[FwBrBw];
118
119}
120//
121//
122//
123int
124TrgEclCluster::getBrICNCluster(int ICNId, int location)
125{
126 // get the # of Cluster in Barrel.
127 return m_BrCluster[ICNId][location];
128
129}
130//
131//
132//
133int
134TrgEclCluster::getBwICNCluster(int ICNId, int location)
135{
136
137 return m_BwCluster[ICNId][location];
138
139}
140//
141//
142//
143int
144TrgEclCluster::getFwICNCluster(int ICNId, int location)
145{
146
147 return m_FwCluster[ICNId][location];
148
149}
150//
151//
152//
153void
154TrgEclCluster::setICN(const std::vector<int>& tcid)
155{
156 m_TCId = tcid ;
157 m_Quadrant.clear();
158 m_Quadrant.resize(3, std::vector<int>(4, 0.0));
159 m_icnfwbrbw.clear();
160 m_icnfwbrbw.resize(3, 0);
161 m_BRICN = 0 ;
162 m_FWDICN = 0;
163 m_BWDICN = 0;
164
168
169 return;
170}
171//
172//
173//
174void
175TrgEclCluster::setICN(const std::vector<int>& tcid,
176 const std::vector<double>& tcenergy,
177 const std::vector<double>& tctiming)
178{
179 m_TCId = tcid ;
180 m_Energy = tcenergy;
181 m_Timing = tctiming;
182
186
188
189 return;
190}
191//
192//
193//
194void
196{
197 // Save Cluster
198 // Save order : Barrel, Forward, Backward
199
200 int m_hitNum = 0;
201 int clusterId = 0;
202 int counter = 0;
203 for (int iposition = 0; iposition < 3 ; iposition ++) {
204 const int Ncluster = m_ClusterEnergy[iposition].size();
205 for (int icluster = 0; icluster < Ncluster; icluster++) {
206 if (m_ClusterEnergy[iposition][icluster] <= 0) {continue;}
207
208 if (counter >= m_LimitNCluster) {
209 continue;
210 } else {
211 counter ++;
212 }
213
214 StoreArray<TRGECLCluster> ClusterArray;
215 ClusterArray.appendNew();
216 m_hitNum = ClusterArray.getEntries() - 1;
217 ClusterArray[m_hitNum]->setEventId(m_nEvent);
218 ClusterArray[m_hitNum]->setClusterId(clusterId);
219 ClusterArray[m_hitNum]->setMaxTCId(m_MaxTCId[iposition][icluster]);
220 ClusterArray[m_hitNum]->setMaxThetaId(m_TCMap->getTCThetaIdFromTCId(m_MaxTCId[iposition][icluster]));
221 ClusterArray[m_hitNum]->setMaxPhiId(m_TCMap->getTCPhiIdFromTCId(m_MaxTCId[iposition][icluster]));
222 ClusterArray[m_hitNum]->setNofTCinCluster(m_NofTCinCluster[iposition][icluster]);
223 ClusterArray[m_hitNum]->setEnergyDep(m_ClusterEnergy[iposition][icluster]);
224 ClusterArray[m_hitNum]->setTimeAve(m_ClusterTiming[iposition][icluster]);
225
226 ClusterArray[m_hitNum]->setPositionX(m_ClusterPositionX[iposition][icluster]);
227 ClusterArray[m_hitNum]->setPositionY(m_ClusterPositionY[iposition][icluster]);
228 ClusterArray[m_hitNum]->setPositionZ(m_ClusterPositionZ[iposition][icluster]);
229 clusterId ++;
230 }
231 }
232
233
234}
235//
236//
237//
239{
240
241 std::vector<int> TCFire;
242 std::vector<double> TCFireEnergy;
243 std::vector<double> TCFireTiming;
244 std::vector<std::vector<double>> TCFirePosition;
245
246 TCFire.clear();
247 TCFireEnergy.clear();
248 TCFireTiming.clear();
249 TCFirePosition.clear();
250
251 TCFire.resize(432, 0);
252 TCFireEnergy.resize(432, 0.);
253 TCFireTiming.resize(432, 0.);
254 TCFirePosition.resize(432, std::vector<double>(3, 0.));
255
256 const int hit_size = m_TCId.size();
257 for (int ihit = 0 ; ihit < hit_size ; ihit++) {
258 if (m_TCId[ihit] >= 81 && m_TCId[ihit] <= 512) {
259 TCFire[m_TCId[ihit] - 81] = m_TCId[ihit];
260 TCFireEnergy[m_TCId[ihit] - 81] = m_Energy[ihit];
261 TCFireTiming[m_TCId[ihit] - 81] = m_Timing[ihit];
262 TCFirePosition[m_TCId[ihit] - 81][0] = (m_TCMap->getTCPosition(m_TCId[ihit])).X();
263 TCFirePosition[m_TCId[ihit] - 81][1] = (m_TCMap->getTCPosition(m_TCId[ihit])).Y();
264 TCFirePosition[m_TCId[ihit] - 81][2] = (m_TCMap->getTCPosition(m_TCId[ihit])).Z();
265 }
266 }
267 //
268 //
269 //
270 int tc_upper = 0; // check upper TC
271 int tc_upper_right = 0; // check right TC
272 int tc_right = 0; // check right TC
273 int tc_lower_right = 0;
274 int tc_lower = 0; // check lower TC
275 int tc_lower_left = 0; // check lower TC
276 int tc_left = 0;
277 int tc_upper_left = 0;
278
279 for (int iii = 0 ; iii < 432 ; iii++) {
280
281 if (TCFire[iii] == 0) { continue; }
282
283 setBarrelICNsub(iii,
284 TCFire,
285 tc_upper,
286 tc_upper_right,
287 tc_right,
288 tc_lower_right,
289 tc_lower,
290 tc_lower_left,
291 tc_left,
292 tc_upper_left);
293
294 if (!(tc_upper != 0 || tc_left != 0)) {
295 if (!(tc_lower != 0 && tc_lower_left != 0)) {
296
297 if (Method == 1) {
298 // for cluster method2(Consider TC energy in oderto find the center of cluster)
299 int maxTCid = 0;
300 double maxTCEnergy = 0;
301 for (int iTC = 0; iTC < 9; iTC++) { //find center of Cluster
302 if (m_TempCluster[iTC] == 0) {continue;}
303 if (maxTCEnergy < TCFireEnergy[m_TempCluster[iTC] - 81]) {
304 maxTCEnergy = TCFireEnergy[m_TempCluster[iTC] - 81];
305 maxTCid = m_TempCluster[iTC];
306 }
307 }
308 // maxTCid is in barral
309 if (maxTCid < 81 ||
310 maxTCid > 512) {
311 B2ERROR("maxTCID is out of barrel region : maxTCID = " << maxTCid);
312 }
313
314 m_TempCluster[0] = maxTCid;
315
316 // 8 TCs surrounding maxTC
317 int indexNeighboringTC[8] = {0};
318 // set neighboring TC ID of maxTC by taking boundary condtion into account
319 if (maxTCid < 93) {
320 indexNeighboringTC[0] = maxTCid + 420 - 81;
321 indexNeighboringTC[1] = maxTCid + 419 - 81;
322 indexNeighboringTC[2] = maxTCid - 1 - 81;
323 indexNeighboringTC[3] = maxTCid + 11 - 81;
324 indexNeighboringTC[4] = maxTCid + 12 - 81;
325 indexNeighboringTC[5] = maxTCid + 13 - 81;
326 indexNeighboringTC[6] = maxTCid + 1 - 81;
327 indexNeighboringTC[7] = maxTCid + 421 - 81;
328 } else if (maxTCid < 501) {
329 indexNeighboringTC[0] = maxTCid - 12 - 81;
330 indexNeighboringTC[1] = maxTCid - 13 - 81;
331 indexNeighboringTC[2] = maxTCid - 1 - 81;
332 indexNeighboringTC[3] = maxTCid + 11 - 81;
333 indexNeighboringTC[4] = maxTCid + 12 - 81;
334 indexNeighboringTC[5] = maxTCid + 13 - 81;
335 indexNeighboringTC[6] = maxTCid + 1 - 81;
336 indexNeighboringTC[7] = maxTCid - 11 - 81;
337 } else {
338 indexNeighboringTC[0] = maxTCid - 12 - 81;
339 indexNeighboringTC[1] = maxTCid - 13 - 81;
340 indexNeighboringTC[2] = maxTCid - 1 - 81;
341 indexNeighboringTC[3] = maxTCid - 421 - 81;
342 indexNeighboringTC[4] = maxTCid - 420 - 81;
343 indexNeighboringTC[5] = maxTCid - 419 - 81;
344 indexNeighboringTC[6] = maxTCid + 1 - 81;
345 indexNeighboringTC[7] = maxTCid - 11 - 81;
346 }
347 // check out of boundary(0-431) of TCFire array
348 for (int jjj = 0; jjj < 8; jjj++) {
349 if (indexNeighboringTC[jjj] <= -1 ||
350 indexNeighboringTC[jjj] >= (int) TCFire.size()) {
351 indexNeighboringTC[jjj] = -1;
352 }
353 }
354 // check forward and backward side boundary in barrel
355 if ((maxTCid - 81) % 12 == 0) {
356 // forward side in barral
357 indexNeighboringTC[1] = -1;
358 indexNeighboringTC[2] = -1;
359 indexNeighboringTC[3] = -1;
360 } else if ((maxTCid - 81) % 12 == 11) {
361 // backward side in barral
362 indexNeighboringTC[5] = -1;
363 indexNeighboringTC[6] = -1;
364 indexNeighboringTC[7] = -1;
365 }
366 // set TC hit flag for 8 TCs surrounding maxTC
367 for (int jjj = 0; jjj < 8; jjj++) {
368 if (indexNeighboringTC[jjj] >= 0) {
369 m_TempCluster[jjj + 1] = TCFire.at(indexNeighboringTC[jjj]);
370 } else {
371 m_TempCluster[jjj + 1] = 0;
372 }
373 }
374 }
375
376 for (int iNearTC = 1; iNearTC < 9; iNearTC ++) {
377 for (int jNearTC = 1; jNearTC < 9; jNearTC ++) {
378 if (m_TempCluster[iNearTC] == 0) {continue;}
379 if (iNearTC == jNearTC) {continue;}
380 if (m_TempCluster[iNearTC] == m_TempCluster[jNearTC]) {
381 m_TempCluster[jNearTC] = 0;
382 }
383 }
384 }
385
386 int maxTCId = 999;
387 double clusterenergy = 0;
388 double clustertiming = 0;
389 double clusterpositionX = 0;
390 double clusterpositionY = 0;
391 double clusterpositionZ = 0;
392 int noftcincluster = 0;
393 for (int iNearTC = 0; iNearTC < 9; iNearTC ++) {
394 if (m_TempCluster[iNearTC] == 0) {continue;}
395 else {noftcincluster++;}
396 clusterenergy += TCFireEnergy[m_TempCluster[iNearTC] - 81];
397 clustertiming += TCFireEnergy[m_TempCluster[iNearTC] - 81] * TCFireTiming[m_TempCluster[iNearTC] - 81];
398 clusterpositionX += TCFireEnergy[m_TempCluster[iNearTC] - 81] * TCFirePosition[m_TempCluster[iNearTC] - 81][0];
399 clusterpositionY += TCFireEnergy[m_TempCluster[iNearTC] - 81] * TCFirePosition[m_TempCluster[iNearTC] - 81][1];
400 clusterpositionZ += TCFireEnergy[m_TempCluster[iNearTC] - 81] * TCFirePosition[m_TempCluster[iNearTC] - 81][2];
401 }
402 //
403 maxTCId = m_TempCluster[0];
404 //
405 clustertiming /= clusterenergy;
406 if (m_Position == 1) {
407 clusterpositionX /= clusterenergy;
408 clusterpositionY /= clusterenergy;
409 clusterpositionZ /= clusterenergy;
410 } else if (m_Position == 0) {
411 clustertiming = TCFireTiming[maxTCId - 81];
412 clusterpositionX = TCFirePosition[maxTCId - 81][0];
413 clusterpositionY = TCFirePosition[maxTCId - 81][1];
414 clusterpositionZ = TCFirePosition[maxTCId - 81][2];
415 }
416 if (clustertiming == 0 && clusterenergy == 0) {continue;}
417 m_BrCluster.push_back(m_TempCluster);
418 m_ClusterEnergy[0].push_back(clusterenergy);
419 m_ClusterTiming[0].push_back(clustertiming);
420 m_ClusterPositionX[0].push_back(clusterpositionX);
421 m_ClusterPositionY[0].push_back(clusterpositionY);
422 m_ClusterPositionZ[0].push_back(clusterpositionZ);
423 m_NofTCinCluster[0].push_back(noftcincluster);
424 m_MaxTCId[0].push_back(maxTCId);
425 }
426 }
427 }// iii loop
428 m_BRNofCluster = m_MaxTCId[0].size();
429
430}
431//
432//
433//
434void
436{
437
438 std::vector<int> TCFire;
439 std::vector<double> TCFireEnergy;
440 std::vector<double> TCFireTiming;
441 std::vector<std::vector<double>> TCFirePosition;
442
443 std::vector<double> TempClusterEnergy;
444 std::vector<double> TempClusterTiming;
445 std::vector<double> TempClusterPositionX;
446 std::vector<double> TempClusterPositionY;
447 std::vector<double> TempClusterPositionZ;
448 std::vector<double> Sort1D;
449 std::vector<std::vector<double>> Sort2D;
450
451 std::vector<int> TempNofTCinCluster;
452 std::vector<int> TempMaxTCId;
453
454 int TempICNTCId = 0;;
455
456 TempClusterEnergy.clear();
457 TempClusterTiming.clear();
458 TempClusterPositionX.clear();
459 TempClusterPositionY.clear();
460 TempClusterPositionZ.clear();
461 TempNofTCinCluster.clear();
462 TempMaxTCId.clear();
463
464 Sort2D.clear();
465 Sort1D.clear();
466
467 TCFire.clear();
468 TCFireEnergy.clear();
469 TCFireTiming.clear();
470 TCFirePosition.clear();
471
472 TCFire.resize(96, 0);
473 TCFireEnergy.resize(96, 0.);
474 TCFireTiming.resize(96, 0.);
475
476 TCFirePosition.resize(96, std::vector<double>(3, 0.));
477
478
479 const int hit_size = m_TCId.size();
480 for (int ihit = 0 ; ihit < hit_size ; ihit++) {
481 if (m_TCId[ihit] > 80) {continue;}
482
483 TCFireEnergy[m_TCId[ihit] - 1] = m_Energy[ihit];
484 TCFireTiming[m_TCId[ihit] - 1] = m_Timing[ihit];
485 TCFirePosition[m_TCId[ihit] - 1][0] = (m_TCMap->getTCPosition(m_TCId[ihit])).X();
486 TCFirePosition[m_TCId[ihit] - 1][1] = (m_TCMap->getTCPosition(m_TCId[ihit])).Y();
487 TCFirePosition[m_TCId[ihit] - 1][2] = (m_TCMap->getTCPosition(m_TCId[ihit])).Z();
488
489 //------------------------------------
490 // To rearrange the hit map
491 //
492 // original converted
493 // (<- Theta) (<- Theta)
494 //
495 // 3 2 1 64 32 0
496 // 4 5 - 65 33 1
497 // 8 7 6 => 66 34 2
498 // 9 10 - 67 35 3
499 // .... ...
500 // 78 77 76 94 62 30
501 // 79 80 - 95 63 31
502 //
503 // Here, TCId-1 becomes TCId=0 and 1.
504 //------------------------------------
505 int iTCId0 = m_TCId[ihit] - 1;
506 int kkk = 0;
507 if (iTCId0 % 5 == 0) {
508 kkk = (iTCId0 / 5) * 2;
509 TCFire[kkk] = m_TCId[ihit];
510 TCFire[kkk + 1] = m_TCId[ihit];
511 } else {
512 kkk = iTCId0 / 5;
513 switch (iTCId0 % 5) {
514 case 1 :
515 TCFire[32 + 2 * kkk] = m_TCId[ihit]; break;
516 case 2 :
517 TCFire[64 + 2 * kkk] = m_TCId[ihit]; break;
518 case 3 :
519 TCFire[64 + 2 * kkk + 1] = m_TCId[ihit]; break;
520 case 4 :
521 TCFire[32 + 2 * kkk + 1] = m_TCId[ihit]; break;
522 default:
523 break;
524 }
525 }
526 }
527
528 for (int iii = 0 ; iii < 96 ; iii++) {
529 int icn_flag = 0;
530 if (iii < 32) {
531 if (iii % 2 == 1) {
532 continue;
533 }
534 }
535 for (int iinit = 0; iinit < 9; iinit ++)
536 m_TempCluster[iinit] = 0;
537 if (TCFire[iii] == 0)
538 continue;
539 // cppcheck-suppress knownConditionTrueFalse
540 if (iii < 32) { // most inner
541 if (iii == 0) {
542 m_TempCluster[0] = TCFire[iii];
543 m_TempCluster[1] = TCFire[30]; // top
544 m_TempCluster[2] = TCFire[63]; // left up
545 m_TempCluster[3] = TCFire[iii + 32] ; // left 1
546 m_TempCluster[4] = TCFire[iii + 33]; // left 2
547 m_TempCluster[5] = TCFire[iii + 34]; // left bottom
548 m_TempCluster[6] = TCFire[iii + 2]; // bottom
549 m_TempCluster[7] = 0;
550 m_TempCluster[8] = 0;
551
552 } else if (iii == 30) {
553 m_TempCluster[0] = TCFire[iii];
554 m_TempCluster[1] = TCFire[iii - 2]; // top
555 m_TempCluster[2] = TCFire[iii + 31]; // left up
556 m_TempCluster[3] = TCFire[iii + 32] ; // left 1
557 m_TempCluster[4] = TCFire[iii + 33]; // left 2
558 m_TempCluster[5] = TCFire[32]; // left bottom
559 m_TempCluster[6] = TCFire[0]; // bottom
560 m_TempCluster[7] = 0;
561 m_TempCluster[8] = 0;
562
563 } else {
564 m_TempCluster[0] = TCFire[iii];
565 m_TempCluster[1] = TCFire[iii - 2]; // top
566 m_TempCluster[2] = TCFire[iii + 31]; // left up
567 m_TempCluster[3] = TCFire[iii + 32] ; // left 1
568 m_TempCluster[4] = TCFire[iii + 33]; // left 2
569 m_TempCluster[5] = TCFire[iii + 34]; // left bottom
570 m_TempCluster[6] = TCFire[iii + 2]; // bottom
571 m_TempCluster[7] = 0;
572 m_TempCluster[8] = 0;
573
574 }
575 if (!(m_TempCluster[1] != 0 || (m_TempCluster[3] != 0 || m_TempCluster[4] != 0))) {
576 if (!(m_TempCluster[5] != 0 && m_TempCluster[6] != 0)) {
577 icn_flag = 1;
578
579
580 }
581 }
582
583 } else if (iii < 64) {
584 if (iii == 32) {
585 m_TempCluster[0] = TCFire[iii];
586 m_TempCluster[1] = TCFire[63]; // up
587 m_TempCluster[2] = TCFire[iii - 2]; // up right
588 m_TempCluster[3] = TCFire[iii - 32]; // right
589 m_TempCluster[4] = 0; //right bottom
590 m_TempCluster[5] = TCFire[iii + 1]; // bottom
591 m_TempCluster[6] = TCFire[iii + 33]; // left bottom
592 m_TempCluster[7] = TCFire[iii + 32]; // left
593 m_TempCluster[8] = TCFire[95]; // up left
594
595 } else if (iii == 33) {
596
597 m_TempCluster[0] = TCFire[iii];
598 m_TempCluster[1] = TCFire[iii - 1]; // up
599 m_TempCluster[2] = 0; // up right
600 m_TempCluster[3] = TCFire[iii - 32]; // right
601 m_TempCluster[4] = TCFire[iii - 30]; //right bottom
602 m_TempCluster[5] = TCFire[iii + 1]; // bottom
603 m_TempCluster[6] = TCFire[iii + 33]; // left bottom
604 m_TempCluster[7] = TCFire[iii + 32]; // left
605 m_TempCluster[8] = TCFire[iii + 31]; // up left
606
607 }
608
609 else if (iii == 62) {
610 m_TempCluster[0] = TCFire[iii];
611 m_TempCluster[1] = TCFire[iii - 1]; // up
612 m_TempCluster[2] = TCFire[iii - 34]; // up right
613 m_TempCluster[3] = TCFire[iii - 32]; // right
614 m_TempCluster[4] = 0; //right bottom
615 m_TempCluster[5] = TCFire[iii + 1]; // bottom
616 m_TempCluster[6] = TCFire[iii + 33]; // left bottom
617 m_TempCluster[7] = TCFire[iii + 32]; // left
618 m_TempCluster[8] = TCFire[iii + 31]; // up left
619
620
621 } else if (iii == 63) {
622 m_TempCluster[0] = TCFire[iii];
623 m_TempCluster[1] = TCFire[iii - 1]; // up
624 m_TempCluster[2] = 0; // up right
625 m_TempCluster[3] = TCFire[iii - 32]; // right
626 m_TempCluster[4] = TCFire[1]; //right bottom
627 m_TempCluster[5] = TCFire[32]; // bottom
628 m_TempCluster[6] = TCFire[64]; // left bottom
629 m_TempCluster[7] = TCFire[iii + 32]; // left
630 m_TempCluster[8] = TCFire[iii + 31]; // up left
631
632 }
633
634 else {
635
636 m_TempCluster[0] = TCFire[iii];
637 m_TempCluster[1] = TCFire[iii - 1]; // up
638 m_TempCluster[2] = TCFire[iii - 34]; // up right
639 m_TempCluster[3] = TCFire[iii - 32]; // right
640 m_TempCluster[4] = TCFire[iii - 30]; //right bottom
641 m_TempCluster[5] = TCFire[iii + 1]; // bottom
642 m_TempCluster[6] = TCFire[iii + 33]; // left bottom
643 m_TempCluster[7] = TCFire[iii + 32]; // left
644 m_TempCluster[8] = TCFire[iii + 31]; // up left
645 if (iii % 2 == 0) {
646 m_TempCluster[4] = 0;
647 } else {
648 m_TempCluster[2] = 0;
649 }
650 }
651 if (!(m_TempCluster[1] != 0 || m_TempCluster[7] != 0)) {
652 if (!(m_TempCluster[5] != 0 && m_TempCluster[6] != 0)) {
653 icn_flag = 1;
654 }
655 }
656
657 } else {
658 if (iii == 64) {
659 m_TempCluster[0] = TCFire[iii];
660 m_TempCluster[1] = TCFire[95]; // top
661 m_TempCluster[2] = TCFire[63];// right top
662 m_TempCluster[3] = TCFire[iii - 32]; //right
663 m_TempCluster[4] = TCFire[iii - 31]; //right bottom
664 m_TempCluster[5] = TCFire[iii + 1]; //bottom
665 m_TempCluster[6] = 0; //bottom left
666 m_TempCluster[7] = 0; // left
667 m_TempCluster[8] = 0; //top left
668 } else if (iii == 95) {
669 m_TempCluster[0] = TCFire[iii];
670 m_TempCluster[1] = TCFire[iii - 1]; // top
671 m_TempCluster[2] = TCFire[iii - 33]; // right top
672 m_TempCluster[3] = TCFire[iii - 32]; //right
673 m_TempCluster[4] = TCFire[32]; //right bottom
674 m_TempCluster[5] = TCFire[64]; //bottom
675 m_TempCluster[6] = 0; //bottom left
676 m_TempCluster[7] = 0; // left
677 m_TempCluster[8] = 0; //top left
678
679 } else {
680 m_TempCluster[0] = TCFire[iii];
681 m_TempCluster[1] = TCFire[iii - 1]; // top
682 m_TempCluster[2] = TCFire[iii - 33]; // right top
683 m_TempCluster[3] = TCFire[iii - 32]; //right
684 m_TempCluster[4] = TCFire[iii - 31]; //right bottom
685 m_TempCluster[5] = TCFire[iii + 1]; //bottom
686 m_TempCluster[6] = 0; //bottom left
687 m_TempCluster[7] = 0; // left
688 m_TempCluster[8] = 0; //top left
689 }
690 if (!(m_TempCluster[1] != 0 || m_TempCluster[7] != 0)) {
691 if (!(m_TempCluster[5] != 0 && m_TempCluster[6] != 0)) {
692 icn_flag = 1;
693
694 }
695 }
696
697
698 }
699
700 if (icn_flag == 1) {
701 TempICNTCId = TCFire[iii];
702
703 if (Method == 1) { //for cluster method2
704 int maxTCid = 0;
705 double maxTCEnergy = 0;
706 for (int iTC = 0; iTC < 9; iTC++) { //find center of Cluster
707 if (m_TempCluster[iTC] == 0) {continue;}
708 if (maxTCEnergy < TCFireEnergy[m_TempCluster[iTC] - 1]) {
709 maxTCEnergy = TCFireEnergy[m_TempCluster[iTC] - 1];
710 maxTCid = m_TempCluster[iTC];
711 }
712 }
713 m_TempCluster.resize(9, 0);
714 m_TempCluster[0] = maxTCid;
715 int kkk = (m_TempCluster[0] - 1) / 5;
716 if ((m_TempCluster[0] - 1) % 5 == 0) {
717 kkk = kkk * 2;
718 } else if ((m_TempCluster[0] - 1) % 5 == 1) {
719 kkk = 32 + 2 * kkk;
720 } else if ((m_TempCluster[0] - 1) % 5 == 2) {
721 kkk = 64 + 2 * kkk;
722 } else if ((m_TempCluster[0] - 1) % 5 == 3) {
723 kkk = 64 + 1 + 2 * kkk;
724 } else if ((m_TempCluster[0] - 1) % 5 == 4) {
725 kkk = 32 + 1 + 2 * kkk;
726 }
727
728 if (kkk < 32) { // most inner
729 if (kkk == 0) {
730 m_TempCluster[0] = TCFire[kkk];
731 m_TempCluster[1] = TCFire[30]; // top
732 m_TempCluster[2] = TCFire[63]; // left up
733 m_TempCluster[3] = TCFire[kkk + 32] ; // left 1
734 m_TempCluster[4] = TCFire[kkk + 33]; // left 2
735 m_TempCluster[5] = TCFire[kkk + 34]; // left bottom
736 m_TempCluster[6] = TCFire[kkk + 2]; // bottom
737 m_TempCluster[7] = 0;
738 m_TempCluster[8] = 0;
739
740 } else if (kkk == 30) {
741 m_TempCluster[0] = TCFire[kkk];
742 m_TempCluster[1] = TCFire[kkk - 2]; // top
743 m_TempCluster[2] = TCFire[kkk + 31]; // left up
744 m_TempCluster[3] = TCFire[kkk + 32] ; // left 1
745 m_TempCluster[4] = TCFire[kkk + 33]; // left 2
746 m_TempCluster[5] = TCFire[32]; // left bottom
747 m_TempCluster[6] = TCFire[0]; // bottom
748 m_TempCluster[7] = 0;
749 m_TempCluster[8] = 0;
750
751 } else {
752 m_TempCluster[0] = TCFire[kkk];
753 m_TempCluster[1] = TCFire[kkk - 2]; // top
754 m_TempCluster[2] = TCFire[kkk + 31]; // left up
755 m_TempCluster[3] = TCFire[kkk + 32] ; // left 1
756 m_TempCluster[4] = TCFire[kkk + 33]; // left 2
757 m_TempCluster[5] = TCFire[kkk + 34]; // left bottom
758 m_TempCluster[6] = TCFire[kkk + 2]; // bottom
759 m_TempCluster[7] = 0;
760 m_TempCluster[8] = 0;
761
762 }
763
764 } else if (kkk < 64) {
765 if (kkk == 32) {
766 m_TempCluster[0] = TCFire[kkk];
767 m_TempCluster[1] = TCFire[63]; // up
768 m_TempCluster[2] = TCFire[kkk - 2]; // up right
769 m_TempCluster[3] = TCFire[kkk - 32]; // right
770 m_TempCluster[4] = 0; //right bottom
771 m_TempCluster[5] = TCFire[kkk + 1]; // bottom
772 m_TempCluster[6] = TCFire[kkk + 33]; // left bottom
773 m_TempCluster[7] = TCFire[kkk + 32]; // left
774 m_TempCluster[8] = TCFire[95]; // up left
775
776 } else if (kkk == 33) {
777
778 m_TempCluster[0] = TCFire[kkk];
779 m_TempCluster[1] = TCFire[kkk - 1]; // up
780 m_TempCluster[2] = 0; // up right
781 m_TempCluster[3] = TCFire[kkk - 32]; // right
782 m_TempCluster[4] = TCFire[kkk - 30]; //right bottom
783 m_TempCluster[5] = TCFire[kkk + 1]; // bottom
784 m_TempCluster[6] = TCFire[kkk + 33]; // left bottom
785 m_TempCluster[7] = TCFire[kkk + 32]; // left
786 m_TempCluster[8] = TCFire[kkk + 31]; // up left
787
788 }
789
790 else if (kkk == 62) {
791 m_TempCluster[0] = TCFire[kkk];
792 m_TempCluster[1] = TCFire[kkk - 1]; // up
793 m_TempCluster[2] = TCFire[kkk - 34]; // up right
794 m_TempCluster[3] = TCFire[kkk - 32]; // right
795 m_TempCluster[4] = 0; //right bottom
796 m_TempCluster[5] = TCFire[kkk + 1]; // bottom
797 m_TempCluster[6] = TCFire[kkk + 33]; // left bottom
798 m_TempCluster[7] = TCFire[kkk + 32]; // left
799 m_TempCluster[8] = TCFire[kkk + 31]; // up left
800
801
802 } else if (kkk == 63) {
803 m_TempCluster[0] = TCFire[kkk];
804 m_TempCluster[1] = TCFire[kkk - 1]; // up
805 m_TempCluster[2] = 0; // up right
806 m_TempCluster[3] = TCFire[kkk - 32]; // right
807 m_TempCluster[4] = TCFire[1]; //right bottom
808 m_TempCluster[5] = TCFire[32]; // bottom
809 m_TempCluster[6] = TCFire[64]; // left bottom
810 m_TempCluster[7] = TCFire[kkk + 32]; // left
811 m_TempCluster[8] = TCFire[kkk + 31]; // up left
812
813 }
814
815 else {
816 m_TempCluster[0] = TCFire[kkk];
817 m_TempCluster[1] = TCFire[kkk - 1]; // up
818 m_TempCluster[2] = TCFire[kkk - 34]; // up right
819 m_TempCluster[3] = TCFire[kkk - 32]; // right
820 m_TempCluster[4] = TCFire[kkk - 30]; //right bottom
821 m_TempCluster[5] = TCFire[kkk + 1]; // bottom
822 m_TempCluster[6] = TCFire[kkk + 33]; // left bottom
823 m_TempCluster[7] = TCFire[kkk + 32]; // left
824 m_TempCluster[8] = TCFire[kkk + 31]; // up left
825 if (kkk % 2 == 0) {
826 m_TempCluster[4] = 0;
827 } else {
828 m_TempCluster[2] = 0;
829 }
830
831 }
832
833
834
835 } else {
836 if (kkk == 64) {
837 m_TempCluster[0] = TCFire[kkk];
838 m_TempCluster[1] = TCFire[95]; // top
839 m_TempCluster[2] = TCFire[63];// right top
840 m_TempCluster[3] = TCFire[kkk - 32]; //right
841 m_TempCluster[4] = TCFire[kkk - 31]; //right bottom
842 m_TempCluster[5] = TCFire[kkk + 1]; //bottom
843 m_TempCluster[6] = 0; //bottom left
844 m_TempCluster[7] = 0; // left
845 m_TempCluster[8] = 0; //top left
846 } else if (kkk == 95) {
847 m_TempCluster[0] = TCFire[kkk];
848 m_TempCluster[1] = TCFire[kkk - 1]; // top
849 m_TempCluster[2] = TCFire[kkk - 33]; // right top
850 m_TempCluster[3] = TCFire[kkk - 32]; //right
851 m_TempCluster[4] = TCFire[32]; //right bottom
852 m_TempCluster[5] = TCFire[64]; //bottom
853 m_TempCluster[6] = 0; //bottom left
854 m_TempCluster[7] = 0; // left
855 m_TempCluster[8] = 0; //top left
856
857 } else {
858 m_TempCluster[0] = TCFire[kkk];
859 m_TempCluster[1] = TCFire[kkk - 1]; // top
860 m_TempCluster[2] = TCFire[kkk - 33]; // right top
861 m_TempCluster[3] = TCFire[kkk - 32]; //right
862 m_TempCluster[4] = TCFire[kkk - 31]; //right bottom
863 m_TempCluster[5] = TCFire[kkk + 1]; //bottom
864 m_TempCluster[6] = 0; //bottom left
865 m_TempCluster[7] = 0; // left
866 m_TempCluster[8] = 0; //top left
867 }
868
869 }
870 }
871 for (int iNearTC = 1; iNearTC < 9; iNearTC ++) {
872 for (int jNearTC = 1; jNearTC < 9; jNearTC ++) {
873 if (m_TempCluster[iNearTC] == 0) {continue;}
874 if (iNearTC == jNearTC)continue;
875 if (m_TempCluster[iNearTC] == m_TempCluster[jNearTC]) {
876 m_TempCluster[jNearTC] = 0;
877 }
878 }
879 }
880
881 int maxTCId = 999;
882 double clusterenergy = 0;
883 double clustertiming = 0;
884 double clusterpositionX = 0;
885 double clusterpositionY = 0;
886 double clusterpositionZ = 0;
887 int noftcincluster = 0;
888 for (int iNearTC = 0; iNearTC < 9; iNearTC ++) {
889 if (m_TempCluster[iNearTC] == 0) {continue;}
890 else {noftcincluster++;}
891 clusterenergy += TCFireEnergy[m_TempCluster[iNearTC] - 1];
892 clustertiming += TCFireEnergy[m_TempCluster[iNearTC] - 1] * TCFireTiming[m_TempCluster[iNearTC] - 1];
893 clusterpositionX += TCFireEnergy[m_TempCluster[iNearTC] - 1] * TCFirePosition[m_TempCluster[iNearTC] - 1][0];
894 clusterpositionY += TCFireEnergy[m_TempCluster[iNearTC] - 1] * TCFirePosition[m_TempCluster[iNearTC] - 1][1];
895 clusterpositionZ += TCFireEnergy[m_TempCluster[iNearTC] - 1] * TCFirePosition[m_TempCluster[iNearTC] - 1][2];
896
897 }
898 //
899 maxTCId = m_TempCluster[0];
900 //
901
902 clustertiming /= clusterenergy;
903 if (m_Position == 1) {
904 clusterpositionX /= clusterenergy;
905 clusterpositionY /= clusterenergy;
906 clusterpositionZ /= clusterenergy;
907 } else if (m_Position == 0) {
908 clustertiming = TCFireTiming[maxTCId - 1];
909 clusterpositionX = TCFirePosition[maxTCId - 1][0];
910 clusterpositionY = TCFirePosition[maxTCId - 1][1];
911 clusterpositionZ = TCFirePosition[maxTCId - 1][2];
912 }
913 if (clustertiming == 0 && clusterenergy == 0) {continue;}
914
915 TempClusterEnergy.push_back(clusterenergy);
916 TempClusterTiming.push_back(clustertiming);
917 TempClusterPositionX.push_back(clusterpositionX);
918 TempClusterPositionY.push_back(clusterpositionY);
919 TempClusterPositionZ.push_back(clusterpositionZ);
920 TempNofTCinCluster.push_back(noftcincluster);
921 TempMaxTCId.push_back(maxTCId);
922
923 Sort1D.push_back(TempICNTCId);
924 Sort1D.push_back(clusterenergy);
925 Sort1D.push_back(clustertiming);
926 Sort1D.push_back(clusterpositionX);
927 Sort1D.push_back(clusterpositionY);
928 Sort1D.push_back(clusterpositionZ);
929 Sort1D.push_back(noftcincluster);
930 Sort1D.push_back(maxTCId);
931
932 Sort2D.push_back(Sort1D);
933 Sort1D.clear();
934
935 }
936
937 }
938
939 // Sorting in the order of TC Id
940
941 sort(Sort2D.begin(), Sort2D.end(),
942 [](const vector<double>& aa1, const vector<double>& aa2) {return aa1[0] < aa2[0];});
943
944 const int clustersize = Sort2D.size();
945 for (int jtc = 0; jtc < clustersize; jtc++) {
946
947 m_ClusterEnergy[1].push_back(Sort2D[jtc][1]);
948 m_ClusterTiming[1].push_back(Sort2D[jtc][2]);
949 m_ClusterPositionX[1].push_back(Sort2D[jtc][3]);
950 m_ClusterPositionY[1].push_back(Sort2D[jtc][4]);
951 m_ClusterPositionZ[1].push_back(Sort2D[jtc][5]);
952 m_NofTCinCluster[1].push_back(Sort2D[jtc][6]);
953 m_MaxTCId[1].push_back(Sort2D[jtc][7]);
954 }
955
956 m_FWDNofCluster = m_MaxTCId[1].size();
957}
958//
959//
960//
962{
963 std::vector<int> TCFire;
964 std::vector<double> TCFireEnergy;
965 std::vector<double> TCFireTiming;
966 std::vector<std::vector<double>> TCFirePosition;
967
968
969 std::vector<double> TempClusterEnergy;
970 std::vector<double> TempClusterTiming;
971 std::vector<double> TempClusterPositionX;
972 std::vector<double> TempClusterPositionY;
973 std::vector<double> TempClusterPositionZ;
974 std::vector<int> TempNofTCinCluster;
975 std::vector<int> TempMaxTCId;
976
977 std::vector<double> Sort1D;
978 std::vector<std::vector<double>> Sort2D;
979
980 int TempICNTCId = 0;
981
982 TempClusterEnergy.clear();
983 TempClusterTiming.clear();
984 TempClusterPositionX.clear();
985 TempClusterPositionY.clear();
986 TempClusterPositionZ.clear();
987 TempNofTCinCluster.clear();
988 TempMaxTCId.clear();
989 Sort1D.clear();
990 Sort2D.clear();
991
992 TCFire.clear();
993 TCFireEnergy.clear();
994 TCFireTiming.clear();
995 TCFirePosition.clear();
996
997 TCFire.resize(64, 0);
998 TCFireEnergy.resize(64, 0.);
999 TCFireTiming.resize(64, 0.);
1000 TCFirePosition.resize(64, std::vector<double>(3, 0.));
1001
1002 const int hit_size = m_TCId.size();
1003 for (int ihit = 0 ; ihit < hit_size ; ihit++) {
1004 if (m_TCId[ihit] < 513) {continue;}
1005 TCFireEnergy[m_TCId[ihit] - 513] = m_Energy[ihit];
1006 TCFireTiming[m_TCId[ihit] - 513] = m_Timing[ihit];
1007 TCFirePosition[m_TCId[ihit] - 513][0] = (m_TCMap->getTCPosition(m_TCId[ihit])).X();
1008 TCFirePosition[m_TCId[ihit] - 513][1] = (m_TCMap->getTCPosition(m_TCId[ihit])).Y();
1009 TCFirePosition[m_TCId[ihit] - 513][2] = (m_TCMap->getTCPosition(m_TCId[ihit])).Z();
1010
1011 //------------------------------------
1012 // To rearrange the hit map
1013 //
1014 // original converted
1015 // (<- Theta) (<- Theta)
1016 //
1017 // 516 515 32 0
1018 // 513 514 33 1
1019 // 520 519 => 34 2
1020 // 517 518 35 3
1021 // ... .
1022 // 576 575 62 30
1023 // 573 574 63 31
1024 //
1025 // Here, TCId-1 becomes TCId=0 and 1.
1026 //------------------------------------
1027 int iTCId0 = m_TCId[ihit] - 1;
1028 int kkk = 0;
1029 if ((iTCId0 - 512) % 4 == 2) {
1030 kkk = (iTCId0 - 512) / 2 - 1;
1031 }
1032 if ((iTCId0 - 512) % 4 == 1) {
1033 kkk = ((iTCId0 - 512) + 1) / 2;
1034 }
1035 if ((iTCId0 - 512) % 4 == 3) {
1036 kkk = 32 + ((iTCId0 - 512) - 3) / 2;
1037 }
1038 if ((iTCId0 - 512) % 4 == 0) {
1039 kkk = 33 + ((iTCId0 - 512)) / 2;
1040 }
1041
1042 TCFire[kkk] = iTCId0 + 1;
1043
1044 }
1045
1046
1047 for (int iii = 0 ; iii < 64 ; iii ++) {
1048
1049 if (TCFire[iii] == 0) { continue; }
1050
1051 for (int iinit = 0; iinit < 9; iinit ++) {m_TempCluster[iinit] = 0;}
1052 if (iii < 32) {
1053 if (iii == 0) {
1054 m_TempCluster[0] = TCFire[ 0];
1055 m_TempCluster[1] = TCFire[31]; // top
1056 m_TempCluster[2] = 0;// right top
1057 m_TempCluster[3] = 0; //right
1058 m_TempCluster[4] = 0; //right bottom
1059 m_TempCluster[5] = TCFire[ 1]; // bottom
1060 m_TempCluster[6] = TCFire[33]; // bottom left
1061 m_TempCluster[7] = TCFire[32]; // left
1062 m_TempCluster[8] = TCFire[63]; // top left
1063 } else if (iii == 31) {
1064 m_TempCluster[0] = TCFire[31];
1065 m_TempCluster[1] = TCFire[30];
1066 m_TempCluster[2] = 0;// right top
1067 m_TempCluster[3] = 0; //right
1068 m_TempCluster[4] = 0; //right bottom
1069 m_TempCluster[5] = TCFire[0]; //bottom
1070 m_TempCluster[6] = TCFire[32]; // bottom left
1071 m_TempCluster[7] = TCFire[63]; // left
1072 m_TempCluster[8] = TCFire[62]; //top left
1073 } else {
1074 m_TempCluster[0] = TCFire[iii];
1075 m_TempCluster[1] = TCFire[iii - 1]; // top
1076 m_TempCluster[2] = 0;// right top
1077 m_TempCluster[3] = 0; //right
1078 m_TempCluster[4] = 0; //right bottom
1079 m_TempCluster[5] = TCFire[iii + 1]; //bottom
1080 m_TempCluster[6] = TCFire[iii + 33]; //bottom left
1081 m_TempCluster[7] = TCFire[iii + 32]; // left
1082 m_TempCluster[8] = TCFire[iii + 31]; //top left
1083 }
1084 } else {
1085 if (iii == 32) {
1086 m_TempCluster[0] = TCFire[32];
1087 m_TempCluster[1] = TCFire[63]; // top
1088 m_TempCluster[2] = TCFire[31];// right top
1089 m_TempCluster[3] = TCFire[0]; //right
1090 m_TempCluster[4] = TCFire[1]; //right bottom
1091 m_TempCluster[5] = TCFire[33]; //bottom
1092 m_TempCluster[6] = 0; //bottom left
1093 m_TempCluster[7] = 0; // left
1094 m_TempCluster[8] = 0; //top left
1095 } else if (iii == 63) {
1096 m_TempCluster[0] = TCFire[63];
1097 m_TempCluster[1] = TCFire[62]; // top
1098 m_TempCluster[2] = TCFire[30];// right top
1099 m_TempCluster[3] = TCFire[31]; //right
1100 m_TempCluster[4] = TCFire[0]; //right bottom
1101 m_TempCluster[5] = TCFire[32]; //bottom
1102 m_TempCluster[6] = 0; //bottom left
1103 m_TempCluster[7] = 0; // left
1104 m_TempCluster[8] = 0; //top left
1105 } else {
1106 m_TempCluster[0] = TCFire[iii];
1107 m_TempCluster[1] = TCFire[iii - 1]; // top
1108 m_TempCluster[2] = TCFire[iii - 33]; // right top
1109 m_TempCluster[3] = TCFire[iii - 32]; //right
1110 m_TempCluster[4] = TCFire[iii - 31]; //right bottom
1111 m_TempCluster[5] = TCFire[iii + 1]; //bottom
1112 m_TempCluster[6] = 0; //bottom left
1113 m_TempCluster[7] = 0; // left
1114 m_TempCluster[8] = 0; //top left
1115 }
1116
1117 }
1118
1119 if (!(m_TempCluster[1] != 0 || m_TempCluster[7] != 0)) {
1120 if (!(m_TempCluster[5] != 0 && m_TempCluster[6] != 0)) {
1121 TempICNTCId = TCFire[iii];
1122
1123 if (Method == 1) {
1124 int maxTCid = 0;
1125 double maxTCEnergy = 0;
1126 for (int iTC = 0; iTC < 9; iTC++) { //find center of Cluster
1127 if (m_TempCluster[iTC] == 0) {continue;}
1128 if (maxTCEnergy < TCFireEnergy[m_TempCluster[iTC] - 513]) {
1129 maxTCEnergy = TCFireEnergy[m_TempCluster[iTC] - 513];
1130 maxTCid = m_TempCluster[iTC];
1131 }
1132 }
1133 int kkk = 0;
1134 m_TempCluster[0] = maxTCid;
1135 if ((m_TempCluster[0] - 513) % 4 == 2) {
1136 kkk = (m_TempCluster[0] - 513) / 2 - 1;
1137 }
1138 if ((m_TempCluster[0] - 513) % 4 == 1) {
1139 kkk = ((m_TempCluster[0] - 513) + 1) / 2;
1140 }
1141 if ((m_TempCluster[0] - 513) % 4 == 3) {
1142 kkk = 32 + ((m_TempCluster[0] - 513) - 3) / 2;
1143 }
1144 if ((m_TempCluster[0] - 513) % 4 == 0) {
1145 kkk = 33 + ((m_TempCluster[0] - 513)) / 2;
1146 }
1147
1148 if (kkk < 32) {
1149 if (kkk == 0) {
1150 m_TempCluster[0] = TCFire[ 0];
1151 m_TempCluster[1] = TCFire[31]; // top
1152 m_TempCluster[2] = 0;// right top
1153 m_TempCluster[3] = 0; //right
1154 m_TempCluster[4] = 0; //right bottom
1155 m_TempCluster[5] = TCFire[ 1]; // bottom
1156 m_TempCluster[6] = TCFire[33]; // bottom left
1157 m_TempCluster[7] = TCFire[32]; // left
1158 m_TempCluster[8] = TCFire[63]; // top left
1159 } else if (kkk == 31) {
1160 m_TempCluster[0] = TCFire[31];
1161 m_TempCluster[1] = TCFire[30];
1162 m_TempCluster[2] = 0;// right top
1163 m_TempCluster[3] = 0; //right
1164 m_TempCluster[4] = 0; //right bottom
1165 m_TempCluster[5] = TCFire[0]; //bottom
1166 m_TempCluster[6] = TCFire[32]; // bottom left
1167 m_TempCluster[7] = TCFire[63]; // left
1168 m_TempCluster[8] = TCFire[62]; //top left
1169 } else {
1170 m_TempCluster[0] = TCFire[kkk];
1171 m_TempCluster[1] = TCFire[kkk - 1]; // top
1172 m_TempCluster[2] = 0;// right top
1173 m_TempCluster[3] = 0; //right
1174 m_TempCluster[4] = 0; //right bottom
1175 m_TempCluster[5] = TCFire[kkk + 1]; //bottom
1176 m_TempCluster[6] = TCFire[kkk + 33]; //bottom left
1177 m_TempCluster[7] = TCFire[kkk + 32]; // left
1178 m_TempCluster[8] = TCFire[kkk + 31]; //top left
1179 }
1180 } else {
1181 if (kkk == 32) {
1182 m_TempCluster[0] = TCFire[32];
1183 m_TempCluster[1] = TCFire[63]; // top
1184 m_TempCluster[2] = TCFire[31];// right top
1185 m_TempCluster[3] = TCFire[0]; //right
1186 m_TempCluster[4] = TCFire[1]; //right bottom
1187 m_TempCluster[5] = TCFire[33]; //bottom
1188 m_TempCluster[6] = 0; //bottom left
1189 m_TempCluster[7] = 0; // left
1190 m_TempCluster[8] = 0; //top left
1191 } else if (kkk == 63) {
1192 m_TempCluster[0] = TCFire[63];
1193 m_TempCluster[1] = TCFire[62]; // top
1194 m_TempCluster[2] = TCFire[30];// right top
1195 m_TempCluster[3] = TCFire[31]; //right
1196 m_TempCluster[4] = TCFire[0]; //right bottom
1197 m_TempCluster[5] = TCFire[32]; //bottom
1198 m_TempCluster[6] = 0; //bottom left
1199 m_TempCluster[7] = 0; // left
1200 m_TempCluster[8] = 0; //top left
1201 } else {
1202 m_TempCluster[0] = TCFire[kkk];
1203 m_TempCluster[1] = TCFire[kkk - 1]; // top
1204 m_TempCluster[2] = TCFire[kkk - 33]; // right top
1205 m_TempCluster[3] = TCFire[kkk - 32]; //right
1206 m_TempCluster[4] = TCFire[kkk - 31]; //right bottom
1207 m_TempCluster[5] = TCFire[kkk + 1]; //bottom
1208 m_TempCluster[6] = 0; //bottom left
1209 m_TempCluster[7] = 0; // left
1210 m_TempCluster[8] = 0; //top left
1211 }
1212
1213 }
1214 }
1215
1216 for (int iNearTC = 1; iNearTC < 9; iNearTC ++) {
1217 for (int jNearTC = 1; jNearTC < 9; jNearTC ++) {
1218 if (m_TempCluster[iNearTC] == 0) {continue;}
1219 if (iNearTC == jNearTC) {continue;}
1220 if (m_TempCluster[iNearTC] == m_TempCluster[jNearTC]) {
1221 m_TempCluster[jNearTC] = 0;
1222 }
1223 }
1224 }
1225
1226 int maxTCId = 999;
1227 double clusterenergy = 0;
1228 double clustertiming = 0;
1229 double clusterpositionX = 0;
1230 double clusterpositionY = 0;
1231 double clusterpositionZ = 0;
1232 int noftcincluster = 0;
1233 for (int iNearTC = 0; iNearTC < 9; iNearTC ++) {
1234 if (m_TempCluster[iNearTC] == 0) {continue;}
1235 else {noftcincluster++;}
1236
1237 clusterenergy += TCFireEnergy[m_TempCluster[iNearTC] - 513];
1238 clustertiming += TCFireEnergy[m_TempCluster[iNearTC] - 513] * TCFireTiming[m_TempCluster[iNearTC] - 513];
1239 clusterpositionX += TCFireEnergy[m_TempCluster[iNearTC] - 513] * TCFirePosition[m_TempCluster[iNearTC] - 513][0];
1240 clusterpositionY += TCFireEnergy[m_TempCluster[iNearTC] - 513] * TCFirePosition[m_TempCluster[iNearTC] - 513][1];
1241 clusterpositionZ += TCFireEnergy[m_TempCluster[iNearTC] - 513] * TCFirePosition[m_TempCluster[iNearTC] - 513][2];
1242
1243
1244 }
1245 //
1246 maxTCId = m_TempCluster[0];
1247 //
1248
1249 clustertiming /= clusterenergy;
1250 if (m_Position == 1) {
1251 clusterpositionX /= clusterenergy;
1252 clusterpositionY /= clusterenergy;
1253 clusterpositionZ /= clusterenergy;
1254 } else if (m_Position == 0) {
1255 clustertiming = TCFireTiming[maxTCId - 513];
1256 clusterpositionX = TCFirePosition[maxTCId - 513][0];
1257 clusterpositionY = TCFirePosition[maxTCId - 513][1];
1258 clusterpositionZ = TCFirePosition[maxTCId - 513][2];
1259 }
1260
1261 if (clustertiming == 0 && clusterenergy == 0) {continue;}
1262 TempClusterEnergy.push_back(clusterenergy);
1263 TempClusterTiming.push_back(clustertiming);
1264 TempClusterPositionX.push_back(clusterpositionX);
1265 TempClusterPositionY.push_back(clusterpositionY);
1266 TempClusterPositionZ.push_back(clusterpositionZ);
1267 TempNofTCinCluster.push_back(noftcincluster);
1268 TempMaxTCId.push_back(maxTCId);
1269
1270
1271 Sort1D.push_back(TempICNTCId);
1272 Sort1D.push_back(clusterenergy);
1273 Sort1D.push_back(clustertiming);
1274 Sort1D.push_back(clusterpositionX);
1275 Sort1D.push_back(clusterpositionY);
1276 Sort1D.push_back(clusterpositionZ);
1277 Sort1D.push_back(noftcincluster);
1278 Sort1D.push_back(maxTCId);
1279
1280 Sort2D.push_back(Sort1D);
1281 Sort1D.clear();
1282
1283
1284 }
1285 }
1286 }
1287
1288 sort(Sort2D.begin(), Sort2D.end(),
1289 [](const vector<double>& aa1, const vector<double>& aa2) {return aa1[0] < aa2[0];});
1290
1291 const int clustersize = Sort2D.size();
1292 for (int jtc = 0; jtc < clustersize; jtc++) {
1293 m_ClusterEnergy[2].push_back(Sort2D[jtc][1]);
1294 m_ClusterTiming[2].push_back(Sort2D[jtc][2]);
1295 m_ClusterPositionX[2].push_back(Sort2D[jtc][3]);
1296 m_ClusterPositionY[2].push_back(Sort2D[jtc][4]);
1297 m_ClusterPositionZ[2].push_back(Sort2D[jtc][5]);
1298 m_NofTCinCluster[2].push_back(Sort2D[jtc][6]);
1299 m_MaxTCId[2].push_back(Sort2D[jtc][7]);
1300 }
1301
1302 m_BWDNofCluster = m_MaxTCId[2].size();
1303}
1304//
1305//
1306//
1307int
1309{
1310
1311 std::vector<int> TCFire;
1312
1313 TCFire.clear();
1314
1315 TCFire.resize(432, 0);
1316
1317 const int hit_size = m_TCId.size();
1318 for (int ihit = 0 ; ihit < hit_size ; ihit++) {
1319 if (m_TCId[ihit] >= 81 && m_TCId[ihit] <= 512) {
1320 TCFire[m_TCId[ihit] - 81] = m_TCId[ihit];
1321 }
1322 }
1323 //
1324 //
1325 //
1326 int tc_upper = 0; // check upper TC
1327 int tc_upper_right = 0; // check right TC
1328 int tc_right = 0; // check right TC
1329 int tc_lower_right = 0;
1330 int tc_lower = 0; // check lower TC
1331 int tc_lower_left = 0; // check lower TC
1332 int tc_left = 0;
1333 int tc_upper_left = 0;
1334
1335 for (int iii = 0 ; iii < 432 ; iii++) {
1336 if (TCFire[iii] == 0) { continue; }
1337
1338 setBarrelICNsub(iii,
1339 TCFire,
1340 tc_upper,
1341 tc_upper_right,
1342 tc_right,
1343 tc_lower_right,
1344 tc_lower,
1345 tc_lower_left,
1346 tc_left,
1347 tc_upper_left);
1348
1349 if (!(tc_upper != 0 || tc_left != 0)) {
1350 if (!(tc_lower != 0 && tc_lower_left != 0)) {
1351 m_BRICN++;
1352 int phiid = m_TCMap->getTCPhiIdFromTCId(iii + 80 + 1);
1353
1354 if (phiid == 36 || (phiid > 0 && phiid < 11)) {
1355 m_Quadrant[1][0]++;
1356 }
1357 if (phiid > 8 && phiid < 20) {
1358 m_Quadrant[1][1]++;
1359 }
1360 if (phiid > 17 && phiid < 29) {
1361 m_Quadrant[1][2]++;
1362 }
1363 if ((phiid > 26 && phiid < 37) || phiid == 1) {
1364 m_Quadrant[1][3]++;
1365 }
1366
1367 }
1368 }// iii loop
1369 }
1370 return m_BRICN;
1371
1372}
1373//
1374//
1375//
1376void
1378 std::vector<int> TCFire,
1379 int& tc_upper,
1380 int& tc_upper_right,
1381 int& tc_right,
1382 int& tc_lower_right,
1383 int& tc_lower,
1384 int& tc_lower_left,
1385 int& tc_left,
1386 int& tc_upper_left)
1387{
1388 // take into account TCId jump at boundary between FAM-9 and FAM-44
1389 int offset_upper = 0;
1390 int offset_lower = 0;
1391 if (iii <= 11) {
1392 // FAM-9
1393 offset_upper = 432;
1394 offset_lower = 0;
1395 } else if (iii <= 419) {
1396 // FAM-10 to FAM-43
1397 offset_upper = 0;
1398 offset_lower = 0;
1399 } else {
1400 // FAM-44
1401 offset_upper = 0;
1402 offset_lower = -432;
1403 }
1404
1405 // take into account TC at boundary near endcaps
1406 if (iii % 12 == 0) {
1407 // TC at most forward side
1408 tc_upper = TCFire[iii - 12 + offset_upper];
1409 tc_upper_right = 0;
1410 tc_right = 0;
1411 tc_lower_right = 0;
1412 tc_lower = TCFire[iii + 12 + offset_lower];
1413 tc_lower_left = TCFire[iii + 13 + offset_lower];
1414 tc_left = TCFire[iii + 1];
1415 tc_upper_left = TCFire[iii - 11 + offset_upper];
1416 } else if (iii % 12 == 11) {
1417 // TC at most backward side
1418 tc_upper = TCFire[iii - 12 + offset_upper];
1419 tc_upper_right = TCFire[iii - 13 + offset_upper];
1420 tc_right = TCFire[iii - 1];
1421 tc_lower_right = TCFire[iii + 11 + offset_lower];
1422 tc_lower = TCFire[iii + 12 + offset_lower];
1423 tc_lower_left = 0;
1424 tc_left = 0;
1425 tc_upper_left = 0;
1426 } else {
1427 tc_upper = TCFire[iii - 12 + offset_upper];
1428 tc_upper_right = TCFire[iii - 13 + offset_upper];
1429 tc_right = TCFire[iii - 1];
1430 tc_lower_right = TCFire[iii + 11 + offset_lower];
1431 tc_lower = TCFire[iii + 12 + offset_lower];
1432 tc_lower_left = TCFire[iii + 13 + offset_lower];
1433 tc_left = TCFire[iii + 1];
1434 tc_upper_left = TCFire[iii - 11 + offset_upper];
1435 }
1436
1437 m_TempCluster[0] = iii + 80 + 1; //middle of ICN
1438 m_TempCluster[1] = tc_upper; // upper
1439 m_TempCluster[2] = tc_upper_right; //right
1440 m_TempCluster[3] = tc_right; //right
1441 m_TempCluster[4] = tc_lower_right; //lower
1442 m_TempCluster[5] = tc_lower; //lower
1443 m_TempCluster[6] = tc_lower_left; //lower
1444 m_TempCluster[7] = tc_left; //lower
1445 m_TempCluster[8] = tc_upper_left; //lower right;
1446}
1447//
1448//
1449//
1450int
1452{
1453
1454 std::vector<int> TCFire;
1455
1456
1457 TCFire.clear();
1458
1459 TCFire.resize(96, 0);
1460
1461
1462 const int hit_size = m_TCId.size();
1463 for (int ihit = 0 ; ihit < hit_size ; ihit++) {
1464 if (m_TCId[ihit] > 80) {continue;}
1465
1466
1467 //------------------------------------
1468 // To rearrange the hit map
1469 //
1470 // original converted
1471 // (<- Theta) (<- Theta)
1472 //
1473 // 3 2 1 64 32 0
1474 // 4 5 - 65 33 1
1475 // 8 7 6 => 66 34 2
1476 // 9 10 - 67 35 3
1477 // .... ...
1478 // 78 77 76 94 62 30
1479 // 79 80 - 95 63 31
1480 //
1481 // Here, TCId-1 becomes TCId=0 and 1.
1482 //------------------------------------
1483 int iTCId0 = m_TCId[ihit] - 1;
1484 int kkk = 0;
1485 if (iTCId0 % 5 == 0) {
1486 kkk = (iTCId0 / 5) * 2;
1487 TCFire[kkk] = m_TCId[ihit];
1488 TCFire[kkk + 1] = m_TCId[ihit];
1489 } else {
1490 kkk = iTCId0 / 5;
1491 switch (iTCId0 % 5) {
1492 case 1 :
1493 TCFire[32 + 2 * kkk] = m_TCId[ihit]; break;
1494 case 2 :
1495 TCFire[64 + 2 * kkk] = m_TCId[ihit]; break;
1496 case 3 :
1497 TCFire[64 + 2 * kkk + 1] = m_TCId[ihit]; break;
1498 case 4 :
1499 TCFire[32 + 2 * kkk + 1] = m_TCId[ihit]; break;
1500 default:
1501 break;
1502 }
1503 }
1504 }
1505
1506
1507 for (int iii = 32 ; iii < 96 ; iii++) {
1508 for (int iinit = 0; iinit < 9; iinit ++) {m_TempCluster[iinit] = 0;}
1509 if (TCFire[iii] == 0) { continue; }
1510 if (iii < 64) {
1511 if (iii == 32) {
1512 m_TempCluster[0] = TCFire[iii];
1513 m_TempCluster[1] = TCFire[63]; // top
1514 m_TempCluster[2] = 0;// right top
1515 m_TempCluster[3] = 0; //right
1516 m_TempCluster[4] = 0; //right bottom
1517 m_TempCluster[5] = TCFire[iii + 1]; //bottom
1518 m_TempCluster[6] = TCFire[iii + 33]; //bottom left
1519 m_TempCluster[7] = TCFire[iii + 32]; // left
1520 m_TempCluster[8] = TCFire[95]; //top left
1521 } else if (iii == 63) {
1522 m_TempCluster[0] = TCFire[iii];
1523 m_TempCluster[1] = TCFire[iii - 1]; // top
1524 m_TempCluster[2] = 0; // right top
1525 m_TempCluster[3] = 0; //right
1526 m_TempCluster[4] = 0; //right bottom
1527 m_TempCluster[5] = TCFire[32]; //bottom
1528 m_TempCluster[6] = TCFire[64]; //bottom left
1529 m_TempCluster[7] = TCFire[iii + 32]; // left
1530 m_TempCluster[8] = TCFire[iii + 31]; //top left
1531 } else {
1532 m_TempCluster[0] = TCFire[iii];
1533 m_TempCluster[1] = TCFire[iii - 1]; // top
1534 m_TempCluster[2] = 0; // right top
1535 m_TempCluster[3] = 0; //right
1536 m_TempCluster[4] = 0; //right bottom
1537 m_TempCluster[5] = TCFire[iii + 1]; //bottom
1538 m_TempCluster[6] = TCFire[iii + 33]; //bottom left
1539 m_TempCluster[7] = TCFire[iii + 32]; // left
1540 m_TempCluster[8] = TCFire[iii + 31]; //top left
1541 }
1542 } else {
1543 if (iii == 64) {
1544 m_TempCluster[0] = TCFire[iii];
1545 m_TempCluster[1] = TCFire[95]; // top
1546 m_TempCluster[2] = TCFire[63];// right top
1547 m_TempCluster[3] = TCFire[iii - 32]; //right
1548 m_TempCluster[4] = TCFire[iii - 31]; //right bottom
1549 m_TempCluster[5] = TCFire[iii + 1]; //bottom
1550 m_TempCluster[6] = 0; //bottom left
1551 m_TempCluster[7] = 0; // left
1552 m_TempCluster[8] = 0; //top left
1553 } else if (iii == 95) {
1554 m_TempCluster[0] = TCFire[iii];
1555 m_TempCluster[1] = TCFire[iii - 1]; // top
1556 m_TempCluster[2] = TCFire[iii - 33]; // right top
1557 m_TempCluster[3] = TCFire[iii - 32]; //right
1558 m_TempCluster[4] = TCFire[32]; //right bottom
1559 m_TempCluster[5] = TCFire[64]; //bottom
1560 m_TempCluster[6] = 0; //bottom left
1561 m_TempCluster[7] = 0; // left
1562 m_TempCluster[8] = 0; //top left
1563
1564 } else {
1565 m_TempCluster[0] = TCFire[iii];
1566 m_TempCluster[1] = TCFire[iii - 1]; // top
1567 m_TempCluster[2] = TCFire[iii - 33]; // right top
1568 m_TempCluster[3] = TCFire[iii - 32]; //right
1569 m_TempCluster[4] = TCFire[iii - 31]; //right bottom
1570 m_TempCluster[5] = TCFire[iii + 1]; //bottom
1571 m_TempCluster[6] = 0; //bottom left
1572 m_TempCluster[7] = 0; // left
1573 m_TempCluster[8] = 0; //top left
1574 }
1575
1576 }
1577 if (!(m_TempCluster[1] != 0 || m_TempCluster[7] != 0)) {
1578 if (!(m_TempCluster[5] != 0 && m_TempCluster[6] != 0)) {
1579 m_FWDICN++;
1580 int phiid = m_TCMap->getTCPhiIdFromTCId(TCFire[iii]);
1581
1582 if (phiid == 32 || (phiid > 0 && phiid < 10)) {
1583 m_Quadrant[0][0]++;
1584 }
1585 if (phiid > 7 && phiid < 18) {
1586 m_Quadrant[0][1]++;
1587 }
1588 if (phiid > 15 && phiid < 26) {
1589 m_Quadrant[0][2]++;
1590 }
1591 if ((phiid > 22 && phiid < 33) || phiid == 1) {
1592 m_Quadrant[0][3]++;
1593 }
1594
1595
1596 }
1597 }
1598 }
1599 return m_FWDICN;
1600}
1601//
1602//
1603//
1605{
1606 std::vector<int> TCFire;
1607
1608
1609 TCFire.clear();
1610
1611 TCFire.resize(64, 0);
1612
1613
1614
1615 const int hit_size = m_TCId.size();
1616 for (int ihit = 0 ; ihit < hit_size ; ihit++) {
1617 if (m_TCId[ihit] < 513) {continue;}
1618
1619 // TCFire[m_TCId[ihit] - 513] = m_TCId[ihit];
1620 //------------------------------------
1621 // To rearrange the hit map
1622 //
1623 // original converted
1624 // (<- Theta) (<- Theta)
1625 //
1626 // 516 515 32 0
1627 // 513 514 33 1
1628 // 520 519 => 34 2
1629 // 517 518 35 3
1630 // ... .
1631 // 576 575 62 30
1632 // 573 574 63 31
1633 //
1634 // Here, TCId-1 becomes TCId=0 and 1.
1635 //------------------------------------
1636 int iTCId0 = m_TCId[ihit] - 1;
1637 int kkk = 0;
1638 if ((iTCId0 - 512) % 4 == 2) {
1639 kkk = (iTCId0 - 512) / 2 - 1;
1640 }
1641 if ((iTCId0 - 512) % 4 == 1) {
1642 kkk = ((iTCId0 - 512) + 1) / 2;
1643 }
1644 if ((iTCId0 - 512) % 4 == 3) {
1645 kkk = 32 + ((iTCId0 - 512) - 3) / 2;
1646 }
1647 if ((iTCId0 - 512) % 4 == 0) {
1648 kkk = 33 + ((iTCId0 - 512)) / 2;
1649 }
1650
1651 TCFire[kkk] = iTCId0 + 1;
1652
1653 }
1654
1655
1656 for (int iii = 0 ; iii < 64 ; iii ++) {
1657
1658 if (TCFire[iii] == 0) { continue; }
1659
1660 for (int iinit = 0; iinit < 9; iinit ++) {m_TempCluster[iinit] = 0;}
1661 if (iii < 32) {
1662 if (iii == 0) {
1663 m_TempCluster[0] = TCFire[ 0];
1664 m_TempCluster[1] = TCFire[31]; // top
1665 m_TempCluster[2] = 0;// right top
1666 m_TempCluster[3] = 0; //right
1667 m_TempCluster[4] = 0; //right bottom
1668 m_TempCluster[5] = TCFire[ 1]; // bottom
1669 m_TempCluster[6] = TCFire[33]; // bottom left
1670 m_TempCluster[7] = TCFire[32]; // left
1671 m_TempCluster[8] = TCFire[63]; // top left
1672 } else if (iii == 31) {
1673 m_TempCluster[0] = TCFire[31];
1674 m_TempCluster[1] = TCFire[30];
1675 m_TempCluster[2] = 0;// right top
1676 m_TempCluster[3] = 0; //right
1677 m_TempCluster[4] = 0; //right bottom
1678 m_TempCluster[5] = TCFire[0]; //bottom
1679 m_TempCluster[6] = TCFire[32]; // bottom left
1680 m_TempCluster[7] = TCFire[63]; // left
1681 m_TempCluster[8] = TCFire[62]; //top left
1682 } else {
1683 m_TempCluster[0] = TCFire[iii];
1684 m_TempCluster[1] = TCFire[iii - 1]; // top
1685 m_TempCluster[2] = 0;// right top
1686 m_TempCluster[3] = 0; //right
1687 m_TempCluster[4] = 0; //right bottom
1688 m_TempCluster[5] = TCFire[iii + 1]; //bottom
1689 m_TempCluster[6] = TCFire[iii + 33]; //bottom left
1690 m_TempCluster[7] = TCFire[iii + 32]; // left
1691 m_TempCluster[8] = TCFire[iii + 31]; //top left
1692 }
1693 } else {
1694 if (iii == 32) {
1695 m_TempCluster[0] = TCFire[32];
1696 m_TempCluster[1] = TCFire[63]; // top
1697 m_TempCluster[2] = TCFire[31];// right top
1698 m_TempCluster[3] = TCFire[0]; //right
1699 m_TempCluster[4] = TCFire[1]; //right bottom
1700 m_TempCluster[5] = TCFire[33]; //bottom
1701 m_TempCluster[6] = 0; //bottom left
1702 m_TempCluster[7] = 0; // left
1703 m_TempCluster[8] = 0; //top left
1704 } else if (iii == 63) {
1705 m_TempCluster[0] = TCFire[63];
1706 m_TempCluster[1] = TCFire[62]; // top
1707 m_TempCluster[2] = TCFire[30];// right top
1708 m_TempCluster[3] = TCFire[31]; //right
1709 m_TempCluster[4] = TCFire[0]; //right bottom
1710 m_TempCluster[5] = TCFire[32]; //bottom
1711 m_TempCluster[6] = 0; //bottom left
1712 m_TempCluster[7] = 0; // left
1713 m_TempCluster[8] = 0; //top left
1714 } else {
1715 m_TempCluster[0] = TCFire[iii];
1716 m_TempCluster[1] = TCFire[iii - 1]; // top
1717 m_TempCluster[2] = TCFire[iii - 33]; // right top
1718 m_TempCluster[3] = TCFire[iii - 32]; //right
1719 m_TempCluster[4] = TCFire[iii - 31]; //right bottom
1720 m_TempCluster[5] = TCFire[iii + 1]; //bottom
1721 m_TempCluster[6] = 0; //bottom left
1722 m_TempCluster[7] = 0; // left
1723 m_TempCluster[8] = 0; //top left
1724 }
1725
1726 }
1727
1728 if (!(m_TempCluster[1] != 0 || m_TempCluster[7] != 0)) {
1729 if (!(m_TempCluster[5] != 0 && m_TempCluster[6] != 0)) {
1730 m_BWDICN ++;
1731 int phiid = m_TCMap->getTCPhiIdFromTCId(TCFire[iii]);
1732
1733 if (phiid == 32 || (phiid > 0 && phiid < 10)) {
1734 m_Quadrant[2][0]++;
1735 }
1736 if (phiid > 7 && phiid < 18) {
1737 m_Quadrant[2][1]++;
1738 }
1739 if (phiid > 15 && phiid < 26) {
1740 m_Quadrant[2][2]++;
1741 }
1742 if ((phiid > 22 && phiid < 33) || phiid == 1) {
1743 m_Quadrant[2][3]++;
1744 }
1745
1746
1747 }
1748 }
1749 }
1750
1751 return m_BWDICN;
1752}
1753//
1754//
1755//
1757{
1758 int ncluster =
1759 m_ClusterEnergy[0].size() +
1760 m_ClusterEnergy[1].size() +
1761 m_ClusterEnergy[2].size();
1762 if (ncluster > m_LimitNCluster) {
1763 return ncluster;
1764 } else {
1765 return 0;
1766 }
1767}
1768//
1769//===<END>
1770//
Accessor to arrays stored in the data store.
Definition StoreArray.h:113
T * appendNew()
Construct a new T object at the end of the array.
Definition StoreArray.h:246
int getEntries() const
Get the number of objects in the array.
Definition StoreArray.h:216
std::vector< std::vector< int > > m_BwCluster
cluster in backward endcap
int m_BWDNofCluster
Cluster in Backward Endcap.
void save(int)
Save Cluster information in TRGECLCluster Table.
int m_LimitNCluster
the Limit Number of Cluster
void setICN(const std::vector< int > &)
set ICN for each part(Fw,Br,Bw)
int getICNSub(int)
get ICN in each region(Fw(0), Br(1), Bw(2))
std::vector< std::vector< int > > m_FwCluster
cluster in forward endcap
std::vector< std::vector< double > > m_ClusterTiming
Cluster timing.
int getICNFwBr(void)
get ICN in Barrel and Forward
int m_BRNofCluster
Cluster in Barrel.
int getNofExceedCluster()
get # Cluster in case of exceeding limit
int setBarrelICN()
calculate Belle ICN in Barrel
int m_Method
Clustering method.
std::vector< int > m_icnfwbrbw
icn
int setBackwardICN()
calculate Belle ICN in Backward endcap
std::vector< std::vector< int > > m_MaxTCId
Maximum contribution TC Id in Cluster.
std::vector< std::vector< double > > m_ClusterPositionX
Cluster position in X-axis.
std::vector< std::vector< double > > m_ClusterEnergy
Cluster enrgy.
int m_FWDICN
ICN in Forward Endcap.
std::vector< std::vector< double > > m_ClusterPositionZ
Cluster position in Z-axis.
int m_BRICN
get Beam bkg veto flag.
std::vector< std::vector< int > > m_NofTCinCluster
N of TC in Cluster.
int m_BWDICN
ICN in Backward Endcap.
std::vector< std::vector< int > > m_Quadrant
Quadrant for Beam Background veto.
int getBrICNCluster(int ICNId, int)
get ICN in QuadrantId in Fw or Br or Bw.
std::vector< double > m_Energy
TC energy.
int setForwardICN()
calculate Belle ICN in Forward endcap
int getFwICNCluster(int ICNId, int)
0 : center , 1; upper , 2: right , 3: lower , 4: lower right
std::vector< std::vector< int > > m_BrCluster
cluster in barrel
void setBarrelICNsub(int, std::vector< int >, int &, int &, int &, int &, int &, int &, int &, int &)
calculate 3x3 TC hit map for ICN in Barrel
void initialize(void)
initialization
std::vector< int > m_TempCluster
Temporal Cluster.
std::vector< int > m_TCId
TC Id.
virtual ~TrgEclCluster()
Constructor.
TrgEclCluster()
Constructor.
int getBwICNCluster(int ICNId, int)
0 : center , 1; upper , 2: right , 3: lower , 4: lower right
int m_FWDNofCluster
Cluster in Forward Endcap.
int m_EventId
event number
int m_Position
Position calculation method(0:Most energetic TC Position, 1 : Energy weighted Position)
std::vector< std::vector< double > > m_ClusterPositionY
Cluster position in Y-axis.
TrgEclMapping * m_TCMap
Object of TC Mapping.
std::vector< double > m_Timing
TC timing.
A class of TC Mapping.
Abstract base class for different kinds of events.
STL namespace.