ATLAS Offline Software
LuJets.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 LuJets, which is used
8 // to modify LUJETS common.
9 
10 #ifndef LuJets_h
11 #define LuJets_h
12 
13 #include <cstdint>
14 
15 extern "C" { uintptr_t lujets_address_(); }
16 
17 class LuJets {
18 public:
19  LuJets();
20  ~LuJets();
21 
22  int& n (void);
23  int& k (int i, int j);
24  float& p (int i, int j);
25  float& v (int i, int j);
26 
27  void init (void);
28 
29  // return common array lengths
30  inline int leniK() const {return s_leniK;}
31  inline int lenjK() const {return s_lenjK;}
32  inline int leniP() const {return s_leniP;}
33  inline int lenjP() const {return s_lenjP;}
34  inline int leniV() const {return s_leniV;}
35  inline int lenjV() const {return s_lenjV;}
36 
37 private:
38 
39  // Lengths of array in LuJets common
40  static const int s_leniK = 150000;
41  static const int s_lenjK = 5;
42  static const int s_leniP = 150000;
43  static const int s_lenjP = 5;
44  static const int s_leniV = 150000;
45  static const int s_lenjV = 5;
46 
47  struct LUJETS;
48  friend struct LUJETS;
49 
50  struct LUJETS
51  {
52  int n;
53  int k[s_lenjK][s_leniK];
54  float p[s_lenjP][s_leniP];
55  float v[s_lenjV][s_leniV];
56  };
57 
58  int m_dummy;
59  float m_realdummy;
60 
61  static LUJETS* s_lujets;
62 };
63 
64 // set pointer to zero at start
66 
67 inline void
69 { if (!s_lujets) s_lujets = reinterpret_cast<LUJETS*>(lujets_address_()); }
70 
71 // Constructor
72 inline
74  : m_dummy (-999),
75  m_realdummy (-999.)
76 {}
77 
78 // Destructor
79 inline
81 {}
82 
83 inline int&
84 LuJets::n (void)
85 {
86  init();
87  return s_lujets->n;
88 }
89 
90 inline int&
91 LuJets::k (int i, int j)
92 {
93  init(); // check COMMON is initialized
94  if( i < 1 || i > leniK() ||
95  j < 1 || j > lenjK() ) return m_dummy;
96 
97  return s_lujets->k[j-1][i-1];
98 }
99 
100 inline float&
101 LuJets::p (int i, int j)
102 {
103  init(); // check COMMON is initialized
104  if( i < 1 || i > leniP() ||
105  j < 1 || j > lenjP() ) return m_realdummy;
106 
107  return s_lujets->p[j-1][i-1];
108 }
109 
110 inline float&
111 LuJets::v (int i, int j)
112 {
113  init(); // check COMMON is initialized
114  if( i < 1 || i > leniV() ||
115  j < 1 || j > lenjV() ) return m_realdummy;
116 
117  return s_lujets->v[j-1][i-1];
118 }
119 
120 #endif
LuJets::lenjK
int lenjK() const
Definition: LuJets.h:31
LuJets::s_lenjP
static const int s_lenjP
Definition: LuJets.h:43
LuJets::s_lujets
static LUJETS * s_lujets
Definition: LuJets.h:61
LuJets::s_lenjV
static const int s_lenjV
Definition: LuJets.h:45
LuJets::n
int & n(void)
Definition: LuJets.h:84
LuJets::s_leniV
static const int s_leniV
Definition: LuJets.h:44
LuJets::leniV
int leniV() const
Definition: LuJets.h:34
LuJets::lenjV
int lenjV() const
Definition: LuJets.h:35
LuJets::s_leniK
static const int s_leniK
Definition: LuJets.h:40
lumiFormat.i
int i
Definition: lumiFormat.py:85
LuJets
Definition: LuJets.h:17
LuJets::~LuJets
~LuJets()
Definition: LuJets.h:80
LuJets::m_dummy
int m_dummy
Definition: LuJets.h:58
LuJets::LUJETS
Definition: LuJets.h:51
LuJets::m_realdummy
float m_realdummy
Definition: LuJets.h:59
LuJets::s_leniP
static const int s_leniP
Definition: LuJets.h:42
LuJets::leniP
int leniP() const
Definition: LuJets.h:32
LuJets::LUJETS::n
int n
Definition: LuJets.h:52
LuJets::p
float & p(int i, int j)
Definition: LuJets.h:101
LuJets::LUJETS::p
float p[s_lenjP][s_leniP]
Definition: LuJets.h:54
LuJets::leniK
int leniK() const
Definition: LuJets.h:30
LuJets::lenjP
int lenjP() const
Definition: LuJets.h:33
LuJets::LUJETS::v
float v[s_lenjV][s_leniV]
Definition: LuJets.h:55
LuJets::LuJets
LuJets()
Definition: LuJets.h:73
lujets_address_
uintptr_t lujets_address_()
LuJets::s_lenjK
static const int s_lenjK
Definition: LuJets.h:41
LuJets::LUJETS::k
int k[s_lenjK][s_leniK]
Definition: LuJets.h:53
LuJets::v
float & v(int i, int j)
Definition: LuJets.h:111
LuJets::k
int & k(int i, int j)
Definition: LuJets.h:91
LuJets::init
void init(void)
Definition: LuJets.h:68