27 static const char*
const first_t =
"first";
44 int main(
int argc,
char **argv)
49 typedef JAbstractHistogram<Double_t> JHistogram_t;
61 JParser<> zap(
"Auxiliary program to histogram bin-by-bin deviations of a set of 2D histograms.");
63 zap[
'f'] =
make_field(inputFile,
"<input file>:<object name>");
64 zap[
'o'] =
make_field(
outputFile,
"ROOT file with histogram (possibly I/O, option -r)") =
"variance.root";
65 zap[
'r'] =
make_field(reuse,
"reuse histogram from existing output file");
67 zap[
'F'] =
make_field(formula,
"ROOT TFormula (may contain method names of object)") =
"0";
68 zap[
'R'] =
make_field(reverse,
"reverse sign");
73 catch(
const exception &error) {
74 FATAL(error.what() << endl);
82 TH2* h2 =
dynamic_cast<TH2*
>(
getObject(*input));
85 listOfHistograms.push_back(h2);
89 if (listOfHistograms.empty()) {
90 FATAL(
"No histograms." << endl);
94 FATAL(
"Empty formula." << endl);
104 h0 =
new TH1D(
"h0", NULL,
105 X.getNumberOfBins(), X.getLowerLimit(), X.getUpperLimit());
109 TH2* h2 = listOfHistograms[0];
111 if (listOfHistograms.size() == 1) {
113 const double y1 =
getResult(formula, h2);
115 DEBUG(h2->GetName() <<
' ' << formula <<
' ' << y1 << endl);
117 for (Int_t ix = 1; ix <= h2->GetNbinsX(); ++ix) {
118 for (Int_t iy = 1; iy <= h2->GetNbinsY(); ++iy) {
120 const Double_t yp = h2->GetBinContent(ix,iy);
122 h0->Fill(reverse ? y1 - yp : yp - y1);
128 if (formula == first_t) {
130 for (Int_t ix = 1; ix <= h2->GetNbinsX(); ++ix) {
131 for (Int_t iy = 1; iy <= h2->GetNbinsY(); ++iy) {
133 const double y1 = h2->GetBinContent(ix,iy);
137 const Double_t yp = (*p)->GetBinContent(ix,iy);
139 h0->Fill(reverse ? y1 - yp : yp - y1);
148 for (Int_t ix = 1; ix <= h2->GetNbinsX(); ++ix) {
149 for (Int_t iy = 1; iy <= h2->GetNbinsY(); ++iy) {
153 const Double_t yp = (*p)->GetBinContent(ix,iy);
155 h0->Fill(reverse ? y1 - yp : yp - y1);
Utility class to parse command line options.
TObject * getObject(const JRootObjectID &id)
Get first TObject with given identifier.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Double_t getResult(const TString &text, TObject *object=NULL)
Get result of given textual formula.
General purpose messaging.
Utility class to parse command line options.
#define DEBUG(A)
Message macros.
int main(int argc, char *argv[])