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

Private Attributes

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

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) {};
float m_xmin
minimum value for the first bin
float m_dx
bin size (in the case of equidistant binning)
float m_xmax
maximum value for the last bin

◆ 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 :
62 m_title(title), m_type(typ), m_nbins(nbins), m_xmin(xmin), m_xmax(xmax)
63 {
64 m_xbins.resize(0);
65 m_dx = (m_xmax-m_xmin)/float(m_nbins);
66 }
std::vector< float > m_xbins
bins borders (if dimension has non-equidistant binning), vector of size m_nbins+1
std::string m_title
dimensions title (e.g. "eta", "energy", "lambda", "blabla", etc)
double xmax
Definition listroot.cxx:61
double xmin
Definition listroot.cxx:60

◆ 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}
#define x

◆ 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}
int getBin(float &x) const
return bin number

◆ 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: