MINT2
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
HyperBinningAlgorithms Class Reference

#include <HyperBinningAlgorithms.h>

Public Types

enum  Alg {
  SMART, MINT, MINT_SMART, MINT_RANDOM,
  SMART_RANDOM, LIKELIHOOD, SMART_LIKELIHOOD, SMART_MULTI,
  FUNC_PHASE
}
 

Public Member Functions

 HyperBinningAlgorithms (Alg algorithm)
 
void addAlgOption (AlgOption option)
 Add an AlgOption which is passed to the binning algortihm. More...
 
HyperBinningMakergetHyperBinningMaker (HyperCuboid binningRange, HyperPointSet points)
 
 ~HyperBinningAlgorithms ()
 

Private Member Functions

AlgOption getOpt (AlgOption::OptionName name)
 
bool optExist (AlgOption::OptionName name)
 

Private Attributes

std::vector< AlgOption_algOptions
 
Alg _alg
 

Detailed Description

HyperPlot, Author: Sam Harnew, sam.h.nosp@m.arne.nosp@m.w@gma.nosp@m.il.c.nosp@m.om , Date: Dec 2015

This class is used to pick one of the binning algorithms (in HyperBinningMakers.h) and then sets any additional options that are passed as AlgOption's

Definition at line 134 of file HyperBinningAlgorithms.h.

Member Enumeration Documentation

◆ Alg

Constructor & Destructor Documentation

◆ HyperBinningAlgorithms()

HyperBinningAlgorithms::HyperBinningAlgorithms ( Alg  algorithm)

Constuct a HyperBinningAlgorithms by selecting the algortihm you would like to use

Definition at line 293 of file HyperBinningAlgorithms.cpp.

293  :
294  _alg(algorithm)
295 {
296 
297 }

◆ ~HyperBinningAlgorithms()

HyperBinningAlgorithms::~HyperBinningAlgorithms ( )

Destructor

Definition at line 424 of file HyperBinningAlgorithms.cpp.

424  {
425 
426 }

Member Function Documentation

◆ addAlgOption()

void HyperBinningAlgorithms::addAlgOption ( AlgOption  option)

Add an AlgOption which is passed to the binning algortihm.

Definition at line 300 of file HyperBinningAlgorithms.cpp.

300  {
301  _algOptions.push_back(option);
302 }
std::vector< AlgOption > _algOptions

◆ getHyperBinningMaker()

HyperBinningMaker * HyperBinningAlgorithms::getHyperBinningMaker ( HyperCuboid  binningRange,
HyperPointSet  points 
)

Get the HyperBinningMaker (the binning algorithm) with the chosen algorithm type, and with the chosen AlgOption's

Definition at line 306 of file HyperBinningAlgorithms.cpp.

306  {
307 
308  int dim = binningRange.getDimension();
309 
310  HyperBinningMaker* binnningMaker = 0;
311 
312  int startDimension = 0;
313 
315  startDimension = getOpt(AlgOption::START_DIM ).getIntOpt();
316 
317  int numPhaseBinPairs = 3;
319  numPhaseBinPairs = getOpt(AlgOption::NUM_BIN_PAIRS ).getIntOpt();
320 
321 
322 
323  //Chose the binning algorithm
324 
325  if (_alg == SMART ) {
326  binnningMaker = new HyperBinningMakerSmart(binningRange, points, startDimension);
327  }
328  if (_alg == MINT ) {
329  binnningMaker = new HyperBinningMakerMint(binningRange, points, startDimension);
330  }
331  if (_alg == MINT_SMART ) {
332  binnningMaker = new HyperBinningMakerMintSmart(binningRange, points, startDimension);
333  }
334  if (_alg == MINT_RANDOM ) {
335  binnningMaker = new HyperBinningMakerMintRandomise(binningRange, points);
336  }
337  if (_alg == SMART_RANDOM ) {
338  binnningMaker = new HyperBinningMakerSmartRandomise(binningRange, points);
339  }
340  if (_alg == LIKELIHOOD ) {
341  binnningMaker = new HyperBinningMakerLikelihood(binningRange, points);
342  }
343  if (_alg == SMART_LIKELIHOOD ) {
344  binnningMaker = new HyperBinningMakerSmartLikelihood(binningRange, points);
345  }
346  if (_alg == SMART_MULTI) {
347  binnningMaker = new HyperBinningMakerMultiSmart(binningRange, points, startDimension);
348  }
349  if (_alg == FUNC_PHASE) {
350  HyperBinningMakerPhaseBinning* phaseBinningMaker = new HyperBinningMakerPhaseBinning(binningRange, 0);
351  phaseBinningMaker->setNumBinPairs(numPhaseBinPairs);
352 
354  phaseBinningMaker->setBinEdges( getOpt(AlgOption::PHASE_BIN_EDGES ).getDoubleVectorOpt() );
355 
356  binnningMaker = dynamic_cast<HyperBinningMaker*>(phaseBinningMaker);
357  }
358  //Now set the options
359 
360 
362  binnningMaker->setSeed ( getOpt(AlgOption::RAND_SEED ).getIntOpt() );
363 
365  binnningMaker->useEventWeights( getOpt(AlgOption::USE_WEIGHTS).getBoolOpt() );
366 
368  binnningMaker->setBinningDimensions( getOpt(AlgOption::BINNING_DIMS).getIntVectorOpt() );
369 
370  if (optExist(AlgOption::FUNC ))
371  binnningMaker->setHyperFunction( getOpt(AlgOption::FUNC).getFuncOpt() );
372 
374  //can provide either a double or a HyperPoint here.
375 
377  double widthsB = getOpt(AlgOption::MIN_BIN_WIDTH).getDoubleOpt ();
378  if ( widthsA.getDimension() == 0 ) widthsA = HyperPoint(dim, widthsB);
379  binnningMaker->setMinimumEdgeLength(widthsA);
380  }
381 
383  binnningMaker->addShadowHyperPointSet( getOpt(AlgOption::USE_SHADOW_DATA).getHyperPointSetOpt() );
384 
386  binnningMaker->setMinimumBinContent( getOpt(AlgOption::MIN_BIN_CONTENT).getDoubleOpt() );
387 
389  binnningMaker->setShadowMinimumBinContent( getOpt(AlgOption::MIN_BIN_CONTENT).getDoubleOpt() );
390 
392  binnningMaker->drawAfterEachIteration( getOpt(AlgOption::DRAW_ALGORITHM).getStringOpt() );
393 
395  binnningMaker->setNames( getOpt(AlgOption::AXIS_NAMES).getHyperNameOpt() );
396 
398  binnningMaker->useSnapToGrid( getOpt(AlgOption::SNAP_TO_GRID).getBoolOpt() );
399  }
400 
402 
405 
406  if (valA.getDimension() != 0){
407  binnningMaker->setGridMultiplier(valA);
408  }
409  else{
410  binnningMaker->setGridMultiplier(valB);
411  }
412  }
413 
415  binnningMaker->updateFromExistingHyperBinning( *getOpt(AlgOption::START_BINNING).getHyperBinningOpt() );
416  }
417 
418  return binnningMaker;
419 
420 }
void addShadowHyperPointSet(const HyperPointSet &data)
void setShadowMinimumBinContent(double val)
void setBinningDimensions(std::vector< int > dims)
void setNames(HyperName names)
void drawAfterEachIteration(TString path)
void setGridMultiplier(HyperPoint &multipliers)
void setMinimumEdgeLength(double val)
HyperPoint getHyperPointOpt()
void useSnapToGrid(bool val)
void updateFromExistingHyperBinning(const HyperBinning &binning)
const int & getDimension() const
Definition: HyperCuboid.h:45
AlgOption getOpt(AlgOption::OptionName name)
bool optExist(AlgOption::OptionName name)
void setHyperFunction(HyperFunction *fnc)
Set the HyperFunction - only used by some binning Algs.
void setBinEdges(std::vector< double > binEdges)
void setSeed(int seed)
void useEventWeights(bool val=true)
int getDimension() const
Definition: HyperPoint.h:99
void setMinimumBinContent(double val)

◆ getOpt()

AlgOption HyperBinningAlgorithms::getOpt ( AlgOption::OptionName  name)
private

look through the list of AlgOption's and see if one with a specific OptionName exsits. If so, return it, if not return the OptionName EMTPY

Definition at line 274 of file HyperBinningAlgorithms.cpp.

274  {
275 
276  for (unsigned i = 0; i < _algOptions.size(); i++) {
277  if (_algOptions.at(i).getOptionName() == name) return _algOptions.at(i);
278  }
279 
280  return AlgOption::Empty();
281 }
static AlgOption Empty()
std::vector< AlgOption > _algOptions

◆ optExist()

bool HyperBinningAlgorithms::optExist ( AlgOption::OptionName  name)
private

look through the list of AlgOption's and see if one with a specific OptionName exsits.

Definition at line 285 of file HyperBinningAlgorithms.cpp.

285  {
286 
287  return getOpt(name).isEmpty() == 0;
288 
289 }
AlgOption getOpt(AlgOption::OptionName name)

Member Data Documentation

◆ _alg

Alg HyperBinningAlgorithms::_alg
private

the algorithm (e.g. HyperBinningMakerMint) that will be used in a particular instance of the class

Definition at line 147 of file HyperBinningAlgorithms.h.

◆ _algOptions

std::vector<AlgOption> HyperBinningAlgorithms::_algOptions
private

list of options that will be given to the HyperBinningMaker

Definition at line 144 of file HyperBinningAlgorithms.h.


The documentation for this class was generated from the following files: