29int main(
int argc,
char **argv)
39 JParser<> zap(
"Auxiliary program to print (x,y) of the maximum of 2D 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();
80 double zmax = numeric_limits<double>::lowest();
84 TH2& h2 =
dynamic_cast<TH2&
>(*object);
86 for (Int_t ix = 1; ix <= h2.GetXaxis()->GetNbins(); ++ix) {
87 for (Int_t iy = 1; iy <= h2.GetYaxis()->GetNbins(); ++iy) {
89 double z = h2.GetBinContent(ix,iy);
93 x = h2.GetXaxis()->GetBinCenter(ix);
94 y = h2.GetYaxis()->GetBinCenter(iy);
103 TProfile2D& h2 =
dynamic_cast<TProfile2D&
>(*object);
105 for (Int_t ix = 1; ix <= h2.GetXaxis()->GetNbins(); ++ix) {
106 for (Int_t iy = 1; iy <= h2.GetYaxis()->GetNbins(); ++iy) {
108 double z = h2.GetBinContent(ix,iy);
112 x = h2.GetXaxis()->GetBinCenter(ix);
113 y = h2.GetYaxis()->GetBinCenter(iy);
122 TGraph2D& g2 =
dynamic_cast<TGraph2D&
>(*object);
124 for (Int_t i = 0; i != g2.GetN(); ++i) {
125 if (g2.GetZ()[i] > zmax) {
134 if (zmax != numeric_limits<double>::lowest()) {
135 cout << setw(32) << left << key->GetName() << right <<
' ' <<
SCIENTIFIC(15,5) << x <<
' ' <<
SCIENTIFIC(15,5) << y << endl;