GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » Fairroot » General Discussion » [SOLVED] Event filter after simulation phase
Re: Event filter after simulation phase [message #24830 is a reply to message #24814] Fri, 24 April 2020 23:05 Go to previous messageGo to previous message
MG is currently offline  MG
Messages: 5
Registered: April 2020
occasional visitor
From: *
I got a bit stuck again. Smile I've implemented custom Stack based on the example, along with a simple filter on track momentum. What I've found is that the tracks are indeed removed, but hits from these tracks registered in detector are not, they just have their trackID set to -2. I would like to remove these hits as well.

I've tried updating the loop in FairStack::UpdateTrackIndex method, adding
if(-2 == point->GetTrackID())

at the end, after the indices are set properly and also modified the loop to go backwards, so I don't break the indexing by removing items:
for (Int_t iPoint = nPoints - 1; iPoint >= 0; --iPoint)

This produces interesting results, which I've found after printing the size of hitArray before and after the call to RemoveAt. Basically, it works correctly up to some point and then stops removing items, even though the index is smaller than the size of the array.


index 13 trackID -2
size before 14
size after 13
index 12 trackID -2
size before 13
size after 12
index 11 trackID -2
size before 12
size after 11
index 10 trackID 7
index 9 trackID -2
size before 11
size after 11
index 8 trackID -2
size before 11
size after 11

This behavior continues through many events and then it crashes with segmentation violation at some point (like 800 events in). It seems to always appear after the first case of trackID not being -2, as if only removing items from the end of CloneArray worked. My guess is that I'm breaking something with memory, because the branch is already registered and filled.

Is there a better way to do this?

Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Add two similar files as friends in the simulation
Next Topic: Remove hits from removed tracks
Goto Forum:

Current Time: Fri Sep 22 23:48:08 CEST 2023

Total time taken to generate the page: 0.01181 seconds