ATLAS Offline Software
McEventCollectionCnv_p7.h
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // McEventCollectionCnv_p7.h
8 // Header file for class McEventCollectionCnv_p7
9 // Author: J.Chapman, P.Clark and A.Verbytskyi
11 #ifndef GENERATOROBJECTSTPCNV_MCEVENTCOLLECTIONCNV_p7_H
12 #define GENERATOROBJECTSTPCNV_MCEVENTCOLLECTIONCNV_p7_H
13 
14 // STL includes
15 #include <unordered_map>
16 
17 #ifdef HEPMC3
18 #include "AtlasHepMC/GenEvent.h"
19 #include "AtlasHepMC/GenVertex.h"
20 #include "AtlasHepMC/GenParticle.h"
21 #include "HepMC3/Data/GenRunInfoData.h"
22 #else
23 #ifdef __clang__
24 #pragma clang diagnostic push
25 #pragma clang diagnostic ignored "-Wkeyword-macro"
26 #endif
27 #define private public
28 #define protected public
30 #include "AtlasHepMC/GenVertex.h"
31 #include "AtlasHepMC/GenParticle.h"
32 #undef private
33 #undef protected
34 #ifdef __clang__
35 #pragma clang diagnostic pop
36 #endif
37 #endif
39 
40 // AthenaPoolCnvSvc includes
42 
43 // GeneratorObjectsTPCnv includes
45 
46 #include "GaudiKernel/ServiceHandle.h"
47 
48 class IHepMCWeightSvc;
49 
50 // Forward declaration
51 class MsgStream;
52 namespace HepMC { struct DataPool; }
53 
55  McEventCollection,
56  McEventCollection_p7
57  >
58 {
59 
62 
64  // Public methods:
66  public:
67 
71 
75 
79 
83 
84  void setPileup();
85 
89  virtual void persToTrans( const McEventCollection_p7* persObj,
90  McEventCollection* transObj,
91  MsgStream &log ) ;
92 
96  virtual void transToPers( const McEventCollection* transObj,
97  McEventCollection_p7* persObj,
98  MsgStream &log ) ;
99 
101  // Protected method:
103  protected:
104 
105  typedef std::unordered_map<HepMC::GenParticlePtr,int> ParticlesMap_t;
106 
117  createGenVertex( const McEventCollection_p7& persEvts,
118  const GenVertex_p7& vtx,
119  ParticlesMap_t& bcToPart,
120  HepMC::DataPool& datapools, HepMC::GenEvent* parent=nullptr ) const;
121 
129  ParticlesMap_t& partToEndVtx,
130  HepMC::DataPool& datapools, const HepMC::GenVertexPtr& parent=nullptr, bool add_to_output = true ) const;
131 
136 #ifdef HEPMC3
137  static void writeGenVertex( const HepMC::ConstGenVertexPtr& vtx, McEventCollection_p7& persEvt );
138 #else
139  void writeGenVertex( const HepMC::GenVertex& vtx, McEventCollection_p7& persEvt ) const;
140 #endif
141 
146 #ifdef HEPMC3
147  static int writeGenParticle( const HepMC::ConstGenParticlePtr& p, McEventCollection_p7& persEvt );
148 #else
149  int writeGenParticle( const HepMC::GenParticle& p, McEventCollection_p7& persEvt ) const;
150 #endif
151 
154 };
155 #endif //> GENERATOROBJECTSTPCNV_MCEVENTCOLLECTIONCNV_p7_H
McEventCollectionCnv_p7::operator=
McEventCollectionCnv_p7 & operator=(const McEventCollectionCnv_p7 &rhs)
Assignement operator.
Definition: McEventCollectionCnv_p7.cxx:49
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
GenEvent.h
McEventCollectionCnv_p7::persToTrans
virtual void persToTrans(const McEventCollection_p7 *persObj, McEventCollection *transObj, MsgStream &log)
Method creating the transient representation of McEventCollection from its persistent representation ...
Definition: McEventCollectionCnv_p7.cxx:66
McEventCollectionCnv_p7::createGenVertex
HepMC::GenVertexPtr createGenVertex(const McEventCollection_p7 &persEvts, const GenVertex_p7 &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_p7.cxx:631
HepMC::DataPool
Definition: HepMcDataPool.h:81
McEventCollectionCnv_p7::m_isPileup
bool m_isPileup
Definition: McEventCollectionCnv_p7.h:152
McEventCollectionCnv_p7::createGenParticle
HepMC::GenParticlePtr createGenParticle(const GenParticle_p7 &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_p7.cxx:698
McEventCollectionCnv_p7::setPileup
void setPileup()
Definition: McEventCollectionCnv_p7.cxx:968
GenVertex.h
HepMC::GenParticlePtr
GenParticle * GenParticlePtr
Definition: GenParticle.h:37
McEventCollection
McEventCollection
Definition: GeneratorObjectsTPCnv.cxx:60
TPConverterBase
Definition: TPConverter.h:738
McEventCollectionCnv_p7::~McEventCollectionCnv_p7
virtual ~McEventCollectionCnv_p7()
Destructor.
McEventCollection_p7.h
GenParticle.h
McEventCollectionCnv_p7::Base_t
T_AthenaPoolTPCnvBase< McEventCollection, McEventCollection_p7 > Base_t
Definition: McEventCollectionCnv_p7.h:61
GenVertex_p7
Definition: GenVertex_p7.h:24
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
McEventCollection.h
T_AthenaPoolTPConverter.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
McEventCollection_p7
Definition: McEventCollection_p7.h:27
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_p7::ParticlesMap_t
std::unordered_map< HepMC::GenParticlePtr, int > ParticlesMap_t
Definition: McEventCollectionCnv_p7.h:105
McEventCollectionCnv_p7::writeGenParticle
int writeGenParticle(const HepMC::GenParticle &p, McEventCollection_p7 &persEvt) const
Method to write a persistent GenParticle object It returns the index of the persistent GenParticle in...
Definition: McEventCollectionCnv_p7.cxx:922
McEventCollectionCnv_p7::m_hepMCWeightSvc
ServiceHandle< IHepMCWeightSvc > m_hepMCWeightSvc
Definition: McEventCollectionCnv_p7.h:153
HepMC
Definition: Barcode.h:14
McEventCollectionCnv_p7::writeGenVertex
void writeGenVertex(const HepMC::GenVertex &vtx, McEventCollection_p7 &persEvt) const
Method to write a persistent GenVertex object.
Definition: McEventCollectionCnv_p7.cxx:841
McEventCollectionCnv_p7::McEventCollectionCnv_p7
McEventCollectionCnv_p7()
Default constructor:
Definition: McEventCollectionCnv_p7.cxx:38
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:63
McEventCollectionCnv_p7::transToPers
virtual void transToPers(const McEventCollection *transObj, McEventCollection_p7 *persObj, MsgStream &log)
Method creating the persistent representation McEventCollection_p7 from its transient representation ...
Definition: McEventCollectionCnv_p7.cxx:362
HepMC::ConstGenVertexPtr
const HepMC::GenVertex * ConstGenVertexPtr
Definition: GenVertex.h:60
McEventCollectionCnv_p7
Definition: McEventCollectionCnv_p7.h:58
GenParticle
@ GenParticle
Definition: TruthClasses.h:30
ServiceHandle< IHepMCWeightSvc >
GenParticle_p7
Definition: GenParticle_p7.h:22