ATLAS Offline Software
McEventCollection.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 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  // Force a deep copy on the DataVector
64  //
65  for (const HepMC::GenEvent* ev : in)
66  {
67  HepMC::GenEvent* nev = new HepMC::GenEvent(*ev);
68 #ifdef HEPMC3
69  auto ri = ev->run_info();
70  if (ri) {
71  std::shared_ptr<HepMC3::GenRunInfo> nri = std::make_shared<HepMC3::GenRunInfo>(*(ri.get()));
72  nev->set_run_info(nri);
73  }
74  // Fill barcodes attribute in copied GenEvent
76 #endif
78 
79  }
80 
81  return *this;
82 }
83 
84 inline
86 {}
87 
88 
89 CLASS_DEF(McEventCollection, 133273, 1)
90 
91 #endif
McEventCollection::EventIterator
DataVector< HepMC::GenEvent >::iterator EventIterator
Definition: McEventCollection.h:34
GenEvent.h
McEventCollection::~McEventCollection
~McEventCollection()
Definition: McEventCollection.h:85
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:64
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