ATLAS Offline Software
HyJets.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 HyJets, which is used
8 // to modify HYJETS common.
9 
10 #ifndef HyJets_h
11 #define HyJets_h
12 
13 #include <cstdint>
14 
15 extern "C" { uintptr_t hyjets_address_(); }
16 
17 class HyJets {
18 public:
19  HyJets();
20  ~HyJets();
21 
22  int& nhj (void);
23  int& nhp (void);
24  int& khj (int i, int j);
25  double& phj (int i, int j);
26  double& vhj (int i, int j);
27 
28  void init (void);
29 
30  // return common array lengths
31  inline int leniKhj() const {return s_leniKhj;}
32  inline int lenjKhj() const {return s_lenjKhj;}
33  inline int leniPhj() const {return s_leniPhj;}
34  inline int lenjPhj() const {return s_lenjPhj;}
35  inline int leniVhj() const {return s_leniVhj;}
36  inline int lenjVhj() const {return s_lenjVhj;}
37 
38 private:
39 
40  // Lengths of array in HyJets common
41  static const int s_leniKhj = 150000;
42  static const int s_lenjKhj = 5;
43  static const int s_leniPhj = 150000;
44  static const int s_lenjPhj = 5;
45  static const int s_leniVhj = 150000;
46  static const int s_lenjVhj = 5;
47 
48  struct HYJETS;
49  friend struct HYJETS;
50 
51  struct HYJETS
52  {
53  int nhj;
54  int nhp;
58  };
59 
60  int m_dummy;
61  double m_realdummy;
62 
63  static HYJETS* s_hyjets;
64 };
65 
66 // set pointer to zero at start
68 
69 inline void
71 { if (!s_hyjets) s_hyjets = reinterpret_cast<HYJETS*>(hyjets_address_()); }
72 
73 // Constructor
74 inline
76  : m_dummy (-999),
77  m_realdummy (-999.)
78 {}
79 
80 // Destructor
81 inline
83 {}
84 
85 inline int&
87 {
88  init();
89  return s_hyjets->nhj;
90 }
91 
92 inline int&
94 {
95  init();
96  return s_hyjets->nhp;
97 }
98 
99 inline int&
100 HyJets::khj (int i, int j)
101 {
102  init(); // check COMMON is initialized
103  if( i < 1 || i > leniKhj() ||
104  j < 1 || j > lenjKhj() ) return m_dummy;
105 
106  return s_hyjets->khj[j-1][i-1];
107 }
108 
109 inline double&
110 HyJets::phj (int i, int j)
111 {
112  init(); // check COMMON is initialized
113  if( i < 1 || i > leniPhj() ||
114  j < 1 || j > lenjPhj() ) return m_realdummy;
115 
116  return s_hyjets->phj[j-1][i-1];
117 }
118 
119 inline double&
120 HyJets::vhj (int i, int j)
121 {
122  init(); // check COMMON is initialized
123  if( i < 1 || i > leniVhj() ||
124  j < 1 || j > lenjVhj() ) return m_realdummy;
125 
126  return s_hyjets->vhj[j-1][i-1];
127 }
128 
129 #endif
HyJets::nhp
int & nhp(void)
Definition: HyJets.h:93
HyJets::s_lenjPhj
static const int s_lenjPhj
Definition: HyJets.h:44
HyJets::m_dummy
int m_dummy
Definition: HyJets.h:60
HyJets::m_realdummy
double m_realdummy
Definition: HyJets.h:61
HyJets::HYJETS::phj
double phj[s_lenjPhj][s_leniPhj]
Definition: HyJets.h:56
HyJets::lenjKhj
int lenjKhj() const
Definition: HyJets.h:32
HyJets::vhj
double & vhj(int i, int j)
Definition: HyJets.h:120
HyJets::leniPhj
int leniPhj() const
Definition: HyJets.h:33
HyJets::leniVhj
int leniVhj() const
Definition: HyJets.h:35
HyJets::khj
int & khj(int i, int j)
Definition: HyJets.h:100
HyJets::HyJets
HyJets()
Definition: HyJets.h:75
HyJets::s_hyjets
static HYJETS * s_hyjets
Definition: HyJets.h:63
HyJets::nhj
int & nhj(void)
Definition: HyJets.h:86
HyJets::phj
double & phj(int i, int j)
Definition: HyJets.h:110
HyJets::leniKhj
int leniKhj() const
Definition: HyJets.h:31
HyJets::s_leniPhj
static const int s_leniPhj
Definition: HyJets.h:43
HyJets::s_leniVhj
static const int s_leniVhj
Definition: HyJets.h:45
HyJets::HYJETS::nhp
int nhp
Definition: HyJets.h:54
lumiFormat.i
int i
Definition: lumiFormat.py:92
HyJets::s_lenjVhj
static const int s_lenjVhj
Definition: HyJets.h:46
HyJets::HYJETS
Definition: HyJets.h:52
HyJets::lenjPhj
int lenjPhj() const
Definition: HyJets.h:34
HyJets
Definition: HyJets.h:17
hyjets_address_
uintptr_t hyjets_address_()
HyJets::HYJETS::vhj
double vhj[s_lenjVhj][s_leniVhj]
Definition: HyJets.h:57
HyJets::lenjVhj
int lenjVhj() const
Definition: HyJets.h:36
HyJets::s_lenjKhj
static const int s_lenjKhj
Definition: HyJets.h:42
HyJets::HYJETS::nhj
int nhj
Definition: HyJets.h:53
HyJets::init
void init(void)
Definition: HyJets.h:70
HyJets::~HyJets
~HyJets()
Definition: HyJets.h:82
HyJets::s_leniKhj
static const int s_leniKhj
Definition: HyJets.h:41
HyJets::HYJETS::khj
int khj[s_lenjKhj][s_leniKhj]
Definition: HyJets.h:55