Skip to content

Commit

Permalink
Adapt to new (v00-15) podio generated class names
Browse files Browse the repository at this point in the history
- Replace some dedicated types with  and rename others (Cluster -> MutableCluster, ConstCluster -> Cluster) to adapt to the new naming scheme introduced in AIDASoft/podio#205.
  • Loading branch information
vvolkl committed Feb 2, 2022
1 parent dd2489a commit 101e343
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion k4Gen/src/components/HepEVTReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ StatusCode HepEVTReader::execute()
return StatusCode::FAILURE;
}

edm4hep::MCParticle particle = particles->create();
auto particle = particles->create();

particle.setPDG(IDHEP);
particle.setGeneratorStatus(ISTHEP);
Expand Down
10 changes: 5 additions & 5 deletions k4Gen/src/components/HepMCToEDMConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
DECLARE_COMPONENT(HepMCToEDMConverter)


edm4hep::MCParticle HepMCToEDMConverter::convert(std::shared_ptr<const HepMC3::GenParticle> hepmcParticle) {
edm4hep::MCParticle edm_particle;
edm4hep::MutableMCParticle HepMCToEDMConverter::convert(std::shared_ptr<const HepMC3::GenParticle> hepmcParticle) {
edm4hep::MutableMCParticle edm_particle;
edm_particle.setPDG(hepmcParticle->pdg_id());
edm_particle.setGeneratorStatus(hepmcParticle->status());
// look up charge from pdg_id
Expand Down Expand Up @@ -42,19 +42,19 @@ StatusCode HepMCToEDMConverter::execute() {
edm4hep::MCParticleCollection* particles = new edm4hep::MCParticleCollection();


std::unordered_map<unsigned int, edm4hep::MCParticle> _map;
std::unordered_map<unsigned int, edm4hep::MutableMCParticle> _map;
for (auto _p:evt->particles()) {
debug() << "Converting hepmc particle with Pdg_ID \t" << _p->pdg_id() << "and id \t" << _p->id() << endmsg;
if (_map.find(_p->id()) == _map.end()) {
edm4hep::MCParticle edm_particle = convert(_p);
edm4hep::MutableMCParticle edm_particle = convert(_p);
_map.insert({_p->id(), edm_particle});
}
// mother/daughter links
auto prodvertex = _p->production_vertex();
if (nullptr != prodvertex) {
for (auto particle_mother: prodvertex->particles_in()) {
if (_map.find(particle_mother->id()) == _map.end()) {
edm4hep::MCParticle edm_particle = convert(particle_mother);
edm4hep::MutableMCParticle edm_particle = convert(particle_mother);
_map.insert({particle_mother->id(), edm_particle});
}
_map[_p->id()].addToParents(_map[particle_mother->id()]);
Expand Down
3 changes: 2 additions & 1 deletion k4Gen/src/components/HepMCToEDMConverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace edm4hep {
class MCParticleCollection;
class MCParticle;
class MutableMCParticle;
}

class HepMCToEDMConverter : public GaudiAlgorithm {
Expand All @@ -34,6 +35,6 @@ class HepMCToEDMConverter : public GaudiAlgorithm {
/// Handle for the genparticles to be written
DataHandle<edm4hep::MCParticleCollection> m_genphandle{"GenParticles", Gaudi::DataHandle::Writer, this};

edm4hep::MCParticle convert(std::shared_ptr<const HepMC3::GenParticle> hepmcParticle);
edm4hep::MutableMCParticle convert(std::shared_ptr<const HepMC3::GenParticle> hepmcParticle);
};
#endif

0 comments on commit 101e343

Please sign in to comment.