30 int main(
int argc,
char **argv)
35 typedef JRange<double> JRange_t;
46 JParser<> zap(
"Auxiliary program to make cumulative ROOT histogram.");
48 zap[
'f'] =
make_field(inputFile,
"<input file>:<object name>");
50 zap[
'x'] =
make_field(
X,
"accepted x-range values") = JRange_t();
51 zap[
'R'] =
make_field(reverse,
"sum right to left instead of left to right");
52 zap[
'N'] =
make_field(normalise,
"normalise histogram contents");
57 catch(
const exception &error) {
58 FATAL(error.what() << endl);
66 DEBUG(
"Input: " << *input << endl);
71 ERROR(
"File: " << input->getFullFilename() <<
" not opened." << endl);
75 const TRegexp regexp(input->getObjectName());
77 TIter iter(dir->GetListOfKeys());
79 for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
81 const TString tag(key->GetName());
83 DEBUG(
"Key: " << tag <<
" match = " << tag.Contains(regexp) << endl);
87 if (tag.Contains(regexp)) {
89 TObject*
object = key->ReadObj();
93 TH1&
h1 =
dynamic_cast<TH1&
>(*object);
99 for (Int_t i = 0; i <= h1.GetXaxis()->GetNbins() + 1; ++i) {
101 if (
X(h1.GetBinCenter(i))) {
102 W += h1.GetBinContent(i);
105 h1.SetBinContent(i, W);
110 for (Int_t i = h1.GetXaxis()->GetNbins() + 1; i >= 0; --i) {
112 if (
X(h1.GetBinCenter(i))) {
113 W += h1.GetBinContent(i);
116 h1.SetBinContent(i, W);
120 NOTICE(setw(24) << left << h1.GetName() <<
' ' <<
SCIENTIFIC(12,3) << W << endl);
122 if (normalise && W != 0.0) {
126 out.WriteTObject(&h1);
Utility class to parse command line options.
int main(int argc, char *argv[])
then for HISTOGRAM in h0 h1
I/O formatting auxiliaries.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
then break fi done getCenter read X Y Z let X
General purpose messaging.
Auxiliary class to define a range between two values.
Utility class to parse command line options.
TDirectory * getDirectory(const JRootObjectID &id)
Get TDirectory pointer.
Auxiliary data structure for floating point format specification.
#define DEBUG(A)
Message macros.