Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
McEventCollection.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef GENERATOROBJECTSMCEVENTCOLLECTION_H
6 #define GENERATOROBJECTSMCEVENTCOLLECTION_H 1
7 
8 
10 #include "AthenaKernel/CLASS_DEF.h"
11 #include "AtlasHepMC/GenEvent.h"
12 #include "AtlasHepMC/GenParticle.h"
13 #include "AtlasHepMC/GenVertex.h"
14 #include "AtlasHepMC/GenRanges.h"
15 
16 #include <iostream>
32 class McEventCollection : public DataVector<HepMC::GenEvent>
33 {
36 
37  public:
39 
41 
43 
44 
46 
47  const HepMC::GenEvent* find(int evtNumber) const;
48 };
49 
50 inline
52  : DataVector<HepMC::GenEvent> ()
53 {}
54 
56 {
58 }
59 
60 
62 {
63  if (this != &in) {
64  // Force a deep copy on the DataVector
65  //
66  for (const HepMC::GenEvent* ev : in)
67  {
68  HepMC::GenEvent* nev = new HepMC::GenEvent(*ev);
69 #ifdef HEPMC3
70  auto ri = ev->run_info();
71  if (ri) {
72  std::shared_ptr<HepMC3::GenRunInfo> nri = std::make_shared<HepMC3::GenRunInfo>(*(ri.get()));
73  nev->set_run_info(nri);
74  }
75  // Fill barcodes attribute in copied GenEvent
77 #endif
79  }
80  }
81 
82  return *this;
83 }
84 
85 inline
87 {}
88 
89 
90 CLASS_DEF(McEventCollection, 133273, 1)
91 
92 #endif
McEventCollection::EventIterator
DataVector< HepMC::GenEvent >::iterator EventIterator
Definition: McEventCollection.h:34
GenEvent.h
McEventCollection::~McEventCollection
~McEventCollection()
Definition: McEventCollection.h:86
GenVertex.h
McEventCollection::EventConstIterator
DataVector< HepMC::GenEvent >::const_iterator EventConstIterator
Definition: McEventCollection.h:35
HepMC::fillBarcodesAttribute
void fillBarcodesAttribute(GenEvent *)
Definition: GenEvent.h:626
GenParticle.h
McEventCollection::operator=
McEventCollection & operator=(const McEventCollection &)
Definition: McEventCollection.h:61
ev
int ev
Definition: globals.cxx:25
McEventCollection
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
Definition: McEventCollection.h:33
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
DataVector.h
An STL vector of pointers that by default owns its pointed-to elements.
LArCellNtuple.nev
int nev
Definition: LArCellNtuple.py:135
HepMC
Definition: Barcode.h:14
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:67
GenRanges.h
McEventCollection::find
const HepMC::GenEvent * find(int evtNumber) const
Definition: McEventCollection.cxx:30
CLASS_DEF.h
macros to associate a CLID to a type
McEventCollection::McEventCollection
McEventCollection()
Definition: McEventCollection.h:51