31{
34
38 bool reverse;
40
41 try {
42
43 JParser<> zap(
"Auxiliary program to extract quantiles from 2D histogram.");
44
50
52 }
53 catch(const exception &error) {
55 }
56
57
58 if (Q.empty()) {
60 }
61
63
64
66
68
70
72 ERROR(
"File: " << input->getFullFilename() <<
" not opened." <<
endl);
73 continue;
74 }
75
77
79
81
82 const TString tag(
key->GetName());
83
85
86
87
89
91
92 try {
93
94 TH2& h2 =
dynamic_cast<TH2&
>(*object);
95
97
98 for (size_t i = 0; i != Q.size(); ++i) {
99
100 ostringstream os;
101
102 os << h2.GetName();
103 os << i <<
"[" <<
setw(3) << (
int) (100.0 * Q[i]) <<
"%]";
104
105 DEBUG(
"Creating 1D histogram: " << os.str() <<
endl);
106
107 TAxis* axis = h2.GetXaxis();
108
109 if (axis->IsVariableBinSize())
110 h1[i] =
new TH1D(os.str().c_str(),
NULL, axis->GetNbins(), axis->GetXbins()->GetArray());
111 else
112 h1[i] =
new TH1D(os.str().c_str(),
NULL, axis->GetNbins(), axis->GetXmin(), axis->GetXmax());
113 }
114
115
117
119
121 W += h2.GetBinContent(i,j);
122 }
123
124 if (W != 0.0) {
125
127
128 if (!reverse) {
129
130 for (
int j = 0, k = 0;
j <= h2.GetYaxis()->
GetNbins() + 1; ++
j) {
131
132 w += h2.GetBinContent(i,j);
133
134 for ( ; k != (
int) h1.size() && w >= Q[k]*W; ++k) {
135 h1[k]->SetBinContent(i, h2.GetYaxis()->GetBinCenter(j));
136 }
137 }
138
139 } else {
140
141 for (
int j = h2.GetYaxis()->GetNbins() + 1, k = 0;
j >= 0; --
j) {
142
143 w += h2.GetBinContent(i,j);
144
145 for ( ; k != (
int) h1.size() && w >= Q[k]*W; ++k) {
146 h1[k]->SetBinContent(i, h2.GetYaxis()->GetBinCenter(j));
147 }
148 }
149 }
150 }
151 }
152
153 out.cd();
154
156 (*i)->Write();
157 }
158 }
159 catch(exception&) {
160 ERROR(
"Not available for other objects than 2D histograms." <<
endl);
161 }
162 }
163 }
164 }
165
166 out.Write();
167 out.Close();
168}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Template definition of a multi-dimensional oscillation probability interpolation table.
Utility class to parse command line options.
TDirectory * getDirectory(const JRootObjectID &id)
Get TDirectory pointer.
bool isTObject(const TKey *key)
Check if given key corresponds to a TObject.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).