ATLAS Offline Software
Loading...
Searching...
No Matches
CP::HistHandler_TH2Poly Class Reference

#include <HistHandler.h>

Inheritance diagram for CP::HistHandler_TH2Poly:
Collaboration diagram for CP::HistHandler_TH2Poly:

Public Member Functions

 HistHandler_TH2Poly (columnar::ColumnarTool<> *parent, TH2Poly *hist)
 The HistHandler_TH2Poly handles the TH2Poly histograms of the scale-factor maps.
virtual ~HistHandler_TH2Poly ()
int nOverFlowBins () const override
 Return the number of overflow bins.
bool isOverFlowBin (int b) const override
 States whether a bin is overflow or not.
int nBins () const override
 Return the total number of bins in the histogram -> (GetNbins() +2)**n.
std::string GetBinName (unsigned int bin) const override
 Translates the bin number into the borders and return them as name.
CorrectionCode FindBin (columnar::MuonId muon, int &bin) const override
 Function that changes from Implementation to implementation.
double GetBinContent (int bin) const
void SetBinContent (int bin, float val)
double GetBinError (int bin) const
TH1 * GetHist () const
void SetBinError (int bin, float val)

Private Attributes

TH2Poly * m_h
std::unique_ptr< AxisHandlerm_x_handler
std::unique_ptr< AxisHandlerm_y_handler
std::unique_ptr< TH1 > m_H

Detailed Description

Definition at line 162 of file HistHandler.h.

Constructor & Destructor Documentation

◆ HistHandler_TH2Poly()

CP::HistHandler_TH2Poly::HistHandler_TH2Poly ( columnar::ColumnarTool<> * parent,
TH2Poly * hist )

The HistHandler_TH2Poly handles the TH2Poly histograms of the scale-factor maps.

Since the bin-finding, algoritihms of the TH2Poly differ from the ones of TH1, TH2 & TH3 explicit methods of TH2Poly are needed to pick-up the proper bin.

Definition at line 297 of file HistHandler.cxx.

297 :
298 HistHandler(parent, h),
299 m_h(h),
300 m_x_handler(GetHist() == nullptr ? 0 : AxisHandlerProvider::GetAxisHandler(parent, h->GetXaxis())),
301 m_y_handler(GetHist() == nullptr ? 0 : AxisHandlerProvider::GetAxisHandler(parent, h->GetYaxis())) {
302
303 }
static std::unique_ptr< AxisHandler > GetAxisHandler(columnar::ColumnarTool<> *parent, const TAxis *axis)
std::unique_ptr< AxisHandler > m_y_handler
std::unique_ptr< AxisHandler > m_x_handler
TH1 * GetHist() const
Definition HistHandler.h:63
HistHandler(columnar::ColumnarTool<> *parent, TH1 *Hist)

◆ ~HistHandler_TH2Poly()

CP::HistHandler_TH2Poly::~HistHandler_TH2Poly ( )
virtual

Definition at line 305 of file HistHandler.cxx.

305 {
306 }

Member Function Documentation

◆ FindBin()

CorrectionCode CP::HistHandler_TH2Poly::FindBin ( columnar::MuonId muon,
int & bin ) const
overridevirtual

Function that changes from Implementation to implementation.

Implements CP::HistHandler.

Definition at line 314 of file HistHandler.cxx.

314 {
315 if (!m_h) return CorrectionCode::Error;
316 float parx = 0;
317 float pary = 0;
318 if (m_x_handler->GetBinningParameter(muon, parx) == CorrectionCode::Error ||
319 m_y_handler->GetBinningParameter(muon, pary) == CorrectionCode::Error) return CorrectionCode::Error;
320 else {
321 bin = GetHist()->FindBin(parx, pary);
322 if (bin < 0) {
324 }
325 }
326 return CorrectionCode::Ok;
327 }
@ Error
Some error happened during the object correction.
@ OutOfValidityRange
Input object is out of validity range.
@ Ok
The correction was done successfully.

◆ GetBinContent()

double CP::HistHandler::GetBinContent ( int bin) const
inlineinherited

Definition at line 51 of file HistHandler.h.

51 {
52 if (!m_H) return DBL_MAX;
53 return m_H->GetBinContent(bin);
54 }
std::unique_ptr< TH1 > m_H
Definition HistHandler.h:86

◆ GetBinError()

double CP::HistHandler::GetBinError ( int bin) const
inlineinherited

Definition at line 58 of file HistHandler.h.

58 {
59 if (!m_H) return DBL_MAX;
60 return m_H->GetBinError(bin);
61 }

◆ GetBinName()

std::string CP::HistHandler_TH2Poly::GetBinName ( unsigned int bin) const
overridevirtual

Translates the bin number into the borders and return them as name.

Implements CP::HistHandler.

Definition at line 328 of file HistHandler.cxx.

328 {
329 int x(0), y(0), z(0);
330 GetHist()->GetBinXYZ(bin, x, y, z);
331 TAxis* xAx = GetHist()->GetXaxis();
332 TAxis* yAx = GetHist()->GetYaxis();
333 return Form("%s_%.2f_to_%.2f__times_%s_%.2f_to_%.2f",
334 xAx->GetTitle(), xAx->GetBinLowEdge(x), xAx->GetBinUpEdge(x),
335 yAx->GetTitle(), yAx->GetBinLowEdge(y), yAx->GetBinUpEdge(y));
336 }
#define y
#define x
#define z

◆ GetHist()

TH1 * CP::HistHandler::GetHist ( ) const
inlineinherited

Definition at line 63 of file HistHandler.h.

63 {
64 return m_H.get();
65 }

◆ isOverFlowBin()

bool CP::HistHandler_TH2Poly::isOverFlowBin ( int b) const
overridevirtual

States whether a bin is overflow or not.

Implements CP::HistHandler.

Definition at line 312 of file HistHandler.cxx.

312{return b < 1;}

◆ nBins()

int CP::HistHandler_TH2Poly::nBins ( ) const
overridevirtual

Return the total number of bins in the histogram -> (GetNbins() +2)**n.

Implements CP::HistHandler.

Definition at line 307 of file HistHandler.cxx.

307 {
308 return m_h->GetNumberOfBins() + 1;
309 }

◆ nOverFlowBins()

int CP::HistHandler_TH2Poly::nOverFlowBins ( ) const
overridevirtual

Return the number of overflow bins.

Implements CP::HistHandler.

Definition at line 311 of file HistHandler.cxx.

311{return 10;}

◆ SetBinContent()

void HistHandler::SetBinContent ( int bin,
float val )
inherited

Definition at line 140 of file HistHandler.cxx.

140 {
141 if (m_H) {
142 m_H->SetBinContent(bin, val);
143 }
144 }

◆ SetBinError()

void HistHandler::SetBinError ( int bin,
float val )
inherited

Definition at line 145 of file HistHandler.cxx.

145 {
146 if (m_H) {
147 m_H->SetBinError(bin, val);
148 }
149 }

Member Data Documentation

◆ m_H

std::unique_ptr<TH1> CP::HistHandler::m_H
privateinherited

Definition at line 86 of file HistHandler.h.

◆ m_h

TH2Poly* CP::HistHandler_TH2Poly::m_h
private

Definition at line 179 of file HistHandler.h.

◆ m_x_handler

std::unique_ptr<AxisHandler> CP::HistHandler_TH2Poly::m_x_handler
private

Definition at line 180 of file HistHandler.h.

◆ m_y_handler

std::unique_ptr<AxisHandler> CP::HistHandler_TH2Poly::m_y_handler
private

Definition at line 181 of file HistHandler.h.


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