ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Generators
GeneratorObjects
GeneratorObjects
xAODTruthParticleLink.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef XAODTRUTHPARTICLELINK_H
6
#define XAODTRUTHPARTICLELINK_H
7
8
#include "
GeneratorObjects/HepMcParticleLink.h
"
9
#include "
xAODTruth/TruthParticleContainer.h
"
10
#include "AthLinks/ElementLink.h"
11
#include "
AthContainers/DataVector.h
"
12
#include "
AthenaKernel/CLASS_DEF.h
"
13
#include <algorithm>
14
15
typedef
std::pair<HepMcParticleLink,ElementLink<xAOD::TruthParticleContainer> >
xAODTruthParticleLink
;
16
17
struct
SortTruthParticleLink
{
18
bool
operator()
(
const
xAODTruthParticleLink
& l1,
const
xAODTruthParticleLink
& l2 ) {
19
return
l1.first < l2.first;
20
}
21
bool
operator()
(
const
xAODTruthParticleLink
* l1,
const
xAODTruthParticleLink
* l2 ) {
22
return
operator()
(*l1,*l2);
23
}
24
};
25
26
class
xAODTruthParticleLinkVector
:
public
DataVector
<xAODTruthParticleLink> {
27
public
:
28
ElementLink<xAOD::TruthParticleContainer>
find
(
const
HepMcParticleLink
& hepMCLink )
const
{
29
auto
result = std::lower_bound(
begin
(),
end
(), hepMCLink, [](
const
xAODTruthParticleLink
* l,
const
HepMcParticleLink
& hepLink ) {
return
l->first < hepLink;});
30
if
( result !=
end
() ) {
31
if
( (*result)->first == hepMCLink )
return
(*result)->second;
32
}
33
return
ElementLink<xAOD::TruthParticleContainer>
{};
34
}
35
};
36
37
CLASS_DEF
(
xAODTruthParticleLinkVector
, 143434583, 1)
38
#endif
CLASS_DEF.h
macros to associate a CLID to a type
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
DataVector.h
An STL vector of pointers that by default owns its pointed-to elements.
TruthParticleContainer.h
HepMcParticleLink.h
DataVector< xAODTruthParticleLink >::DataVector
DataVector(SG::OwnershipPolicy ownPolicy=SG::OWN_ELEMENTS, SG::IndexTrackingPolicy trackIndices=SG::DEFAULT_TRACK_INDICES)
DataVector< xAODTruthParticleLink >::end
const_iterator end() const noexcept
DataVector< xAODTruthParticleLink >::begin
const_iterator begin() const noexcept
ElementLink
ElementLink implementation for ROOT usage.
Definition
A/AthLinks/ElementLink.h:40
HepMcParticleLink
a link optimized in size for a GenParticle in a McEventCollection
Definition
HepMcParticleLink.h:72
xAODTruthParticleLinkVector
Definition
xAODTruthParticleLink.h:26
xAODTruthParticleLinkVector::find
ElementLink< xAOD::TruthParticleContainer > find(const HepMcParticleLink &hepMCLink) const
Definition
xAODTruthParticleLink.h:28
SortTruthParticleLink
Definition
xAODTruthParticleLink.h:17
SortTruthParticleLink::operator()
bool operator()(const xAODTruthParticleLink &l1, const xAODTruthParticleLink &l2)
Definition
xAODTruthParticleLink.h:18
xAODTruthParticleLink
std::pair< HepMcParticleLink, ElementLink< xAOD::TruthParticleContainer > > xAODTruthParticleLink
Definition
xAODTruthParticleLink.h:15
Generated on
for ATLAS Offline Software by
1.17.0