ATLAS Offline Software
McEventCollectionCnv_p4.h
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // McEventCollectionCnv_p4.h
8 // Header file for class McEventCollectionCnv_p4
9 // Author: S.Binet<binet@cern.ch>
11 #ifndef GENERATOROBJECTSTPCNV_MCEVENTCOLLECTIONCNV_P4_H
12 #define GENERATOROBJECTSTPCNV_MCEVENTCOLLECTIONCNV_P4_H
13 
14 // STL includes
15 #include <unordered_map>
16 
17 #ifdef __clang__
18 #pragma clang diagnostic push
19 #pragma clang diagnostic ignored "-Wkeyword-macro"
20 #endif
21 #define private public
22 #define protected public
24 #include "AtlasHepMC/GenVertex.h"
25 #include "AtlasHepMC/GenParticle.h"
26 #undef private
27 #undef protected
28 #ifdef __clang__
29 #pragma clang diagnostic pop
30 #endif
32 
33 // AthenaPoolCnvSvc includes
35 
36 // GeneratorObjectsTPCnv includes
38 
39 #include "GaudiKernel/ServiceHandle.h"
40 
41 // Forward declaration
42 class IHepMCWeightSvc;
43 class MsgStream;
44 namespace HepMC { struct DataPool; }
45 
47  McEventCollection,
48  McEventCollection_p4
49  >
50 {
51 
54 
56  // Public methods:
58  public:
59 
63 
67 
71 
75 
76  void setPileup();
77 
81  virtual void persToTrans( const McEventCollection_p4* persObj,
82  McEventCollection* transObj,
83  MsgStream &log ) ;
84 
88  virtual void transToPers( const McEventCollection* transObj,
89  McEventCollection_p4* persObj,
90  MsgStream &log ) ;
91 
93  // Protected method:
95  protected:
96 
97  typedef std::unordered_map<HepMC::GenParticlePtr,int> ParticlesMap_t;
98 
109  createGenVertex( const McEventCollection_p4& persEvts,
110  const GenVertex_p4& vtx,
111  ParticlesMap_t& bcToPart,
112  HepMC::DataPool& datapools,HepMC::GenEvent* parent=nullptr ) const;
113 
121  ParticlesMap_t& partToEndVtx,
122  HepMC::DataPool& datapools,const HepMC::GenVertexPtr& parent=nullptr , bool add_to_output = true ) const;
123 
128 #ifdef HEPMC3
129  static void writeGenVertex( const HepMC::ConstGenVertexPtr& vtx,
130  McEventCollection_p4& persEvt ) ;
131 #else
132  void writeGenVertex( const HepMC::GenVertex& vtx,
133  McEventCollection_p4& persEvt ) const;
134 #endif
135 
141 #ifdef HEPMC3
142  static int writeGenParticle( const HepMC::ConstGenParticlePtr& p,
143  McEventCollection_p4& persEvt ) ;
144 #else
146  McEventCollection_p4& persEvt ) const;
147 
148 #endif
149  // Protected data:
152  protected:
153 
156 };
157 #endif //> GENERATOROBJECTSTPCNV_MCEVENTCOLLECTIONCNV_P4_H
HepMC::GenVertexPtr
HepMC::GenVertex * GenVertexPtr
Definition: GenVertex.h:59
IHepMCWeightSvc
IService to read/write HepMC's WeightContainer key names from/to IOVMetaDataContainers author: will b...
Definition: IHepMCWeightSvc.h:18
GenVertex_p4
Definition: GenVertex_p4.h:24
GenEvent.h
GenParticle_p4
Definition: GenParticle_p4.h:22
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
McEventCollectionCnv_p4::createGenParticle
HepMC::GenParticlePtr createGenParticle(const GenParticle_p4 &p, ParticlesMap_t &partToEndVtx, HepMC::DataPool &datapools, const HepMC::GenVertexPtr &parent=nullptr, bool add_to_output=true) const
Create a transient GenParticle from a persistent one (vers.1) It returns the new GenParticle.
Definition: McEventCollectionCnv_p4.cxx:455
HepMC::DataPool
Definition: HepMcDataPool.h:81
McEventCollection_p4.h
GenVertex.h
HepMC::GenParticlePtr
GenParticle * GenParticlePtr
Definition: GenParticle.h:37
McEventCollectionCnv_p4::transToPers
virtual void transToPers(const McEventCollection *transObj, McEventCollection_p4 *persObj, MsgStream &log)
Method creating the persistent representation McEventCollection_p4 from its transient representation ...
Definition: McEventCollectionCnv_p4.cxx:249
McEventCollection
McEventCollection
Definition: GeneratorObjectsTPCnv.cxx:60
TPConverterBase
Definition: TPConverter.h:738
McEventCollectionCnv_p4::createGenVertex
HepMC::GenVertexPtr createGenVertex(const McEventCollection_p4 &persEvts, const GenVertex_p4 &vtx, ParticlesMap_t &bcToPart, HepMC::DataPool &datapools, HepMC::GenEvent *parent=nullptr) const
Create a transient GenVertex from a persistent one (version 1) It returns the new GenVertex.
Definition: McEventCollectionCnv_p4.cxx:381
McEventCollectionCnv_p4::operator=
McEventCollectionCnv_p4 & operator=(const McEventCollectionCnv_p4 &rhs)
Assignement operator.
Definition: McEventCollectionCnv_p4.cxx:44
GenParticle.h
McEventCollectionCnv_p4::setPileup
void setPileup()
Definition: McEventCollectionCnv_p4.cxx:736
McEventCollectionCnv_p4::writeGenParticle
int writeGenParticle(const HepMC::GenParticle &p, McEventCollection_p4 &persEvt) const
Method to write a persistent GenParticle object It returns the index of the persistent GenParticle in...
Definition: McEventCollectionCnv_p4.cxx:691
McEventCollectionCnv_p4::persToTrans
virtual void persToTrans(const McEventCollection_p4 *persObj, McEventCollection *transObj, MsgStream &log)
Method creating the transient representation of McEventCollection from its persistent representation ...
Definition: McEventCollectionCnv_p4.cxx:64
McEventCollection.h
McEventCollection_p4
Definition: McEventCollection_p4.h:27
T_AthenaPoolTPConverter.h
McEventCollectionCnv_p4::m_isPileup
bool m_isPileup
Definition: McEventCollectionCnv_p4.h:154
test_pyathena.parent
parent
Definition: test_pyathena.py:15
McEventCollectionCnv_p4::m_hepMCWeightSvc
ServiceHandle< IHepMCWeightSvc > m_hepMCWeightSvc
Definition: McEventCollectionCnv_p4.h:155
McEventCollection
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
Definition: McEventCollection.h:33
HepMC::ConstGenParticlePtr
const GenParticle * ConstGenParticlePtr
Definition: GenParticle.h:38
McEventCollectionCnv_p4::~McEventCollectionCnv_p4
virtual ~McEventCollectionCnv_p4()
Destructor.
McEventCollectionCnv_p4::writeGenVertex
void writeGenVertex(const HepMC::GenVertex &vtx, McEventCollection_p4 &persEvt) const
Method to write a persistent GenVertex object.
Definition: McEventCollectionCnv_p4.cxx:609
McEventCollectionCnv_p4::McEventCollectionCnv_p4
McEventCollectionCnv_p4()
Default constructor:
Definition: McEventCollectionCnv_p4.cxx:33
HepMC
Definition: Barcode.h:14
McEventCollectionCnv_p4::Base_t
T_AthenaPoolTPCnvBase< McEventCollection, McEventCollection_p4 > Base_t
Definition: McEventCollectionCnv_p4.h:53
McEventCollectionCnv_p4
Definition: McEventCollectionCnv_p4.h:50
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
DataPool
a typed memory pool that saves time spent allocation small object. This is typically used by containe...
Definition: DataPool.h:47
HepMC::ConstGenVertexPtr
const HepMC::GenVertex * ConstGenVertexPtr
Definition: GenVertex.h:60
McEventCollectionCnv_p4::ParticlesMap_t
std::unordered_map< HepMC::GenParticlePtr, int > ParticlesMap_t
Definition: McEventCollectionCnv_p4.h:97
GenParticle
@ GenParticle
Definition: TruthClasses.h:30
ServiceHandle< IHepMCWeightSvc >