Jpp
Public Member Functions | Protected Attributes | List of all members
JValue Struct Reference

Map value. More...

#include <JHistogramToolkit.hh>

Public Member Functions

 JValue ()
 Default constructor. More...
 
 JValue (TH1D *hA, TH1D *hB, TH1D *hC, TH1D *hD, bool logx=false)
 Constructor. More...
 
void Fill (const Double_t xA, const Double_t xB, const bool option)
 Fill histograms. More...
 
void Scale ()
 Scale histograms. More...
 
void Write (TFile &out)
 Write histograms to file. More...
 

Protected Attributes

TH1D * hA
 
TH1D * hB
 
TH1D * hC
 
TH1D * hD
 
bool logx
 

Detailed Description

Map value.

Definition at line 69 of file JHistogramToolkit.hh.

Constructor & Destructor Documentation

◆ JValue() [1/2]

JValue::JValue ( )
inline

Default constructor.

Definition at line 73 of file JHistogramToolkit.hh.

73  :
74  hA(NULL),
75  hB(NULL),
76  hC(NULL),
77  hD(NULL),
78  logx(false)
79  {}

◆ JValue() [2/2]

JValue::JValue ( TH1D *  hA,
TH1D *  hB,
TH1D *  hC,
TH1D *  hD,
bool  logx = false 
)
inline

Constructor.

Parameters
hApointer to histogram
hBpointer to histogram
hCpointer to histogram
hDpointer to histogram
logxlog10(x) filling mode

Definition at line 91 of file JHistogramToolkit.hh.

96  {
97  this->hA = hA;
98  this->hB = hB;
99  this->hC = hC;
100  this->hD = hD;
101  this->logx = logx;
102  }

Member Function Documentation

◆ Fill()

void JValue::Fill ( const Double_t  xA,
const Double_t  xB,
const bool  option 
)
inline

Fill histograms.

Parameters
xAfirst abscissa value
xBsecond abscissa value
optionoption

Definition at line 112 of file JHistogramToolkit.hh.

113  {
114  hA->Fill(logx ? log10(xA) : xA);
115  hB->Fill(logx ? log10(xB) : xB);
116  if (option)
117  hC->Fill(logx ? log10(xB/xA) : xB - xA);
118  else
119  hD->Fill(logx ? log10(xB/xA) : xB - xA);
120  }

◆ Scale()

void JValue::Scale ( )
inline

Scale histograms.

Definition at line 126 of file JHistogramToolkit.hh.

127  {
128  if (hA->GetEntries() != 0) { hA->Scale(1.0/hA->GetEntries()); }
129  if (hB->GetEntries() != 0) { hB->Scale(1.0/hB->GetEntries()); }
130  if (hC->GetEntries() != 0) { hC->Scale(1.0/hC->GetEntries()); }
131  if (hD->GetEntries() != 0) { hD->Scale(1.0/hD->GetEntries()); }
132  }

◆ Write()

void JValue::Write ( TFile &  out)
inline

Write histograms to file.

Parameters
outROOT file

Definition at line 140 of file JHistogramToolkit.hh.

141  {
142  out.WriteTObject(hA);
143  out.WriteTObject(hB);
144  out.WriteTObject(hC);
145  out.WriteTObject(hD);
146  }

Member Data Documentation

◆ hA

TH1D* JValue::hA
protected

Definition at line 149 of file JHistogramToolkit.hh.

◆ hB

TH1D* JValue::hB
protected

Definition at line 150 of file JHistogramToolkit.hh.

◆ hC

TH1D* JValue::hC
protected

Definition at line 151 of file JHistogramToolkit.hh.

◆ hD

TH1D* JValue::hD
protected

Definition at line 152 of file JHistogramToolkit.hh.

◆ logx

bool JValue::logx
protected

Definition at line 153 of file JHistogramToolkit.hh.


The documentation for this struct was generated from the following file:
JValue::logx
bool logx
Definition: JHistogramToolkit.hh:153
JValue::hB
TH1D * hB
Definition: JHistogramToolkit.hh:150
JValue::hC
TH1D * hC
Definition: JHistogramToolkit.hh:151
JValue::hA
TH1D * hA
Definition: JHistogramToolkit.hh:149
JValue::hD
TH1D * hD
Definition: JHistogramToolkit.hh:152