ATLAS Offline Software
HiMain2.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 #ifndef HiMain2_h
7 #define HiMain2_h
8 
9 #include <cstdint>
10 
11 extern "C" { uintptr_t himain2_address_(); }
17 class HiMain2 {
18 public:
19  HiMain2();
20  ~HiMain2();
21 
22  int& katt (int i, int j);
23  float& patt (int i, int j);
24  float& vatt (int i, int j);
25 
26  void init (void);
27 
28  // return common array lengths
29  inline int leniKatt() const {return s_leniKatt;}
30  inline int lenjKatt() const {return s_lenjKatt;}
31  inline int leniPatt() const {return s_leniPatt;}
32  inline int lenjPatt() const {return s_lenjPatt;}
33  inline int leniVatt() const {return s_leniVatt;}
34  inline int lenjVatt() const {return s_lenjVatt;}
35 
36 private:
37 
38  // Lengths of array in HiMain2 common
39  static const int s_leniKatt = 130000;
40  static const int s_lenjKatt = 4;
41  static const int s_leniPatt = 130000;
42  static const int s_lenjPatt = 4;
43  static const int s_leniVatt = 130000;
44  static const int s_lenjVatt = 4;
45 
46  struct HIMAIN2;
47  friend struct HIMAIN2;
48 
49  struct HIMAIN2
50  {
54  };
55 
56  int m_dummy;
57  float m_realdummy;
58 
59  static HIMAIN2* s_himain2;
60 };
61 
62 // set pointer to zero at start
64 
65 inline void
67 { if (!s_himain2) s_himain2 = reinterpret_cast<HIMAIN2*>(himain2_address_()); }
68 
69 // Constructor
70 inline
72  : m_dummy (-999),
73  m_realdummy (-999.)
74 {}
75 
76 // Destructor
77 inline
79 {}
80 
81 inline int&
82 HiMain2::katt (int i, int j)
83 {
84  init(); // check COMMON is initialized
85  if( i < 1 || i > leniKatt() ||
86  j < 1 || j > lenjKatt() ) return m_dummy;
87 
88  return s_himain2->katt[j-1][i-1];
89 }
90 
91 inline float&
92 HiMain2::patt (int i, int j)
93 {
94  init(); // check COMMON is initialized
95  if( i < 1 || i > leniPatt() ||
96  j < 1 || j > lenjPatt() ) return m_realdummy;
97 
98  return s_himain2->patt[j-1][i-1];
99 }
100 
101 inline float&
102 HiMain2::vatt (int i, int j)
103 {
104  init(); // check COMMON is initialized
105  if( i < 1 || i > leniVatt() ||
106  j < 1 || j > lenjVatt() ) return m_realdummy;
107 
108  return s_himain2->vatt[j-1][i-1];
109 }
110 
111 #endif
HiMain2::katt
int & katt(int i, int j)
Definition: HiMain2.h:82
HiMain2::lenjVatt
int lenjVatt() const
Definition: HiMain2.h:34
HiMain2::HiMain2
HiMain2()
Definition: HiMain2.h:71
HiMain2::lenjPatt
int lenjPatt() const
Definition: HiMain2.h:32
HiMain2::s_leniKatt
static const int s_leniKatt
Definition: HiMain2.h:39
HiMain2::leniKatt
int leniKatt() const
Definition: HiMain2.h:29
HiMain2::leniVatt
int leniVatt() const
Definition: HiMain2.h:33
HiMain2::s_himain2
static HIMAIN2 * s_himain2
Definition: HiMain2.h:59
HiMain2::HIMAIN2::vatt
float vatt[s_lenjVatt][s_leniVatt]
Definition: HiMain2.h:53
HiMain2::init
void init(void)
Definition: HiMain2.h:66
HiMain2::s_lenjKatt
static const int s_lenjKatt
Definition: HiMain2.h:40
HiMain2::m_dummy
int m_dummy
Definition: HiMain2.h:56
himain2_address_
uintptr_t himain2_address_()
HiMain2::patt
float & patt(int i, int j)
Definition: HiMain2.h:92
HiMain2::HIMAIN2
Definition: HiMain2.h:50
lumiFormat.i
int i
Definition: lumiFormat.py:85
HiMain2::lenjKatt
int lenjKatt() const
Definition: HiMain2.h:30
HiMain2::s_lenjPatt
static const int s_lenjPatt
Definition: HiMain2.h:42
HiMain2::vatt
float & vatt(int i, int j)
Definition: HiMain2.h:102
HiMain2::s_leniVatt
static const int s_leniVatt
Definition: HiMain2.h:43
HiMain2::leniPatt
int leniPatt() const
Definition: HiMain2.h:31
HiMain2::HIMAIN2::katt
int katt[s_lenjKatt][s_leniKatt]
Definition: HiMain2.h:51
HiMain2
Class definition for HiMain2, which is used to modify the Hijing HIMAIN2 common.
Definition: HiMain2.h:17
HiMain2::~HiMain2
~HiMain2()
Definition: HiMain2.h:78
HiMain2::HIMAIN2::patt
float patt[s_lenjPatt][s_leniPatt]
Definition: HiMain2.h:52
HiMain2::s_leniPatt
static const int s_leniPatt
Definition: HiMain2.h:41
HiMain2::m_realdummy
float m_realdummy
Definition: HiMain2.h:57
HiMain2::s_lenjVatt
static const int s_lenjVatt
Definition: HiMain2.h:44