30int main(
int argc,
char **argv)
40 JParser<> zap(
"Auxiliary program to print (x) of the maximum of 1D ROOT objects.");
42 zap[
'f'] =
make_field(inputFile,
"<input file>:<object name>");
47 catch(
const exception &error) {
48 FATAL(error.what() << endl);
52 for (vector<JRootObjectID>::const_iterator input = inputFile.begin(); input != inputFile.end(); ++input) {
54 DEBUG(
"Input: " << *input << endl);
56 TDirectory* dir = getDirectory(*input);
59 ERROR(
"File: " << input->getFullFilename() <<
" not opened." << endl);
63 const TRegexp regexp(input->getObjectName());
65 TIter iter(dir->GetListOfKeys());
67 for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
69 const TString tag(key->GetName());
71 DEBUG(
"Key: " << tag <<
" match = " << tag.Contains(regexp) << endl);
75 if (tag.Contains(regexp) && isTObject(key)) {
77 TObject*
object = key->ReadObj();
80 double ymax = numeric_limits<double>::lowest();
84 TH1& h1 =
dynamic_cast<TH1&
>(*object);
86 for (Int_t ix = 1; ix <= h1.GetXaxis()->GetNbins(); ++ix) {
88 double y = h1.GetBinContent(ix);
92 x = h1.GetXaxis()->GetBinCenter(ix);
100 TProfile& h1 =
dynamic_cast<TProfile&
>(*object);
102 for (Int_t ix = 1; ix <= h1.GetXaxis()->GetNbins(); ++ix) {
104 double y = h1.GetBinContent(ix);
108 x = h1.GetXaxis()->GetBinCenter(ix);
116 TGraph&
g1 =
dynamic_cast<TGraph&
>(*object);
118 for (Int_t i = 0; i !=
g1.GetN(); ++i) {
119 if (
g1.GetY()[i] > ymax) {
127 if (ymax != numeric_limits<double>::lowest()) {
128 cout << setw(32) << left << key->GetName() << right <<
' ' <<
SCIENTIFIC(15,5) << x << endl;