ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
TrigSeedML_LUT Struct Reference

#include <TrigSeedML_LUT.h>

Collaboration diagram for TrigSeedML_LUT:

Public Member Functions

 TrigSeedML_LUT ()
 
 TrigSeedML_LUT (int id, int w, int h, float c[4])
 
 TrigSeedML_LUT (const TrigSeedML_LUT &tsl)
 
 ~TrigSeedML_LUT ()
 
bool check (float fX, float fY) const
 
bool getValidRange (float fX, float &min, float &max) const
 
void initialize ()
 
void setBin (int r, int c)
 
void generate (float offset, float slope, float hwm, float hwp)
 

Public Attributes

int m_id
 
int m_w
 
int m_h
 
float m_c [4]
 
std::vector< unsigned char > m_data
 
float m_invBinWidthX
 
float m_invBinWidthY
 

Detailed Description

Definition at line 10 of file TrigSeedML_LUT.h.

Constructor & Destructor Documentation

◆ TrigSeedML_LUT() [1/3]

TrigSeedML_LUT::TrigSeedML_LUT ( )
inline

Definition at line 12 of file TrigSeedML_LUT.h.

12 : m_id(-1), m_w(0), m_h(0), m_data(0), m_invBinWidthX(0), m_invBinWidthY(0) {};

◆ TrigSeedML_LUT() [2/3]

TrigSeedML_LUT::TrigSeedML_LUT ( int  id,
int  w,
int  h,
float  c[4] 
)
inline

Definition at line 14 of file TrigSeedML_LUT.h.

14  : m_id(id), m_w(w), m_h(h) {
15  for(int i=0;i<4;i++) m_c[i] = c[i];
16  initialize();
17 }

◆ TrigSeedML_LUT() [3/3]

TrigSeedML_LUT::TrigSeedML_LUT ( const TrigSeedML_LUT tsl)
inline

Definition at line 19 of file TrigSeedML_LUT.h.

19  : m_id(tsl.m_id), m_w(tsl.m_w), m_h(tsl.m_h), m_data(tsl.m_data) {
20  for(int i=0;i<4;i++) m_c[i] = tsl.m_c[i];
21  m_invBinWidthX = m_w/(m_c[1]-m_c[0]);
22  m_invBinWidthY = m_h/(m_c[3]-m_c[2]);
23 }

◆ ~TrigSeedML_LUT()

TrigSeedML_LUT::~TrigSeedML_LUT ( )
inline

Definition at line 25 of file TrigSeedML_LUT.h.

25 {m_data.clear();}

Member Function Documentation

◆ check()

bool TrigSeedML_LUT::check ( float  fX,
float  fY 
) const
inline

Definition at line 27 of file TrigSeedML_LUT.h.

27  {
28 
29  int i = (fY - m_c[2])*m_invBinWidthY;
30  int j = (fX - m_c[0])*m_invBinWidthX;
31 
32  if(i<0 || i>= m_h || j<0 || j>=m_w) return false;
33 
34  return (m_data[j+i*m_w] != 0);
35  }

◆ generate()

void TrigSeedML_LUT::generate ( float  offset,
float  slope,
float  hwm,
float  hwp 
)
inline

Definition at line 74 of file TrigSeedML_LUT.h.

74  {
75 
76  m_data.resize(m_h*m_w, 0);
77 
78  for(int j=0;j<m_w;j++) {
79  float x = m_c[0] + j/m_invBinWidthX;
80 
81  float y = offset + x*slope;
82  float yp= y+hwp;
83  float ym= y+hwm;
84 
85  if(yp < m_c[2]) yp = m_c[2];
86  if(yp > m_c[3]) yp = m_c[3];
87 
88  if(ym < m_c[2]) ym = m_c[2];
89  if(ym > m_c[3]) ym = m_c[3];
90 
91  int i1 = int((ym-m_c[2])*m_invBinWidthY);
92  int i2 = int((yp-m_c[2])*m_invBinWidthY);
93 
94  for(int i=i1;i<i2;i++) {
95  m_data[j+m_w*i] = 1;
96  }
97 
98  }
99  }

◆ getValidRange()

bool TrigSeedML_LUT::getValidRange ( float  fX,
float &  min,
float &  max 
) const
inline

Definition at line 37 of file TrigSeedML_LUT.h.

37  {
38  min = m_c[2];
39  max = m_c[3];
40  int j = (fX - m_c[0])*m_invBinWidthX;
41  if(j<0 || j>=m_w) return false;
42 
43  int idx=j;
44  int i1=0;
45  int i2=0;
46  int i=0;
47  for(;i<m_h;i++, idx+=m_w) {
48  if(m_data[idx] == 0) continue;
49  else {
50  i1 = i;
51  i2 = i1;
52  break;
53  }
54  }
55  for(;i<m_h;i++, idx+=m_w) {
56  if(m_data[idx] != 0) i2++;
57  else break;
58  }
59 
60  min = m_c[2] + i1/m_invBinWidthY;
61  max = m_c[2] + i2/m_invBinWidthY;
62  return true;
63  }

◆ initialize()

void TrigSeedML_LUT::initialize ( )
inline

Definition at line 64 of file TrigSeedML_LUT.h.

64  {
65  m_invBinWidthX = m_w/(m_c[1]-m_c[0]);
66  m_invBinWidthY = m_h/(m_c[3]-m_c[2]);
67  m_data.resize(m_h*m_w, 0);
68  }

◆ setBin()

void TrigSeedML_LUT::setBin ( int  r,
int  c 
)
inline

Definition at line 70 of file TrigSeedML_LUT.h.

70  {
71  m_data[c + r*m_w] = 1;
72  }

Member Data Documentation

◆ m_c

float TrigSeedML_LUT::m_c[4]

Definition at line 103 of file TrigSeedML_LUT.h.

◆ m_data

std::vector<unsigned char> TrigSeedML_LUT::m_data

Definition at line 104 of file TrigSeedML_LUT.h.

◆ m_h

int TrigSeedML_LUT::m_h

Definition at line 102 of file TrigSeedML_LUT.h.

◆ m_id

int TrigSeedML_LUT::m_id

Definition at line 101 of file TrigSeedML_LUT.h.

◆ m_invBinWidthX

float TrigSeedML_LUT::m_invBinWidthX

Definition at line 105 of file TrigSeedML_LUT.h.

◆ m_invBinWidthY

float TrigSeedML_LUT::m_invBinWidthY

Definition at line 105 of file TrigSeedML_LUT.h.

◆ m_w

int TrigSeedML_LUT::m_w

Definition at line 102 of file TrigSeedML_LUT.h.


The documentation for this struct was generated from the following file:
beamspotman.r
def r
Definition: beamspotman.py:676
max
#define max(a, b)
Definition: cfImp.cxx:41
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
TrigSeedML_LUT::m_w
int m_w
Definition: TrigSeedML_LUT.h:102
TrigSeedML_LUT::m_invBinWidthX
float m_invBinWidthX
Definition: TrigSeedML_LUT.h:105
TrigSeedML_LUT::m_h
int m_h
Definition: TrigSeedML_LUT.h:102
x
#define x
TrigSeedML_LUT::m_id
int m_id
Definition: TrigSeedML_LUT.h:101
lumiFormat.i
int i
Definition: lumiFormat.py:85
TrigSeedML_LUT::m_invBinWidthY
float m_invBinWidthY
Definition: TrigSeedML_LUT.h:105
min
#define min(a, b)
Definition: cfImp.cxx:40
y
#define y
h
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
TrigSeedML_LUT::m_c
float m_c[4]
Definition: TrigSeedML_LUT.h:103
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
python.compressB64.c
def c
Definition: compressB64.py:93
TrigSeedML_LUT::initialize
void initialize()
Definition: TrigSeedML_LUT.h:64
TrigSeedML_LUT::m_data
std::vector< unsigned char > m_data
Definition: TrigSeedML_LUT.h:104