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

#include <HistHandler.h>

Inheritance diagram for CP::HistHandler_TH1:
Collaboration diagram for CP::HistHandler_TH1:

Public Member Functions

 HistHandler_TH1 (columnar::ColumnarTool<> *parent, TH1 *hist)
 
virtual ~HistHandler_TH1 ()
 
int nBins () const override
 Return the total number of bins in the histogram -> (GetNbins() +2)**n. More...
 
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...
 
std::string GetBinName (unsigned int bin) const override
 Translates the bin number into the borders and return them as name. More...
 
CorrectionCode FindBin (columnar::MuonId 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
 
TH1 * GetHist () const
 
void SetBinError (int bin, float val)
 

Private Attributes

std::unique_ptr< AxisHandlerm_x_handler
 
std::unique_ptr< TH1 > m_H
 

Detailed Description

Definition at line 92 of file HistHandler.h.

Constructor & Destructor Documentation

◆ HistHandler_TH1()

CP::HistHandler_TH1::HistHandler_TH1 ( columnar::ColumnarTool<> *  parent,
TH1 *  hist 
)

Definition at line 153 of file HistHandler.cxx.

153  :
154  HistHandler(parent, h),
155  m_x_handler(h == nullptr ? 0 : AxisHandlerProvider::GetAxisHandler(parent, h->GetXaxis())) {
156  }

◆ ~HistHandler_TH1()

CP::HistHandler_TH1::~HistHandler_TH1 ( )
virtual

Definition at line 158 of file HistHandler.cxx.

158  {
159  }

Member Function Documentation

◆ FindBin()

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

Function that changes from Implementation to implementation.

Implements CP::HistHandler.

Definition at line 167 of file HistHandler.cxx.

167  {
168  if (!GetHist()) {
169  bin = -1;
170  return CorrectionCode::Error;
171  }
172  float par = 0;
173  if (m_x_handler->GetBinningParameter(muon, par) == CorrectionCode::Error) {
174  return CorrectionCode::Error;
175  } else {
176  bin = GetHist()->FindBin(par);
177  if (bin < 1 || bin > GetHist()->GetNbinsX()) {
179  }
180  }
181  return CorrectionCode::Ok;
182  }

◆ 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  }

◆ 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_TH1::GetBinName ( unsigned int  bin) const
overridevirtual

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

Implements CP::HistHandler.

Definition at line 163 of file HistHandler.cxx.

163  {
164  TAxis* xAx = GetHist()->GetXaxis();
165  return Form("%s_%.2f_to_%.2f", xAx->GetTitle(), xAx->GetBinLowEdge(bin), xAx->GetBinUpEdge(bin));
166  }

◆ 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_TH1::isOverFlowBin ( int  b) const
overridevirtual

States whether a bin is overflow or not.

Implements CP::HistHandler.

Definition at line 162 of file HistHandler.cxx.

162 { return b == 0 || b >= nBins() -1; }

◆ nBins()

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

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

Implements CP::HistHandler.

Definition at line 160 of file HistHandler.cxx.

160 {return GetHist()->GetNbinsX() + 2;}

◆ nOverFlowBins()

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

Return the number of overflow bins.

Implements CP::HistHandler.

Definition at line 161 of file HistHandler.cxx.

161 {return 2; }

◆ 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_x_handler

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

Definition at line 109 of file HistHandler.h.


The documentation for this class was generated from the following files:
xAOD::muon
@ muon
Definition: TrackingPrimitives.h:196
CP::HistHandler_TH1::m_x_handler
std::unique_ptr< AxisHandler > m_x_handler
Definition: HistHandler.h:109
CP::HistHandler::HistHandler
HistHandler(columnar::ColumnarTool<> *parent, TH1 *Hist)
Definition: HistHandler.cxx:122
bin
Definition: BinsDiffFromStripMedian.h: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:63
CP::AxisHandlerProvider::GetAxisHandler
static std::unique_ptr< AxisHandler > GetAxisHandler(columnar::ColumnarTool<> *parent, const TAxis *axis)
Definition: HistHandler.cxx:20
test_pyathena.parent
parent
Definition: test_pyathena.py:15
createCoolChannelIdFile.par
par
Definition: createCoolChannelIdFile.py:28
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:76
CP::HistHandler_TH1::nBins
int nBins() const override
Return the total number of bins in the histogram -> (GetNbins() +2)**n.
Definition: HistHandler.cxx:160
CP::CorrectionCode::Ok
@ Ok
The correction was done successfully.
Definition: CorrectionCode.h:38
h
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
CP::HistHandler::m_H
std::unique_ptr< TH1 > m_H
Definition: HistHandler.h:86