ATLAS Offline Software
Loading...
Searching...
No Matches
PyPars.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 PyPars which is used
8// to modify PYPARS common.
9
10#ifndef PyPars_h
11#define PyPars_h
12
13#include <cstdint>
14
15extern "C" { uintptr_t pypars_address_(); }
16
17class PyPars {
18public:
19 PyPars();
20 ~PyPars();
21
22 int& mstp (int n);
23 double& parp (int n);
24 int& msti (int n);
25 double& pari (int n);
26
27 void init (void);
28
29 // return common array lengths
30 inline int lenMstp() const {return s_lenMstp;}
31 inline int lenParp() const {return s_lenParp;}
32 inline int lenMsti() const {return s_lenMsti;}
33 inline int lenPari() const {return s_lenPari;}
34
35private:
36
37 // Lengths of the COMMONS
38 static const int s_lenMstp = 200;
39 static const int s_lenParp = 200;
40 static const int s_lenMsti = 200;
41 static const int s_lenPari = 200;
42
43 struct PYPARS;
44 friend struct PYPARS;
45
46 struct PYPARS
47 {
49 double parp[s_lenParp];
51 double pari[s_lenPari];
52 };
53
57};
58
59// set pointer to zero at start
61
62inline void
64{ if (!s_pypars) s_pypars = reinterpret_cast<PYPARS*>(pypars_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 > lenMstp()) return m_dummy;
81 return s_pypars->mstp[n-1];
82}
83
84inline double&
86{
87 init(); // check COMMON is initialized
88 if(n < 1 || n > lenParp()) return m_realdummy;
89 return s_pypars->parp[n-1];
90}
91
92inline int&
94{
95 init(); // check COMMON is initialized
96 if(n < 1 || n > lenMsti()) return m_dummy;
97 return s_pypars->msti[n-1];
98}
99
100inline double&
102{
103 init(); // check COMMON is initialized
104 if(n < 1 || n > lenPari()) return m_realdummy;
105 return s_pypars->pari[n-1];
106}
107
108#endif
uintptr_t pypars_address_()
~PyPars()
Definition PyPars.h:73
static const int s_lenMsti
Definition PyPars.h:40
int lenMsti() const
Definition PyPars.h:32
int lenMstp() const
Definition PyPars.h:30
int m_dummy
Definition PyPars.h:54
int lenPari() const
Definition PyPars.h:33
PyPars()
Definition PyPars.h:67
int & msti(int n)
Definition PyPars.h:93
static PYPARS * s_pypars
Definition PyPars.h:56
int & mstp(int n)
Definition PyPars.h:77
double m_realdummy
Definition PyPars.h:55
static const int s_lenParp
Definition PyPars.h:39
static const int s_lenPari
Definition PyPars.h:41
int lenParp() const
Definition PyPars.h:31
double & parp(int n)
Definition PyPars.h:85
double & pari(int n)
Definition PyPars.h:101
static const int s_lenMstp
Definition PyPars.h:38
void init(void)
Definition PyPars.h:63
double parp[s_lenParp]
Definition PyPars.h:49
double pari[s_lenPari]
Definition PyPars.h:51
int msti[s_lenMsti]
Definition PyPars.h:50
int mstp[s_lenMstp]
Definition PyPars.h:48