Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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

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  TH1D* hA = new TH1D(("[A " + key.name + "]").c_str(), NULL, nx, xmin, xmax);
179  TH1D* hB = new TH1D(("[B " + key.name + "]").c_str(), NULL, nx, xmin, xmax);
180  TH1D* hC = new TH1D(("[C " + key.name + "]").c_str(), NULL, nx, -xmax, xmax);
181  TH1D* hD = new TH1D(("[D " + key.name + "]").c_str(), NULL, nx, -xmax, xmax);
182 
183  std::map<JKey, JValue>::insert(make_pair(key, JValue(hA,hB,hC,hD,logx)));
184  }
std::string name
Map value.
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 194 of file JHistogramToolkit.hh.

195  {
196  for (iterator i = begin(); i != end(); ++i) {
197 
198  const int index = i->first.index;
199 
200  if (index == JQUALITY) {
201  i->second.Fill(fA.getQ(), fB.getQ(), option);
202  } else if (fA.hasW(index) && fB.hasW(index)) {
203  i->second.Fill(fA.getW(index), fB.getW(index), option);
204  }
205  };
206  }
bool hasW(const int i) const
Check availability of value.
Definition: JEvt.hh:200
static const int JQUALITY
fit quality identifier
double getQ() const
Get quality.
Definition: JEvt.hh:151
double getW(const int i) const
Get value.
Definition: JEvt.hh:212
void JManager::Scale ( )
inline

Scale histograms.

Definition at line 212 of file JHistogramToolkit.hh.

213  {
214  for (iterator i = this->begin(); i != this->end(); ++i) {
215  i->second.Scale();
216  }
217  }
void JManager::Write ( TFile &  out)
inline

Write histograms to file.

Parameters
outROOT file

Definition at line 225 of file JHistogramToolkit.hh.

226  {
227  for (iterator i = this->begin(); i != this->end(); ++i) {
228  i->second.Write(out);
229  }
230  }
void JManager::Write ( const char *  file_name)
inline

Write histograms to file.

Parameters
file_namefile name

Definition at line 238 of file JHistogramToolkit.hh.

239  {
240  TFile out(file_name, "RECREATE");
241 
242  this->Write(out);
243 
244  out.Write();
245  out.Close();
246  }
void Write(TFile &out)
Write histograms to file.

The documentation for this struct was generated from the following file: