Skip to content

Commit d27c104

Browse files
authored
Merge branch 'dev' into pr14910
2 parents edd8d77 + 056504e commit d27c104

File tree

96 files changed

+649
-293
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+649
-293
lines changed

DataFormats/Detectors/TPC/include/DataFormatsTPC/Defs.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -97,23 +97,6 @@ enum class StatisticsType {
9797
MeanStdDev ///< Use mean and standard deviation
9898
};
9999

100-
enum class PadFlags : unsigned short {
101-
flagGoodPad = 1 << 0, ///< flag for a good pad binary 0001
102-
flagDeadPad = 1 << 1, ///< flag for a dead pad binary 0010
103-
flagUnknownPad = 1 << 2, ///< flag for unknown status binary 0100
104-
flagSaturatedPad = 1 << 3, ///< flag for saturated status binary 0100
105-
flagHighPad = 1 << 4, ///< flag for pad with extremly high IDC value
106-
flagLowPad = 1 << 5, ///< flag for pad with extremly low IDC value
107-
flagSkip = 1 << 6, ///< flag for defining a pad which is just ignored during the calculation of I1 and IDCDelta
108-
flagFEC = 1 << 7, ///< flag for a whole masked FEC
109-
flagNeighbour = 1 << 8, ///< flag if n neighbouring pads are outlier
110-
flagAllNoneGood = flagDeadPad | flagUnknownPad | flagSaturatedPad | flagHighPad | flagLowPad | flagSkip | flagFEC | flagNeighbour,
111-
};
112-
113-
inline PadFlags operator&(PadFlags a, PadFlags b) { return static_cast<PadFlags>(static_cast<int>(a) & static_cast<int>(b)); }
114-
inline PadFlags operator~(PadFlags a) { return static_cast<PadFlags>(~static_cast<int>(a)); }
115-
inline PadFlags operator|(PadFlags a, PadFlags b) { return static_cast<PadFlags>(static_cast<int>(a) | static_cast<int>(b)); }
116-
117100
// default point definitions for PointND, PointNDlocal, PointNDglobal are in
118101
// MathUtils/CartesianND.h
119102

DataFormats/Detectors/TPC/src/DataFormatsTPCLinkDef.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,13 @@
2222
#pragma link C++ class o2::tpc::ClusterHardwareContainerFixedSize < 8192> + ;
2323
#pragma link C++ class o2::tpc::ClusterNativeContainer + ;
2424
#pragma link C++ class o2::tpc::Digit + ;
25-
#pragma link C++ enum o2::tpc::PadFlags + ; // enum itself
2625
#pragma link C++ class o2::tpc::ZeroSuppressedContainer8kb + ;
2726
#pragma link C++ class std::vector < o2::tpc::ClusterNative> + ;
2827
#pragma link C++ class std::vector < o2::tpc::ClusterNativeContainer> + ;
2928
#pragma link C++ class std::vector < o2::tpc::ClusterHardware> + ;
3029
#pragma link C++ class std::vector < o2::tpc::ClusterHardwareContainerFixedSize < 8192>> + ;
3130
#pragma link C++ class std::vector < o2::tpc::ClusterHardwareContainer8kb> + ;
3231
#pragma link C++ class std::vector < o2::tpc::Digit> + ;
33-
#pragma link C++ class std::vector < o2::tpc::PadFlags> + ;
3432
#pragma link C++ class std::vector < o2::tpc::ZeroSuppressedContainer8kb> + ;
3533
#pragma link C++ class o2::tpc::TrackTPC + ;
3634
#pragma link C++ class o2::tpc::LaserTrack + ;

Detectors/EMCAL/base/include/EMCALBase/ClusterFactory.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,10 @@ class ClusterFactory
401401
/// in cell units
402402
void evalElipsAxis(gsl::span<const int> inputsIndices, AnalysisCluster& clusterAnalysis) const;
403403

404+
///
405+
/// Calculate the number of local maxima in the cluster
406+
void evalNExMax(gsl::span<const int> inputsIndices, AnalysisCluster& clusterAnalysis) const;
407+
404408
///
405409
/// Time is set to the time of the digit with the maximum energy
406410
void evalTime(gsl::span<const int> inputsIndices, AnalysisCluster& clusterAnalysis) const;

Detectors/EMCAL/base/include/EMCALBase/Geometry.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,14 @@ class Geometry
429429
/// \return Position (0 - phi, 1 - eta) of the cell inside teh supermodule
430430
std::tuple<int, int> GetCellPhiEtaIndexInSModule(int supermoduleID, int moduleID, int phiInModule, int etaInModule) const;
431431

432+
/// \brief Get topological row and column of cell in SM (same as for clusteriser with artifical gaps)
433+
/// \param supermoduleID super module number
434+
/// \param moduleID module number
435+
/// \param phiInModule index in phi direction in module
436+
/// \param etaInModule index in phi direction in module
437+
/// \return tuple with (row, column) of the cell, which is global numbering scheme
438+
std::tuple<short, short> GetTopologicalRowColumn(int supermoduleID, int moduleID, int phiInModule, int etaInModule) const;
439+
432440
/// \brief Adapt cell indices in supermodule to online indexing
433441
/// \param supermoduleID super module number of the channel/cell
434442
/// \param iphi row/phi cell index, modified for DCal

Detectors/EMCAL/base/src/ClusterFactory.cxx

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ o2::emcal::AnalysisCluster ClusterFactory<InputType>::buildCluster(int clusterIn
120120
evalElipsAxis(inputsIndices, clusterAnalysis);
121121
evalDispersion(inputsIndices, clusterAnalysis);
122122

123+
// evaluate number of local maxima
124+
evalNExMax(inputsIndices, clusterAnalysis);
125+
123126
evalCoreEnergy(inputsIndices, clusterAnalysis);
124127
evalTime(inputsIndices, clusterAnalysis);
125128

@@ -489,6 +492,63 @@ void ClusterFactory<InputType>::evalCoreEnergy(gsl::span<const int> inputsIndice
489492
clusterAnalysis.setCoreEnergy(coreEnergy);
490493
}
491494

495+
///
496+
/// Calculate the number of local maxima in the cluster
497+
//____________________________________________________________________________
498+
template <class InputType>
499+
void ClusterFactory<InputType>::evalNExMax(gsl::span<const int> inputsIndices, AnalysisCluster& clusterAnalysis) const
500+
{
501+
// Pre-compute cell indices and energies for all cells in cluster to avoid multiple expensive geometry lookups
502+
const size_t n = inputsIndices.size();
503+
std::vector<short> rows;
504+
std::vector<short> columns;
505+
std::vector<double> energies;
506+
507+
rows.reserve(n);
508+
columns.reserve(n);
509+
energies.reserve(n);
510+
511+
for (auto iInput : inputsIndices) {
512+
auto [nSupMod, nModule, nIphi, nIeta] = mGeomPtr->GetCellIndex(mInputsContainer[iInput].getTower());
513+
514+
// get a nice topological indexing that is done in exactly the same way as used by the clusterizer
515+
// this way we can handle the shared cluster cases correctly
516+
const auto [row, column] = mGeomPtr->GetTopologicalRowColumn(nSupMod, nModule, nIphi, nIeta);
517+
518+
rows.push_back(row);
519+
columns.push_back(column);
520+
energies.push_back(mInputsContainer[iInput].getEnergy());
521+
}
522+
523+
// Now find local maxima using pre-computed data
524+
int nExMax = 0;
525+
for (size_t i = 0; i < n; i++) {
526+
// this cell is assumed to be local maximum unless we find a higher energy cell in the neighborhood
527+
bool isExMax = true;
528+
529+
// loop over all other cells in cluster
530+
for (size_t j = 0; j < n; j++) {
531+
if (i == j)
532+
continue;
533+
534+
// adjacent cell is any cell with adjacent phi or eta index
535+
if (std::abs(rows[i] - rows[j]) <= 1 &&
536+
std::abs(columns[i] - columns[j]) <= 1) {
537+
538+
// if there is a cell with higher energy than the current cell, it is not a local maximum
539+
if (energies[j] > energies[i]) {
540+
isExMax = false;
541+
break;
542+
}
543+
}
544+
}
545+
if (isExMax) {
546+
nExMax++;
547+
}
548+
}
549+
clusterAnalysis.setNExMax(nExMax);
550+
}
551+
492552
///
493553
/// Calculates the axis of the shower ellipsoid in eta and phi
494554
/// in cell units

Detectors/EMCAL/base/src/Geometry.cxx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,30 @@ std::tuple<int, int> Geometry::GetCellPhiEtaIndexInSModule(int supermoduleID, in
11031103
return std::make_tuple(phiInSupermodule, etaInSupermodule);
11041104
}
11051105

1106+
std::tuple<short, short> Geometry::GetTopologicalRowColumn(int supermoduleID, int moduleID, int phiInModule, int etaInModule) const
1107+
{
1108+
auto [iphi, ieta] = GetCellPhiEtaIndexInSModule(supermoduleID, moduleID, phiInModule, etaInModule);
1109+
int row = iphi;
1110+
int column = ieta;
1111+
1112+
// Add shifts wrt. supermodule and type of calorimeter
1113+
// NOTE:
1114+
// * Rows (phi) are arranged that one space is left empty between supermodules in phi
1115+
// This is due to the physical gap that forbids clustering
1116+
// * For DCAL, there is an additional empty column between two supermodules in eta
1117+
// Again, this is to account for the gap in DCAL
1118+
1119+
row += supermoduleID / 2 * (24 + 1);
1120+
// In DCAL, leave a gap between two SMs with same phi
1121+
if (!IsDCALSM(supermoduleID)) { // EMCAL
1122+
column += supermoduleID % 2 * 48;
1123+
} else {
1124+
column += supermoduleID % 2 * (48 + 1);
1125+
}
1126+
1127+
return std::make_tuple(static_cast<short>(row), static_cast<short>(column));
1128+
}
1129+
11061130
std::tuple<int, int> Geometry::ShiftOnlineToOfflineCellIndexes(Int_t supermoduleID, Int_t iphi, Int_t ieta) const
11071131
{
11081132
if (supermoduleID == 13 || supermoduleID == 15 || supermoduleID == 17) {

Detectors/EMCAL/calib/include/EMCALCalib/CellRecalibrator.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class CellRecalibrator
6262
public:
6363
/// \class CellTypeException
6464
/// \brief Handling of invalid cell types in calibration
65-
class CellTypeException : public std::exception
65+
class CellTypeException final : public std::exception
6666
{
6767
public:
6868
/// \brief Constructor
@@ -73,7 +73,7 @@ class CellRecalibrator
7373

7474
/// \brief Get error message of the exception
7575
/// \return Error message
76-
const char* what() const noexcept final
76+
[[nodiscard]] char const* what() const noexcept final
7777
{
7878
return "Only possible to calibrate cells of type high gain or low gain";
7979
}
@@ -208,4 +208,4 @@ std::ostream& operator<<(std::ostream& in, const CellRecalibrator& calib);
208208

209209
} // namespace o2
210210

211-
#endif // !ALCEO2_EMCAL_CELLRECALIBRATOR_H
211+
#endif // !ALCEO2_EMCAL_CELLRECALIBRATOR_H

Detectors/ITSMFT/common/reconstruction/include/ITSMFTReconstruction/Clusterer.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ class Clusterer
121121
};
122122

123123
struct ClustererThread {
124+
struct PreCluster {
125+
int head = 0; // index of precluster head in the pixels
126+
int index = 0;
127+
};
124128
int id = -1;
125129
Clusterer* parent = nullptr; // parent clusterer
126130
// buffers for entries in preClusterIndices in 2 columns, to avoid boundary checks, we reserve
@@ -132,12 +136,11 @@ class Clusterer
132136
// pixels[].first is the index of the next pixel of the same precluster in the pixels
133137
// pixels[].second is the index of the referred pixel in the ChipPixelData (element of mChips)
134138
std::vector<std::pair<int, uint32_t>> pixels;
135-
std::vector<int> preClusterHeads; // index of precluster head in the pixels
136-
std::vector<int> preClusterIndices;
137139
uint16_t currCol = 0xffff; ///< Column being processed
138140
bool noLeftCol = true; ///< flag that there is no column on the left to check
139141
std::array<Label, MaxLabels> labelsBuff; //! temporary buffer for building cluster labels
140142
std::vector<PixelData> pixArrBuff; //! temporary buffer for pattern calc.
143+
std::vector<PreCluster> preClusters; //! preclusters info
141144
//
142145
/// temporary storage for the thread output
143146
CompClusCont compClusters;
@@ -154,7 +157,7 @@ class Clusterer
154157
///< add cluster at row (entry ip in the ChipPixeData) to the precluster with given index
155158
void expandPreCluster(uint32_t ip, uint16_t row, int preClusIndex)
156159
{
157-
auto& firstIndex = preClusterHeads[preClusterIndices[preClusIndex]];
160+
auto& firstIndex = preClusters[preClusters[preClusIndex].index].head;
158161
pixels.emplace_back(firstIndex, ip);
159162
firstIndex = pixels.size() - 1;
160163
curr[row] = preClusIndex;
@@ -163,11 +166,10 @@ class Clusterer
163166
///< add new precluster at given row of current column for the fired pixel with index ip in the ChipPixelData
164167
void addNewPrecluster(uint32_t ip, uint16_t row)
165168
{
166-
preClusterHeads.push_back(pixels.size());
169+
int lastIndex = preClusters.size();
170+
preClusters.emplace_back(pixels.size(), lastIndex);
167171
// new head does not point yet (-1) on other pixels, store just the entry of the pixel in the ChipPixelData
168172
pixels.emplace_back(-1, ip);
169-
int lastIndex = preClusterIndices.size();
170-
preClusterIndices.push_back(lastIndex);
171173
curr[row] = lastIndex; // store index of the new precluster in the current column buffer
172174
}
173175

0 commit comments

Comments
 (0)