ATLAS Offline Software
Loading...
Searching...
No Matches
HiStrng.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 HiStrng_h
7#define HiStrng_h
8
9#include <cstdint>
10
11extern "C" { uintptr_t histrng_address_(); }
17class HiStrng {
18public:
19 HiStrng();
20 ~HiStrng();
21
22 int& nfp (int i, int j);
23 float& pp (int i, int j);
24 int& nft (int i, int j);
25 float& pt (int i, int j);
26
27 void init (void);
28
29 // return common array lengths
30 inline int lenI() const {return s_lenI;}
31 inline int lenJ() const {return s_lenJ;}
32
33private:
34
35 // Lengths of array in HiMain2 common
36 static const int s_lenI = 300;
37 static const int s_lenJ = 15;
38
39 struct HISTRNG;
40 friend struct HISTRNG;
41
42 struct HISTRNG
43 {
45 float pp [s_lenJ][s_lenI];
47 float pt [s_lenJ][s_lenI];
48 };
49
52
54};
55
56// set pointer to zero at start
58
59inline void
61{ if (!s_histrng) s_histrng = reinterpret_cast<HISTRNG*>(histrng_address_()); }
62
63// Constructor
64inline
66 : m_dummy (-999),
67 m_realdummy (-999.)
68{}
69
70// Destructor
71inline
74
75inline int&
76HiStrng::nfp (int i, int j)
77{
78 init(); // check COMMON is initialized
79 if( i < 1 || i > lenI() ||
80 j < 1 || j > lenJ() ) return m_dummy;
81
82 return s_histrng->nfp[j-1][i-1];
83}
84
85inline float&
86HiStrng::pp (int i, int j)
87{
88 init(); // check COMMON is initialized
89 if( i < 1 || i > lenI() ||
90 j < 1 || j > lenJ() ) return m_realdummy;
91
92 return s_histrng->pp[j-1][i-1];
93}
94
95inline int&
96HiStrng::nft (int i, int j)
97{
98 init(); // check COMMON is initialized
99 if( i < 1 || i > lenI() ||
100 j < 1 || j > lenJ() ) return m_dummy;
101
102 return s_histrng->nft[j-1][i-1];
103}
104
105inline float&
106HiStrng::pt (int i, int j)
107{
108 init(); // check COMMON is initialized
109 if( i < 1 || i > lenI() ||
110 j < 1 || j > lenJ() ) return m_realdummy;
111
112 return s_histrng->pt[j-1][i-1];
113}
114
115#endif
uintptr_t histrng_address_()
static HISTRNG * s_histrng
Definition HiStrng.h:53
int & nfp(int i, int j)
Definition HiStrng.h:76
int lenI() const
Definition HiStrng.h:30
float m_realdummy
Definition HiStrng.h:51
float & pp(int i, int j)
Definition HiStrng.h:86
int m_dummy
Definition HiStrng.h:50
float & pt(int i, int j)
Definition HiStrng.h:106
int lenJ() const
Definition HiStrng.h:31
static const int s_lenJ
Definition HiStrng.h:37
HiStrng()
Definition HiStrng.h:65
static const int s_lenI
Definition HiStrng.h:36
int & nft(int i, int j)
Definition HiStrng.h:96
void init(void)
Definition HiStrng.h:60
~HiStrng()
Definition HiStrng.h:72
float pt[s_lenJ][s_lenI]
Definition HiStrng.h:47
float pp[s_lenJ][s_lenI]
Definition HiStrng.h:45
int nfp[s_lenJ][s_lenI]
Definition HiStrng.h:44
int nft[s_lenJ][s_lenI]
Definition HiStrng.h:46