29int main(
int argc,
char **argv)
39 JParser<> zap(
"Auxiliary program to print (x) of the maximum of 1D ROOT objects.");
41 zap[
'f'] =
make_field(inputFile,
"<input file>:<object name>");
46 catch(
const exception &error) {
47 FATAL(error.what() << endl);
51 for (vector<JRootObjectID>::const_iterator input = inputFile.begin(); input != inputFile.end(); ++input) {
53 DEBUG(
"Input: " << *input << endl);
55 TDirectory* dir = getDirectory(*input);
58 ERROR(
"File: " << input->getFullFilename() <<
" not opened." << endl);
62 const TRegexp regexp(input->getObjectName());
64 TIter iter(dir->GetListOfKeys());
66 for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
68 const TString tag(key->GetName());
70 DEBUG(
"Key: " << tag <<
" match = " << tag.Contains(regexp) << endl);
74 if (tag.Contains(regexp) && isTObject(key)) {
76 TObject*
object = key->ReadObj();
79 double ymax = numeric_limits<double>::lowest();
83 TH1& h1 =
dynamic_cast<TH1&
>(*object);
85 for (Int_t ix = 1; ix <= h1.GetXaxis()->GetNbins(); ++ix) {
87 double y = h1.GetBinContent(ix);
91 x = h1.GetXaxis()->GetBinCenter(ix);
99 TProfile& h1 =
dynamic_cast<TProfile&
>(*object);
101 for (Int_t ix = 1; ix <= h1.GetXaxis()->GetNbins(); ++ix) {
103 double y = h1.GetBinContent(ix);
107 x = h1.GetXaxis()->GetBinCenter(ix);
115 TGraph&
g1 =
dynamic_cast<TGraph&
>(*object);
117 for (Int_t i = 0; i !=
g1.GetN(); ++i) {
118 if (
g1.GetY()[i] > ymax) {
126 if (ymax != numeric_limits<double>::lowest()) {
127 cout << setw(32) << left << key->GetName() << right <<
' ' <<
SCIENTIFIC(15,5) << x << endl;