1 #ifndef __JHISTOGRAM_TOOLKIT__
2 #define __JHISTOGRAM_TOOLKIT__
63 #define make_key(PARAMETER) JKey(#PARAMETER, PARAMETER)
112 void Fill(
const Double_t xA,
const Double_t xB,
const bool option)
114 hA->Fill(logx ? log10(xA) : xA);
115 hB->Fill(logx ? log10(xB) : xB);
117 hC->Fill(logx ? log10(xB/xA) : xB - xA);
119 hD->Fill(logx ? log10(xB/xA) : xB - xA);
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()); }
142 out.WriteTObject(hA);
143 out.WriteTObject(hB);
144 out.WriteTObject(hC);
145 out.WriteTObject(hD);
176 const double logx =
false)
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);
196 for (iterator i = begin(); i != end(); ++i) {
198 const int index = i->first.index;
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);
214 for (iterator i = this->begin(); i != this->end(); ++i) {
227 for (iterator i = this->begin(); i != this->end(); ++i) {
228 i->second.Write(out);
240 TFile out(file_name,
"RECREATE");
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.
JKey(const char *name, const int index)
Constructor.
Auxiliary class to manage set of histograms.
void Scale()
Scale histograms.
JValue()
Default constructor.
void Fill(const JFit &fA, const JFit &fB, const bool option)
Fill histograms.
Data structure for track fit results.
Definition of fit parameters from various applications.
bool hasW(const int i) const
Check availability of value.
JValue(TH1D *hA, TH1D *hB, TH1D *hC, TH1D *hD, bool logx=false)
Constructor.
friend bool operator<(const JKey &first, const JKey &second)
Less than operator.
void Fill(const Double_t xA, const Double_t xB, const bool option)
Fill histograms.
double getQ() const
Get quality.
void Write(TFile &out)
Write histograms to file.
double getW(const int i) const
Get value.
void Write(TFile &out)
Write histograms to file.
void Scale()
Scale histograms.
void Write(const char *file_name)
Write histograms to file.