Jpp  18.3.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Functions | Variables
JGIZMO Namespace Reference

Auxiliary applications for use of ROOT and more. More...

Classes

struct  JOpera
 Auxiliary data structure for JOpera1D.cc and JOpera2D.cc applications. More...
 
class  JRootObject
 Auxiliary data structure for TObject with a user defined label. More...
 
class  JRootObjectID
 Auxiliary class to handle file name, ROOT directory and object name. More...
 

Functions

TFile * getFile (const std::string &file_name, const std::string &option="exist")
 Get TFile pointer corresponding to give file name. More...
 
TDirectory * getDirectory (const JRootObjectID &id)
 Get TDirectory pointer. More...
 
TObjectgetObject (const JRootObjectID &id)
 Get first TObject with given identifier. More...
 
bool isTAttLine (const TObject *object)
 Get drawing option of TH1. More...
 
Double_t getResult (const TString &text, TObject *object=NULL)
 Get result of given textual formula. More...
 
Double_t getResult (const std::string &text, TObject *object=NULL)
 Get result of given textual formula. More...
 
int getParameter (const std::string &text)
 Get parameter number from text string. More...
 
Double_t getValue (const std::string &text, TObject *object=NULL)
 Get parameter value from text string. More...
 
Double_t getValue (const std::string &text, const int index)
 Get parameter value from text string. More...
 
void setLogarithmic (TAxis *axis)
 Make histogram axis logarithmic (e.g. after using log10()). More...
 
TString getLogarithmic (const TString &formula, const char parameter)
 Make given parameter in formula logarithmic (e.g. after using log10()). More...
 
void copy (const TF1 &from, TF1 &to)
 Copy function parameters. More...
 
void copy (const TF2 &from, TF2 &to)
 Copy function parameters. More...
 
template<class T >
void setLogarithmicX (TList *list)
 Make x-axis of objects in list logarithmic (e.g. after using log10()). More...
 
template<class T >
void setLogarithmicY (TList *list)
 Make y-axis of objects in list logarithmic (e.g. after using log10()). More...
 
void setLogarithmicX (TF1 *f1)
 Make x-axis of given function logarithmic (e.g. after using log10()). More...
 
void setLogarithmicY (TF1 *f1)
 Make y-axis of given function logarithmic (e.g. after using log10()). More...
 
void setLogarithmicX (TF2 *f2)
 Make x-axis of given function logarithmic (e.g. after using log10()). More...
 
void setLogarithmicY (TF2 *f2)
 Make y-axis of given function logarithmic (e.g. after using log10()). More...
 
void setLogarithmicX (TH1 *h1)
 Make x-axis and associated functions of given histogram logarithmic (e.g. after using log10()). More...
 
void setLogarithmicX (TH2 *h2)
 Make x-axis and associated functions of given histogram logarithmic (e.g. after using log10()). More...
 
void setLogarithmicY (TH2 *h2)
 Make y-axis and associated functions of given histogram logarithmic (e.g. after using log10()). More...
 
void setLogarithmicX (TGraph *g1)
 Make x-axis and associated functions of given graph logarithmic (e.g. after using log10()). More...
 
void setLogarithmicY (TGraph *g1)
 Make y-axis and associated functions of given graph logarithmic (e.g. after using log10()). More...
 
void setLogarithmicX (TGraphErrors *g1)
 Make x-axis and associated functions of given graph logarithmic (e.g. after using log10()). More...
 
void setLogarithmicY (TGraphErrors *g1)
 Make y-axis and associated functions of given graph logarithmic (e.g. after using log10()). More...
 
void setLogarithmicX (TGraph2D *g2)
 Make x-axis and associated functions of given graph logarithmic (e.g. after using log10()). More...
 
void setLogarithmicY (TGraph2D *g2)
 Make y-axis and associated functions of given graph logarithmic (e.g. after using log10()). More...
 
void setLogarithmicX (TGraph2DErrors *g2)
 Make x-axis and associated functions of given graph logarithmic (e.g. after using log10()). More...
 
void setLogarithmicY (TGraph2DErrors *g2)
 Make y-axis and associated functions of given graph logarithmic (e.g. after using log10()). More...
 
void setLogarithmicX (TMultiGraph *gn)
 Make x-axis of given multi-graph logarithmic (e.g. after using log10()). More...
 
void setLogarithmicY (TMultiGraph *gn)
 Make y-axis of given multi-graph logarithmic (e.g. after using log10()). More...
 
void setLogarithmicX (TLine *line)
 Make x-axis of given line logarithmic (e.g. after using log10()). More...
 
void setLogarithmicY (TLine *line)
 Make y-axis of given line logarithmic (e.g. after using log10()). More...
 
void setLogarithmicX (TEllipse *ellipse)
 Make x-axis of given ellipse logarithmic (e.g. after using log10()). More...
 
void setLogarithmicY (TEllipse *ellipse)
 Make y-axis of given ellipse logarithmic (e.g. after using log10()). More...
 
void convertToPDF (TH1 &h1, const std::string &option="NW", const double factor=1.0)
 Convert 1D histogram to PDF. More...
 
void convertToPDF (TH2 &h2, const std::string &option="NXYW", const double factor=1.0)
 Convert 2D histogram to PDF. More...
 
void convertToPDF (TH3 &h3, const std::string &option="NXYW", const double factor=1.0)
 Convert 3D histogram to PDF. More...
 
void setLimits (TGraph &g1)
 Set limits of TGraph. More...
 
void setLimits (TGraph2D &g2)
 Set limits of TGraph2D. More...
 
void setRange (double &xmin, double &xmax, const bool logx)
 Set axis range. More...
 
void setAxisLabels (TAxis *axis, const JModuleAddressMap &memo)
 Set axis with PMT address labels. More...
 
void setAxisLabels (TH1 &h1, const std::string axis, const JModuleAddressMap &memo)
 Set axis labels with PMT addresses. More...
 
bool isTObject (const TKey *key)
 Check if given key corresponds to a TObject. More...
 

Variables

static const char *const TIMESTAMP = "#splitline{}{#splitline{%d:%m:%y}{ %H:%M}}%F1970-01-01 00:00:00"
 Time stamp of earliest UTC time. More...
 
static const char LABEL_TERMINATOR = '&'
 label terminator More...
 

Detailed Description

Auxiliary applications for use of ROOT and more.

Author
mdejong

Function Documentation

TFile* JGIZMO::getFile ( const std::string file_name,
const std::string option = "exist" 
)
inline

Get TFile pointer corresponding to give file name.

The TFile pointer of an already opened file is recovered, else a new file is opened.
Note that the closure of the opened files should be done by the caller of this method.

Parameters
file_namefile name
optionTFile::Open option
Returns
pointer to TFile

Definition at line 107 of file JGizmoToolkit.hh.

108  {
109  using namespace std;
110 
111  gErrorIgnoreLevel = kError;
112 
113  static map<string, TFile*> zmap;
114 
115  map<string, TFile*>::iterator i = zmap.find(file_name);
116 
117  if (i == zmap.end() || i->second == NULL || !i->second->IsOpen()) {
118 
119  TFile* file = TFile::Open(file_name.c_str(), option.c_str());
120 
121  zmap[file_name] = file;
122 
123  return file;
124 
125  } else {
126 
127  return i->second;
128  }
129  }
then usage $script[< detector identifier >< run range >]< QA/QCfile > nExample script to produce data quality plots nWhen a detector identifier and run range are data are downloaded from the database nand subsequently stored in the given QA QC file
Definition: JDataQuality.sh:19
TDirectory* JGIZMO::getDirectory ( const JRootObjectID id)
inline

Get TDirectory pointer.

The TFile pointer of an already opened file is recovered, else a new file is opened.

Parameters
ididentifier
Returns
pointer to TDirectory

Definition at line 140 of file JGizmoToolkit.hh.

141  {
142  TFile* in = getFile(id.getFilename().c_str(), "exist");
143 
144  if (in == NULL || !in->IsOpen()) {
145  return NULL;
146  }
147 
148  if (id.getDirectory() != "")
149  return in->GetDirectory(id.getDirectory());
150  else
151  return in;
152  }
TFile * getFile(const std::string &file_name, const std::string &option="exist")
Get TFile pointer corresponding to give file name.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:48
TDirectory * getDirectory(const JRootObjectID &id)
Get TDirectory pointer.
std::string getFilename(const std::string &file_name)
Get file name part, i.e. part after last JEEP::PATHNAME_SEPARATOR if any.
Definition: JeepToolkit.hh:128
TObject* JGIZMO::getObject ( const JRootObjectID id)
inline

Get first TObject with given identifier.

Parameters
ididentifier
Returns
pointer to TObject (or NULL)

Definition at line 161 of file JGizmoToolkit.hh.

162  {
163  TDirectory* dir = getDirectory(id);
164 
165  if (dir != NULL) {
166 
167  const TRegexp regexp(id.getObjectName());
168 
169  TIter iter(dir->GetListOfKeys());
170 
171  for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
172 
173  const TString tag(key->GetName());
174 
175  // option match
176 
177  if (tag.Index(regexp) != -1) {
178  return key->ReadObj();
179  }
180  }
181  }
182 
183  return NULL;
184  }
TDirectory * getDirectory(const JRootObjectID &id)
Get TDirectory pointer.
bool JGIZMO::isTAttLine ( const TObject object)
inline

Get drawing option of TH1.

Parameters
objectpointer to TObject
Returns
true if TH1 looks like a line; else false

Definition at line 193 of file JGizmoToolkit.hh.

194  {
195  {
196  const TH1* h1 = dynamic_cast<const TH1*>(object);
197 
198  if (h1 != NULL) {
199 
200  if (h1->GetSumw2N()) {
201  for (Int_t i = 1; i <= h1->GetNbinsX(); ++i) {
202  if (h1->GetBinError(i) != 0.0) {
203  return false;
204  }
205  }
206  }
207  }
208  }
209  {
210  const TGraphErrors* g1 = dynamic_cast<const TGraphErrors*>(object);
211 
212  if (g1 != NULL) {
213 
214  for (Int_t i = 0; i != g1->GetN(); ++i) {
215  if (g1->GetEY()[i] != 0.0) {
216  return false;
217  }
218  }
219 
220  return g1->GetN() > 1;
221  }
222  }
223  {
224  const TGraph* g1 = dynamic_cast<const TGraph*>(object);
225 
226  if (g1 != NULL) {
227  return g1->GetN() > 1;
228  }
229  }
230 
231  return true;
232  }
Double_t g1(const Double_t x)
Function.
Definition: JQuantiles.cc:25
Double_t JGIZMO::getResult ( const TString &  text,
TObject object = NULL 
)
inline

Get result of given textual formula.

The formula may contain names of member methods of the object pointed to.
These methods should return a value that is compatible with Double_t and could have arguments.
For example:

        getResult("1.0 / GetEntries", TH1*);
Parameters
texttext
objectpointer to object
Returns
value

Definition at line 249 of file JGizmoToolkit.hh.

250  {
251  TString buffer(text);
252 
253  if (object != NULL) {
254 
255  TClass* p = TClass::GetClass(object->ClassName());
256 
257  if (p != NULL) {
258 
259  for ( ; ; ) {
260 
261  TMethod* method = NULL;
262 
263  for (std::unique_ptr<TIterator> iter(p->GetListOfAllPublicMethods()->MakeIterator()); TMethod* p = (TMethod*) iter->Next(); ) {
264  if (buffer.Index(p->GetName()) != -1) {
265  if (method == NULL || strlen(p->GetName()) > strlen(method->GetName())) {
266  method = p;
267  }
268  }
269  }
270 
271  if (method == NULL) {
272  break;
273  }
274 
275  for (Ssiz_t index; (index = buffer.Index(method->GetName())) != -1; ) {
276 
277  const TRegexp fp(" *([^)]*)"); // function call
278 
279  Ssiz_t len;
280  Ssiz_t pos = buffer.Index(fp, &len, index);
281 
282  Double_t value;
283 
284  if (pos == -1 || pos != index + (Ssiz_t) strlen(method->GetName())) {
285 
286  TMethodCall(p, method->GetName(), NULL).Execute(object, value);
287 
288  len = strlen(method->GetName());
289 
290  } else {
291 
292  TMethodCall(p, method->GetName(), NULL).Execute(object, TString(buffer(pos + 1, len - 2)), value);
293 
294  len += strlen(method->GetName());
295  }
296 
297  buffer.Replace(index, len, TString::Format("%20.10e", value));
298  }
299  }
300  }
301  }
302 
303  return TFormula("/tmp", buffer.Data()).Eval(0.0);
304  }
char text[TEXT_SIZE]
Definition: elog.cc:72
Double_t JGIZMO::getResult ( const std::string text,
TObject object = NULL 
)
inline

Get result of given textual formula.

The formula may contain names of member methods of the object pointed to.
These methods should return a value that is compatible with Double_t and could have arguments.
For example:

        getResult("1.0 / GetEntries", TH1*);
Parameters
texttext
objectpointer to object
Returns
value

Definition at line 321 of file JGizmoToolkit.hh.

322  {
323  return getResult(TString(text.c_str()), object);
324  }
char text[TEXT_SIZE]
Definition: elog.cc:72
Double_t getResult(const TString &text, TObject *object=NULL)
Get result of given textual formula.
int JGIZMO::getParameter ( const std::string text)
inline

Get parameter number from text string.

The number corresponds to the value [0-9]* in the expression "p[0-9]* = ..".

Parameters
texttext
Returns
parameter number

Definition at line 335 of file JGizmoToolkit.hh.

336  {
337  const char* regexp("p[0-9]* *=");
338 
339  TString buffer(text.c_str());
340 
341  buffer = buffer(TRegexp(regexp));
342  buffer = buffer(1, buffer.Length() - 2);
343 
344  if (!buffer.IsDigit()) {
345  THROW(JParseError, "Text is not a number " << text << ' ' << regexp);
346  }
347 
348  return buffer.Atoi();
349  }
char text[TEXT_SIZE]
Definition: elog.cc:72
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
Double_t JGIZMO::getValue ( const std::string text,
TObject object = NULL 
)
inline

Get parameter value from text string.

The formula may contain names of member methods of the object pointed to.
These methods should return a value that is compatible with Double_t and could have arguments.
For example:

        getValue("p[..] = 2 * GetMaximum", TH1*);
Parameters
texttext
objectpointer to object
Returns
value

Definition at line 366 of file JGizmoToolkit.hh.

367  {
368  const char* regexp("=.*");
369 
370  TString buffer(text.c_str());
371 
372  buffer = buffer(TRegexp(regexp));
373  buffer = buffer(1, buffer.Length() - 1);
374 
375  return getResult(std::string(buffer), object);
376  }
char text[TEXT_SIZE]
Definition: elog.cc:72
Double_t getResult(const TString &text, TObject *object=NULL)
Get result of given textual formula.
then awk string
Double_t JGIZMO::getValue ( const std::string text,
const int  index 
)
inline

Get parameter value from text string.

The formula may contain names of member methods of the object pointed to.
These methods should return a value that is compatible with Double_t and could have arguments.
For example:

        getValue("p[..] = 1.0 2.0 3.0", 1);

will return 2.0.

Parameters
texttext
indexindex
Returns
value

Definition at line 394 of file JGizmoToolkit.hh.

395  {
396  using namespace std;
397 
398  const char* regexp("=.*");
399 
400  TString buffer(text.c_str());
401 
402  buffer = buffer(TRegexp(regexp));
403  buffer = buffer(1, buffer.Length() - 1);
404 
405 
406  istringstream is((std::string(buffer)));
407 
408  Double_t value;
409 
410  for (int i = index; is >> value && i > 0; --i) {}
411 
412  if (is)
413  return value;
414  else
415  THROW(JParseError, "Text does not contain a number at given position " << buffer << ' ' << index);
416  }
char text[TEXT_SIZE]
Definition: elog.cc:72
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
is
Definition: JDAQCHSM.chsm:167
then awk string
void JGIZMO::setLogarithmic ( TAxis *  axis)
inline

Make histogram axis logarithmic (e.g. after using log10()).

Parameters
axisaxis

Definition at line 424 of file JGizmoToolkit.hh.

425  {
426  if (axis != NULL) {
427 
428  const Int_t first = axis->GetFirst();
429  const Int_t last = axis->GetLast();
430 
431  const Double_t xmin = axis->GetBinLowEdge(first);
432  const Double_t xmax = axis->GetBinLowEdge(last) + axis->GetBinWidth(last);
433 
434  const Int_t N = axis->GetNbins();
435  Double_t buffer[N+1];
436 
437  buffer[0] = TMath::Power(10.0, axis->GetBinLowEdge(1));
438 
439  for (Int_t i = 1; i <= N; ++i) {
440  buffer[i] = TMath::Power(10.0, axis->GetBinLowEdge(i) + axis->GetBinWidth(i));
441  }
442 
443  axis->Set(N, buffer);
444 
445  if (axis->TestBit(TAxis::kAxisRange)) {
446  axis->SetRangeUser(TMath::Power(10.0, xmin), TMath::Power(10.0, xmax));
447  }
448  }
449  }
const double xmax
Definition: JQuadrature.cc:24
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
const double xmin
Definition: JQuadrature.cc:23
then usage $script< input file >[option[primary[working directory]]] nWhere option can be N
Definition: JMuonPostfit.sh:40
TString JGIZMO::getLogarithmic ( const TString &  formula,
const char  parameter 
)
inline

Make given parameter in formula logarithmic (e.g. after using log10()).

Parameters
formulaformula
parameterparameter
Returns
formula

Definition at line 459 of file JGizmoToolkit.hh.

460  {
461  const TRegexp regexp[] = {
462  TString("^") + TString(parameter) + TString("[^a-zA-Z_]"), // parameter at start of line
463  TString("[^a-zA-Z_]") + TString(parameter) + TString("[^a-zA-Z_]"), // parameter in middle of line
464  TString("[^a-zA-Z_]") + TString(parameter) + TString("$") // parameter at end of line
465  };
466 
467  const TString replacement = TString("log10(") + TString(parameter) + TString(")");
468 
469  TString buffer(formula);
470 
471  if (buffer.Length() == 1 && buffer[0] == parameter) {
472 
473  buffer = replacement;
474 
475  } else {
476 
477  for (Ssiz_t pos = 0, i; pos < buffer.Length(); pos += replacement.Length()) {
478  if ((i = buffer.Index(regexp[0], pos)) != -1) { buffer.Replace((pos = i + 0), 1, replacement); }
479  else if ((i = buffer.Index(regexp[1], pos)) != -1) { buffer.Replace((pos = i + 1), 1, replacement); }
480  else if ((i = buffer.Index(regexp[2], pos)) != -1) { buffer.Replace((pos = i + 1), 1, replacement); }
481  else { break; }
482  }
483  }
484 
485  return buffer;
486  }
void JGIZMO::copy ( const TF1 &  from,
TF1 &  to 
)
inline

Copy function parameters.

Parameters
fromfunction
tofunction

Definition at line 495 of file JGizmoToolkit.hh.

496  {
497  static_cast<TAttLine&> (to) = static_cast<const TAttLine&> (from);
498  static_cast<TAttFill&> (to) = static_cast<const TAttFill&> (from);
499  static_cast<TAttMarker&>(to) = static_cast<const TAttMarker&>(from);
500 
501  to.SetParameters(from.GetParameters());
502 
503  to.SetNpx(from.GetNpx());
504  }
void JGIZMO::copy ( const TF2 &  from,
TF2 &  to 
)
inline

Copy function parameters.

Parameters
fromfunction
tofunction

Definition at line 513 of file JGizmoToolkit.hh.

514  {
515  copy(static_cast<const TF1&>(from), static_cast<TF1&>(to));
516 
517  to.SetNpy(from.GetNpy());
518  }
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition: JHead.cc:162
template<class T >
void JGIZMO::setLogarithmicX ( TList *  list)
inline

Make x-axis of objects in list logarithmic (e.g. after using log10()).

Parameters
listlist

Definition at line 921 of file JGizmoToolkit.hh.

922  {
923  for (TIter i(list); T* p = dynamic_cast<T*>(i.Next()); ) {
924  setLogarithmicX(p);
925  }
926  }
void setLogarithmicX(TList *list)
Make x-axis of objects in list logarithmic (e.g. after using log10()).
do set_variable OUTPUT_DIRECTORY $WORKDIR T
template<class T >
void JGIZMO::setLogarithmicY ( TList *  list)
inline

Make y-axis of objects in list logarithmic (e.g. after using log10()).

Parameters
listlist

Definition at line 935 of file JGizmoToolkit.hh.

936  {
937  for (TIter i(list); T* p = dynamic_cast<T*>(i.Next()); ) {
938  setLogarithmicY(p);
939  }
940  }
do set_variable OUTPUT_DIRECTORY $WORKDIR T
void setLogarithmicY(TList *list)
Make y-axis of objects in list logarithmic (e.g. after using log10()).
void JGIZMO::setLogarithmicX ( TF1 *  f1)
inline

Make x-axis of given function logarithmic (e.g. after using log10()).

Parameters
f1function

Definition at line 544 of file JGizmoToolkit.hh.

545  {
546  if (f1 != NULL) {
547 
548  TF1 fn(f1->GetName(), getLogarithmic(f1->GetExpFormula(), 'x'));
549 
550  copy(*f1, fn);
551 
552  fn.SetRange(f1->GetXmin(),
553  f1->GetXmax());
554 
555  *f1 = fn;
556 
557  f1->SetRange(TMath::Power(10.0,f1->GetXmin()),
558  TMath::Power(10.0,f1->GetXmax()));
559  }
560  }
const JPolynome f1(1.0, 2.0, 3.0)
Function.
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition: JHead.cc:162
TString getLogarithmic(const TString &formula, const char parameter)
Make given parameter in formula logarithmic (e.g. after using log10()).
void JGIZMO::setLogarithmicY ( TF1 *  f1)
inline

Make y-axis of given function logarithmic (e.g. after using log10()).

Parameters
f1function

Definition at line 568 of file JGizmoToolkit.hh.

569  {
570  if (f1 != NULL) {
571 
572  TString buffer = f1->GetExpFormula();
573 
574  buffer = "pow(10.0, " + buffer + ")";
575 
576  TF1 fn(f1->GetName(), buffer);
577 
578  copy(*f1, fn);
579 
580  *f1 = fn;
581  }
582  }
const JPolynome f1(1.0, 2.0, 3.0)
Function.
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition: JHead.cc:162
void JGIZMO::setLogarithmicX ( TF2 *  f2)
inline

Make x-axis of given function logarithmic (e.g. after using log10()).

Parameters
f2function

Definition at line 590 of file JGizmoToolkit.hh.

591  {
592  if (f2 != NULL) {
593 
594  TF2 fn(f2->GetName(), getLogarithmic(f2->GetExpFormula(), 'x'));
595 
596  copy(*f2, fn);
597 
598  fn.SetRange(f2->GetXmin(),
599  f2->GetYmin(),
600  f2->GetXmax(),
601  f2->GetYmax());
602 
603  *f2 = fn;
604 
605  f2->SetRange(TMath::Power(10.0,f2->GetXmin()),
606  f2->GetYmin(),
607  TMath::Power(10.0,f2->GetXmax()),
608  f2->GetYmax());
609  }
610  }
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition: JHead.cc:162
TString getLogarithmic(const TString &formula, const char parameter)
Make given parameter in formula logarithmic (e.g. after using log10()).
void JGIZMO::setLogarithmicY ( TF2 *  f2)
inline

Make y-axis of given function logarithmic (e.g. after using log10()).

Parameters
f2function

Definition at line 618 of file JGizmoToolkit.hh.

619  {
620  if (f2 != NULL) {
621 
622  TF2 fn(f2->GetName(), getLogarithmic(f2->GetExpFormula(), 'y'));
623 
624  copy(*f2, fn);
625 
626  fn.SetRange(f2->GetXmin(),
627  f2->GetYmin(),
628  f2->GetXmax(),
629  f2->GetYmax());
630 
631  *f2 = fn;
632 
633  f2->SetRange(f2->GetXmin(),
634  TMath::Power(10.0,f2->GetYmin()),
635  f2->GetXmax(),
636  TMath::Power(10.0,f2->GetYmax()));
637  }
638  }
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition: JHead.cc:162
TString getLogarithmic(const TString &formula, const char parameter)
Make given parameter in formula logarithmic (e.g. after using log10()).
void JGIZMO::setLogarithmicX ( TH1 *  h1)
inline

Make x-axis and associated functions of given histogram logarithmic (e.g. after using log10()).

Parameters
h1histogram

Definition at line 646 of file JGizmoToolkit.hh.

647  {
648  if (h1 != NULL) {
649 
650  setLogarithmicX<TF1>(h1->GetListOfFunctions());
651 
652  setLogarithmic(h1->GetXaxis());
653  }
654  }
void setLogarithmic(TAxis *axis)
Make histogram axis logarithmic (e.g. after using log10()).
void JGIZMO::setLogarithmicX ( TH2 *  h2)
inline

Make x-axis and associated functions of given histogram logarithmic (e.g. after using log10()).

Parameters
h2histogram

Definition at line 662 of file JGizmoToolkit.hh.

663  {
664  using namespace std;
665 
666  if (h2 != NULL) {
667 
668  setLogarithmicX<TF2>(h2->GetListOfFunctions());
669 
670  setLogarithmic(h2->GetXaxis());
671  }
672  }
void setLogarithmic(TAxis *axis)
Make histogram axis logarithmic (e.g. after using log10()).
void JGIZMO::setLogarithmicY ( TH2 *  h2)
inline

Make y-axis and associated functions of given histogram logarithmic (e.g. after using log10()).

Parameters
h2histogram

Definition at line 680 of file JGizmoToolkit.hh.

681  {
682  if (h2 != NULL) {
683 
684  setLogarithmicY<TF2>(h2->GetListOfFunctions());
685 
686  setLogarithmic(h2->GetYaxis());
687  }
688  }
void setLogarithmic(TAxis *axis)
Make histogram axis logarithmic (e.g. after using log10()).
void JGIZMO::setLogarithmicX ( TGraph *  g1)
inline

Make x-axis and associated functions of given graph logarithmic (e.g. after using log10()).

Parameters
g1graph

Definition at line 696 of file JGizmoToolkit.hh.

697  {
698  if (g1 != NULL) {
699 
700  setLogarithmicX<TF1>(g1->GetListOfFunctions());
701 
702  for (Int_t i = 0; i != g1->GetN(); ++i) {
703  g1->GetX()[i] = pow(10.0, g1->GetX()[i]);
704  }
705  }
706  }
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97
Double_t g1(const Double_t x)
Function.
Definition: JQuantiles.cc:25
void JGIZMO::setLogarithmicY ( TGraph *  g1)
inline

Make y-axis and associated functions of given graph logarithmic (e.g. after using log10()).

Parameters
g1graph

Definition at line 714 of file JGizmoToolkit.hh.

715  {
716  if (g1 != NULL) {
717 
718  setLogarithmicY<TF1>(g1->GetListOfFunctions());
719 
720  for (Int_t i = 0; i != g1->GetN(); ++i) {
721  g1->GetY()[i] = pow(10.0, g1->GetY()[i]);
722  }
723  }
724  }
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97
Double_t g1(const Double_t x)
Function.
Definition: JQuantiles.cc:25
void JGIZMO::setLogarithmicX ( TGraphErrors *  g1)
inline

Make x-axis and associated functions of given graph logarithmic (e.g. after using log10()).

Parameters
g1graph

Definition at line 732 of file JGizmoToolkit.hh.

733  {
734  if (g1 != NULL) {
735 
736  setLogarithmicX<TF1>(g1->GetListOfFunctions());
737 
738  for (Int_t i = 0; i != g1->GetN(); ++i) {
739  g1->GetEX()[i] = pow(10.0, g1->GetX()[i] + g1->GetEX()[i]) - pow(10.0, g1->GetX()[i]);
740  g1->GetX() [i] = pow(10.0, g1->GetX()[i]);
741  }
742  }
743  }
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97
Double_t g1(const Double_t x)
Function.
Definition: JQuantiles.cc:25
void JGIZMO::setLogarithmicY ( TGraphErrors *  g1)
inline

Make y-axis and associated functions of given graph logarithmic (e.g. after using log10()).

Parameters
g1graph

Definition at line 751 of file JGizmoToolkit.hh.

752  {
753  if (g1 != NULL) {
754 
755  setLogarithmicY<TF1>(g1->GetListOfFunctions());
756 
757  for (Int_t i = 0; i != g1->GetN(); ++i) {
758  g1->GetEY()[i] = pow(10.0, g1->GetY()[i] + g1->GetEY()[i]) - pow(10.0, g1->GetY()[i]);
759  g1->GetY() [i] = pow(10.0, g1->GetY()[i]);
760  }
761  }
762  }
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97
Double_t g1(const Double_t x)
Function.
Definition: JQuantiles.cc:25
void JGIZMO::setLogarithmicX ( TGraph2D *  g2)
inline

Make x-axis and associated functions of given graph logarithmic (e.g. after using log10()).

Parameters
g2graph

Definition at line 770 of file JGizmoToolkit.hh.

771  {
772  if (g2 != NULL) {
773 
774  setLogarithmicX<TF2>(g2->GetListOfFunctions());
775 
776  for (Int_t i = 0; i != g2->GetN(); ++i) {
777  g2->GetX()[i] = pow(10.0, g2->GetX()[i]);
778  }
779  }
780  }
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97
void JGIZMO::setLogarithmicY ( TGraph2D *  g2)
inline

Make y-axis and associated functions of given graph logarithmic (e.g. after using log10()).

Parameters
g2graph

Definition at line 788 of file JGizmoToolkit.hh.

789  {
790  if (g2 != NULL) {
791 
792  setLogarithmicY<TF2>(g2->GetListOfFunctions());
793 
794  for (Int_t i = 0; i != g2->GetN(); ++i) {
795  g2->GetY()[i] = pow(10.0, g2->GetY()[i]);
796  }
797  }
798  }
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97
void JGIZMO::setLogarithmicX ( TGraph2DErrors *  g2)
inline

Make x-axis and associated functions of given graph logarithmic (e.g. after using log10()).

Parameters
g2graph

Definition at line 806 of file JGizmoToolkit.hh.

807  {
808  if (g2 != NULL) {
809 
810  setLogarithmicX<TF2>(g2->GetListOfFunctions());
811 
812  for (Int_t i = 0; i != g2->GetN(); ++i) {
813  g2->GetEX()[i] = pow(10.0, g2->GetX()[i] + g2->GetEX()[i]) - pow(10.0, g2->GetX()[i]);
814  g2->GetX() [i] = pow(10.0, g2->GetX()[i]);
815  }
816  }
817  }
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97
void JGIZMO::setLogarithmicY ( TGraph2DErrors *  g2)
inline

Make y-axis and associated functions of given graph logarithmic (e.g. after using log10()).

Parameters
g2graph

Definition at line 825 of file JGizmoToolkit.hh.

826  {
827  if (g2 != NULL) {
828 
829  setLogarithmicY<TF2>(g2->GetListOfFunctions());
830 
831  for (Int_t i = 0; i != g2->GetN(); ++i) {
832  g2->GetEY()[i] = pow(10.0, g2->GetY()[i] + g2->GetEY()[i]) - pow(10.0, g2->GetY()[i]);
833  g2->GetY() [i] = pow(10.0, g2->GetY()[i]);
834  }
835  }
836  }
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97
void JGIZMO::setLogarithmicX ( TMultiGraph *  gn)
inline

Make x-axis of given multi-graph logarithmic (e.g. after using log10()).

Parameters
gnmulti graph

Definition at line 844 of file JGizmoToolkit.hh.

845  {
846  if (gn != NULL) {
847  setLogarithmicX<TGraph>(gn->GetListOfGraphs());
848  }
849  }
void JGIZMO::setLogarithmicY ( TMultiGraph *  gn)
inline

Make y-axis of given multi-graph logarithmic (e.g. after using log10()).

Parameters
gnmulti graph

Definition at line 857 of file JGizmoToolkit.hh.

858  {
859  if (gn != NULL) {
860  setLogarithmicY<TGraph>(gn->GetListOfGraphs());
861  }
862  }
void JGIZMO::setLogarithmicX ( TLine *  line)
inline

Make x-axis of given line logarithmic (e.g. after using log10()).

Parameters
lineline

Definition at line 870 of file JGizmoToolkit.hh.

871  {
872  if (line != NULL) {
873  line->SetX1(pow(10.0, line->GetX1()));
874  line->SetX2(pow(10.0, line->GetX2()));
875  }
876  }
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97
void JGIZMO::setLogarithmicY ( TLine *  line)
inline

Make y-axis of given line logarithmic (e.g. after using log10()).

Parameters
lineline

Definition at line 884 of file JGizmoToolkit.hh.

885  {
886  if (line != NULL) {
887  line->SetY1(pow(10.0, line->GetY1()));
888  line->SetY2(pow(10.0, line->GetY2()));
889  }
890  }
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97
void JGIZMO::setLogarithmicX ( TEllipse *  ellipse)
inline

Make x-axis of given ellipse logarithmic (e.g. after using log10()).

Parameters
ellipseellipse

Definition at line 898 of file JGizmoToolkit.hh.

899  {
900  THROW(JFunctionalException, "Operation setLogarithmicX on TEllipse not allowed.");
901  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
void JGIZMO::setLogarithmicY ( TEllipse *  ellipse)
inline

Make y-axis of given ellipse logarithmic (e.g. after using log10()).

Parameters
ellipseellipse

Definition at line 909 of file JGizmoToolkit.hh.

910  {
911  THROW(JFunctionalException, "Operation setLogarithmicY on TEllipse not allowed.");
912  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
void JGIZMO::convertToPDF ( TH1 &  h1,
const std::string option = "NW",
const double  factor = 1.0 
)
inline

Convert 1D histogram to PDF.

Possible options are:

  • N normalise to histogram contents;
  • W divide by bin width;
  • E convert also bin errors.
Parameters
h1histogram
optionoption
factorscaling factor

Definition at line 955 of file JGizmoToolkit.hh.

956  {
957  using namespace std;
958 
959  const bool normalise = (option.find('N') != string::npos || option.find('n') != string::npos);
960  const bool bin_width = (option.find('W') != string::npos || option.find('w') != string::npos);
961  const bool use_error = (option.find('E') != string::npos || option.find('e') != string::npos);
962 
963  Double_t W = 1.0;
964 
965  if (normalise) {
966 
967  W = 0.0;
968 
969  for (Int_t i = 1; i <= h1.GetXaxis()->GetNbins(); ++i) {
970  W += h1.GetBinContent(i);
971  }
972  }
973 
974  if (W != 0.0) {
975 
976  for (Int_t i = 1; i <= h1.GetXaxis()->GetNbins(); ++i) {
977 
978  const Double_t w = W * (bin_width ? h1.GetXaxis()->GetBinWidth(i) : 1.0);
979 
980  h1.SetBinContent(i, h1.GetBinContent(i) * factor / w);
981 
982  if (use_error) {
983  h1.SetBinError(i, h1.GetBinError(i) * factor / w);
984  }
985  }
986  }
987  }
data_type w[N+1][M+1]
Definition: JPolint.hh:867
void JGIZMO::convertToPDF ( TH2 &  h2,
const std::string option = "NXYW",
const double  factor = 1.0 
)
inline

Convert 2D histogram to PDF.

Possible options are:

  • N normalise to histogram contents;
  • X convert x-axis to PDF;
  • Y convert y-axis to PDF;
  • W divide by bin width;
  • E convert also bin errors.
Parameters
h2histogram
optionoption
factorscaling factor

Definition at line 1004 of file JGizmoToolkit.hh.

1005  {
1006  using namespace std;
1007 
1008  const bool normalise = (option.find('N') != string::npos || option.find('n') != string::npos);
1009  const bool X = (option.find('X') != string::npos || option.find('x') != string::npos);
1010  const bool Y = (option.find('Y') != string::npos || option.find('y') != string::npos);
1011  const bool bin_width = (option.find('W') != string::npos || option.find('w') != string::npos);
1012  const bool use_error = (option.find('E') != string::npos || option.find('e') != string::npos);
1013 
1014  Double_t W = 1.0;
1015 
1016  if (X && Y) {
1017 
1018  if (normalise) {
1019 
1020  W = 0.0;
1021 
1022  for (Int_t ix = 1; ix <= h2.GetXaxis()->GetNbins(); ++ix) {
1023  for (Int_t iy = 1; iy <= h2.GetYaxis()->GetNbins(); ++iy) {
1024  W += h2.GetBinContent(ix,iy);
1025  }
1026  }
1027  }
1028 
1029  if (W != 0.0) {
1030 
1031  for (Int_t ix = 1; ix <= h2.GetXaxis()->GetNbins(); ++ix) {
1032  for (Int_t iy = 1; iy <= h2.GetYaxis()->GetNbins(); ++iy) {
1033 
1034  const Double_t w = W * (bin_width ? h2.GetXaxis()->GetBinWidth(ix) * h2.GetYaxis()->GetBinWidth(iy) : 1.0);
1035 
1036  h2.SetBinContent(ix, iy, h2.GetBinContent(ix,iy) * factor / w);
1037 
1038  if (use_error) {
1039  h2.SetBinError(ix, iy, h2.GetBinError(ix,iy) * factor / w);
1040  }
1041  }
1042  }
1043  }
1044 
1045  } else if (X) {
1046 
1047  for (Int_t iy = 1; iy <= h2.GetYaxis()->GetNbins(); ++iy) {
1048 
1049  if (normalise) {
1050 
1051  W = 0.0;
1052 
1053  for (Int_t ix = 1; ix <= h2.GetXaxis()->GetNbins(); ++ix) {
1054  W += h2.GetBinContent(ix,iy);
1055  }
1056  }
1057 
1058  if (W != 0.0) {
1059 
1060  for (Int_t ix = 1; ix <= h2.GetXaxis()->GetNbins(); ++ix) {
1061 
1062  const Double_t w = W * (bin_width ? h2.GetXaxis()->GetBinWidth(ix) : 1.0);
1063 
1064  h2.SetBinContent(ix, iy, h2.GetBinContent(ix,iy) * factor / w);
1065 
1066  if (use_error) {
1067  h2.SetBinError(ix, iy, h2.GetBinError(ix,iy) * factor / w);
1068  }
1069  }
1070  }
1071  }
1072 
1073  } else if (Y) {
1074 
1075  for (Int_t ix = 1; ix <= h2.GetXaxis()->GetNbins(); ++ix) {
1076 
1077  if (normalise) {
1078 
1079  W = 0.0;
1080 
1081  for (Int_t iy = 1; iy <= h2.GetYaxis()->GetNbins(); ++iy) {
1082  W += h2.GetBinContent(ix,iy);
1083  }
1084  }
1085 
1086  if (W != 0.0) {
1087 
1088  for (Int_t iy = 1; iy <= h2.GetYaxis()->GetNbins(); ++iy) {
1089 
1090  const Double_t w = W * (bin_width ? h2.GetYaxis()->GetBinWidth(iy) : 1.0);
1091 
1092  h2.SetBinContent(ix, iy, h2.GetBinContent(ix,iy) / w);
1093 
1094  if (use_error) {
1095  h2.SetBinError(ix, iy, h2.GetBinError(ix,iy) / w);
1096  }
1097  }
1098  }
1099  }
1100  }
1101  }
data_type w[N+1][M+1]
Definition: JPolint.hh:867
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
no fit printf nominal n $STRING awk v X
void JGIZMO::convertToPDF ( TH3 &  h3,
const std::string option = "NXYW",
const double  factor = 1.0 
)
inline

Convert 3D histogram to PDF.

Possible options are:

  • N normalise to histogram contents;
  • X convert x-axis to PDF;
  • Y convert y-axis to PDF;
  • Z convert z-axis to PDF;
  • W divide by bin width;
  • E convert also bin errors.
Parameters
h3histogram
optionoption
factorscaling factor

Definition at line 1119 of file JGizmoToolkit.hh.

1120  {
1121  using namespace std;
1122 
1123  const bool normalise = (option.find('N') != string::npos || option.find('n') != string::npos);
1124  const bool X = (option.find('X') != string::npos || option.find('x') != string::npos);
1125  const bool Y = (option.find('Y') != string::npos || option.find('y') != string::npos);
1126  const bool Z = (option.find('Z') != string::npos || option.find('z') != string::npos);
1127  const bool bin_width = (option.find('W') != string::npos || option.find('w') != string::npos);
1128  const bool use_error = (option.find('E') != string::npos || option.find('e') != string::npos);
1129 
1130  Double_t W = 1.0;
1131 
1132  if (X && Y && Z) {
1133 
1134  if (normalise) {
1135 
1136  W = 0.0;
1137 
1138  for (Int_t ix = 1; ix <= h3.GetXaxis()->GetNbins(); ++ix) {
1139  for (Int_t iy = 1; iy <= h3.GetYaxis()->GetNbins(); ++iy) {
1140  for (Int_t iz = 1; iz <= h3.GetZaxis()->GetNbins(); ++iz) {
1141  W += h3.GetBinContent(ix,iy,iz);
1142  }
1143  }
1144  }
1145  }
1146 
1147  if (W != 0.0) {
1148 
1149  for (Int_t ix = 1; ix <= h3.GetXaxis()->GetNbins(); ++ix) {
1150  for (Int_t iy = 1; iy <= h3.GetYaxis()->GetNbins(); ++iy) {
1151  for (Int_t iz = 1; iz <= h3.GetZaxis()->GetNbins(); ++iz) {
1152 
1153  const Double_t w = W * (bin_width ? h3.GetXaxis()->GetBinWidth(ix) * h3.GetYaxis()->GetBinWidth(iy) * h3.GetZaxis()->GetBinWidth(iz) : 1.0);
1154 
1155  h3.SetBinContent(ix, iy, iz, h3.GetBinContent(ix,iy,iz) * factor / w);
1156 
1157  if (use_error) {
1158  h3.SetBinError(ix, iy, iz, h3.GetBinError(ix,iy,iz) * factor / w);
1159  }
1160  }
1161  }
1162  }
1163  }
1164 
1165  } else if (X && Z) {
1166 
1167  for (Int_t iy = 1; iy <= h3.GetYaxis()->GetNbins(); ++iy) {
1168 
1169  if (normalise) {
1170 
1171  W = 0.0;
1172 
1173  for (Int_t ix = 1; ix <= h3.GetXaxis()->GetNbins(); ++ix) {
1174  for (Int_t iz = 1; iz <= h3.GetZaxis()->GetNbins(); ++iz) {
1175  W += h3.GetBinContent(ix,iy,iz);
1176  }
1177  }
1178  }
1179 
1180  if (W != 0.0) {
1181 
1182  for (Int_t ix = 1; ix <= h3.GetXaxis()->GetNbins(); ++ix) {
1183  for (Int_t iz = 1; iz <= h3.GetZaxis()->GetNbins(); ++iz) {
1184 
1185  const Double_t w = W * (bin_width ? h3.GetXaxis()->GetBinWidth(ix) * h3.GetZaxis()->GetBinWidth(iz) : 1.0);
1186 
1187  h3.SetBinContent(ix, iy, iz, h3.GetBinContent(ix,iy,iz) * factor / w);
1188 
1189  if (use_error) {
1190  h3.SetBinError(ix, iy, iz, h3.GetBinError(ix,iy,iz) * factor / w);
1191  }
1192  }
1193  }
1194  }
1195  }
1196 
1197  } else if (Y && Z) {
1198 
1199  for (Int_t ix = 1; ix <= h3.GetXaxis()->GetNbins(); ++ix) {
1200 
1201  if (normalise) {
1202 
1203  W = 0.0;
1204 
1205  for (Int_t iy = 1; iy <= h3.GetYaxis()->GetNbins(); ++iy) {
1206  for (Int_t iz = 1; iz <= h3.GetZaxis()->GetNbins(); ++iz) {
1207  W += h3.GetBinContent(ix,iy,iz);
1208  }
1209  }
1210  }
1211 
1212  if (W != 0.0) {
1213 
1214  for (Int_t iy = 1; iy <= h3.GetYaxis()->GetNbins(); ++iy) {
1215  for (Int_t iz = 1; iz <= h3.GetZaxis()->GetNbins(); ++iz) {
1216 
1217  const Double_t w = W * (bin_width ? h3.GetYaxis()->GetBinWidth(iy) * h3.GetZaxis()->GetBinWidth(iz) : 1.0);
1218 
1219  h3.SetBinContent(ix, iy, iz, h3.GetBinContent(ix,iy,iz) * factor / w);
1220 
1221  if (use_error) {
1222  h3.SetBinError(ix, iy, iz, h3.GetBinError(ix,iy,iz) * factor / w);
1223  }
1224  }
1225  }
1226  }
1227  }
1228 
1229  } else if (X && Y) {
1230 
1231  for (Int_t iz = 1; iz <= h3.GetZaxis()->GetNbins(); ++iz) {
1232 
1233  if (normalise) {
1234 
1235  W = 0.0;
1236 
1237  for (Int_t ix = 1; ix <= h3.GetXaxis()->GetNbins(); ++ix) {
1238  for (Int_t iy = 1; iy <= h3.GetYaxis()->GetNbins(); ++iy) {
1239  W += h3.GetBinContent(ix,iy,iz);
1240  }
1241  }
1242  }
1243 
1244  if (W != 0.0) {
1245 
1246  for (Int_t ix = 1; ix <= h3.GetXaxis()->GetNbins(); ++ix) {
1247  for (Int_t iy = 1; iy <= h3.GetYaxis()->GetNbins(); ++iy) {
1248 
1249  const Double_t w = W * (bin_width ? h3.GetXaxis()->GetBinWidth(ix) * h3.GetYaxis()->GetBinWidth(iy) : 1.0);
1250 
1251  h3.SetBinContent(ix, iy, iz, h3.GetBinContent(ix,iy,iz) * factor / w);
1252 
1253  if (use_error) {
1254  h3.SetBinError(ix, iy, iz, h3.GetBinError(ix,iy,iz) * factor / w);
1255  }
1256  }
1257  }
1258  }
1259  }
1260 
1261  } else if (X) {
1262 
1263  for (Int_t iy = 1; iy <= h3.GetYaxis()->GetNbins(); ++iy) {
1264  for (Int_t iz = 1; iz <= h3.GetZaxis()->GetNbins(); ++iz) {
1265 
1266  if (normalise) {
1267 
1268  W = 0.0;
1269 
1270  for (Int_t ix = 1; ix <= h3.GetXaxis()->GetNbins(); ++ix) {
1271  W += h3.GetBinContent(ix,iy,iz);
1272  }
1273  }
1274 
1275  if (W != 0.0) {
1276 
1277  for (Int_t ix = 1; ix <= h3.GetXaxis()->GetNbins(); ++ix) {
1278 
1279  const Double_t w = W * (bin_width ? h3.GetXaxis()->GetBinWidth(ix) : 1.0);
1280 
1281  h3.SetBinContent(ix, iy, iz, h3.GetBinContent(ix,iy,iz) * factor / w);
1282 
1283  if (use_error) {
1284  h3.SetBinError(ix, iy, iz, h3.GetBinError(ix,iy,iz) * factor / w);
1285  }
1286  }
1287  }
1288  }
1289  }
1290 
1291  } else if (Y) {
1292 
1293  for (Int_t ix = 1; ix <= h3.GetXaxis()->GetNbins(); ++ix) {
1294  for (Int_t iz = 1; iz <= h3.GetZaxis()->GetNbins(); ++iz) {
1295 
1296  if (normalise) {
1297 
1298  W = 0.0;
1299 
1300  for (Int_t iy = 1; iy <= h3.GetYaxis()->GetNbins(); ++iy) {
1301  W += h3.GetBinContent(ix,iy,iz);
1302  }
1303  }
1304 
1305  if (W != 0.0) {
1306 
1307  for (Int_t iy = 1; iy <= h3.GetYaxis()->GetNbins(); ++iy) {
1308 
1309  const Double_t w = W * (bin_width ? h3.GetYaxis()->GetBinWidth(iy) : 1.0);
1310 
1311  h3.SetBinContent(ix, iy, iz, h3.GetBinContent(ix,iy,iz) / w);
1312 
1313  if (use_error) {
1314  h3.SetBinError(ix, iy, iz, h3.GetBinError(ix,iy,iz) / w);
1315  }
1316  }
1317  }
1318  }
1319  }
1320 
1321  } else if (Z) {
1322 
1323  for (Int_t ix = 1; ix <= h3.GetXaxis()->GetNbins(); ++ix) {
1324  for (Int_t iy = 1; iy <= h3.GetYaxis()->GetNbins(); ++iy) {
1325 
1326  if (normalise) {
1327 
1328  W = 0.0;
1329 
1330  for (Int_t iz = 1; iz <= h3.GetZaxis()->GetNbins(); ++iz) {
1331  W += h3.GetBinContent(ix,iy,iz);
1332  }
1333  }
1334 
1335  if (W != 0.0) {
1336 
1337  for (Int_t iz = 1; iz <= h3.GetZaxis()->GetNbins(); ++iz) {
1338 
1339  const Double_t w = W * (bin_width ? h3.GetZaxis()->GetBinWidth(iz) : 1.0);
1340 
1341  h3.SetBinContent(ix, iy, iz, h3.GetBinContent(ix,iy,iz) / w);
1342 
1343  if (use_error) {
1344  h3.SetBinError(ix, iy, iz, h3.GetBinError(ix,iy,iz) / w);
1345  }
1346  }
1347  }
1348  }
1349  }
1350  }
1351  }
data_type w[N+1][M+1]
Definition: JPolint.hh:867
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
no fit printf nominal n $STRING awk v X
do set_variable MODULE getModule a $WORKDIR detector_a datx L $STRING JEditDetector a $WORKDIR detector_a datx M $MODULE setz o $WORKDIR detector_a datx JEditDetector a $WORKDIR detector_b datx M $MODULE setz o $WORKDIR detector_b datx done echo Output stored at $WORKDIR detector_a datx and $WORKDIR tripod_a txt JDrawDetector2D a $WORKDIR detector_a datx a $WORKDIR detector_b datx L BL o detector $FORMAT $BATCH JDrawDetector2D T $WORKDIR tripod_a txt T $WORKDIR tripod_b txt L BL o tripod $FORMAT $BATCH JCompareDetector a $WORKDIR detector_a datx b $WORKDIR detector_b datx o $WORKDIR abc root &dev null for KEY in X Y Z
void JGIZMO::setLimits ( TGraph &  g1)
inline

Set limits of TGraph.

Parameters
g1graph

Definition at line 1359 of file JGizmoToolkit.hh.

1360  {
1361  using namespace std;
1362 
1363  Double_t ymin = numeric_limits<Double_t>::max();
1364  Double_t ymax = numeric_limits<Double_t>::lowest();
1365 
1366  for (Int_t i = 0; i != g1.GetN(); ++i) {
1367 
1368  const Double_t y = g1.GetY()[i];
1369 
1370  if (y > ymax) { ymax = y; }
1371  if (y < ymin) { ymin = y; }
1372  }
1373 
1374  g1.SetMinimum(ymin);
1375  g1.SetMaximum(ymax);
1376  }
Double_t g1(const Double_t x)
Function.
Definition: JQuantiles.cc:25
void JGIZMO::setLimits ( TGraph2D &  g2)
inline

Set limits of TGraph2D.

Parameters
g2graph

Definition at line 1384 of file JGizmoToolkit.hh.

1385  {
1386  using namespace std;
1387 
1388  Double_t zmin = numeric_limits<Double_t>::max();
1389  Double_t zmax = numeric_limits<Double_t>::lowest();
1390 
1391  for (Int_t i = 0; i != g2.GetN(); ++i) {
1392 
1393  const Double_t z = g2.GetZ()[i];
1394 
1395  if (z > zmax) { zmax = z; }
1396  if (z < zmin) { zmin = z; }
1397  }
1398 
1399  g2.SetMinimum(zmin);
1400  g2.SetMaximum(zmax);
1401  }
void JGIZMO::setRange ( double &  xmin,
double &  xmax,
const bool  logx 
)
inline

Set axis range.

Parameters
xminlower limit (I/O)
xmaxupper limit (I/O)
logxlogarithmic

Definition at line 1411 of file JGizmoToolkit.hh.

1414  {
1415  if (logx) {
1416  xmin = log(xmin);
1417  xmax = log(xmax);
1418  }
1419 
1420  double dx = (xmax - xmin) * 0.1;
1421 
1422  if (logx || xmin >= dx || xmin < 0.0)
1423  xmin -= dx;
1424  else
1425  xmin = 0.0;
1426 
1427  xmax += dx;
1428 
1429  if (logx) {
1430  xmin = exp(xmin);
1431  xmax = exp(xmax);
1432  }
1433  }
const double xmax
Definition: JQuadrature.cc:24
then set_variable DIR else fatal Wrong number of arguments fi for INPUT_FILE in ls rt $DIR stage * log
const double xmin
Definition: JQuadrature.cc:23
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable STRING $argv[2] set_array QUANTILES set_variable FORMULA *[0] exp(-0.5 *(x-[1])*(x-[1])/([2]*[2]))" set_variable MODULE `getModule -a $DETECTOR -L "$STRING 0"` source JAcousticsToolkit.sh typeset -A TRIPODS get_tripods $WORKDIR/tripod.txt TRIPODS XMEAN
void JGIZMO::setAxisLabels ( TAxis *  axis,
const JModuleAddressMap &  memo 
)
inline

Set axis with PMT address labels.

This methods sets the labels of the given axis to the sorted values of the PMT ring and position.
It should normally be called before filling of the corresponding histogram.
The filling should then be made with the textual representation of the PMT ring and position (i.e. JDETECTOR::JPMTPhysicalAddress::toString).

Alternatively, the filling can be made with the index of the PMT in the address map of the corresponding module (i.e. JDETECTOR::JModuleAddressMap::getIndex).
In that case, the method can be called before or after filling of the histogram.

Parameters
axisaxis
memomodule address map

Definition at line 1450 of file JGizmoToolkit.hh.

1451  {
1452  using namespace JPP;
1453 
1454  if (axis->GetNbins() == (int) memo.size()) {
1455 
1456  for (int i = 0; i != axis->GetNbins(); ++i) {
1457 
1458  const JPMTPhysicalAddress& address = memo[i];
1459 
1460  axis->SetBinLabel(i + 1, address.toString().c_str());
1461  }
1462 
1463  } else {
1464 
1465  THROW(JValueOutOfRange, "Number of bins " << axis->GetNbins() << " != " << memo.size());
1466  }
1467  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
void JGIZMO::setAxisLabels ( TH1 &  h1,
const std::string  axis,
const JModuleAddressMap &  memo 
)
inline

Set axis labels with PMT addresses.

This methods sets the labels of the given axis to the sorted values of the PMT ring and position.
It should be called after filling of the corresponding histogram.
The filling should have been made with the PMT number (e.g. KM3NETDAQ::JDAQHit::getPMT).

Parameters
h1histogram
axisaxis (x, X, y, Y, z, Z)
memomodule address map

Definition at line 1481 of file JGizmoToolkit.hh.

1482  {
1483  using namespace JPP;
1484 
1485  TAxis* pax = NULL;
1486 
1487  if (axis == "x" || axis == "X")
1488  pax = h1.GetXaxis();
1489  else if (axis == "y" || axis == "Y")
1490  pax = h1.GetYaxis();
1491  else if (axis == "z" || axis == "Z")
1492  pax = h1.GetZaxis();
1493  else
1494  THROW(JValueOutOfRange, "Invalid axis " << axis);
1495 
1496  if (pax->GetNbins() == (int) memo.size()) {
1497 
1498  for (int i = 0; i != pax->GetNbins(); ++i) {
1499 
1500  const JPMTPhysicalAddress& address = memo.getAddressTranslator(i);
1501 
1502  pax->SetBinLabel(i + 1, address.toString().c_str());
1503  }
1504 
1505  h1.LabelsOption("a", axis.c_str()); // sort labels
1506 
1507  } else {
1508 
1509  THROW(JValueOutOfRange, "Number of bins " << pax->GetNbins() << " != " << memo.size());
1510  }
1511  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
bool JGIZMO::isTObject ( const TKey *  key)
inline

Check if given key corresponds to a TObject.

Parameters
keyROOT key
Returns
true if given key corresponds to a TObject; else false

Definition at line 1520 of file JGizmoToolkit.hh.

1521  {
1522  return (key != NULL && TClass::GetClass(key->GetClassName())->IsTObject());
1523  }

Variable Documentation

const char* const JGIZMO::TIMESTAMP = "#splitline{}{#splitline{%d:%m:%y}{ %H:%M}}%F1970-01-01 00:00:00"
static

Time stamp of earliest UTC time.

Definition at line 94 of file JGizmoToolkit.hh.

const char JGIZMO::LABEL_TERMINATOR = '&'
static

label terminator

Definition at line 23 of file JRootObject.hh.