Skip to content
Snippets Groups Projects
Commit 3d310ffd authored by Dominik Smith's avatar Dominik Smith
Browse files

Cleaned up starting position computation.

parent 2b269663
No related branches found
No related tags found
1 merge request!1653Draft: CbmTrdModuleRecR cleanup discussions.
Pipeline #27165 failed
......@@ -74,7 +74,6 @@ std::vector<CbmTrdCluster> CbmTrdModuleRecR::BuildClusters(bool)
const double interval = CbmTrdDigi::Clk(CbmTrdDigi::eCbmTrdAsicType::kSPADIC);
auto start = fDigiMap.begin(); // marker to skip already processed entries from the map
double lasttime = 0; // time of previous digi in series
// search for an unprocessed main triggered digi and then start a subloop to
// directly construct the cluster (search for main-trigger then add the neighbors)
......@@ -84,14 +83,11 @@ std::vector<CbmTrdCluster> CbmTrdModuleRecR::BuildClusters(bool)
const CbmTrdDigi* digi = (const CbmTrdDigi*) std::get<2>(*mainit);
if (!digi) continue;
// update time and markers
const double time = digi->GetTime();
if (time - lasttime > interval) {
start = mainit;
}
lasttime = time;
///////////// To do: Perhaps separte self and neighbor digis?
////////////// To do: Rethink the start position logic
// get digi type
// get digi time and type
const double time = digi->GetTime();
const CbmTrdDigi::eTriggerType type = static_cast<CbmTrdDigi::eTriggerType>(digi->GetTriggerType());
const Bool_t marked = std::get<1>(*mainit);
if (type != CbmTrdDigi::eTriggerType::kSelf || marked) continue;
......@@ -132,14 +128,18 @@ std::vector<CbmTrdCluster> CbmTrdModuleRecR::BuildClusters(bool)
Bool_t addtop = false; // adds the buffered information of the second row
Bool_t addbot = false;
// //deque which contains the actual cluster
std::deque<std::pair<Int_t, const CbmTrdDigi*>> cluster;
// //vector which contains the actual cluster
std::vector<std::pair<Int_t, const CbmTrdDigi*>> cluster;
cluster.push_back(std::make_pair(digiId, digi));
std::get<1>(*mainit) = true;
// Bool_t mergerow=CbmTrdClusterFinder::HasRowMerger();
Bool_t mergerow = true;
// update start position
start = std::lower_bound(start, fDigiMap.end(), time - interval,
[](const auto& obj, double val) { return std::get<2>(obj)->GetTime() < val; });
// loop to find the other pads corresponding to the main trigger
// is exited either if the implemented trigger logic is fullfilled
// or if there are no more adjacend pads due to edges,etc.
......@@ -152,14 +152,14 @@ std::vector<CbmTrdCluster> CbmTrdModuleRecR::BuildClusters(bool)
// find the FN digis of main trigger or adjacent main triggers
for (auto FNit = start; FNit != fDigiMap.end(); FNit++) {
// Skip already processed digis
bool& filled = std::get<1>(*FNit);
if (filled) continue;
// some information to serparate the time space and to skip processed digis
const CbmTrdDigi* d = (const CbmTrdDigi*) std::get<2>(*FNit);
const double newtime = d->GetTime();
const double dt = newtime - time;
bool& filled = std::get<1>(*FNit);
if (filled) continue;
if (dt < -interval) continue;
if (dt > interval) break;
if (newtime > time + interval) break;
// position information of the possible neighbor digis
const double charge = d->GetCharge();
......@@ -286,7 +286,7 @@ std::vector<CbmTrdCluster> CbmTrdModuleRecR::BuildClusters(bool)
}
//_____________________________________________________________________
void CbmTrdModuleRecR::addClusters(std::deque<std::pair<Int_t, const CbmTrdDigi*>> cluster,
void CbmTrdModuleRecR::addClusters(std::vector<std::pair<Int_t, const CbmTrdDigi*>> cluster,
std::vector<CbmTrdCluster>* clustersOut)
{
// create vector for indice matching
......
......@@ -61,7 +61,7 @@ class CbmTrdModuleRecR : public CbmTrdModuleRec {
CbmTrdModuleRecR(const CbmTrdModuleRecR& ref);
const CbmTrdModuleRecR& operator=(const CbmTrdModuleRecR& ref);
void addClusters(std::deque<std::pair<Int_t, const CbmTrdDigi*>> cluster, std::vector<CbmTrdCluster>* clustersOut);
void addClusters(std::vector<std::pair<Int_t, const CbmTrdDigi*>> cluster, std::vector<CbmTrdCluster>* clustersOut);
Int_t fDigiCounter; // digits over threshold
Int_t fCheck = 0;
......
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