Project
Loading...
Searching...
No Matches
PreClusterizer.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
17
18namespace o2
19{
20namespace mid
21{
22
23//______________________________________________________________________________
24void PreClusterizer::process(gsl::span<const ColumnData> stripPatterns, bool accumulate)
25{
26 // Reset fired DEs and pre-cluster information
27 mActiveDEs.clear();
28 if (!accumulate) {
29 mPreClusters.clear();
30 }
31
32 // Load the stripPatterns to get the fired strips
33 if (loadPatterns(stripPatterns)) {
34 // Loop only on fired detection elements
35 for (auto& deId : mActiveDEs) {
36 // reset the precluster
37 PatternStruct& de = mMpDEs[deId];
38
39 preClusterizeNBP(de);
40 preClusterizeBP(de);
41
42 de.firedColumns = 0; // Reset fired columns
43 }
44 }
45}
46
47void PreClusterizer::process(gsl::span<const ColumnData> stripPatterns, gsl::span<const ROFRecord> rofRecords)
48{
49 mPreClusters.clear();
50 mROFRecords.clear();
51 for (auto& rofRecord : rofRecords) {
52 auto firstEntry = mPreClusters.size();
53 process(stripPatterns.subspan(rofRecord.firstEntry, rofRecord.nEntries), true);
54 auto nEntries = mPreClusters.size() - firstEntry;
55 mROFRecords.emplace_back(rofRecord, firstEntry, nEntries);
56 }
57}
58
59//______________________________________________________________________________
60bool PreClusterizer::loadPatterns(gsl::span<const ColumnData>& stripPatterns)
61{
62
63 // Loop on stripPatterns
64 for (auto& col : stripPatterns) {
65 auto& de = mMpDEs[col.deId];
66 de.deId = col.deId;
67 mActiveDEs.emplace(col.deId);
68
69 de.firedColumns |= (1 << col.columnId);
70 de.columns[col.columnId] = col;
71 }
72
73 return (stripPatterns.size() > 0);
74}
75
76//______________________________________________________________________________
77void PreClusterizer::preClusterizeNBP(PatternStruct& de)
78{
79 PreCluster* pc = nullptr;
80 for (int icolumn = 0; icolumn < 7; ++icolumn) {
81 if (de.columns[icolumn].getNonBendPattern() == 0) {
82 continue;
83 }
84 int nStripsNBP = mMapping.getNStripsNBP(icolumn, de.deId);
85 for (int istrip = 0; istrip < nStripsNBP; ++istrip) {
86 if (de.columns[icolumn].isNBPStripFired(istrip)) {
87 if (!pc) {
88 mPreClusters.push_back({de.deId, 1, static_cast<uint8_t>(icolumn), static_cast<uint8_t>(icolumn), 0, 0, static_cast<uint8_t>(istrip), static_cast<uint8_t>(istrip)});
89 pc = &mPreClusters.back();
90 }
91 pc->lastColumn = icolumn;
92 pc->lastStrip = istrip;
93 } else {
94 pc = nullptr;
95 }
96 }
97 de.columns[icolumn].setNonBendPattern(0); // Reset pattern
98 }
99}
100
101//______________________________________________________________________________
102void PreClusterizer::preClusterizeBP(PatternStruct& de)
103{
104 for (int icolumn = mMapping.getFirstColumn(de.deId); icolumn < 7; ++icolumn) {
105 if ((de.firedColumns & (1 << icolumn)) == 0) {
106 continue;
107 }
108 PreCluster* pc = nullptr;
109 int firstLine = mMapping.getFirstBoardBP(icolumn, de.deId);
110 int lastLine = mMapping.getLastBoardBP(icolumn, de.deId);
111 for (int iline = firstLine; iline <= lastLine; ++iline) {
112 if (de.columns[icolumn].getBendPattern(iline) == 0) {
113 continue;
114 }
115 for (int istrip = 0; istrip < 16; ++istrip) {
116 if (de.columns[icolumn].isBPStripFired(istrip, iline)) {
117 if (!pc) {
118 mPreClusters.push_back({de.deId, 0, static_cast<uint8_t>(icolumn), static_cast<uint8_t>(icolumn), static_cast<uint8_t>(iline), static_cast<uint8_t>(iline), static_cast<uint8_t>(istrip), static_cast<uint8_t>(istrip)});
119 pc = &mPreClusters.back();
120 }
121 pc->lastLine = iline;
122 pc->lastStrip = istrip;
123 } else {
124 pc = nullptr;
125 }
126 }
127 de.columns[icolumn].setBendPattern(0, iline); // Reset pattern
128
129 } // loop on lines
130 } // loop on columns
131}
132
133} // namespace mid
134} // namespace o2
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to process
int32_t nEntries
Definition Objects.cxx:40
Pre-cluster reconstruction algorithm for MID.
uint32_t col
Definition RawData.h:4
int getNStripsNBP(int column, int deId) const
Definition Mapping.cxx:159
int getFirstColumn(int deId) const
Definition Mapping.cxx:169
int getLastBoardBP(int column, int deId) const
Definition Mapping.cxx:188
int getFirstBoardBP(int column, int deId) const
Definition Mapping.cxx:178
void process(gsl::span< const ColumnData > stripPatterns, bool accumulate=false)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
uint16_t de