ATLAS Offline Software
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
27  , bool > = true>
28 inline int barcode(const T& p){ return p.barcode();}
29 
30 template <class T, std::enable_if_t<
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<
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
57  , bool> = true> inline int barcode(const T& p){ return p.barcode();}
58 #endif
59 
60 }
61 #endif
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
athena.value
value
Definition: athena.py:122
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
HepMC
Definition: Barcode.h:14
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35