Jpp
Public Member Functions | List of all members
JManager Struct Reference

Auxiliary class to manage set of histograms. More...

#include <JHistogramToolkit.hh>

Inheritance diagram for JManager:
std::map< JKey, JValue >

Public Member Functions

void insert (const JKey &key, const Int_t nx, const Double_t xmin, const Double_t xmax, const double logx=false)
 Insert set of histograms. More...
 
void Fill (const JFit &fA, const JFit &fB, const bool option)
 Fill histograms. More...
 
void Scale ()
 Scale histograms. More...
 
void Write (TFile &out)
 Write histograms to file. More...
 
void Write (const char *file_name)
 Write histograms to file. More...
 

Detailed Description

Auxiliary class to manage set of histograms.

Definition at line 160 of file JHistogramToolkit.hh.

Member Function Documentation

◆ insert()

void JManager::insert ( const JKey key,
const Int_t  nx,
const Double_t  xmin,
const Double_t  xmax,
const double  logx = false 
)
inline

Insert set of histograms.

Parameters
keykey
nxnumber of bins
xminminimal abscissa value
xmaxmaximal abscissa value
logxlog10(x)

Definition at line 172 of file JHistogramToolkit.hh.

177  {
178  using namespace std;
179 
180  TH1D* hA = new TH1D(("[A " + key.name + "]").c_str(), NULL, nx, xmin, xmax);
181  TH1D* hB = new TH1D(("[B " + key.name + "]").c_str(), NULL, nx, xmin, xmax);
182  TH1D* hC = new TH1D(("[C " + key.name + "]").c_str(), NULL, nx, -xmax, xmax);
183  TH1D* hD = new TH1D(("[D " + key.name + "]").c_str(), NULL, nx, -xmax, xmax);
184 
185  std::map<JKey, JValue>::insert(make_pair(key, JValue(hA,hB,hC,hD,logx)));
186  }

◆ Fill()

void JManager::Fill ( const JFit fA,
const JFit fB,
const bool  option 
)
inline

Fill histograms.

Parameters
fAfirst fit result
fBsecond fit result
optionoption

Definition at line 196 of file JHistogramToolkit.hh.

197  {
198  for (iterator i = begin(); i != end(); ++i) {
199 
200  const int index = i->first.index;
201 
202  if (index == JQUALITY) {
203  i->second.Fill(fA.getQ(), fB.getQ(), option);
204  } else if (fA.hasW(index) && fB.hasW(index)) {
205  i->second.Fill(fA.getW(index), fB.getW(index), option);
206  }
207  };
208  }

◆ Scale()

void JManager::Scale ( )
inline

Scale histograms.

Definition at line 214 of file JHistogramToolkit.hh.

215  {
216  for (iterator i = this->begin(); i != this->end(); ++i) {
217  i->second.Scale();
218  }
219  }

◆ Write() [1/2]

void JManager::Write ( TFile &  out)
inline

Write histograms to file.

Parameters
outROOT file

Definition at line 227 of file JHistogramToolkit.hh.

228  {
229  for (iterator i = this->begin(); i != this->end(); ++i) {
230  i->second.Write(out);
231  }
232  }

◆ Write() [2/2]

void JManager::Write ( const char *  file_name)
inline

Write histograms to file.

Parameters
file_namefile name

Definition at line 240 of file JHistogramToolkit.hh.

241  {
242  TFile out(file_name, "RECREATE");
243 
244  this->Write(out);
245 
246  out.Write();
247  out.Close();
248  }

The documentation for this struct was generated from the following file:
JQUALITY
static const int JQUALITY
fit quality identifier
Definition: JHistogramToolkit.hh:19
JManager::Write
void Write(TFile &out)
Write histograms to file.
Definition: JHistogramToolkit.hh:227
std::iterator
Definition: JSTDTypes.hh:18
JFIT::JFit::hasW
bool hasW(const int i) const
Check availability of value.
Definition: JEvt.hh:222
JFIT::JFit::getW
const std::vector< double > & getW() const
Get values.
Definition: JEvt.hh:188
JFIT::JFit::getQ
double getQ() const
Get quality.
Definition: JEvt.hh:151
JKey::name
std::string name
Definition: JHistogramToolkit.hh:52
std::map
Definition: JSTDTypes.hh:16
std
Definition: jaanetDictionary.h:36
JLANG::JValue
Wrapper class around template object.
Definition: JValue.hh:151