Skip to content

Adding HepMC3 products to EDMProduct #38033

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions SimDataFormats/GeneratorProducts/interface/HepMC3Product.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include "DataFormats/Common/interface/Ref.h"
#include <TMatrixD.h>
#include <HepMC3/GenEvent.h>
#include <HepMC3/GenParticle.h>
#include <HepMC3/GenVertex.h>
#include <cstddef>

namespace HepMC3 {
Expand Down Expand Up @@ -57,11 +59,11 @@ namespace edm {
// This allows edm::Refs to work with HepMC3Product
namespace refhelper {
template <>
struct FindTrait<edm::HepMC3Product, HepMC3::GenParticle> {
struct FindTrait<edm::HepMC3Product, HepMC3::GenParticlePtr> {
struct Find {
using first_argument_type = edm::HepMC3Product const &;
using second_argument_type = int;
using result_type = HepMC3::GenParticle const *;
using result_type = HepMC3::GenParticlePtr const *;

result_type operator()(first_argument_type iContainer, second_argument_type iBarCode) {
//return iContainer.getHepMCData().barcode_to_particle(iBarCode);
Expand All @@ -73,11 +75,11 @@ namespace edm {
};

template <>
struct FindTrait<edm::HepMC3Product, HepMC3::GenVertex> {
struct FindTrait<edm::HepMC3Product, HepMC3::GenVertexPtr> {
struct Find {
using first_argument_type = edm::HepMC3Product const &;
using second_argument_type = int;
using result_type = HepMC3::GenVertex const *;
using result_type = HepMC3::GenVertexPtr const *;

result_type operator()(first_argument_type iContainer, second_argument_type iBarCode) {
//return iContainer.getHepMCData().barcode_to_vertex(iBarCode);
Expand Down
5 changes: 5 additions & 0 deletions SimDataFormats/GeneratorProducts/src/classes.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,21 @@
#include "SimDataFormats/GeneratorProducts/interface/LHEXMLStringProduct.h"

#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
#include "SimDataFormats/GeneratorProducts/interface/HepMC3Product.h"

#include "SimDataFormats/GeneratorProducts/interface/GenRunInfoProduct.h"
#include "SimDataFormats/GeneratorProducts/interface/GenFilterInfo.h"
#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h"
#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct3.h"
#include "SimDataFormats/GeneratorProducts/interface/GenLumiInfoProduct.h"
#include "SimDataFormats/GeneratorProducts/interface/GenLumiInfoHeader.h"
#include "SimDataFormats/GeneratorProducts/interface/ExternalGeneratorLumiInfo.h"
#include "SimDataFormats/GeneratorProducts/interface/ExternalGeneratorEventInfo.h"

#include <HepMC/GenRanges.h>
#include <HepMC3/GenVertex.h>
#include <HepMC3/GenParticle.h>
#include <HepMC3/Attribute.h>

//needed for backward compatibility between HepMC 2.06.xx and 2.05.yy
namespace hepmc_rootio {
Expand Down
41 changes: 41 additions & 0 deletions SimDataFormats/GeneratorProducts/src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,36 @@
<class name="std::pair&lt;int,HepMC::GenParticle*&gt;"/>
<class name="std::map&lt;int,HepMC::GenVertex*,std::greater&lt;int&gt; &gt;"/>




<!-- HepMC3 externals -->
<class name="HepMC3::GenEvent"/>
<class name="HepMC3::GenVertex"/>
<class name="HepMC3::GenParticle"/>

<!-- HepMC3Product -->

<class name="edm::Wrapper&lt;edm::HepMC3Product&gt;"/>
<class name="std::vector&lt;const edm::HepMC3Product*&gt;"/>
<!--
<class name="edm::Ref&lt;edm::HepMC3Product,HepMC3::GenVertex,edm::refhelper::FindTrait&lt;edm::HepMC3Product,HepMC3::GenVertex&gt;::Find&gt;"/>
<class name="edm::Ref&lt;edm::HepMC3Product,HepMC3::GenParticle,edm::refhelper::FindTrait&lt;edm::HepMC3Product,HepMC3::GenParticle&gt;::Find&gt;"/>
<class name="edm::RefVector&lt;edm::HepMC3Product,HepMC3::GenVertex,edm::refhelper::FindTrait&lt;edm::HepMC3Product,HepMC3::GenVertex&gt;::Find&gt;"/>
<class name="edm::RefVector&lt;edm::HepMC3Product,HepMC3::GenParticle,edm::refhelper::FindTrait&lt;edm::HepMC3Product,HepMC3::GenParticle&gt;::Find&gt;"/>
-->
<class name="std::map&lt;int,HepMC3::GenVertex*&gt;"/>
<class name="std::pair&lt;const int,HepMC3::GenVertex*&gt;"/>
<class name="std::pair&lt;int,HepMC3::GenVertex*&gt;"/>
<class name="std::map&lt;int,HepMC3::GenParticle*&gt;"/>
<class name="std::pair&lt;const int,HepMC3::GenParticle*&gt;"/>
<class name="std::pair&lt;int,HepMC3::GenParticle*&gt;"/>
<class name="std::map&lt;int,HepMC3::GenVertex*,std::greater&lt;int&gt; &gt;"/>





<!-- Classes shared between different kinds of products -->

<class name="gen::PdfInfo" ClassVersion="10">
Expand Down Expand Up @@ -185,6 +215,17 @@
</ioread>
<class name="edm::Wrapper&lt;GenEventInfoProduct&gt;"/>




<!-- GenEventInfoProduct3 -->
<class name="GenEventInfoProduct3"/>
<class name="edm::Wrapper<GenEventInfoProduct3>"/>





<!-- LHE products -->

<class name="lhef::HEPEUP::FiveVector" ClassVersion="10">
Expand Down