ATLAS Offline Software
Generators
AtlasHepMC
AtlasHepMC
Barcode.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
/* Author: Andrii Verbytskyi andrii.verbytskyi@mpp.mpg.de */
5
6
#ifndef ATLASHEPMC_BARCODE_H
7
#define ATLASHEPMC_BARCODE_H
8
#include <type_traits>
9
#ifdef HEPMC3
10
#include "HepMC3/GenParticle.h"
11
#include "HepMC3/GenVertex.h"
12
#include "HepMC3/GenEvent.h"
13
#endif
14
namespace
HepMC
{
15
template
<
class
T>
16
inline
int
barcode
(
const
T*
p
){
return
p
->barcode(); }
17
inline
int
barcode
(
int
p
){
return
p
; }
18
#ifdef HEPMC3
19
template <class T, std::enable_if_t< !std::is_pointer<T>::value
&&
20
!
std::is_same<T, HepMC3::GenParticlePtr>::value
&&
21
!
std::is_same<T, HepMC3::ConstGenParticlePtr>::value
&&
22
!
std::is_same<T, HepMC3::GenVertexPtr>::value
&&
23
!
std::is_same<T, HepMC3::ConstGenVertexPtr>::value
&&
24
!
std::is_same<T, HepMC3::GenVertex>::value
&&
25
!
std::is_same<T, HepMC3::GenParticle>::value
&&
26
!
std::is_same<T, int>::value
27
,
bool
> =
true
>
28
inline
int
barcode
(
const
T&
p
){
return
p
.barcode();}
29
30
template
<
class
T
, std::enable_if_t<
31
std::is_same<T, HepMC3::GenParticlePtr>::value
||
32
std::is_same<T, HepMC3::ConstGenParticlePtr>::value
||
33
std::is_same<T, HepMC3::GenVertexPtr>::value
||
34
std::is_same<T, HepMC3::ConstGenVertexPtr>::value
35
,
bool
> =
true
>
36
inline
int
barcode
(
const
T&
p
) {
37
if
(!
p
)
return
0;
38
const
HepMC3::GenEvent*
e
=
p
->parent_event();
39
if
(!
e
)
return
0;
40
std::shared_ptr<HepMC3::IntAttribute>
barcode
=
e
->attribute<HepMC3::IntAttribute>(
"barcode"
,
p
->id());
41
return
barcode
? (
barcode
->value()) :
p
->id();
42
}
43
44
template
<
class
T
, std::enable_if_t<
45
std::is_same<T, HepMC3::GenParticle>::value
||
46
std::is_same<T, HepMC3::GenVertex>::value
47
,
bool
> =
true
>
48
inline
int
barcode
(
const
T&
p
) {
49
const
HepMC3::GenEvent*
e
=
p
.parent_event();
50
if
(!
e
)
return
0;
51
std::shared_ptr<HepMC3::IntAttribute>
barcode
=
e
->attribute<HepMC3::IntAttribute>(
"barcode"
,
p
.id());
52
return
barcode
?(
barcode
->value()):
p
.id();
53
}
54
#else
55
template <class T, std::enable_if_t<!std::is_pointer<T>::value
&&
56
!
std::is_same<T,int>::value
57
,
bool
> =
true
>
inline
int
barcode
(
const
T&
p
){
return
p
.barcode();}
58
#endif
59
60
}
61
#endif
AllowedVariables::e
e
Definition:
AsgElectronSelectorTool.cxx:37
athena.value
value
Definition:
athena.py:124
python.utils.AtlRunQueryDQUtils.p
p
Definition:
AtlRunQueryDQUtils.py:210
HepMC::barcode
int barcode(const T *p)
Definition:
Barcode.h:16
HepMC
Definition:
Barcode.h:14
TSU::T
unsigned long long T
Definition:
L1TopoDataTypes.h:35
Generated on Sun Dec 22 2024 21:07:21 for ATLAS Offline Software by
1.8.18