Linear Collider Forum



Home » Software Tools » LCIO » Segmentation violation when copying ParticleIDs of ReconstructedParticle
Segmentation violation when copying ParticleIDs of ReconstructedParticle [message #1905] Thu, 21 January 2010 07:35 Go to previous message
doublet
Messages: 4
Registered: October 2008
Location: LAL
Dear LCIO users,

I am facing a segmentation problem when trying to copy ReconstructedParticles. I am naively copying every information of one RecoParticle to another (see code below) and I found out that in several cases, the ParticleIDs fail to do so and give me this error. All of the RecoParticles only have 1 PID associated. Some fail, some don't. I am sorry I have made no other observation that could help understanding this. Anyone already had this problem or has an idea how to avoid this ?

Thanks in advance.
Best regards,
Philippe.


// CODE
for ( int i = 0 ; i < recobj->getNumberOfElements() ; i++ )
{
// The one to be read
ReconstructedParticle* aPFO = dynamic_cast<ReconstructedParticle*>( recobj->getElementAt(i) ) ;
// The new to be created
IMPL::ReconstructedParticleImpl* recoPFO = new IMPL::ReconstructedParticleImpl() ;
// Naive copy
recoPFO->setType( aPFO->getType() );
recoPFO->setMomentum( aPFO->getMomentum() );
recoPFO->setEnergy( aPFO->getEnergy() );
recoPFO->setCovMatrix( aPFO->getCovMatrix() );
recoPFO->setMass( aPFO->getMass() );
recoPFO->setCharge( aPFO->getCharge() );
recoPFO->setReferencePoint( aPFO->getReferencePoint() );
// The following commented lines make *** Break ***
/*for ( unsigned int k = 0 ; k < aPFO->getParticleIDs().size() ; k++ )
{ recoPFO->addParticleID( aPFO->getParticleIDs()[k] ) ; }*/
// The next lines are OK
recoPFO->setParticleIDUsed( aPFO->getParticleIDUsed() );
recoPFO->setGoodnessOfPID( aPFO->getGoodnessOfPID() );
for ( unsigned int k = 0 ; k < aPFO->getParticles().size() ; k++ )
{ recoPFO->addParticle( aPFO->getParticles()[k] ); }
for ( unsigned int k = 0 ; k < aPFO->getClusters().size() ; k++ )
{ recoPFO->addCluster( aPFO->getClusters()[k] ); }
for ( unsigned int k = 0 ; k < aPFO->getTracks().size() ; k++ )
{ recoPFO->addTrack( aPFO->getTracks()[k] ); }
recoPFO->setStartVertex( aPFO->getStartVertex() );

myNewPFOsCollection->addElement( recoPFO ) ;

}

evt->addCollection( myNewPFOsCollection , _NewPFOsColName ) ;
// END
 
Read Message
Read Message
Read Message
Previous Topic:schema evolution with LCGenericObject
Next Topic:Error Using LCIOWriter
Goto Forum:
  


Current Time: Wed Oct 17 23:13:13 Pacific Daylight Time 2018
.:: Contact :: Home ::.

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