9 #include "TApplication.h"
30 int 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);
54 DEBUG(
"Input: " << *input << endl);
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;
Utility class to parse command line options.
int main(int argc, char *argv[])
I/O formatting auxiliaries.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
General purpose messaging.
Utility class to parse command line options.
bool isTObject(const TKey *key)
Check if given key corresponds to a TObject.
TDirectory * getDirectory(const JRootObjectID &id)
Get TDirectory pointer.
Auxiliary data structure for floating point format specification.
#define DEBUG(A)
Message macros.
Double_t g1(const Double_t x)
Function.