ATLAS Offline Software
Loading...
Searching...
No Matches
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
15extern "C" { uintptr_t hyjets_address_(); }
16
17class HyJets {
18public:
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
38private:
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
62
64};
65
66// set pointer to zero at start
68
69inline void
71{ if (!s_hyjets) s_hyjets = reinterpret_cast<HYJETS*>(hyjets_address_()); }
72
73// Constructor
74inline
76 : m_dummy (-999),
77 m_realdummy (-999.)
78{}
79
80// Destructor
81inline
84
85inline int&
87{
88 init();
89 return s_hyjets->nhj;
90}
91
92inline int&
94{
95 init();
96 return s_hyjets->nhp;
97}
98
99inline int&
100HyJets::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
109inline double&
110HyJets::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
119inline double&
120HyJets::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
uintptr_t hyjets_address_()
double m_realdummy
Definition HyJets.h:61
int leniKhj() const
Definition HyJets.h:31
int & nhp(void)
Definition HyJets.h:93
int leniVhj() const
Definition HyJets.h:35
static const int s_leniKhj
Definition HyJets.h:41
int & nhj(void)
Definition HyJets.h:86
static const int s_lenjKhj
Definition HyJets.h:42
static const int s_leniVhj
Definition HyJets.h:45
static const int s_lenjPhj
Definition HyJets.h:44
static const int s_lenjVhj
Definition HyJets.h:46
int & khj(int i, int j)
Definition HyJets.h:100
double & vhj(int i, int j)
Definition HyJets.h:120
~HyJets()
Definition HyJets.h:82
int leniPhj() const
Definition HyJets.h:33
static const int s_leniPhj
Definition HyJets.h:43
HyJets()
Definition HyJets.h:75
void init(void)
Definition HyJets.h:70
static HYJETS * s_hyjets
Definition HyJets.h:63
double & phj(int i, int j)
Definition HyJets.h:110
int lenjPhj() const
Definition HyJets.h:34
int m_dummy
Definition HyJets.h:60
int lenjKhj() const
Definition HyJets.h:32
int lenjVhj() const
Definition HyJets.h:36
double vhj[s_lenjVhj][s_leniVhj]
Definition HyJets.h:57
double phj[s_lenjPhj][s_leniPhj]
Definition HyJets.h:56
int khj[s_lenjKhj][s_leniKhj]
Definition HyJets.h:55