59   typedef JRange<double>     JRange_t;
 
   87     JParser<> zap(
"General purpose plot program for 2D ROOT objects.");
 
   89     zap[
'f'] = 
make_field(inputFile,  
"<input file>:<object name>");
 
   91     zap[
'w'] = 
make_field(canvas,     
"size of canvas <nx>x<ny> [pixels]")  = JCanvas(500, 500);
 
   93     zap[
'x'] = 
make_field(
X,          
"x-abscissa range")                   = JRange_t();
 
   94     zap[
'y'] = 
make_field(
Y,          
"y-abscissa range")                   = JRange_t();
 
   95     zap[
'z'] = 
make_field(Z,          
"ordinate range")                     = JRange_t();
 
   96     zap[
'X'] = 
make_field(logx,       
"logarithmic x-axis (-XX log10 axis)");
 
   97     zap[
'Y'] = 
make_field(logy,       
"logarithmic y-axis (-YY log10 axis)");
 
   98     zap[
'Z'] = 
make_field(logz,       
"logarithmic z-axis");
 
   99     zap[
'P'] = 
make_field(project,    
"projection")                         = 
"", 
"xy", 
"yx", 
"xz", 
"zx", 
"yz", 
"zy";
 
  100     zap[
'>'] = 
make_field(xLabel,     
"x-axis label")                       = 
"";
 
  101     zap[
'<'] = 
make_field(yLabel,     
"y-axis label")                       = 
"";
 
  102     zap[
'^'] = 
make_field(zLabel,     
"z-axis label")                       = 
"";
 
  103     zap[
'S'] = 
make_field(markerSize, 
"marker size")                        = 1.0;
 
  104     zap[
'O'] = 
make_field(option,     
"plotting option")                    = 
"";
 
  106     zap[
'B'] = 
make_field(batch,      
"batch processing");
 
  107     zap[
'T'] = 
make_field(title,      
"title")                              = 
"KM3NeT preliminary";
 
  109     zap[
'p'] = 
make_field(palette,    
"palette")                            = -1;
 
  114   catch(
const exception &error) {
 
  115     FATAL(error.what() << endl);
 
  119   gROOT->SetBatch(batch);
 
  121   TApplication* tp = 
new TApplication(
"user", NULL, NULL);
 
  122   TCanvas*      cv = 
new TCanvas(
"c1", 
"c1", canvas.x, canvas.y);
 
  124   JSinglePointer<TStyle> gStyle(
new JStyle(
"gplot", cv->GetWw(), cv->GetWh()));
 
  127     gStyle->SetPalette(palette);
 
  130   gROOT->SetStyle(
"gplot");
 
  134   cv->SetFillStyle(4000);
 
  135   cv->SetFillColor(kWhite);
 
  141   Double_t xmin = numeric_limits<double>::max();
 
  142   Double_t xmax = numeric_limits<double>::lowest();
 
  143   Double_t ymin = numeric_limits<double>::max();
 
  144   Double_t ymax = numeric_limits<double>::lowest();
 
  145   Double_t zmin = numeric_limits<double>::max();
 
  146   Double_t zmax = numeric_limits<double>::lowest();
 
  154     DEBUG(
"Input: " << *input << endl);
 
  159       ERROR(
"File: " << input->getFullFilename() << 
" not opened." << endl);
 
  163     const TRegexp regexp(input->getObjectName());
 
  165     TIter iter(dir->GetListOfKeys());
 
  167     for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
 
  169       const TString tag(key->GetName());
 
  171       DEBUG(
"Key: " << tag << 
" match = " << tag.Contains(regexp) << endl);
 
  175       if (tag.Contains(regexp)) {
 
  177         if        (title == JName_t) {
 
  178           title = key->GetName();
 
  179         } 
else if (title == JTitle_t) {
 
  180           title = key->GetTitle();
 
  183         JRootObject object(key->ReadObj());
 
  187           TH3& h3 = 
dynamic_cast<TH3&
>(*object);
 
  189           object = h3.Project3D(project.c_str());
 
  195           TH2& h2 = 
dynamic_cast<TH2&
>(*object);
 
  197           h2.SetStats(stats != -1);
 
  199           xmin = min(xmin, h2.GetXaxis()->GetXmin());
 
  200           xmax = max(xmax, h2.GetXaxis()->GetXmax());
 
  201           ymin = min(ymin, h2.GetYaxis()->GetXmin());
 
  202           ymax = max(ymax, h2.GetYaxis()->GetXmax());
 
  203           zmin = min(zmin, logz ? h2.GetMinimum(0.0) : h2.GetMinimum());
 
  204           zmax = max(zmax, h2.GetMaximum());
 
  210           TGraph& 
g1 = 
dynamic_cast<TGraph&
>(*object);
 
  212           for (Int_t i = 0; i != g1.GetN(); ++i) {
 
  213             xmin = min(xmin, g1.GetX()[i] - numeric_limits<float>::epsilon());
 
  214             xmax = max(xmax, g1.GetX()[i] + numeric_limits<float>::epsilon());
 
  215             ymin = min(ymin, g1.GetY()[i] - numeric_limits<float>::epsilon());
 
  216             ymax = max(ymax, g1.GetY()[i] + numeric_limits<float>::epsilon());
 
  222             if (dynamic_cast<TGraph*>(i->get()) != NULL) {
 
  233           TGraph2D& g2 = 
dynamic_cast<TGraph2D&
>(*object);
 
  235           for (Int_t i = 0; i != g2.GetN(); ++i) {
 
  236             if (!logz || g2.GetZ()[i] > 0.0) {
 
  237               xmin = min(xmin, g2.GetX()[i]);
 
  238               xmax = max(xmax, g2.GetX()[i]);
 
  239               ymin = min(ymin, g2.GetY()[i]);
 
  240               ymax = max(ymax, g2.GetY()[i]);
 
  241               zmin = min(zmin, g2.GetZ()[i]);
 
  242               zmax = max(zmax, g2.GetZ()[i]);
 
  246           if (Z != JRange_t()) {
 
  247             g2.SetMinimum(Z.getLowerLimit());
 
  248             g2.SetMaximum(Z.getUpperLimit());
 
  255           TF2& f2 = 
dynamic_cast<TF2&
>(*object);
 
  257           f2.SetLineColor(kRed);
 
  258           f2.SetTitle((title +  
";" + xLabel + 
";" + yLabel + 
";" + zLabel).c_str());
 
  265           f2.GetRange(__xmin, __ymin, __xmax, __ymax);
 
  267           xmin = min(xmin, __xmin);
 
  268           xmax = max(xmax, __xmax);
 
  269           ymin = min(ymin, __ymin);
 
  270           ymax = max(ymax, __ymax);
 
  271           zmin = min(zmin, f2.GetMinimum());
 
  272           zmax = max(zmax, f2.GetMaximum());
 
  276         for (TString buffer[] = { 
object.getLabel(), input->getFilename().c_str(), 
"" }, *i = buffer; *i != 
""; ++i) {
 
  278           *i = (*i)(TRegexp(
"\\[.*\\]"));
 
  280           if ((*i).Length() > 2) {
 
  281             object.setLabel((*i)(1, (*i).Length() - 2));
 
  285         if (dynamic_cast<TH2*>     (
object.
get())  !=  NULL ||
 
  286             dynamic_cast<TGraph*>  (
object.
get())  !=  NULL ||
 
  287             dynamic_cast<TGraph2D*>(
object.
get())  !=  NULL ||
 
  288             dynamic_cast<TEllipse*>(
object.
get())  !=  NULL ||
 
  289             dynamic_cast<TLine*>   (
object.
get())  !=  NULL ||
 
  290             dynamic_cast<TF2*>     (
object.
get())  !=  NULL) {
 
  292           DEBUG(
"Add object: " << tag << 
" with label " << 
object.
getLabel() << endl);
 
  295             master = 
dynamic_cast<TH2*
>(
object.get());
 
  298           listOfObjects.push_back(
object);
 
  301           ERROR(
"For other objects than 2D histograms, use JPlot1D" << endl);
 
  307   if (listOfObjects.empty()) {
 
  308     ERROR(
"Nothing to draw." << endl);
 
  315   if (option.find(
"COLZ") != string::npos ||
 
  316       option.find(
"colz") != string::npos) {
 
  317     gPad->SetRightMargin(0.20);
 
  320   if (
X != JRange_t()) {    
 
  321     xmin = 
X.getLowerLimit();
 
  322     xmax = 
X.getUpperLimit();
 
  325   if (
Y != JRange_t()) {    
 
  326     ymin = 
Y.getLowerLimit();
 
  327     ymax = 
Y.getUpperLimit();
 
  330   if (Z != JRange_t()) {
 
  331     zmin = Z.getLowerLimit();
 
  332     zmax = Z.getUpperLimit();
 
  339     if        (
X != JRange_t() && 
 
  342       master = 
new TH2D(
"__H__", NULL, 
 
  343                         100, 
X.getLowerLimit(), 
X.getUpperLimit(),
 
  344                         100, 
Y.getLowerLimit(), 
Y.getUpperLimit());
 
  348     } 
else if (xmin < xmax && ymin < ymax) {
 
  350       master = 
new TH2D(
"__H__", NULL, 
 
  358       TText* p = 
new TText(0.5, 0.5, 
MAKE_CSTRING(
"No data"));
 
  368     if (logx) { gPad->SetLogx(); }
 
  369     if (logy) { gPad->SetLogy(); }
 
  370     if (logz) { gPad->SetLogz(); }
 
  372     master->GetXaxis()->SetRangeUser(xmin, xmax);
 
  373     master->GetYaxis()->SetRangeUser(ymin, ymax);
 
  378     master->SetTitle(title.c_str());
 
  383     if (xLabel != 
"") { 
master->GetXaxis()->SetTitle(xLabel.c_str()); 
master->GetXaxis()->CenterTitle(
true); }
 
  384     if (yLabel != 
"") { 
master->GetYaxis()->SetTitle(yLabel.c_str()); 
master->GetYaxis()->CenterTitle(
true); }
 
  385     if (zLabel != 
"") { 
master->GetZaxis()->SetTitle(zLabel.c_str()); 
master->GetZaxis()->CenterTitle(
true); }
 
  387     master->GetXaxis()->SetMoreLogLabels((logx == 1 && log10(xmax/xmin) < 2) ||
 
  388                                          (logx >  1 &&       xmax-xmin  < 2));
 
  389     master->GetYaxis()->SetMoreLogLabels((logy == 1 && log10(ymax/ymin) < 2) ||
 
  390                                          (logy >  1 &&       ymax-ymin  < 2));
 
  393       master->SetNdivisions(i->second, i->first.c_str());
 
  396     DEBUG(
"Draw " << 
master->GetName() << 
' ' << option << endl);
 
  398     master->Draw(option.c_str());
 
  401   if (logx > 1 || logy > 1) {
 
  403       if (dynamic_cast<TH2*>(i->get()) != 
master) {
 
  418   if (grid.count(
'x') || grid.count(
'X')) { gPad->SetGridx(); }
 
  419   if (grid.count(
'y') || grid.count(
'Y')) { gPad->SetGridy(); }
 
  422     gStyle->SetOptStat(stats);
 
  424     gStyle->SetOptFit(kFALSE);
 
  428     DEBUG(
"Draw " << (*i)->GetName() << 
' ' << (*i)->GetTitle() << endl);
 
  430     string buffer(option);
 
  436       TH2& h2 = 
dynamic_cast<TH2&
>(*(*i));
 
  445       TGraph& g1 = 
dynamic_cast<TGraph&
>(*(*i));
 
  453       TGraph2D& g2 = 
dynamic_cast<TGraph2D&
>(*(*i));
 
  462       TF2& f2 = 
dynamic_cast<TF2&
>(*(*i));
 
  473     (*i)->Draw(buffer.c_str());
 
  488   return (
master != NULL ? 0 : 1);
 
Utility class to parse command line options. 
 
void setLogarithmicX(TF1 *f1)
Make parameter x of function logarithmic (e.g. after filling with log10()). 
 
std::string getLabel(const JLocation &location)
Get module label for monitoring and other applications. 
 
then echo Test string reversed by master(hit< return > to continue)." JProcess -c "JEcho" -rC fi if (( 1 ))
 
#define MAKE_CSTRING(A)
Make C-string. 
 
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
 
then fatal Wrong number of arguments fi set_variable STRING $argv[1] set_variable DETECTORXY_TXT $WORKDIR $DETECTORXY_TXT tail read X Y CHI2 RMS printf optimum n $X $Y $CHI2 $RMS awk v Y
 
T & getInstance(const T &object)
Get static instance from temporary object. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
then break fi done getCenter read X Y Z let X
 
void setRange(double &xmin, double &xmax, const bool logx)
Set axis range. 
 
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
 
Auxiliary class to handle multiple boolean-like I/O. 
 
TDirectory * getDirectory(const JRootObjectID &id)
Get TDirectory pointer. 
 
void setLogarithmicY(TF2 *f2)
Make parameter y of function logarithmic (e.g. after filling with log10()). 
 
Double_t g1(const Double_t x)
Function.