ROOTTools
 
Loading...
Searching...
No Matches
GUIDistrCutter2D Namespace Reference

Stores various useful data and functions for functionality of GUI cutter. The only useful funtions for user are AddHistogram, ReadCutAreas, SetOutputFile, and Exec. Other functions and variables are employed automaticaly when needed. More...

Functions

void AddHistogram (TH2D *hist)
 Add histogram.
 
void ReadCutAreas (const std::string &fileName)
 Reads cut areas from the file.
 
void SetOutputFile (const std::string &fileName, const bool rewrite=false)
 Set the file in which cut areas will be written.
 
void Exec ()
 Executable to pass to TPad::AddExec(name, command) to start GUI session.
 
void SetLine (TLine &line, const double x1, const double y1, const double x2, const double y2, const Color_t color=kRed)
 Sets style to the provided TLine. This function is called automaticaly when needed.
 
void Draw (const bool isRangeFixed=false)
 Draws histogram with cuts applied. This function is called automaticaly when needed.
 
void ApplyCuts (TH2D *hist)
 Applies cuts to the passed distribution. This function is called automaticaly when needed.
 
void MouseMotionAction (const double x, const double y)
 Applies actions to kMouseMotion event. This function is called automaticaly when needed.
 
void Button1DownAction (const double x, const double y)
 Applies actions to kButton1Down event. This function is called automaticaly when needed.
 
void KeyPressAction (const int button)
 Applies actions to kKeyPress event. This function is called automaticaly when needed.
 
bool IsBinCut (const int binX, const int binY)
 Checks whether the bin is cut or not.
 
double Pol1 (const double x, const double par0, const double par1)
 Needed for angular cut mode. This function is called automaticaly when needed.
 

Variables

std::vector< TH2D * > hists
 stores added distributions
 
std::vector< TH2D * > histsWithCuts
 stores added distributions to which cuts will be applied
 
std::vector< unsigned long > histsOrigIntegral
 stores integrals of added uncut hists
 
unsigned short currentHist = 0
 stores information about the index of the currently displayed histogram
 
std::vector< std::vector< bool > > inputFileCutAreas
 stores information about cut areas that were read from the input file
 
short currentCutMode = -1
 stores information about the current cut mode
 
std::vector< double > rectXMin
 stores minimum x values of the rectangular cut mode
 
std::vector< double > rectXMax
 stores maximum x values of the rectangular cut mode
 
std::vector< double > rectYMin
 stores minimum y values of the rectangular cut mode
 
std::vector< double > rectYMax
 stores maximum y values of the rectangular cut mode
 
std::vector< double > lineXMin
 stores minimum x values of x linear cut mode
 
std::vector< double > lineXMax
 stores maximum x values of x linear cut mode
 
std::vector< double > lineYMin
 stores minimum y values of y linear cut mode
 
std::vector< double > lineYMax
 stores maximum y values of y linear cut mode
 
std::vector< double > invRectXMin
 stores minimum x values of inverse rectangular cut mode
 
std::vector< double > invRectXMax
 stores maximum x values of inverse rectangular cut mode
 
std::vector< double > invRectYMin
 stores minimum y values of inverse rectangular cut mode
 
std::vector< double > invRectYMax
 stores maximum y values of inverse rectangular cut mode
 
std::vector< double > angledLine1X1
 stores x1 values of the 1st line of angled line cuts
 
std::vector< double > angledLine1X2
 stores x2 values of the 1st line of angled line cuts
 
std::vector< double > angledLine1Y1
 stores y1 values of the 1st line of angled line cuts
 
std::vector< double > angledLine1Y2
 stores y2 values of the 1st line of angled line cuts
 
std::vector< double > angledLine2X1
 stores x1 values of the 2nd line of angled line cuts
 
std::vector< double > angledLine2X2
 stores x2 values of the 2nd line of angled line cuts
 
std::vector< double > angledLine2Y1
 stores y1 values of the 2nd line of angled line cuts
 
std::vector< double > angledLine2Y2
 stores y2 values of the 2nd line of angled line cuts
 
std::vector< double > tanAlpha1
 stores tangent of alpha of the 1st line of angled line cuts
 
std::vector< double > tanAlpha2
 stores tangent of alpha of the 2nd line of angled line cuts
 
std::vector< double > shiftY1
 stores y shifts of the 1st line of angled line cuts
 
std::vector< double > shiftY2
 stores y shifts of the 2nd line of angled line cuts
 
std::vector< double > singleBinXCut
 stores x values of the single pixel cut mode
 
std::vector< double > singleBinYCut
 stores y values of the single pixel cut mode
 
std::array< bool, 5 > isMin = {true, true, true, true, true}
 stores information that shows whether the first point was chosen for the given cut mode
 
std::string outputFileName
 name of the file in which cuts will be written
 
bool isOutputFileSet = false
 shows whether the output file was set
 
bool isHistogramAdded = false
 shows whether at least one histogram was added
 
bool isFirstDraw = true
 checks if the histogram was drawn the first time
 

Detailed Description

Stores various useful data and functions for functionality of GUI cutter. The only useful funtions for user are AddHistogram, ReadCutAreas, SetOutputFile, and Exec. Other functions and variables are employed automaticaly when needed.

Function Documentation

◆ AddHistogram()

void GUIDistrCutter2D::AddHistogram ( TH2D * hist)

Add histogram.

Parameters
[in]histhistogram to be added. All added histograms must have the same number of bins and ranges of X and Y axis.

◆ ApplyCuts()

void GUIDistrCutter2D::ApplyCuts ( TH2D * hist)

Applies cuts to the passed distribution. This function is called automaticaly when needed.

◆ Button1DownAction()

void GUIDistrCutter2D::Button1DownAction ( const double x,
const double y )

Applies actions to kButton1Down event. This function is called automaticaly when needed.

◆ Draw()

void GUIDistrCutter2D::Draw ( const bool isRangeFixed = false)

Draws histogram with cuts applied. This function is called automaticaly when needed.

◆ Exec()

void GUIDistrCutter2D::Exec ( )

Executable to pass to TPad::AddExec(name, command) to start GUI session.

◆ IsBinCut()

bool GUIDistrCutter2D::IsBinCut ( const int binX,
const int binY )

Checks whether the bin is cut or not.

◆ KeyPressAction()

void GUIDistrCutter2D::KeyPressAction ( const int button)

Applies actions to kKeyPress event. This function is called automaticaly when needed.

◆ MouseMotionAction()

void GUIDistrCutter2D::MouseMotionAction ( const double x,
const double y )

Applies actions to kMouseMotion event. This function is called automaticaly when needed.

◆ Pol1()

double GUIDistrCutter2D::Pol1 ( const double x,
const double par0,
const double par1 )
inline

Needed for angular cut mode. This function is called automaticaly when needed.

◆ ReadCutAreas()

void GUIDistrCutter2D::ReadCutAreas ( const std::string & fileName)

Reads cut areas from the file.

The cuts from the file will be applied to all added histograms. If no histograms were added prior error will be written and exit(1) will be called.

Parameters
[in]fileNamename of the file to read the info from

◆ SetLine()

void GUIDistrCutter2D::SetLine ( TLine & line,
const double x1,
const double y1,
const double x2,
const double y2,
const Color_t color = kRed )
inline

Sets style to the provided TLine. This function is called automaticaly when needed.

◆ SetOutputFile()

void GUIDistrCutter2D::SetOutputFile ( const std::string & fileName,
const bool rewrite = false )

Set the file in which cut areas will be written.

Data will be written for output file for every bin 0 or 1, i.e. whether the bin was or was not cut. Additionaly, in the beginning of the file number of x bins, x range, number of y bins, y range are written.

Parameters
[in]fileNamename of the output file in which the data will be written.
[in]rewriteif true the file will be rewritten without warning. Else if the file with the same name exists, the old file will be renamed to (fileName + ".backup") and the data will be written into file (fileName).

Variable Documentation

◆ angledLine1X1

std::vector<double> GUIDistrCutter2D::angledLine1X1

stores x1 values of the 1st line of angled line cuts

◆ angledLine1X2

std::vector<double> GUIDistrCutter2D::angledLine1X2

stores x2 values of the 1st line of angled line cuts

◆ angledLine1Y1

std::vector<double> GUIDistrCutter2D::angledLine1Y1

stores y1 values of the 1st line of angled line cuts

◆ angledLine1Y2

std::vector<double> GUIDistrCutter2D::angledLine1Y2

stores y2 values of the 1st line of angled line cuts

◆ angledLine2X1

std::vector<double> GUIDistrCutter2D::angledLine2X1

stores x1 values of the 2nd line of angled line cuts

◆ angledLine2X2

std::vector<double> GUIDistrCutter2D::angledLine2X2

stores x2 values of the 2nd line of angled line cuts

◆ angledLine2Y1

std::vector<double> GUIDistrCutter2D::angledLine2Y1

stores y1 values of the 2nd line of angled line cuts

◆ angledLine2Y2

std::vector<double> GUIDistrCutter2D::angledLine2Y2

stores y2 values of the 2nd line of angled line cuts

◆ currentCutMode

short GUIDistrCutter2D::currentCutMode = -1

stores information about the current cut mode

◆ currentHist

unsigned short GUIDistrCutter2D::currentHist = 0

stores information about the index of the currently displayed histogram

◆ hists

std::vector<TH2D *> GUIDistrCutter2D::hists

stores added distributions

◆ histsOrigIntegral

std::vector<unsigned long> GUIDistrCutter2D::histsOrigIntegral

stores integrals of added uncut hists

◆ histsWithCuts

std::vector<TH2D *> GUIDistrCutter2D::histsWithCuts

stores added distributions to which cuts will be applied

◆ inputFileCutAreas

std::vector<std::vector<bool> > GUIDistrCutter2D::inputFileCutAreas

stores information about cut areas that were read from the input file

◆ invRectXMax

std::vector<double> GUIDistrCutter2D::invRectXMax

stores maximum x values of inverse rectangular cut mode

◆ invRectXMin

std::vector<double> GUIDistrCutter2D::invRectXMin

stores minimum x values of inverse rectangular cut mode

◆ invRectYMax

std::vector<double> GUIDistrCutter2D::invRectYMax

stores maximum y values of inverse rectangular cut mode

◆ invRectYMin

std::vector<double> GUIDistrCutter2D::invRectYMin

stores minimum y values of inverse rectangular cut mode

◆ isFirstDraw

bool GUIDistrCutter2D::isFirstDraw = true

checks if the histogram was drawn the first time

◆ isHistogramAdded

bool GUIDistrCutter2D::isHistogramAdded = false

shows whether at least one histogram was added

◆ isMin

std::array<bool, 5> GUIDistrCutter2D::isMin = {true, true, true, true, true}

stores information that shows whether the first point was chosen for the given cut mode

◆ isOutputFileSet

bool GUIDistrCutter2D::isOutputFileSet = false

shows whether the output file was set

◆ lineXMax

std::vector<double> GUIDistrCutter2D::lineXMax

stores maximum x values of x linear cut mode

◆ lineXMin

std::vector<double> GUIDistrCutter2D::lineXMin

stores minimum x values of x linear cut mode

◆ lineYMax

std::vector<double> GUIDistrCutter2D::lineYMax

stores maximum y values of y linear cut mode

◆ lineYMin

std::vector<double> GUIDistrCutter2D::lineYMin

stores minimum y values of y linear cut mode

◆ outputFileName

std::string GUIDistrCutter2D::outputFileName

name of the file in which cuts will be written

◆ rectXMax

std::vector<double> GUIDistrCutter2D::rectXMax

stores maximum x values of the rectangular cut mode

◆ rectXMin

std::vector<double> GUIDistrCutter2D::rectXMin

stores minimum x values of the rectangular cut mode

◆ rectYMax

std::vector<double> GUIDistrCutter2D::rectYMax

stores maximum y values of the rectangular cut mode

◆ rectYMin

std::vector<double> GUIDistrCutter2D::rectYMin

stores minimum y values of the rectangular cut mode

◆ shiftY1

std::vector<double> GUIDistrCutter2D::shiftY1

stores y shifts of the 1st line of angled line cuts

◆ shiftY2

std::vector<double> GUIDistrCutter2D::shiftY2

stores y shifts of the 2nd line of angled line cuts

◆ singleBinXCut

std::vector<double> GUIDistrCutter2D::singleBinXCut

stores x values of the single pixel cut mode

◆ singleBinYCut

std::vector<double> GUIDistrCutter2D::singleBinYCut

stores y values of the single pixel cut mode

◆ tanAlpha1

std::vector<double> GUIDistrCutter2D::tanAlpha1

stores tangent of alpha of the 1st line of angled line cuts

◆ tanAlpha2

std::vector<double> GUIDistrCutter2D::tanAlpha2

stores tangent of alpha of the 2nd line of angled line cuts