30int main(
int argc,
char **argv)
47 JParser<> zap(
"Auxiliary program to make cumulative ROOT histogram.");
49 zap[
'f'] =
make_field(inputFile,
"<input file>:<object name>");
51 zap[
'x'] =
make_field(X,
"accepted x-range values") = JRange_t();
53 zap[
'R'] =
make_field(reverse,
"sum right to left instead of left to right");
54 zap[
'N'] =
make_field(normalise,
"normalise histogram contents");
59 catch(
const exception &error) {
73 ERROR(
"File: " << input->getFullFilename() <<
" not opened." <<
endl);
83 const TString tag(key->GetName());
89 if (tag.Contains(
regexp) && isTObject(key)) {
91 TObject*
object = key->ReadObj();
95 TH1& h1 =
dynamic_cast<TH1&
>(*object);
103 if (X(h1.GetBinCenter(i))) {
104 W += h1.GetBinContent(i) * (
binwidth ? h1.GetBinWidth(i) : 1.0);
107 h1.SetBinContent(i, W);
109 if (h1.GetSumw2N()) {
110 h1.SetBinError(i, h1.GetBinError(i) * (
binwidth ? h1.GetBinWidth(i) : 1.0));
116 for (
Int_t i = h1.GetXaxis()->GetNbins() + 1; i >= 0; --i) {
118 if (X(h1.GetBinCenter(i))) {
119 W += h1.GetBinContent(i) * (
binwidth ? h1.GetBinWidth(i) : 1.0);
122 h1.SetBinContent(i, W);
124 if (h1.GetSumw2N()) {
125 h1.SetBinError(i, h1.GetBinError(i) * (
binwidth ? h1.GetBinWidth(i) : 1.0));
132 if (normalise && W != 0.0) {
136 out.WriteTObject(&h1);