Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MCParticle Endpoint bit treatment differs from LCIO #113

Closed
fdplacido opened this issue Apr 9, 2021 · 1 comment · Fixed by #275
Closed

MCParticle Endpoint bit treatment differs from LCIO #113

fdplacido opened this issue Apr 9, 2021 · 1 comment · Fixed by #275

Comments

@fdplacido
Copy link
Contributor

fdplacido commented Apr 9, 2021

  • Package version: v00-03-01

MCParticle on LCIO treats the Endpoint status bit differently to EDM4hep.
EDM4hep doesn't provide a way to change this bit either (unless setting all the SimulatorStatus bits at once with an int).

For example, setting the Endpoint in LCIO will change that bit, but EDM4hep won't.

void MCParticleImpl::setEndpoint( const double endpoint[3] ){
  _simstatus.set( BITEndpoint ) ;
  _endpoint[0] = endpoint[0] ;                                                                                                                                                                   
  _endpoint[1] = endpoint[1] ;                                                                                                                                                                   
  _endpoint[2] = endpoint[2] ;
}

On getting the Endpoint a special treatment is applied depending on the value of that bit, wheras just the endpoint array is returned in EDM4hep.

  const double* MCParticleImpl::getEndpoint() const {
    if( ! _simstatus.test( BITEndpoint  ) ){
      if( _daughters.size() == 0 ) return  _endpoint ;

      for(unsigned int i=0;i<_daughters.size();i++)
      {
          if(!_daughters[i]->vertexIsNotEndpointOfParent())
          return _daughters[i]->getVertex();
      }
      return _endpoint ;
    } else
      return _endpoint ;
  } 
@gaede
Copy link
Collaborator

gaede commented May 4, 2021

This is a very special case in LCIO. The bit BITEndpoint is used to decide whether the endpoint of the MCParticle has been set by the user and only then writes it to the file. In PODIO the endpoint is written unconditionally and therefore this bit is not needed and likewise the logic for returning the first daughters vertex in case the bit is not set is not strictly needed here. However it is the users responsibility to ensure that the endpoint is set consistently with that of decay daughters. In general, if we really need to keep internal state of objects consistent, we should provide suitable utility methods to do so. Should remove the BITEndpoint from EDM4hep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants