GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » General » Sorting objects
icon5.gif  Sorting objects [message #18870] Fri, 08 January 2016 17:03 Go to next message
Marcel Tiemens is currently offline  Marcel Tiemens
Messages: 47
Registered: January 2014
continuous participant
From: *kvi-cart.rug.nl
Hello everyone, it's me again, with hopefully a simple problem:

- I have a tree with some objects in it (in my case, EmcClusters), where each event in the tree has some of these objects in it.
- Next, I would like to sort them all (not just within an event) in some way.
- And then write the sorted stream of objects back into a tree, where I group the objects in some way to form a new event for that tree.

That was it. I know there is something called FairRingSorter, but does that also work for objects that aren't hits? And one more thing, there is second branch with objects that are linked to the objects I would like to sort. Will the sorting respect those links?

Cheers,
Marcel
Re: Sorting objects [message #18872 is a reply to message #18870] Fri, 08 January 2016 17:36 Go to previous messageGo to next message
Tobias Stockmanns is currently offline  Tobias Stockmanns
Messages: 489
Registered: May 2007
first-grade participant
From: *ikp.kfa-juelich.de
Dear Marcel,

what is your sorting parameter? TimeStamp? Is your data object (EmcCluster) derived from FairTimeStamp? If the answer is yes for all questions, than you can use the RingSorter. In addition I have written a MapSorter using std::map for sorting.

The output is a (TimeStamp) sorted data stream without an event structure. If you want to have them packaged into events you need to run an additional algorithm. There is a GapEventBuilder which looks for the time between two events and, if this is larger than a threshold, puts everything before in an event.

How are the links between your two branches done? FairLinks? Are this bidirectional links or single direction? From your sorted branch or from your unsorted branch? If it goes from your sorted branch to your unsorted one with FairLinks than they still hold.

Cheers,

Tobias
Re: Sorting objects [message #18875 is a reply to message #18872] Mon, 11 January 2016 11:27 Go to previous messageGo to next message
Marcel Tiemens is currently offline  Marcel Tiemens
Messages: 47
Registered: January 2014
continuous participant
From: *kvi-cart.rug.nl
Hi Tobias,

Thanks for replying so quickly. Yes, I would like to sort using the timestamp. I'm not sure if the object derives from FairTimeStamp, but I think so, since the tasks creating the EmcClusters use calls like FairRunAna::Instance()->IsTimeStamp()... If this isn't related, can you tell me if there's an easy way to check this? And if it does use FairTimeStamp, then how do you use the RingSorter?

Thank you for the GapEventBuilder suggestion, I was aware that I would need to run an additional algorithm for the packaging.

I indeed intend to use FairLinks for the linking, but have no idea if it's bidirectional or not. I use something like cluster->SetLink(FairLink("EmcDigi", iDigi)) to make the links for each cluster (and use the corresponding AddLink function for digis that are added to this cluster). It would go from the sorted branch to the unsorted one.
Re: Sorting objects [message #18876 is a reply to message #18875] Mon, 11 January 2016 12:37 Go to previous messageGo to next message
Tobias Stockmanns is currently offline  Tobias Stockmanns
Messages: 489
Registered: May 2007
first-grade participant
From: *ikp.kfa-juelich.de
Dear Marcel,

a few answers to your questions:
a) Does PndEmcCluster derive from FairTimeStamp? Yes, have a look at the header of PndEmcCluster (class PndEmcCluster : public FairTimeStamp).

b) How to use the RingSorter? Please have a look at the presentation I gave at the PANDA computing week in Torino 2012 : https://indico.gsi.de/conferenceOtherViews.py?view=nicecompact&confI d=1602. As an alternative you can also use the PndMapSorter.

c)Are FairLinks bidirectional? No, they are not. They can only be used in one direction. In your SetLink you should also add the event number (via FairRootManager::GetEntryNr()) in the FairLinks otherwise the connection will be lost after sorting.

Cheers,

Tobias
Re: Sorting objects [message #18877 is a reply to message #18876] Mon, 11 January 2016 14:26 Go to previous messageGo to next message
Marcel Tiemens is currently offline  Marcel Tiemens
Messages: 47
Registered: January 2014
continuous participant
From: *kvi-cart.rug.nl
Aha. Thanks a lot for these answers, they're very helpful. Unfortunately, I can't access the presentation, I get the following message: The specified event with id "1602." does not exist or has been deleted. Perhaps you can email it to me?
Re: Sorting objects [message #18883 is a reply to message #18877] Wed, 13 January 2016 11:26 Go to previous messageGo to next message
Marcel Tiemens is currently offline  Marcel Tiemens
Messages: 47
Registered: January 2014
continuous participant
From: *kvi-cart.rug.nl
Okay, I tried copying what Philipp had done for the digi sorting (which is what you show in your presentation), replacing references to PndEmcDigi's with PndEmcCluster's, but then I get the error that the input branch is not registered, followed by a segmentation violation. The branch is in the input tree, so I don't understand what's wrong. The error is given by the FairRootManager when the SorterTask tries to get the input branch - beyond that I don't have a clue about what's going on.
Re: Sorting objects [message #18943 is a reply to message #18883] Mon, 25 January 2016 16:58 Go to previous messageGo to next message
Marcel Tiemens is currently offline  Marcel Tiemens
Messages: 47
Registered: January 2014
continuous participant
From: *kvi-cart.rug.nl
Some additional information: The BranchList, Folder (cbmout, with subfolders) and Tree (cbmsim, with the branch I want to access) are all there.

Does anyone know what could be wrong? Perhaps I'm missing something basic.
Re: Sorting objects [message #18974 is a reply to message #18943] Wed, 03 February 2016 14:12 Go to previous messageGo to next message
Tobias Stockmanns is currently offline  Tobias Stockmanns
Messages: 489
Registered: May 2007
first-grade participant
From: *ikp.kfa-juelich.de
Dear Marcel,

can you please send the source code of your sorter (or better create an own folder in the development branch of SVN)?

Cheers,

Tobias
Re: Sorting objects [message #19264 is a reply to message #18974] Thu, 19 May 2016 14:00 Go to previous message
Marcel Tiemens is currently offline  Marcel Tiemens
Messages: 47
Registered: January 2014
continuous participant
From: *kvi-cart.rug.nl
Hi everyone,

An update and a follow-up on this topic. Update: With the help of Tobias, the sorting is working. Thanks again!

Then, the follow-up. After sorting the EmcCluster objects, I want to group them according to their timestamp. Each new group is put as an entry into a new ROOT tree - this seems to work. However, it looks like I lose the connection to the digis that belong to each cluster. That association is made when the clusters are created. After this, the cluster objects are sorted and regrouped, and I would expect that the association is maintained. But it looks like this is not the case. Does anyone know how to remedy this?
Previous Topic: CHEP2016 abstract submission open!
Next Topic: Broken FairLinks?
Goto Forum:
  


Current Time: Thu Dec 05 07:54:31 CET 2024

Total time taken to generate the page: 0.00768 seconds