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