ATLAS Offline Software
Loading...
Searching...
No Matches
GenParticle.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4/* Author: Andrii Verbytskyi andrii.verbytskyi@mpp.mpg.de */
5
6#ifndef ATLASHEPMC_GENPARTICLE_H
7#define ATLASHEPMC_GENPARTICLE_H
8#ifdef HEPMC3
9#include "HepMC3/GenParticle.h"
10#include "HepMC3/PrintStreams.h"
11#include "AtlasHepMC/Barcode.h"
13#include "AtlasHepMC/Flow.h"
14namespace HepMC3 {
17inline std::ostream& operator<<(std::ostream& os, GenParticlePtr p) {ConstGenParticlePtr cp = p; Print::line(os,std::move(cp)); return os; }
18}
19namespace HepMC {
20typedef HepMC3::GenParticlePtr GenParticlePtr;
21typedef HepMC3::ConstGenParticlePtr ConstGenParticlePtr;
22inline GenParticlePtr newGenParticlePtr(const HepMC3::FourVector &mom = HepMC3::FourVector::ZERO_VECTOR(), int pid = 0, int status = 0) {
23 return std::make_shared<HepMC3::GenParticle>(mom,pid,status);
24}
25inline ConstGenParticlePtr newConstGenParticlePtr(const HepMC3::FourVector &mom = HepMC3::FourVector::ZERO_VECTOR(), int pid = 0, int status = 0) {
26 return std::make_shared<const HepMC3::GenParticle>(mom,pid,status);
27}
28inline int barcode_or_id(const ConstGenParticlePtr& p) { return p->id(); }
29
30using HepMC3::GenParticle;
31}
32#else
33#include "HepMC/GenParticle.h"
34#include "AtlasHepMC/Barcode.h"
35#include <memory>
36namespace HepMC {
39inline GenParticlePtr newGenParticlePtr(const HepMC::FourVector &mom = HepMC::FourVector(0.0,0.0,0.0,0.0), int pid = 0, int status = 0) {
40 return new HepMC::GenParticle(mom,pid,status);
41}
42inline int barcode_or_id(const ConstGenParticlePtr& p) { return p->barcode();}
43namespace Print {
44inline void line(std::ostream& os,const GenParticle& p) {p.print(os);}
45inline void line(std::ostream& os,const GenParticle* p) {p->print(os);}
46}
47inline std::ostream& operator<<( std::ostream& os, const GenParticle* p ) { if (p) return os<<(*p); else return os;}
48}
49#endif
50#endif
std::ostream & operator<<(std::ostream &lhs, const TestGaudiProperty &rhs)
@ GenParticle
void line(std::ostream &os, const GenEvent &e)
Definition GenEvent.h:677
std::ostream & operator<<(std::ostream &os, const GenParticle *p)
Definition GenParticle.h:47
int barcode_or_id(const ConstGenParticlePtr &p)
Definition GenParticle.h:42
int status(const T &p)
GenParticlePtr newGenParticlePtr(const HepMC::FourVector &mom=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), int pid=0, int status=0)
Definition GenParticle.h:39
GenParticle * GenParticlePtr
Definition GenParticle.h:37
const GenParticle * ConstGenParticlePtr
Definition GenParticle.h:38