ATLAS Offline Software
LuDatr.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 // Description:
7 // Class definition for LuDatr which is used
8 // to modify LUDATR common.
9 
10 #ifndef LuDatr_h
11 #define LuDatr_h
12 
13 #include <cstdint>
14 
15 extern "C" { uintptr_t ludatr_address_(); }
16 
17 class LuDatr {
18 public:
19  LuDatr();
20  ~LuDatr();
21 
22  int& mrlu (int n);
23  float& rrlu (int n);
24 
25  void init (void);
26 
27  // return common array lengths
28  inline int lenMrlu() const {return s_lenMrlu;}
29  inline int lenRrlu() const {return s_lenRrlu;}
30 
31 private:
32 
33  // Lengths of the COMMONS
34  static const int s_lenMrlu = 6;
35  static const int s_lenRrlu = 100;
36 
37  struct LUDATR;
38  friend struct LUDATR;
39 
40  struct LUDATR
41  {
43  float rrlu[s_lenRrlu];
44  };
45 
46  int m_dummy;
47  float m_realdummy;
48  static LUDATR* s_ludatr;
49 };
50 
51 // set pointer to zero at start
53 
54 inline void
56 { if (!s_ludatr) s_ludatr = reinterpret_cast<LUDATR*>(ludatr_address_()); }
57 
58 inline
60  : m_dummy (-999),
61  m_realdummy (-999.)
62 {}
63 
64 inline
66 {}
67 
68 inline int&
70 {
71  init(); // check COMMON is initialized
72  if(n < 1 || n > lenMrlu()) return m_dummy;
73  return s_ludatr->mrlu[n-1];
74 }
75 
76 inline float&
78 {
79  init(); // check COMMON is initialized
80  if(n < 1 || n > lenRrlu()) return m_realdummy;
81  return s_ludatr->rrlu[n-1];
82 }
83 
84 #endif
LuDatr::lenMrlu
int lenMrlu() const
Definition: LuDatr.h:28
LuDatr::LuDatr
LuDatr()
Definition: LuDatr.h:59
LuDatr::s_ludatr
static LUDATR * s_ludatr
Definition: LuDatr.h:48
LuDatr::m_dummy
int m_dummy
Definition: LuDatr.h:46
LuDatr::~LuDatr
~LuDatr()
Definition: LuDatr.h:65
LuDatr::s_lenRrlu
static const int s_lenRrlu
Definition: LuDatr.h:35
LuDatr::s_lenMrlu
static const int s_lenMrlu
Definition: LuDatr.h:34
beamspotman.n
n
Definition: beamspotman.py:731
LuDatr::LUDATR
Definition: LuDatr.h:41
LuDatr::lenRrlu
int lenRrlu() const
Definition: LuDatr.h:29
LuDatr::mrlu
int & mrlu(int n)
Definition: LuDatr.h:69
LuDatr::rrlu
float & rrlu(int n)
Definition: LuDatr.h:77
LuDatr::LUDATR::mrlu
int mrlu[s_lenMrlu]
Definition: LuDatr.h:42
LuDatr
Definition: LuDatr.h:17
LuDatr::m_realdummy
float m_realdummy
Definition: LuDatr.h:47
LuDatr::init
void init(void)
Definition: LuDatr.h:55
ludatr_address_
uintptr_t ludatr_address_()
LuDatr::LUDATR::rrlu
float rrlu[s_lenRrlu]
Definition: LuDatr.h:43