ATLAS Offline Software
HiParnt.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 #ifndef HiParnt_h
7 #define HiParnt_h
8 
9 #include <cstdint>
10 
11 extern "C" { uintptr_t hiparnt_address_(); }
12 
18 class HiParnt {
19 public:
20  HiParnt();
21  ~HiParnt();
22 
23  float& hipr1 (int n);
24  int& ihpr2 (int n);
25  float& hint1 (int n);
26  int& ihnt2 (int n);
27 
28  void init (void);
29 
30  // return common array lengths
31  inline int lenHipr1() const {return s_lenHipr1;}
32  inline int lenIhpr2() const {return s_lenIhpr2;}
33  inline int lenHint1() const {return s_lenHint1;}
34  inline int lenIhnt2() const {return s_lenIhnt2;}
35 
36 private:
37 
38  // Lengths of the COMMONS
39  static const int s_lenHipr1 = 100;
40  static const int s_lenIhpr2 = 50;
41  static const int s_lenHint1 = 100;
42  static const int s_lenIhnt2 = 50;
43 
44  struct HIPARNT;
45  friend struct HIPARNT;
46 
47  struct HIPARNT
48  {
49  float hipr1[s_lenHipr1];
51  float hint1[s_lenHint1];
53  };
54 
55  int m_dummy;
56  float m_realdummy;
57  static HIPARNT* s_hiparnt;
58 };
59 
60 // set pointer to zero at start
62 
63 inline void
65 { if (!s_hiparnt) s_hiparnt = reinterpret_cast<HIPARNT*>(hiparnt_address_()); }
66 
67 inline
69  : m_dummy (-999),
70  m_realdummy (-999.)
71 {}
72 
73 inline
75 {}
76 
77 inline float&
79 {
80  init(); // check COMMON is initialized
81  if(n < 1 || n > lenHipr1()) return m_realdummy;
82  return s_hiparnt->hipr1[n-1];
83 }
84 
85 inline int&
87 {
88  init(); // check COMMON is initialized
89  if(n < 1 || n > lenIhpr2()) return m_dummy;
90  return s_hiparnt->ihpr2[n-1];
91 }
92 
93 inline float&
95 {
96  init(); // check COMMON is initialized
97  if(n < 1 || n > lenHint1()) return m_realdummy;
98  return s_hiparnt->hint1[n-1];
99 }
100 
101 // access ihnt2 in common
102 inline int&
104 {
105  init(); // check COMMON is initialized
106  if(n < 1 || n > lenIhnt2()) return m_dummy;
107  return s_hiparnt->ihnt2[n-1];
108 }
109 
110 #endif
HiParnt::m_dummy
int m_dummy
Definition: HiParnt.h:55
HiParnt::hint1
float & hint1(int n)
Definition: HiParnt.h:94
HiParnt::hipr1
float & hipr1(int n)
Definition: HiParnt.h:78
HiParnt::s_lenHipr1
static const int s_lenHipr1
Definition: HiParnt.h:39
HiParnt::HIPARNT
Definition: HiParnt.h:48
HiParnt::HIPARNT::hint1
float hint1[s_lenHint1]
Definition: HiParnt.h:51
HiParnt
Class definition for HiParnt, which is used to modify the Hijing HIPARNT common.
Definition: HiParnt.h:18
HiParnt::s_hiparnt
static HIPARNT * s_hiparnt
Definition: HiParnt.h:57
hiparnt_address_
uintptr_t hiparnt_address_()
HiParnt::HIPARNT::hipr1
float hipr1[s_lenHipr1]
Definition: HiParnt.h:49
HiParnt::s_lenHint1
static const int s_lenHint1
Definition: HiParnt.h:41
HiParnt::~HiParnt
~HiParnt()
Definition: HiParnt.h:74
beamspotman.n
n
Definition: beamspotman.py:731
HiParnt::m_realdummy
float m_realdummy
Definition: HiParnt.h:56
HiParnt::lenIhnt2
int lenIhnt2() const
Definition: HiParnt.h:34
HiParnt::init
void init(void)
Definition: HiParnt.h:64
HiParnt::s_lenIhnt2
static const int s_lenIhnt2
Definition: HiParnt.h:42
HiParnt::lenHipr1
int lenHipr1() const
Definition: HiParnt.h:31
HiParnt::ihpr2
int & ihpr2(int n)
Definition: HiParnt.h:86
HiParnt::HIPARNT::ihnt2
int ihnt2[s_lenIhnt2]
Definition: HiParnt.h:52
HiParnt::HIPARNT::ihpr2
int ihpr2[s_lenIhpr2]
Definition: HiParnt.h:50
HiParnt::lenIhpr2
int lenIhpr2() const
Definition: HiParnt.h:32
HiParnt::ihnt2
int & ihnt2(int n)
Definition: HiParnt.h:103
HiParnt::lenHint1
int lenHint1() const
Definition: HiParnt.h:33
HiParnt::s_lenIhpr2
static const int s_lenIhpr2
Definition: HiParnt.h:40
HiParnt::HiParnt
HiParnt()
Definition: HiParnt.h:68