ATLAS Offline Software
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
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 (TH2Poly *hist)
 The HistHandler_TH2Poly handles the TH2Poly histograms of the scale-factor maps. More...
 
 HistHandler_TH2Poly (const HistHandler_TH2Poly &other)
 
virtual HistHandler_TH2Polyoperator= (const HistHandler_TH2Poly &other)
 
virtual ~HistHandler_TH2Poly ()
 
int nOverFlowBins () const override
 Return the number of overflow bins. More...
 
bool isOverFlowBin (int b) const override
 States whether a bin is overflow or not. More...
 
int nBins () const override
 Return the total number of bins in the histogram -> (GetNbins() +2)**n. More...
 
std::string GetBinName (unsigned int bin) const override
 Translates the bin number into the borders and return them as name. More...
 
CorrectionCode FindBin (const xAOD::Muon &muon, int &bin) const override
 Function that changes from Implementation to implementation. More...
 
double GetBinContent (int bin) const
 
void SetBinContent (int bin, float val)
 
double GetBinError (int bin) const
 
TH1GetHist () const
 
void SetBinError (int bin, float val)
 

Protected Member Functions

void Copy (const HistHandler &other)
 

Private Attributes

TH2Poly * m_h
 
std::unique_ptr< AxisHandlerm_x_handler
 
std::unique_ptr< AxisHandlerm_y_handler
 
std::unique_ptr< TH1m_H
 

Detailed Description

Definition at line 161 of file HistHandler.h.

Constructor & Destructor Documentation

◆ HistHandler_TH2Poly() [1/2]

CP::HistHandler_TH2Poly::HistHandler_TH2Poly ( 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 341 of file HistHandler.cxx.

341  :
342  HistHandler(h),
343  m_h(h),
344  m_x_handler(GetHist() == nullptr ? 0 : AxisHandlerProvider::GetAxisHandler(h->GetXaxis())),
345  m_y_handler(GetHist() == nullptr ? 0 : AxisHandlerProvider::GetAxisHandler(h->GetYaxis())) {
346 
347  }

◆ HistHandler_TH2Poly() [2/2]

CP::HistHandler_TH2Poly::HistHandler_TH2Poly ( const HistHandler_TH2Poly other)

Definition at line 349 of file HistHandler.cxx.

349  :
351  m_h(other.m_h),
352  m_x_handler(other.GetHist() == nullptr ? 0 : AxisHandlerProvider::GetAxisHandler(other.m_h->GetXaxis())),
353  m_y_handler(other.GetHist() == nullptr ? 0 : AxisHandlerProvider::GetAxisHandler(other.m_h->GetYaxis())) {
354 
355  }

◆ ~HistHandler_TH2Poly()

CP::HistHandler_TH2Poly::~HistHandler_TH2Poly ( )
virtual

Definition at line 368 of file HistHandler.cxx.

368  {
369  }

Member Function Documentation

◆ Copy()

void HistHandler::Copy ( const HistHandler other)
protectedinherited

Definition at line 126 of file HistHandler.cxx.

126  {
127  if (this == &other) {
128  return;
129  }
130  if (other.m_H) {
131  m_H = clone(other.GetHist());
132  }
133  }

◆ FindBin()

CorrectionCode CP::HistHandler_TH2Poly::FindBin ( const xAOD::Muon muon,
int &  bin 
) const
overridevirtual

Function that changes from Implementation to implementation.

Implements CP::HistHandler.

Definition at line 377 of file HistHandler.cxx.

377  {
378  if (!m_h) return CorrectionCode::Error;
379  float parx = 0;
380  float pary = 0;
381  if (m_x_handler->GetBinningParameter(muon, parx) == CorrectionCode::Error ||
382  m_y_handler->GetBinningParameter(muon, pary) == CorrectionCode::Error) return CorrectionCode::Error;
383  else {
384  bin = GetHist()->FindBin(parx, pary);
385  if (bin < 0) {
387  }
388  }
389  return CorrectionCode::Ok;
390  }

◆ GetBinContent()

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

Definition at line 46 of file HistHandler.h.

46  {
47  if (!m_H) return DBL_MAX;
48  return m_H->GetBinContent(bin);
49  }

◆ GetBinError()

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

Definition at line 53 of file HistHandler.h.

53  {
54  if (!m_H) return DBL_MAX;
55  return m_H->GetBinError(bin);
56  }

◆ 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 391 of file HistHandler.cxx.

391  {
392  int x(0), y(0), z(0);
393  GetHist()->GetBinXYZ(bin, x, y, z);
394  TAxis* xAx = GetHist()->GetXaxis();
395  TAxis* yAx = GetHist()->GetYaxis();
396  return Form("%s_%.2f_to_%.2f__times_%s_%.2f_to_%.2f",
397  xAx->GetTitle(), xAx->GetBinLowEdge(x), xAx->GetBinUpEdge(x),
398  yAx->GetTitle(), yAx->GetBinLowEdge(y), yAx->GetBinUpEdge(y));
399  }

◆ GetHist()

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

Definition at line 58 of file HistHandler.h.

58  {
59  return m_H.get();
60  }

◆ isOverFlowBin()

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

States whether a bin is overflow or not.

Implements CP::HistHandler.

Definition at line 375 of file HistHandler.cxx.

375 {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 370 of file HistHandler.cxx.

370  {
371  return m_h->GetNumberOfBins() + 1;
372  }

◆ nOverFlowBins()

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

Return the number of overflow bins.

Implements CP::HistHandler.

Definition at line 374 of file HistHandler.cxx.

374 {return 10;}

◆ operator=()

HistHandler_TH2Poly & CP::HistHandler_TH2Poly::operator= ( const HistHandler_TH2Poly other)
virtual

Definition at line 357 of file HistHandler.cxx.

357  {
358  if (this == &other) {
359  return *this;
360  }
361  Copy(other);
362  m_h = other.m_h;
363  m_x_handler = std::unique_ptr<AxisHandler>(other.GetHist() == nullptr ? 0 : AxisHandlerProvider::GetAxisHandler(other.m_h->GetXaxis()));
364  m_y_handler = std::unique_ptr<AxisHandler>(other.GetHist() == nullptr ? 0 : AxisHandlerProvider::GetAxisHandler(other.m_h->GetYaxis()));
365  return *this;
366  }

◆ 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 81 of file HistHandler.h.

◆ m_h

TH2Poly* CP::HistHandler_TH2Poly::m_h
private

Definition at line 180 of file HistHandler.h.

◆ m_x_handler

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

Definition at line 181 of file HistHandler.h.

◆ m_y_handler

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

Definition at line 182 of file HistHandler.h.


The documentation for this class was generated from the following files:
xAOD::muon
@ muon
Definition: TrackingPrimitives.h:195
CP::HistHandler::Copy
void Copy(const HistHandler &other)
Definition: HistHandler.cxx:126
CP::HistHandler_TH2Poly::m_h
TH2Poly * m_h
Definition: HistHandler.h:180
bin
Definition: BinsDiffFromStripMedian.h:43
x
#define x
CP::HistHandler::HistHandler
HistHandler(TH1 *Hist)
Definition: HistHandler.cxx:122
CP::clone
std::unique_ptr< TH1 > clone(TH1 *H)
Clones a TH1 and handles the ownership then to a unique_ptr.
Definition: PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/Root/UtilFunctions.cxx:43
CP::CorrectionCode::OutOfValidityRange
@ OutOfValidityRange
Input object is out of validity range.
Definition: CorrectionCode.h:37
CP::CorrectionCode::Error
@ Error
Some error happened during the object correction.
Definition: CorrectionCode.h:36
CP::HistHandler::GetHist
TH1 * GetHist() const
Definition: HistHandler.h:58
z
#define z
CP::HistHandler_TH2Poly::m_y_handler
std::unique_ptr< AxisHandler > m_y_handler
Definition: HistHandler.h:182
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
CP::CorrectionCode::Ok
@ Ok
The correction was done successfully.
Definition: CorrectionCode.h:38
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
y
#define y
h
CP::HistHandler_TH2Poly::m_x_handler
std::unique_ptr< AxisHandler > m_x_handler
Definition: HistHandler.h:181
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
CP::AxisHandlerProvider::GetAxisHandler
static std::unique_ptr< AxisHandler > GetAxisHandler(const TAxis *axis)
Definition: HistHandler.cxx:20
CP::HistHandler::m_H
std::unique_ptr< TH1 > m_H
Definition: HistHandler.h:81