44int main(
int argc,
char **argv)
61 JParser<> zap(
"Auxiliary program to histogram bin-by-bin deviations of a set of 1D 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);
80 for (vector<JRootObjectID>::const_iterator input = inputFile.begin(); input != inputFile.end(); ++input) {
82 TH1* h1 =
dynamic_cast<TH1*
>(getObject(*input));
85 listOfHistograms.push_back(h1);
89 if (listOfHistograms.empty()) {
90 FATAL(
"No histograms." << endl);
94 FATAL(
"Empty formula." << endl);
104 h0 =
new TH1D(
"h0", NULL,
109 TH1* h1 = listOfHistograms[0];
111 if (listOfHistograms.size() == 1) {
113 const double y1 = getResult(formula, h1);
115 DEBUG(h1->GetName() <<
' ' << formula <<
' ' << y1 << endl);
117 for (Int_t i = 1; i <= h1->GetNbinsX(); ++i) {
119 const Double_t yp = h1->GetBinContent(i);
121 h0->Fill(reverse ? y1 - yp : yp - y1);
126 if (formula == first_t) {
128 for (Int_t i = 1; i <= h1->GetNbinsX(); ++i) {
130 const double y1 = h1->GetBinContent(i);
132 for (vector<TH1*>::const_iterator p = listOfHistograms.begin(); ++p != listOfHistograms.end(); ) {
134 const Double_t yp = (*p)->GetBinContent(i);
136 h0->Fill(reverse ? y1 - yp : yp - y1);
142 const double y1 = getResult(formula);
144 for (Int_t i = 1; i <= h1->GetNbinsX(); ++i) {
146 for (vector<TH1*>::const_iterator p = listOfHistograms.begin(); p != listOfHistograms.end(); ++p) {
148 const Double_t yp = (*p)->GetBinContent(i);
150 h0->Fill(reverse ? y1 - yp : yp - y1);