ATLAS Offline Software
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"
14 namespace HepMC3 {
17 inline std::ostream& operator<<(std::ostream& os, GenParticlePtr p) {ConstGenParticlePtr cp = p; Print::line(os,cp); return os; }
18 }
19 namespace HepMC {
22 inline 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 }
25 inline 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 }
28 inline int barcode_or_id(const ConstGenParticlePtr& p) { return p->id(); }
29 
31 }
32 #else
33 #include "HepMC/GenParticle.h"
34 #include "AtlasHepMC/Barcode.h"
35 #include <memory>
36 namespace HepMC {
39 inline 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 }
42 inline int barcode_or_id(const ConstGenParticlePtr& p) { return p->barcode();}
43 namespace Print {
44 inline void line(std::ostream& os,const GenParticle& p) {p.print(os);}
45 inline void line(std::ostream& os,const GenParticle* p) {p->print(os);}
46 }
47 inline std::ostream& operator<<( std::ostream& os, const GenParticle* p ) { if (p) return os<<(*p); else return os;}
48 }
49 #endif
50 #endif
Flow.h
Barcode.h
HepMC::GenParticlePtr
GenParticle * GenParticlePtr
Definition: GenParticle.h:37
HepMC::Print::line
void line(std::ostream &os, const GenEvent &e)
Definition: GenEvent.h:676
GenParticle.h
HepMC::operator<<
std::ostream & operator<<(std::ostream &os, const GenParticle *p)
Definition: GenParticle.h:47
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
HepMC::barcode_or_id
int barcode_or_id(const ConstGenParticlePtr &p)
Definition: GenParticle.h:42
ParticleGun_EoverP_Config.pid
pid
Definition: ParticleGun_EoverP_Config.py:62
HepMC::Print::line
void line(std::ostream &os, const GenParticle *p)
Definition: GenParticle.h:45
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
HepMC::ConstGenParticlePtr
const GenParticle * ConstGenParticlePtr
Definition: GenParticle.h:38
LArNewCalib_PedestalAutoCorr.cp
cp
Definition: LArNewCalib_PedestalAutoCorr.py:185
HepMC::newGenParticlePtr
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
HepMC
Definition: Barcode.h:14
dqm_persistency::Print
void Print(const PParameter *param, TDirectory *topdir, Option_t *opt="")
Definition: dqm_persistency_impl.cxx:161
Polarization.h
HepMC::status
int status(const T &p)
Definition: MagicNumbers.h:125
GenParticle
@ GenParticle
Definition: TruthClasses.h:30