31 for (
size_t iDigi = 0; iDigi < digisIn.size(); iDigi++) {
32 const CbmTofDigi* pDigi = &digisIn[iDigi].first;
33 const int32_t index = digisIn[iDigi].second;
35 result[chan].emplace_back(pDigi, index);
57 auto& [clustersOut, chanSizes, chanAddresses, digiIndRef] = result;
63 int32_t lastChan = -1;
64 double lastPosY = 0.0;
65 double lastTime = 0.0;
70 std::vector<inputType::iterator> lastChanPos;
71 for (
size_t chan = 0; chan < numChan; chan++) {
72 lastChanPos.push_back(input[chan].begin());
75 for (int32_t chan = 0; (size_t) chan < numChan; chan++) {
78 chanSizes.push_back(clustersOut.size());
87 auto digiIt = storDigi.begin();
89 while (1 < std::distance(digiIt, storDigi.end())) {
91 while (digiIt->first->GetSide() == std::next(digiIt)->first->GetSide()) {
93 if (2 > std::distance(digiIt, storDigi.end())) {
97 if (2 > std::distance(digiIt, storDigi.end())) {
104 const CbmTofDigi* xDigiB = std::next(digiIt)->first;
107 ROOT::Math::XYZVector
pos(((-(
double) numChan / 2. + (
double) chan) + 0.5) * cell->
sizeX, 0., 0.);
118 const CbmTofDigi* xDigiC = std::next(digiIt, 2)->first;
128 if (std::abs(posYN) >= std::abs(
pos.Y())) {
147 const double time = 0.5 * (xDigiA->
GetTime() + xDigiB->
GetTime());
150 const double totSum = xDigiA->
GetTot() + xDigiB->
GetTot();
162 clustersOut.push_back(cluster);
166 cluster.
add(
pos, time, totSum, totSum);
167 digiIndRef.push_back(digiIt->second);
168 digiIndRef.push_back(std::next(digiIt)->second);
174 AddNextChan(input, lastChan, cluster, clustersOut, digiIndRef, &lastChanPos);
178 chanSizes.back() = clustersOut.size() - chanSizes.back();
189 clustersOut.push_back(cluster);
196 std::vector<Hit>& clustersOut, std::vector<int32_t>& digiIndRef,
197 std::vector<inputType::iterator>* lastChanPos)
203 int32_t chan = lastChan + 1;
207 if ((
size_t) chan >= numChan) {
211 if ((
size_t) chan == numChan) {
216 if (0 == storDigi.size()) {
224 auto i1 = (lastChanPos ==
nullptr) ? storDigi.begin() : (*lastChanPos)[chan];
229 [
this, cell](
const auto& obj,
double val) {
230 return obj.first->GetTime() + cell.sizeY * fParams.fPosYMaxScal / fParams.fSigVel < val;
237 (*lastChanPos)[chan] = i1;
240 for (; i1 < storDigi.end() - 1; i1++) {
248 while (++i2 < storDigi.end()) {
255 const double time = 0.5 * (xDigiA->
GetTime() + xDigiB->
GetTime());
284 const double posX = ((-(double) numChan / 2. + chan) + 0.5) * cell.
sizeX;
285 const double totSum = xDigiA->
GetTot() + xDigiB->
GetTot();
287 ROOT::Math::XYZVector
pos(posX, posY, 0.);
288 cluster.
add(
pos, time, totSum, totSum);
289 digiIndRef.push_back(i1->second);
290 digiIndRef.push_back(i2->second);
293 std::move(i1 + 1, i2, i1);
294 std::move(i2 + 1, storDigi.end(), i2 - 1);
295 storDigi.resize(storDigi.size() - 2);
297 if (
AddNextChan(input, chan, cluster, clustersOut, digiIndRef)) {
309 clustersOut.push_back(cluster);
bool AddNextChan(std::vector< inputType > &input, int32_t iLastChan, Hit &cluster, std::vector< Hit > &clustersOut, std::vector< int32_t > &digiIndRef, std::vector< inputType::iterator > *lastChanPos=nullptr)