ATLAS Offline Software
Loading...
Searching...
No Matches
PyDat1.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 PyDat1 which is used
8// to modify PYDAT1 common.
9
10#ifndef PyDat1_h
11#define PyDat1_h
12
13#include <cstdint>
14
15extern "C" { uintptr_t pydat1_address_(); }
16
17class PyDat1 {
18public:
19 PyDat1();
20 ~PyDat1();
21
22 int& mstu (int n);
23 double& paru (int n);
24 int& mstj (int n);
25 double& parj (int n);
26
27 void init (void);
28
29 // return common array lengths
30 inline int lenMstu() const {return s_lenMstu;}
31 inline int lenParu() const {return s_lenParu;}
32 inline int lenMstj() const {return s_lenMstj;}
33 inline int lenParj() const {return s_lenParj;}
34
35private:
36
37 // Lengths of the COMMONS
38 static const int s_lenMstu = 200;
39 static const int s_lenParu = 200;
40 static const int s_lenMstj = 200;
41 static const int s_lenParj = 200;
42
43 struct PYDAT1;
44 friend struct PYDAT1;
45
46 struct PYDAT1
47 {
49 double paru[s_lenParu];
51 double parj[s_lenParj];
52 };
53
57};
58
59// set pointer to zero at start
61
62inline void
64{ if (!s_pydat1) s_pydat1 = reinterpret_cast<PYDAT1*>(pydat1_address_()); }
65
66inline
68 : m_dummy (-999),
69 m_realdummy (-999.)
70{}
71
72inline
75
76inline int&
78{
79 init(); // check COMMON is initialized
80 if(n < 1 || n > lenMstu()) return m_dummy;
81 return s_pydat1->mstu[n-1];
82}
83
84inline double&
86{
87 init(); // check COMMON is initialized
88 if(n < 1 || n > lenParu()) return m_realdummy;
89 return s_pydat1->paru[n-1];
90}
91
92inline int&
94{
95 init(); // check COMMON is initialized
96 if(n < 1 || n > lenMstj()) return m_dummy;
97 return s_pydat1->mstj[n-1];
98}
99
100inline double&
102{
103 init(); // check COMMON is initialized
104 if(n < 1 || n > lenParj()) return m_realdummy;
105 return s_pydat1->parj[n-1];
106}
107
108#endif
uintptr_t pydat1_address_()
int lenMstu() const
Definition PyDat1.h:30
static const int s_lenParu
Definition PyDat1.h:39
double & paru(int n)
Definition PyDat1.h:85
~PyDat1()
Definition PyDat1.h:73
static const int s_lenParj
Definition PyDat1.h:41
double m_realdummy
Definition PyDat1.h:55
static PYDAT1 * s_pydat1
Definition PyDat1.h:56
int lenParj() const
Definition PyDat1.h:33
int lenParu() const
Definition PyDat1.h:31
static const int s_lenMstu
Definition PyDat1.h:38
int lenMstj() const
Definition PyDat1.h:32
void init(void)
Definition PyDat1.h:63
static const int s_lenMstj
Definition PyDat1.h:40
double & parj(int n)
Definition PyDat1.h:101
PyDat1()
Definition PyDat1.h:67
int & mstu(int n)
Definition PyDat1.h:77
int & mstj(int n)
Definition PyDat1.h:93
int m_dummy
Definition PyDat1.h:54
int mstu[s_lenMstu]
Definition PyDat1.h:48
double paru[s_lenParu]
Definition PyDat1.h:49
int mstj[s_lenMstj]
Definition PyDat1.h:50
double parj[s_lenParj]
Definition PyDat1.h:51