ATLAS Offline Software
HijCrdn.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 HijCrdn_h
7 #define HijCrdn_h
8 
9 #include <cstdint>
10 
11 extern "C" { uintptr_t hijcrdn_address_(); }
17 class HijCrdn {
18 public:
19  HijCrdn();
20  ~HijCrdn();
21 
22  float& yp (int i, int j);
23  float& yt (int i, int j);
24 
25  void init (void);
26 
27  // return common array lengths
28  inline int lenI() const {return s_lenI;}
29  inline int lenJ() const {return s_lenJ;}
30 
31 private:
32 
33  // Lengths of array in HiMain2 common
34  static const int s_lenI = 3;
35  static const int s_lenJ = 300;
36 
37  struct HIJCRDN;
38  friend struct HIJCRDN;
39 
40  struct HIJCRDN
41  {
42  float yp [s_lenJ][s_lenI];
43  float yt [s_lenJ][s_lenI];
44  };
45 
46  float m_realdummy;
47 
48  static HIJCRDN* s_hijcrdn;
49 };
50 
51 // set pointer to zero at start
53 
54 inline void
56 { if (!s_hijcrdn) s_hijcrdn = reinterpret_cast<HIJCRDN*>(hijcrdn_address_()); }
57 
58 // Constructor
59 inline
61  : m_realdummy (-999.)
62 {}
63 
64 // Destructor
65 inline
67 {}
68 
69 inline float&
70 HijCrdn::yp (int i, int j)
71 {
72  init(); // check COMMON is initialized
73  if( i < 1 || i > lenI() ||
74  j < 1 || j > lenJ() ) return m_realdummy;
75 
76  return s_hijcrdn->yp[j-1][i-1];
77 }
78 
79 inline float&
80 HijCrdn::yt (int i, int j)
81 {
82  init(); // check COMMON is initialized
83  if( i < 1 || i > lenI() ||
84  j < 1 || j > lenJ() ) return m_realdummy;
85 
86  return s_hijcrdn->yt[j-1][i-1];
87 }
88 
89 #endif
HijCrdn::HijCrdn
HijCrdn()
Definition: HijCrdn.h:60
HijCrdn::init
void init(void)
Definition: HijCrdn.h:55
HijCrdn::~HijCrdn
~HijCrdn()
Definition: HijCrdn.h:66
hijcrdn_address_
uintptr_t hijcrdn_address_()
HijCrdn::HIJCRDN
Definition: HijCrdn.h:41
HijCrdn::s_lenI
static const int s_lenI
Definition: HijCrdn.h:34
HijCrdn::yp
float & yp(int i, int j)
Definition: HijCrdn.h:70
lumiFormat.i
int i
Definition: lumiFormat.py:92
HijCrdn::s_hijcrdn
static HIJCRDN * s_hijcrdn
Definition: HijCrdn.h:48
HijCrdn::yt
float & yt(int i, int j)
Definition: HijCrdn.h:80
HijCrdn::s_lenJ
static const int s_lenJ
Definition: HijCrdn.h:35
HijCrdn::HIJCRDN::yp
float yp[s_lenJ][s_lenI]
Definition: HijCrdn.h:42
HijCrdn::m_realdummy
float m_realdummy
Definition: HijCrdn.h:46
HijCrdn::HIJCRDN::yt
float yt[s_lenJ][s_lenI]
Definition: HijCrdn.h:43
HijCrdn
Class definition for HijCrdn, which is used to modify the Hijing HIJCRDN common.
Definition: HijCrdn.h:17
HijCrdn::lenI
int lenI() const
Definition: HijCrdn.h:28
HijCrdn::lenJ
int lenJ() const
Definition: HijCrdn.h:29