29int main(
int argc,
char **argv)
41 JParser<> zap(
"Auxiliary program to print quantiles from 1D histogram.");
50 catch(
const exception &error) {
51 FATAL(error.what() << endl);
56 FATAL(
"No quantiles." << endl);
60 for (vector<JRootObjectID>::const_iterator input = inputFile.begin(); input != inputFile.end(); ++input) {
62 DEBUG(
"Input: " << *input << endl);
64 TDirectory* dir = getDirectory(*input);
67 ERROR(
"File: " << input->getFullFilename() <<
" not opened." << endl);
71 const TRegexp regexp(input->getObjectName());
73 TIter iter(dir->GetListOfKeys());
75 for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
77 const TString tag(key->GetName());
79 DEBUG(
"Key: " << tag <<
" match = " << tag.Contains(regexp) << endl);
83 if (tag.Contains(regexp) && isTObject(key)) {
85 TObject*
object = key->ReadObj();
89 TH1& h1 =
dynamic_cast<TH1&
>(*object);
93 for (Int_t ix = 0; ix <= h1.GetXaxis()->GetNbins() + 1; ++ix) {
94 W += h1.GetBinContent(ix);
103 for (
int ix = 0, k = 0; ix <= h1.GetXaxis()->GetNbins() + 1; ++ix) {
105 w += h1.GetBinContent(ix);
107 for ( ; k != (int) Q.size() && w >= Q[k]*W; ++k) {
108 cout << h1.GetName() <<
' ' <<
FIXED(4,2) << Q[k] <<
' ' <<
FIXED(20,10) << h1.GetXaxis()->GetBinCenter(ix) << endl;
115 for (
int ix = h1.GetXaxis()->GetNbins() + 1, k = 0; ix >= 0; --ix) {
117 w += h1.GetBinContent(ix);
119 for ( ; k != (int) Q.size() && w >= Q[k]*W; ++k) {
120 cout << h1.GetName() <<
' ' <<
FIXED(4,2) << Q[k] <<
' ' <<
FIXED(20,10) << h1.GetXaxis()->GetBinCenter(ix) << endl;
127 ERROR(
"Not available for other objects than 1D histograms." << endl);