Linear Collider Forum



Home » Software Tools » LCIO » Segmentation violation when copying ParticleIDs of ReconstructedParticle
Re: Segmentation violation when copying ParticleIDs of ReconstructedParticle [message #1907 is a reply to message #1906] Thu, 21 January 2010 11:16 Go to previous message
doublet
Messages: 4
Registered: October 2008
Location: LAL
Dear Frank,

Thank you very much for your quick answer. However, it did not work as expected, probably due to a constructor problem.
Nevertheless, following your comment, I decided to again copy naively all the information of the ParticleID (code follows). And it now works.

Thanks again for the help.
I would suggest, since this may often happen to LCIO users, that each LCObject class should have a sort of "copy" function that would do such things automatically. It is often useful to copy a collection if one wants to work on it and do some modifications or manipulations.

Best regards,
Philippe.


//CODE
for ( unsigned int k = 0 ; k < aPFO->getParticleIDs().size() ; k++ )
{
ParticleID *pid = aPFO->getParticleIDs()[k] ;
IMPL::ParticleIDImpl* implPID = new IMPL::ParticleIDImpl() ;
implPID->setType( pid->getType() ) ;
implPID->setPDG( pid->getPDG() ) ;
implPID->setLikelihood( pid->getLikelihood() ) ;
implPID->setAlgorithmType( pid->getAlgorithmType() ) ;
for ( unsigned int l = 0 ; l < pid->getParameters().size() ; l++ )
{ implPID->addParameter( pid->getParameters()[l] ) ; }
recoPFO->addParticleID( implPID ) ;
}
 
Read Message
Read Message
Read Message
Previous Topic:schema evolution with LCGenericObject
Next Topic:Error Using LCIOWriter
Goto Forum:
  


Current Time: Sun Feb 25 11:17:01 Pacific Standard Time 2018
.:: Contact :: Home ::.

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