11/* *****************************************************************************
22 * Copyright (C) 2022 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3- * Copyright (C) 2022-2025 Members of R3B Collaboration *
3+ * Copyright (C) 2022-2026 Members of R3B Collaboration *
44 * *
55 * This software is distributed under the terms of the *
66 * GNU General Public Licence (GPL) version 3, *
@@ -459,6 +459,68 @@ void R3BAlpideCal2Hit::FindClustersDefault()
459459 localpos.Y ());
460460 }
461461 }
462+ else if (fGeoversion == 202507 )
463+ {
464+ for (size_t s = 0 ; s < fNbSensors ; s++)
465+ for (size_t i = 0 ; i < nHits; i++)
466+ if (mult[s][i] > 0 )
467+ {
468+ nbcluster++;
469+
470+ TVector3 localpos;
471+ localpos.SetXYZ (meancol[s][i] / double (mult[s][i]) * fPixelSize_ls ,
472+ meanrow[s][i] / double (mult[s][i]) * fPixelSize_ss ,
473+ 0.0 );
474+
475+ TVector3 labpos;
476+
477+ double Z_flex1 = 0 .;
478+
479+ double Z_flex2 = 7 .;
480+
481+ double Z_flex3 = 14 .;
482+
483+ // Mosaic-3
484+ if (s < 3 )
485+ labpos.SetXYZ (-45 . + localpos.X () + 30 . * s, -localpos.Y (), Z_flex1);
486+ else if (s < 6 )
487+ labpos.SetXYZ (45 . - localpos.X () - 30 . * (s - 3 ), localpos.Y (), Z_flex1);
488+ // Mosaic-4
489+ else if (s < 9 )
490+ labpos.SetXYZ (-45 . + localpos.X () + 30 . * s, -localpos.Y (), Z_flex1);
491+ else if (s < 12 )
492+ labpos.SetXYZ (45 . - localpos.X () - 30 . * (s - 3 ), localpos.Y (), Z_flex1);
493+ // Mosaic-5
494+ else if (s < 15 )
495+ labpos.SetXYZ (-45 . + localpos.X () + 30 . * s, -localpos.Y (), Z_flex2);
496+ else if (s < 18 )
497+ labpos.SetXYZ (45 . - localpos.X () - 30 . * (s - 3 ), localpos.Y (), Z_flex2);
498+ // Mosaic-9
499+ else if (s < 21 )
500+ labpos.SetXYZ (-45 . + localpos.X () + 30 . * s, -localpos.Y (), Z_flex2);
501+ else if (s < 24 )
502+ labpos.SetXYZ (45 . - localpos.X () - 30 . * (s - 3 ), localpos.Y (), Z_flex2);
503+ // Mosaic-10
504+ else if (s < 27 )
505+ labpos.SetXYZ (-45 . + localpos.X () + 30 . * s, -localpos.Y (), Z_flex3);
506+ else
507+ labpos.SetXYZ (45 . - localpos.X () - 30 . * (s - 3 ), localpos.Y (), Z_flex3);
508+
509+ AddHitData (s + 1 ,
510+ mult[s][i],
511+ 0 ,
512+ 0 ,
513+ nullMajor,
514+ 0 ,
515+ 0 ,
516+ nullHu,
517+ labpos.X (),
518+ labpos.Y (),
519+ labpos.Z (),
520+ localpos.X (),
521+ localpos.Y ());
522+ }
523+ }
462524
463525 R3BLOG (debug, " Number of clusters: " << nbcluster);
464526 return ;
@@ -467,21 +529,21 @@ void R3BAlpideCal2Hit::FindClustersDefault()
467529// ----- Alternatvie methods: Flood fill ---------------------------
468530void R3BAlpideCal2Hit::FindClustersFloodFill ()
469531{
470- Int_t nHits = fAlpideCluster ->GetEntriesFast ();
532+ auto nHits = fAlpideCluster ->GetEntriesFast ();
471533 if (nHits == 0 )
472534 return ;
473535
474- std::map<Int_t , std::vector<std::pair<Int_t, Int_t >>> sensorPixels;
475- for (Int_t i = 0 ; i < nHits; i++)
536+ std::map<int , std::vector<std::pair<int , int >>> sensorPixels;
537+ for (auto i = 0 ; i < nHits; i++)
476538 {
477539 auto cluster = dynamic_cast <R3BAlpideCluster*>(fAlpideCluster ->At (i));
478- Int_t sen = cluster->GetSensorId () - 1 ;
540+ auto sen = cluster->GetSensorId () - 1 ;
479541 sensorPixels[sen].emplace_back (cluster->GetCol (), cluster->GetRow ());
480542 }
481543
482544 for (auto & sp : sensorPixels)
483545 {
484- Int_t senId = sp.first ;
546+ auto senId = sp.first ;
485547 auto & pixels = sp.second ;
486548
487549 // Determine bounds with padding
@@ -493,17 +555,17 @@ void R3BAlpideCal2Hit::FindClustersFloodFill()
493555 minRow = std::min (minRow, p.second );
494556 maxRow = std::max (maxRow, p.second );
495557 }
496- Int_t nCols = maxCol - minCol + 3 ;
497- Int_t nRows = maxRow - minRow + 3 ;
558+ auto nCols = maxCol - minCol + 3 ;
559+ auto nRows = maxRow - minRow + 3 ;
498560
499561 std::vector<std::vector<bool >> map (nCols, std::vector<bool >(nRows, false ));
500562 std::vector<std::vector<bool >> visited (nCols, std::vector<bool >(nRows, false ));
501563 for (auto & p : pixels)
502564 map[p.first - minCol + 1 ][p.second - minRow + 1 ] = true ;
503565
504566 // Flood-fill function
505- std::function<void (Int_t, Int_t , std::vector<std::pair<Int_t, Int_t >>&)> fill;
506- fill = [&](Int_t x, Int_t y, std::vector<std::pair<Int_t, Int_t >>& clusterPixels)
567+ std::function<void (int , int , std::vector<std::pair<int , int >>&)> fill;
568+ fill = [&](int x, int y, std::vector<std::pair<int , int >>& clusterPixels)
507569 {
508570 if (x < 0 || x >= nCols || y < 0 || y >= nRows)
509571 return ;
@@ -518,14 +580,14 @@ void R3BAlpideCal2Hit::FindClustersFloodFill()
518580 };
519581
520582 // Process all pixels
521- for (Int_t x = 0 ; x < nCols; x++)
583+ for (auto x = 0 ; x < nCols; x++)
522584 {
523- for (Int_t y = 0 ; y < nRows; y++)
585+ for (auto y = 0 ; y < nRows; y++)
524586 {
525587 if (!map[x][y] || visited[x][y])
526588 continue ;
527589
528- std::vector<std::pair<Int_t, Int_t >> clusterPixels;
590+ std::vector<std::pair<int , int >> clusterPixels;
529591 fill (x, y, clusterPixels);
530592
531593 // ================== Hole Detection ==================
@@ -782,6 +844,29 @@ void R3BAlpideCal2Hit::FindClustersFloodFill()
782844 else
783845 labUnit.SetXYZ (+localUnit.X (), +localUnit.Y (), 0.0 );
784846 }
847+ else if (fGeoversion == 202507 )
848+ {
849+ if (senId < 3 )
850+ labUnit.SetXYZ (localUnit.X (), localUnit.Y (), 0.0 );
851+ else if (senId < 6 )
852+ labUnit.SetXYZ (-localUnit.X (), -localUnit.Y (), 0.0 );
853+ else if (senId < 9 )
854+ labUnit.SetXYZ (localUnit.X (), localUnit.Y (), 0.0 );
855+ else if (senId < 12 )
856+ labUnit.SetXYZ (-localUnit.X (), -localUnit.Y (), 0.0 );
857+ else if (senId < 15 )
858+ labUnit.SetXYZ (localUnit.X (), localUnit.Y (), 0.0 );
859+ else if (senId < 18 )
860+ labUnit.SetXYZ (-localUnit.X (), -localUnit.Y (), 0.0 );
861+ else if (senId < 21 )
862+ labUnit.SetXYZ (localUnit.X (), localUnit.Y (), 0.0 );
863+ else if (senId < 24 )
864+ labUnit.SetXYZ (-localUnit.X (), -localUnit.Y (), 0.0 );
865+ else if (senId < 27 )
866+ labUnit.SetXYZ (localUnit.X (), localUnit.Y (), 0.0 );
867+ else
868+ labUnit.SetXYZ (-localUnit.X (), -localUnit.Y (), 0.0 );
869+ }
785870
786871 // Protect from NaN && Inf ->Set to non physical units where possible for later analysis.
787872 if (!std::isfinite (localUnit.X ()))
@@ -958,14 +1043,51 @@ void R3BAlpideCal2Hit::FindClustersFloodFill()
9581043 }
9591044 else if (fGeoversion == 202506 )
9601045 {
1046+ const double Z_alpide1 = -1732.88 ;
1047+ const double Z_alpide2 = -1659.88 ;
1048+
1049+ const double z1_off = -0.837843 ;
1050+ const double z2_off = -2.69759 ;
1051+
1052+ const double rx = 0.0225419 ;
1053+ const double ry = 0.0137131 ;
1054+ const double rz[12 ] = { 0.00595207 , 0.00815014 , 0.0102531 , 0.00857714 , 0.00909736 , 0.0015223 ,
1055+ 0.0133541 , 0.00969408 , 0.0134827 , 0.000125173 , 0.00982907 , 0.021181 };
1056+
1057+ array<TVector3, 12 > pos_offset = {
1058+ TVector3 (0.231386 , 0.18477 , z1_off), TVector3 (0.03624 , 0.0145723 , z1_off),
1059+ TVector3 (-0.162212 , -0.217339 , z1_off), TVector3 (-0.157992 , -0.31182 , z1_off),
1060+ TVector3 (0.0596373 , -0.07224198 , z1_off), TVector3 (0.2458 , 0.131979 , z1_off),
1061+ TVector3 (0.713162 , 0.203712 , z2_off), TVector3 (0.5620141 , -0.18166828 , z2_off),
1062+ TVector3 (0.316365 , -0.445912 , z2_off), TVector3 (0.323927 , -0.298097 , z2_off),
1063+ TVector3 (0.5504176 , -0.2855743 , z2_off), TVector3 (0.781553 , -0.0369948 , z2_off)
1064+ };
1065+
1066+ TRotation Rloc;
1067+ Rloc.RotateZ (rz[senId]);
1068+ TVector3 local_rot = Rloc * localpos;
1069+
9611070 if (senId < 3 )
962- labpos.SetXYZ (45 . - localpos .X () - 30 . * senId, -localpos .Y (), 0 . );
1071+ labpos.SetXYZ (45 . - local_rot .X () - 30 . * senId, -local_rot .Y (), Z_alpide1 );
9631072 else if (senId < 6 )
964- labpos.SetXYZ (-45 . + localpos .X () + 30 . * (senId - 3 ), localpos .Y (), 0 . );
1073+ labpos.SetXYZ (-45 . + local_rot .X () + 30 . * (senId - 3 ), local_rot .Y (), Z_alpide1 );
9651074 else if (senId < 9 )
966- labpos.SetXYZ (45 . - localpos.X () - 30 . * (senId - 6 ), -localpos.Y (), 73 .);
1075+ labpos.SetXYZ (45 . - local_rot.X () - 30 . * (senId - 6 ), -local_rot.Y (), Z_alpide2);
1076+ else
1077+ labpos.SetXYZ (-45 . + local_rot.X () + 30 . * (senId - 9 ), local_rot.Y (), Z_alpide2);
1078+
1079+ TVector3 center;
1080+ if (senId < 6 )
1081+ center.SetXYZ (0 ., 0 ., Z_alpide1);
9671082 else
968- labpos.SetXYZ (-45 . + localpos.X () + 30 . * (senId - 9 ), localpos.Y (), 73 .);
1083+ center.SetXYZ (0 ., 0 ., Z_alpide2);
1084+
1085+ TRotation R;
1086+ R.RotateX (rx);
1087+ R.RotateY (ry);
1088+
1089+ labpos = R * (labpos - center) + center;
1090+ labpos += pos_offset[senId];
9691091 }
9701092
9711093 if (std::isnan (elongation) || std::isinf (elongation))
0 commit comments