ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
CaloLocalHadCoeff::LocalHadDimension Class Reference

Class defines binning for user dimension. More...

#include <CaloLocalHadCoeff.h>

Collaboration diagram for CaloLocalHadCoeff::LocalHadDimension:

Public Member Functions

 LocalHadDimension ()
 Default Constructor. More...
 
 LocalHadDimension (const char *title, unsigned int typ, int nbins, float xmin, float xmax)
 Constructor to define equidistant binning. More...
 
 LocalHadDimension (const char *title, unsigned int typ, std::vector< float > &xbins)
 Constructor to define arbitrary binning. More...
 
 LocalHadDimension (const LocalHadDimension &other)=default
 Copy constructor. More...
 
LocalHadDimensionoperator= (const LocalHadDimension &other)=default
 
 LocalHadDimension (LocalHadDimension &&) noexcept=default
 Move constructor. More...
 
LocalHadDimensionoperator= (LocalHadDimension &&) noexcept=default
 
unsigned int getType () const
 return dimension type More...
 
int getNbins () const
 return number of bins More...
 
float getXmin () const
 return minimum value for the first bin More...
 
float getXmax () const
 return maximum value for the last bin More...
 
float getDx () const
 return size of bin More...
 
int getBin (float &x) const
 return bin number More...
 
int getBinAdjusted (float &x, float &xadj) const
 
const std::string & getTitle () const
 return dimension name More...
 

Private Attributes

std::string m_title
 dimensions title (e.g. "eta", "energy", "lambda", "blabla", etc) More...
 
unsigned int m_type
 dimension type More...
 
int m_nbins
 number of bins More...
 
float m_xmin
 minimum value for the first bin More...
 
float m_xmax
 maximum value for the last bin More...
 
float m_dx
 bin size (in the case of equidistant binning) More...
 
std::vector< float > m_xbins
 bins borders (if dimension has non-equidistant binning), vector of size m_nbins+1 More...
 

Detailed Description

Class defines binning for user dimension.

Definition at line 47 of file CaloLocalHadCoeff.h.

Constructor & Destructor Documentation

◆ LocalHadDimension() [1/5]

CaloLocalHadCoeff::LocalHadDimension::LocalHadDimension ( )
inline

Default Constructor.

Definition at line 52 of file CaloLocalHadCoeff.h.

52 : m_type(0), m_nbins(0), m_xmin(0.0), m_xmax(0.0), m_dx(0.0) {};

◆ LocalHadDimension() [2/5]

CaloLocalHadCoeff::LocalHadDimension::LocalHadDimension ( const char *  title,
unsigned int  typ,
int  nbins,
float  xmin,
float  xmax 
)
inline

Constructor to define equidistant binning.

Parameters
titleDimension title
typeDimension type
xminMinimum value for the first bin
xmaxMaximum value for the last bin

Definition at line 61 of file CaloLocalHadCoeff.h.

61  :
63  {
64  m_xbins.resize(0);
65  m_dx = (m_xmax-m_xmin)/float(m_nbins);
66  }

◆ LocalHadDimension() [3/5]

CaloLocalHadCoeff::LocalHadDimension::LocalHadDimension ( const char *  title,
unsigned int  typ,
std::vector< float > &  xbins 
)
inline

Constructor to define arbitrary binning.

Parameters
titleDimension title
typeDimension type
xbinsBins borders, vector of size m_nbins+1

Definition at line 74 of file CaloLocalHadCoeff.h.

74  :
75  m_title(title), m_type(typ),
76  m_nbins (xbins.size() - 1),
77  m_xmin (xbins.front()),
78  m_xmax (xbins.back()),
79  m_dx(0.0),
80  m_xbins (xbins)
81  {
82  }

◆ LocalHadDimension() [4/5]

CaloLocalHadCoeff::LocalHadDimension::LocalHadDimension ( const LocalHadDimension other)
default

Copy constructor.

◆ LocalHadDimension() [5/5]

CaloLocalHadCoeff::LocalHadDimension::LocalHadDimension ( LocalHadDimension &&  )
defaultnoexcept

Move constructor.

Member Function Documentation

◆ getBin()

int CaloLocalHadCoeff::LocalHadDimension::getBin ( float &  x) const

return bin number

Definition at line 25 of file CaloLocalHadCoeff.cxx.

26 {
27  if( x<m_xmin ) {
28  return -1;
29  }
30  if( x>=m_xmax ) {
31  return -100;
32  }
33  int i_bin = -1;
34  if( m_xbins.empty() ) { // flat binning
35  i_bin = (int)((x - m_xmin)/m_dx);
36  }else{ // user binning
37  for(i_bin=0; i_bin<(int)m_xbins.size(); i_bin++){
38  if( x < m_xbins[i_bin] ) break;
39  }
40  }
41  return i_bin;
42 }

◆ getBinAdjusted()

int CaloLocalHadCoeff::LocalHadDimension::getBinAdjusted ( float &  x,
float &  xadj 
) const

Definition at line 45 of file CaloLocalHadCoeff.cxx.

46 {
47  if (x < m_xmin) {
48  xadj=0.;
49  return 0;
50  }
51 
52 // int i_bin = (int)((x - m_xmin)/m_dx);
53  int i_bin = getBin(x);
54 
55  if(i_bin<-10) {
56  i_bin=m_nbins-1;
57  xadj=1.0;
58  } else if(i_bin<0) {
59  i_bin=0;
60  xadj=0.0;
61  }else{
62  xadj = fmod( (x-m_xmin)/m_dx, 1);
63  if(xadj <= 0.5) {
64  if(i_bin > 0 ){
65  --i_bin;
66  xadj += 0.5;
67  } else {
68  xadj=0.;
69  }
70  }else{
71 // if(i_bin > 0){
72  xadj -= 0.5;
73 // }
74  }
75  }
76  return i_bin;
77 }

◆ getDx()

float CaloLocalHadCoeff::LocalHadDimension::getDx ( ) const
inline

return size of bin

Definition at line 108 of file CaloLocalHadCoeff.h.

108 {return m_dx;}

◆ getNbins()

int CaloLocalHadCoeff::LocalHadDimension::getNbins ( ) const
inline

return number of bins

Definition at line 99 of file CaloLocalHadCoeff.h.

99 {return m_nbins;}

◆ getTitle()

const std::string& CaloLocalHadCoeff::LocalHadDimension::getTitle ( ) const
inline

return dimension name

Definition at line 116 of file CaloLocalHadCoeff.h.

116 {return m_title;}

◆ getType()

unsigned int CaloLocalHadCoeff::LocalHadDimension::getType ( ) const
inline

return dimension type

Definition at line 96 of file CaloLocalHadCoeff.h.

96 {return m_type;}

◆ getXmax()

float CaloLocalHadCoeff::LocalHadDimension::getXmax ( ) const
inline

return maximum value for the last bin

Definition at line 105 of file CaloLocalHadCoeff.h.

105 {return m_xmax;}

◆ getXmin()

float CaloLocalHadCoeff::LocalHadDimension::getXmin ( ) const
inline

return minimum value for the first bin

Definition at line 102 of file CaloLocalHadCoeff.h.

102 {return m_xmin;}

◆ operator=() [1/2]

LocalHadDimension& CaloLocalHadCoeff::LocalHadDimension::operator= ( const LocalHadDimension other)
default

◆ operator=() [2/2]

LocalHadDimension& CaloLocalHadCoeff::LocalHadDimension::operator= ( LocalHadDimension &&  )
defaultnoexcept

Member Data Documentation

◆ m_dx

float CaloLocalHadCoeff::LocalHadDimension::m_dx
private

bin size (in the case of equidistant binning)

Definition at line 135 of file CaloLocalHadCoeff.h.

◆ m_nbins

int CaloLocalHadCoeff::LocalHadDimension::m_nbins
private

number of bins

Definition at line 126 of file CaloLocalHadCoeff.h.

◆ m_title

std::string CaloLocalHadCoeff::LocalHadDimension::m_title
private

dimensions title (e.g. "eta", "energy", "lambda", "blabla", etc)

Definition at line 120 of file CaloLocalHadCoeff.h.

◆ m_type

unsigned int CaloLocalHadCoeff::LocalHadDimension::m_type
private

dimension type

Definition at line 123 of file CaloLocalHadCoeff.h.

◆ m_xbins

std::vector<float > CaloLocalHadCoeff::LocalHadDimension::m_xbins
private

bins borders (if dimension has non-equidistant binning), vector of size m_nbins+1

Definition at line 138 of file CaloLocalHadCoeff.h.

◆ m_xmax

float CaloLocalHadCoeff::LocalHadDimension::m_xmax
private

maximum value for the last bin

Definition at line 132 of file CaloLocalHadCoeff.h.

◆ m_xmin

float CaloLocalHadCoeff::LocalHadDimension::m_xmin
private

minimum value for the first bin

Definition at line 129 of file CaloLocalHadCoeff.h.


The documentation for this class was generated from the following files:
CaloLocalHadCoeff::LocalHadDimension::m_type
unsigned int m_type
dimension type
Definition: CaloLocalHadCoeff.h:123
CaloLocalHadCoeff::LocalHadDimension::m_dx
float m_dx
bin size (in the case of equidistant binning)
Definition: CaloLocalHadCoeff.h:135
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
x
#define x
CaloLocalHadCoeff::LocalHadDimension::m_nbins
int m_nbins
number of bins
Definition: CaloLocalHadCoeff.h:126
xmin
double xmin
Definition: listroot.cxx:60
CaloLocalHadCoeff::LocalHadDimension::m_xbins
std::vector< float > m_xbins
bins borders (if dimension has non-equidistant binning), vector of size m_nbins+1
Definition: CaloLocalHadCoeff.h:138
covarianceTool.title
title
Definition: covarianceTool.py:542
CaloLocalHadCoeff::LocalHadDimension::m_xmax
float m_xmax
maximum value for the last bin
Definition: CaloLocalHadCoeff.h:132
SCT_CalibAlgs::nbins
@ nbins
Definition: SCT_CalibNumbers.h:10
LArCellBinning.xbins
int xbins
Definition: LArCellBinning.py:163
CaloLocalHadCoeff::LocalHadDimension::getBin
int getBin(float &x) const
return bin number
Definition: CaloLocalHadCoeff.cxx:25
CaloLocalHadCoeff::LocalHadDimension::m_xmin
float m_xmin
minimum value for the first bin
Definition: CaloLocalHadCoeff.h:129
xmax
double xmax
Definition: listroot.cxx:61
CaloLocalHadCoeff::LocalHadDimension::m_title
std::string m_title
dimensions title (e.g. "eta", "energy", "lambda", "blabla", etc)
Definition: CaloLocalHadCoeff.h:120