Linear Collider Forum

Home » Analysis and Reconstruction » Analysis Tools » Hashing LCIO objects in pyLCIO (Does anyone know a way of using these objects as dict / hashmap keys?)
Hashing LCIO objects in pyLCIO [message #2336] Thu, 04 September 2014 08:59 Go to previous message
Messages: 9
Registered: August 2014
Hi all,

From the tests I've done any attempt to use these objects as keys in a dict fails. Adding them as keys seems to work fine however attempting to access the dictionary element fails.

Here is a minimal example to illustrate this behaviour.
Presumably this is because the hash is based on references to the object rather than the object itself and the references change.

Currently I'm working around this with a "HashableMCParticle" python class that does implement __hash__ and __eq__ but the number of "HashableX" classes that I'm having to implement is rising rapidly.

Does anyone have a better solution?

Many thanks,


[Updated on: Thu, 04 September 2014 09:48]

Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:Best particle track display tool for a .slcio file
Next Topic:problems installing v17-06 of ilcsoft
Goto Forum:

Current Time: Wed Dec 11 12:12:33 Pacific Standard Time 2019
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.1.
Copyright ©2001-2010 FUDforum Bulletin Board Software