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

#include <ConstantContentBinMaker.h>

Collaboration diagram for MuonCalib::ConstantContentBinMaker:

Public Member Functions

 ConstantContentBinMaker (const std::vector< DataPoint > &points, const double epsilon)
 Constructor. More...
 
 ~ConstantContentBinMaker ()
 
bool binDataPoints (const unsigned int &bin_content, std::vector< unsigned int > &ref_coord)
 group the data points into bins of equal content "bin_content"; returns true in case of success, false otherwise; splitting is done along the coordinate axes stored in ref_coord successively; if ref_coord is of size 0, splitting will be done in all axes successively More...
 
const std::vector< DataBin * > & getBins () const
 get the bins determined by the method "binDataPoints" More...
 

Private Attributes

std::vector< DataPointm_points
 
std::vector< DataBin * > m_bins
 
double m_epsilon
 

Detailed Description

Definition at line 37 of file ConstantContentBinMaker.h.

Constructor & Destructor Documentation

◆ ConstantContentBinMaker()

ConstantContentBinMaker::ConstantContentBinMaker ( const std::vector< DataPoint > &  points,
const double  epsilon 
)

Constructor.

Parameters
pointsData points to be grouped into bins.
epsilonThe upper boundaries of the seed bin are shifted by epsilon to create a half-open intervall containing all data points.

Definition at line 23 of file ConstantContentBinMaker.cxx.

26  : m_points (points),
27  m_epsilon (std::abs(epsilon))
28 {
29 }

◆ ~ConstantContentBinMaker()

ConstantContentBinMaker::~ConstantContentBinMaker ( )

Definition at line 32 of file ConstantContentBinMaker.cxx.

33 {
34  for (DataBin* b : m_bins) {
35  delete b;
36  }
37 }

Member Function Documentation

◆ binDataPoints()

bool ConstantContentBinMaker::binDataPoints ( const unsigned int &  bin_content,
std::vector< unsigned int > &  ref_coord 
)

group the data points into bins of equal content "bin_content"; returns true in case of success, false otherwise; splitting is done along the coordinate axes stored in ref_coord successively; if ref_coord is of size 0, splitting will be done in all axes successively

Definition at line 46 of file ConstantContentBinMaker.cxx.

47  {
48 
50 // VARIABLES //
52 
53  unsigned int n_bins(static_cast<unsigned int>(
54  std::log(m_points.size()/static_cast<double>(bin_content))
55  /std::log(2.0)));
56  std::vector<unsigned int> splitting_axis(ref_coord);
57  unsigned int axis_counter(0);
58 
60 // RESET //
62  for (DataBin* b : m_bins) {
63  delete b;
64  }
65  m_bins.clear();
66 
68 // CHECK WHETHER THE IS SUFFICIENT DATA POINTS //
70 
71  if (m_points.empty() || n_bins<2) {
72  MsgStream log(Athena::getMessageSvc(), "ConstantContentBinMaker");
73  log<< MSG::WARNING << "Class ConstantContentBinMaker, method binDataPoints: Too few data points for binning!"<<endmsg;
74  return false;
75  }
76 
78 // CHECK REFERENCE COORDINATE //
80 
81  if (ref_coord.empty()) {
82  splitting_axis = std::vector<unsigned int>(
83  m_points[0].dataVector().rows());
84  for (unsigned int k=0; k<splitting_axis.size(); k++) {
85  splitting_axis[k] = k;
86  }
87  }
88 
90 // FILL A MOTHER BIN AND BIN THE DATA UNTIL THE REQUIRED BIN CONTENT IS //
91 // REACHED. //
93 
94 // mother bin //
95  m_bins.push_back(new DataBin(m_points, m_epsilon));
96 
97  for (unsigned int split=0; split<n_bins; split++) {
98  unsigned int nb_bins_so_far(m_bins.size());
99  for (unsigned int k=0; k<nb_bins_so_far; k++) {
100  m_bins.push_back(m_bins[k]->splitBin(
101  splitting_axis[axis_counter]));
102  axis_counter++;
103  if (axis_counter==splitting_axis.size()) {
104  axis_counter = 0;
105  }
106  }
107  }
108 
109  return true;
110 
111 }

◆ getBins()

const std::vector< DataBin * > & ConstantContentBinMaker::getBins ( ) const

get the bins determined by the method "binDataPoints"

Definition at line 119 of file ConstantContentBinMaker.cxx.

119  {
120 
121  return m_bins;
122 
123 }

Member Data Documentation

◆ m_bins

std::vector<DataBin *> MuonCalib::ConstantContentBinMaker::m_bins
private

Definition at line 66 of file ConstantContentBinMaker.h.

◆ m_epsilon

double MuonCalib::ConstantContentBinMaker::m_epsilon
private

Definition at line 67 of file ConstantContentBinMaker.h.

◆ m_points

std::vector<DataPoint> MuonCalib::ConstantContentBinMaker::m_points
private

Definition at line 65 of file ConstantContentBinMaker.h.


The documentation for this class was generated from the following files:
plotBeamSpotVxVal.splitBin
splitBin
Definition: plotBeamSpotVxVal.py:156
MuonCalib::ConstantContentBinMaker::m_points
std::vector< DataPoint > m_points
Definition: ConstantContentBinMaker.h:65
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
MuonCalib::ConstantContentBinMaker::m_epsilon
double m_epsilon
Definition: ConstantContentBinMaker.h:67
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
beamspotnt.rows
list rows
Definition: bin/beamspotnt.py:1112
MuonCalib::DataBin
Definition: DataBin.h:37
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
MuonCalib::ConstantContentBinMaker::m_bins
std::vector< DataBin * > m_bins
Definition: ConstantContentBinMaker.h:66
Trk::split
@ split
Definition: LayerMaterialProperties.h:38
jobOptions.points
points
Definition: jobOptions.GenevaPy8_Zmumu.py:97
fitman.k
k
Definition: fitman.py:528