GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » Fairroot » General Discussion » [SOLVED] Event filter after simulation phase
[SOLVED] Event filter after simulation phase [message #24814] Thu, 23 April 2020 14:57 Go to previous message
MG is currently offline  MG
Messages: 5
Registered: April 2020
occasional visitor
From: *telnet.krakow.pl
Hello!

I'm trying to implement a filter, that would run after the geant simulation and decide whether to store an event or not.

I've written a simple FairTask, which loads the branches I'm interested in and registers them for output. The exec method is just:

    
std::cout << "test1" << std::endl;

if(rand() % 2)
 FairRunSim::Instance()->MarkFill(false);
else
 FairRunSim::Instance()->MarkFill(true);


Now, if I use FairRunAna and run this as a task on already generated ntuple, it works flawlessly, saving about half of the events to the new ntuple.
However, if I use FairRunSim as above and add the task in my generation script, I can see that it runs after each event ("test1" is printed for each of the events), but all of the output is saved anyway. I've tried setting the storage of branches I register in the detector code to false, but it doesn't change anything. I've also tried changing the name under which I've registered one of the branches in the task (MCTrack -> MCTrack2) and it saved both MCTrack and MCTrack2 with the same number of events.

What am I doing wrong? Is it possible that the GeoTracks or MCTrack, which are also saved, but I can't control them from the detector (I think), force the tree write in between the simulation and my task?

Thank you very much for help!

[Updated on: Mon, 27 April 2020 14:40]

Report message to a moderator

 
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 Dec 06 08:13:15 CET 2024

Total time taken to generate the page: 0.00729 seconds