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?)
Re: Hashing LCIO objects in pyLCIO [message #2337 is a reply to message #2336] Thu, 04 September 2014 16:51 Go to previous messageGo to previous message
jfstrube
Messages: 64
Registered: September 2004
Location: Tohoku University
The easiest I can think of is to use the index in the collection, which you get from enumerate.

Then you would have to use collection.getElementAt(index) each time you access the particle.
That's not ideal, but you could sugar it by creating your own dict class with the collection in the constructor and an overloaded __getAttr__ or __getAttribute__ method that returns the particle rather than the index.

Without more information on why the number of HashableX classes explodes, that's the quickest way I can think of to get what you want.
It slows down the code, but maybe not noticeably so.

 
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: Sun Jul 22 00:13:15 Pacific Daylight Time 2018
.:: Contact :: Home ::.

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