Skip to content
Snippets Groups Projects
Commit b085b17d authored by Dominik Smith's avatar Dominik Smith Committed by Felix Weiglhofer
Browse files

cbm::algo::Clusterizer: Optimized double loop in AddNextChan().

parent a0a09e98
No related branches found
No related tags found
1 merge request!1391Online-capable TOF hitfinder.
......@@ -20,8 +20,8 @@ namespace cbm::algo::tof
{
//std::vector<inputType> input = calibrateDigis(digisIn);
std::vector<inputType> input = chanSortDigis(digisIn);
//return buildClusters(input);
return buildClustersIter(input); //Iterator based implementation
return buildClusters(input);
//return buildClustersIter(input); //Iterator based implementation
}
std::vector<Clusterizer::inputType> Clusterizer::chanSortDigis(inputType& digisIn)
......@@ -153,7 +153,6 @@ namespace cbm::algo::tof
offset++;
}
*/
storDigi.erase(storDigi.begin() + offset);
if (2 > storDigi.size()) { break; }
} // same condition side end
......@@ -276,13 +275,18 @@ namespace cbm::algo::tof
for (auto i1 = storDigi.begin(); i1 < storDigi.end() - 1; i1++) {
const CbmTofDigi* xDigiA = i1->first;
const double timeMax =
xDigiA->GetTime() + fParams.fChanPar[chan].cell.sizeY * fParams.fPosYMaxScal / fParams.fSigVel;
if (timeMax < cluster.weightedTime / cluster.weightsSum - fParams.fdMaxTimeDist) { continue; }
auto i2 = i1;
//D.Smith 7.9.23: Do we really need to loop through all remaining digis?
//Maybe break at i2 == i1 + 2 ?
//D.Smith 8.9.23: Adding the break condition below probably makes this redundant.
while (++i2 < storDigi.end()) {
const CbmTofDigi* xDigiA = i1->first;
const CbmTofDigi* xDigiB = i2->first;
if (xDigiA->GetSide() == xDigiB->GetSide()) { continue; }
......@@ -292,12 +296,12 @@ namespace cbm::algo::tof
// The optimization relies on time-order.
//if (std::abs(time - cluster.weightedTime / cluster.weightsSum) >= fParams.fdMaxTimeDist) { continue; }
//Break if digis are in the future of cluster time
if (time - cluster.weightedTime / cluster.weightsSum >= fParams.fdMaxTimeDist) { break; }
//Continue if digis are in the past of cluster time
if (cluster.weightedTime / cluster.weightsSum - time >= fParams.fdMaxTimeDist) { continue; }
//Break if digis are in the future of cluster time
if (time - cluster.weightedTime / cluster.weightsSum >= fParams.fdMaxTimeDist) { break; }
const double timeDif = xDigiA->GetTime() - xDigiB->GetTime();
double posY = fParams.fSigVel * timeDif * 0.5;
if (1 != xDigiA->GetSide()) { posY *= -1.; }
......@@ -319,6 +323,7 @@ namespace cbm::algo::tof
return true; // signal hit was already added
}
i1 = storDigi.end(); // jump to end of outer loop
break;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment