Jpp  19.0.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...
 
TObjectgetObject (TList *ls, const char *const name)
 Get first object of which name matches given reguar expression. More...
 
TF1 * getFunction (TH1 *h1, const char *const fcn)
 Get function. More...
 
TF1 * getFunction (TGraph *g1, const char *const fcn)
 Get function. More...
 
TF1 * getFunction (TGraph2D *g2, const char *const fcn)
 Get function. 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 108 of file JGizmoToolkit.hh.

109  {
110  using namespace std;
111 
112  gErrorIgnoreLevel = kError;
113 
114  static map<string, TFile*> zmap;
115 
116  map<string, TFile*>::iterator i = zmap.find(file_name);
117 
118  if (i == zmap.end() || i->second == NULL || !i->second->IsOpen()) {
119 
120  TFile* file = TFile::Open(file_name.c_str(), option.c_str());
121 
122  zmap[file_name] = file;
123 
124  return file;
125 
126  } else {
127 
128  return i->second;
129  }
130  }
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 141 of file JGizmoToolkit.hh.

142  {
143  TFile* in = getFile(id.getFilename().c_str(), "exist");
144 
145  if (in == NULL || !in->IsOpen()) {
146  return NULL;
147  }
148 
149  if (id.getDirectory() != "")
150  return in->GetDirectory(id.getDirectory());
151  else
152  return in;
153  }
TFile * getFile(const std::string &file_name, const std::string &option="exist")
Get TFile pointer corresponding to give file name.
then fatal The output file must have the wildcard in the e g root fi 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 162 of file JGizmoToolkit.hh.

163  {
164  TDirectory* dir = getDirectory(id);
165 
166  if (dir != NULL) {
167 
168  const TRegexp regexp(id.getObjectName());
169 
170  TIter iter(dir->GetListOfKeys());
171 
172  for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
173 
174  const TString tag(key->GetName());
175 
176  // option match
177 
178  if (tag.Index(regexp) != -1) {
179  return key->ReadObj();
180  }
181  }
182  }
183 
184  return NULL;
185  }
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 194 of file JGizmoToolkit.hh.

195  {
196  {
197  const TH1* h1 = dynamic_cast<const TH1*>(object);
198 
199  if (h1 != NULL) {
200 
201  if (h1->GetSumw2N()) {
202  for (Int_t i = 1; i <= h1->GetNbinsX(); ++i) {
203  if (h1->GetBinError(i) != 0.0) {
204  return false;
205  }
206  }
207  }
208  }
209  }
210  {
211  const TGraphErrors* g1 = dynamic_cast<const TGraphErrors*>(object);
212 
213  if (g1 != NULL) {
214 
215  for (Int_t i = 0; i != g1->GetN(); ++i) {
216  if (g1->GetEY()[i] != 0.0) {
217  return false;
218  }
219  }
220 
221  return g1->GetN() > 1;
222  }
223  }
224  {
225  const TGraph* g1 = dynamic_cast<const TGraph*>(object);
226 
227  if (g1 != NULL) {
228  return g1->GetN() > 1;
229  }
230  }
231 
232  return true;
233  }
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 250 of file JGizmoToolkit.hh.

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

323  {
324  return getResult(TString(text.c_str()), object);
325  }
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 336 of file JGizmoToolkit.hh.

337  {
338  const char* regexp("p[0-9]* *=");
339 
340  TString buffer(text.c_str());
341 
342  buffer = buffer(TRegexp(regexp));
343  buffer = buffer(1, buffer.Length() - 2);
344 
345  if (!buffer.IsDigit()) {
346  THROW(JParseError, "Text is not a number " << text << ' ' << regexp);
347  }
348 
349  return buffer.Atoi();
350  }
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 367 of file JGizmoToolkit.hh.

368  {
369  const char* regexp("=.*");
370 
371  TString buffer(text.c_str());
372 
373  buffer = buffer(TRegexp(regexp));
374  buffer = buffer(1, buffer.Length() - 1);
375 
376  return getResult(std::string(buffer), object);
377  }
char text[TEXT_SIZE]
Definition: elog.cc:72
Double_t getResult(const TString &text, TObject *object=NULL)
Get result of given textual formula.
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 395 of file JGizmoToolkit.hh.

396  {
397  using namespace std;
398 
399  const char* regexp("=.*");
400 
401  TString buffer(text.c_str());
402 
403  buffer = buffer(TRegexp(regexp));
404  buffer = buffer(1, buffer.Length() - 1);
405 
406 
407  istringstream is((std::string(buffer)));
408 
409  Double_t value;
410 
411  for (int i = index; is >> value && i > 0; --i) {}
412 
413  if (is)
414  return value;
415  else
416  THROW(JParseError, "Text does not contain a number at given position " << buffer << ' ' << index);
417  }
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
void JGIZMO::setLogarithmic ( TAxis *  axis)
inline

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

Parameters
axisaxis

Definition at line 425 of file JGizmoToolkit.hh.

426  {
427  if (axis != NULL) {
428 
429  const Int_t N = axis->GetNbins();
430  Double_t buffer[N+1];
431 
432  buffer[0] = TMath::Power(10.0, axis->GetBinLowEdge(1));
433 
434  for (Int_t i = 1; i <= N; ++i) {
435  buffer[i] = TMath::Power(10.0, axis->GetBinLowEdge(i) + axis->GetBinWidth(i));
436  }
437 
438  axis->Set(N, buffer);
439  /*
440  if (axis->TestBit(TAxis::kAxisRange)) {
441 
442  const Int_t first = axis->GetFirst();
443  const Int_t last = axis->GetLast();
444 
445  if (first != last) {
446 
447  const Double_t xmin = axis->GetBinLowEdge(first);
448  const Double_t xmax = axis->GetBinLowEdge(last) + axis->GetBinWidth(last);
449 
450  axis->SetRangeUser(TMath::Power(10.0, xmin), TMath::Power(10.0, xmax));
451  }
452  }
453  */
454  }
455  }
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 465 of file JGizmoToolkit.hh.

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

Copy function parameters.

Parameters
fromfunction
tofunction

Definition at line 501 of file JGizmoToolkit.hh.

502  {
503  static_cast<TAttLine&> (to) = static_cast<const TAttLine&> (from);
504  static_cast<TAttFill&> (to) = static_cast<const TAttFill&> (from);
505  static_cast<TAttMarker&>(to) = static_cast<const TAttMarker&>(from);
506 
507  to.SetParameters(from.GetParameters());
508 
509  to.SetNpx(from.GetNpx());
510  }
void JGIZMO::copy ( const TF2 &  from,
TF2 &  to 
)
inline

Copy function parameters.

Parameters
fromfunction
tofunction

Definition at line 519 of file JGizmoToolkit.hh.

520  {
521  copy(static_cast<const TF1&>(from), static_cast<TF1&>(to));
522 
523  to.SetNpy(from.GetNpy());
524  }
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 927 of file JGizmoToolkit.hh.

928  {
929  for (TIter i(list); T* p = dynamic_cast<T*>(i.Next()); ) {
930  setLogarithmicX(p);
931  }
932  }
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 941 of file JGizmoToolkit.hh.

942  {
943  for (TIter i(list); T* p = dynamic_cast<T*>(i.Next()); ) {
944  setLogarithmicY(p);
945  }
946  }
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 550 of file JGizmoToolkit.hh.

551  {
552  if (f1 != NULL) {
553 
554  TF1 fn(f1->GetName(), getLogarithmic(f1->GetExpFormula(), 'x'));
555 
556  copy(*f1, fn);
557 
558  fn.SetRange(f1->GetXmin(),
559  f1->GetXmax());
560 
561  *f1 = fn;
562 
563  f1->SetRange(TMath::Power(10.0,f1->GetXmin()),
564  TMath::Power(10.0,f1->GetXmax()));
565  }
566  }
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 574 of file JGizmoToolkit.hh.

575  {
576  if (f1 != NULL) {
577 
578  TString buffer = f1->GetExpFormula();
579 
580  buffer = "pow(10.0, " + buffer + ")";
581 
582  TF1 fn(f1->GetName(), buffer);
583 
584  copy(*f1, fn);
585 
586  *f1 = fn;
587  }
588  }
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 596 of file JGizmoToolkit.hh.

597  {
598  if (f2 != NULL) {
599 
600  TF2 fn(f2->GetName(), getLogarithmic(f2->GetExpFormula(), 'x'));
601 
602  copy(*f2, fn);
603 
604  fn.SetRange(f2->GetXmin(),
605  f2->GetYmin(),
606  f2->GetXmax(),
607  f2->GetYmax());
608 
609  *f2 = fn;
610 
611  f2->SetRange(TMath::Power(10.0,f2->GetXmin()),
612  f2->GetYmin(),
613  TMath::Power(10.0,f2->GetXmax()),
614  f2->GetYmax());
615  }
616  }
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 624 of file JGizmoToolkit.hh.

625  {
626  if (f2 != NULL) {
627 
628  TF2 fn(f2->GetName(), getLogarithmic(f2->GetExpFormula(), 'y'));
629 
630  copy(*f2, fn);
631 
632  fn.SetRange(f2->GetXmin(),
633  f2->GetYmin(),
634  f2->GetXmax(),
635  f2->GetYmax());
636 
637  *f2 = fn;
638 
639  f2->SetRange(f2->GetXmin(),
640  TMath::Power(10.0,f2->GetYmin()),
641  f2->GetXmax(),
642  TMath::Power(10.0,f2->GetYmax()));
643  }
644  }
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 652 of file JGizmoToolkit.hh.

653  {
654  if (h1 != NULL) {
655 
656  setLogarithmicX<TF1>(h1->GetListOfFunctions());
657 
658  setLogarithmic(h1->GetXaxis());
659  }
660  }
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 668 of file JGizmoToolkit.hh.

669  {
670  using namespace std;
671 
672  if (h2 != NULL) {
673 
674  setLogarithmicX<TF2>(h2->GetListOfFunctions());
675 
676  setLogarithmic(h2->GetXaxis());
677  }
678  }
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 686 of file JGizmoToolkit.hh.

687  {
688  if (h2 != NULL) {
689 
690  setLogarithmicY<TF2>(h2->GetListOfFunctions());
691 
692  setLogarithmic(h2->GetYaxis());
693  }
694  }
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 702 of file JGizmoToolkit.hh.

703  {
704  if (g1 != NULL) {
705 
706  setLogarithmicX<TF1>(g1->GetListOfFunctions());
707 
708  for (Int_t i = 0; i != g1->GetN(); ++i) {
709  g1->GetX()[i] = pow(10.0, g1->GetX()[i]);
710  }
711  }
712  }
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 720 of file JGizmoToolkit.hh.

721  {
722  if (g1 != NULL) {
723 
724  setLogarithmicY<TF1>(g1->GetListOfFunctions());
725 
726  for (Int_t i = 0; i != g1->GetN(); ++i) {
727  g1->GetY()[i] = pow(10.0, g1->GetY()[i]);
728  }
729  }
730  }
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 738 of file JGizmoToolkit.hh.

739  {
740  if (g1 != NULL) {
741 
742  setLogarithmicX<TF1>(g1->GetListOfFunctions());
743 
744  for (Int_t i = 0; i != g1->GetN(); ++i) {
745  g1->GetEX()[i] = pow(10.0, g1->GetX()[i] + g1->GetEX()[i]) - pow(10.0, g1->GetX()[i]);
746  g1->GetX() [i] = pow(10.0, g1->GetX()[i]);
747  }
748  }
749  }
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 757 of file JGizmoToolkit.hh.

758  {
759  if (g1 != NULL) {
760 
761  setLogarithmicY<TF1>(g1->GetListOfFunctions());
762 
763  for (Int_t i = 0; i != g1->GetN(); ++i) {
764  g1->GetEY()[i] = pow(10.0, g1->GetY()[i] + g1->GetEY()[i]) - pow(10.0, g1->GetY()[i]);
765  g1->GetY() [i] = pow(10.0, g1->GetY()[i]);
766  }
767  }
768  }
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 776 of file JGizmoToolkit.hh.

777  {
778  if (g2 != NULL) {
779 
780  setLogarithmicX<TF2>(g2->GetListOfFunctions());
781 
782  for (Int_t i = 0; i != g2->GetN(); ++i) {
783  g2->GetX()[i] = pow(10.0, g2->GetX()[i]);
784  }
785  }
786  }
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 794 of file JGizmoToolkit.hh.

795  {
796  if (g2 != NULL) {
797 
798  setLogarithmicY<TF2>(g2->GetListOfFunctions());
799 
800  for (Int_t i = 0; i != g2->GetN(); ++i) {
801  g2->GetY()[i] = pow(10.0, g2->GetY()[i]);
802  }
803  }
804  }
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 812 of file JGizmoToolkit.hh.

813  {
814  if (g2 != NULL) {
815 
816  setLogarithmicX<TF2>(g2->GetListOfFunctions());
817 
818  for (Int_t i = 0; i != g2->GetN(); ++i) {
819  g2->GetEX()[i] = pow(10.0, g2->GetX()[i] + g2->GetEX()[i]) - pow(10.0, g2->GetX()[i]);
820  g2->GetX() [i] = pow(10.0, g2->GetX()[i]);
821  }
822  }
823  }
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 831 of file JGizmoToolkit.hh.

832  {
833  if (g2 != NULL) {
834 
835  setLogarithmicY<TF2>(g2->GetListOfFunctions());
836 
837  for (Int_t i = 0; i != g2->GetN(); ++i) {
838  g2->GetEY()[i] = pow(10.0, g2->GetY()[i] + g2->GetEY()[i]) - pow(10.0, g2->GetY()[i]);
839  g2->GetY() [i] = pow(10.0, g2->GetY()[i]);
840  }
841  }
842  }
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 850 of file JGizmoToolkit.hh.

851  {
852  if (gn != NULL) {
853  setLogarithmicX<TGraph>(gn->GetListOfGraphs());
854  }
855  }
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 863 of file JGizmoToolkit.hh.

864  {
865  if (gn != NULL) {
866  setLogarithmicY<TGraph>(gn->GetListOfGraphs());
867  }
868  }
void JGIZMO::setLogarithmicX ( TLine *  line)
inline

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

Parameters
lineline

Definition at line 876 of file JGizmoToolkit.hh.

877  {
878  if (line != NULL) {
879  line->SetX1(pow(10.0, line->GetX1()));
880  line->SetX2(pow(10.0, line->GetX2()));
881  }
882  }
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 890 of file JGizmoToolkit.hh.

891  {
892  if (line != NULL) {
893  line->SetY1(pow(10.0, line->GetY1()));
894  line->SetY2(pow(10.0, line->GetY2()));
895  }
896  }
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 904 of file JGizmoToolkit.hh.

905  {
906  THROW(JFunctionalException, "Operation setLogarithmicX on TEllipse not allowed.");
907  }
#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 915 of file JGizmoToolkit.hh.

916  {
917  THROW(JFunctionalException, "Operation setLogarithmicY on TEllipse not allowed.");
918  }
#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 961 of file JGizmoToolkit.hh.

962  {
963  using namespace std;
964 
965  const bool normalise = (option.find('N') != string::npos || option.find('n') != string::npos);
966  const bool bin_width = (option.find('W') != string::npos || option.find('w') != string::npos);
967  const bool use_error = (option.find('E') != string::npos || option.find('e') != string::npos);
968 
969  Double_t W = 1.0;
970 
971  if (normalise) {
972 
973  W = 0.0;
974 
975  for (Int_t i = 1; i <= h1.GetXaxis()->GetNbins(); ++i) {
976  W += h1.GetBinContent(i);
977  }
978  }
979 
980  if (W != 0.0) {
981 
982  for (Int_t i = 1; i <= h1.GetXaxis()->GetNbins(); ++i) {
983 
984  const Double_t w = W * (bin_width ? h1.GetXaxis()->GetBinWidth(i) : 1.0);
985 
986  h1.SetBinContent(i, h1.GetBinContent(i) * factor / w);
987 
988  if (use_error) {
989  h1.SetBinError(i, h1.GetBinError(i) * factor / w);
990  }
991  }
992  }
993  }
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 1010 of file JGizmoToolkit.hh.

1011  {
1012  using namespace std;
1013 
1014  const bool normalise = (option.find('N') != string::npos || option.find('n') != string::npos);
1015  const bool X = (option.find('X') != string::npos || option.find('x') != string::npos);
1016  const bool Y = (option.find('Y') != string::npos || option.find('y') != string::npos);
1017  const bool bin_width = (option.find('W') != string::npos || option.find('w') != string::npos);
1018  const bool use_error = (option.find('E') != string::npos || option.find('e') != string::npos);
1019 
1020  Double_t W = 1.0;
1021 
1022  if (X && Y) {
1023 
1024  if (normalise) {
1025 
1026  W = 0.0;
1027 
1028  for (Int_t ix = 1; ix <= h2.GetXaxis()->GetNbins(); ++ix) {
1029  for (Int_t iy = 1; iy <= h2.GetYaxis()->GetNbins(); ++iy) {
1030  W += h2.GetBinContent(ix,iy);
1031  }
1032  }
1033  }
1034 
1035  if (W != 0.0) {
1036 
1037  for (Int_t ix = 1; ix <= h2.GetXaxis()->GetNbins(); ++ix) {
1038  for (Int_t iy = 1; iy <= h2.GetYaxis()->GetNbins(); ++iy) {
1039 
1040  const Double_t w = W * (bin_width ? h2.GetXaxis()->GetBinWidth(ix) * h2.GetYaxis()->GetBinWidth(iy) : 1.0);
1041 
1042  h2.SetBinContent(ix, iy, h2.GetBinContent(ix,iy) * factor / w);
1043 
1044  if (use_error) {
1045  h2.SetBinError(ix, iy, h2.GetBinError(ix,iy) * factor / w);
1046  }
1047  }
1048  }
1049  }
1050 
1051  } else if (X) {
1052 
1053  for (Int_t iy = 1; iy <= h2.GetYaxis()->GetNbins(); ++iy) {
1054 
1055  if (normalise) {
1056 
1057  W = 0.0;
1058 
1059  for (Int_t ix = 1; ix <= h2.GetXaxis()->GetNbins(); ++ix) {
1060  W += h2.GetBinContent(ix,iy);
1061  }
1062  }
1063 
1064  if (W != 0.0) {
1065 
1066  for (Int_t ix = 1; ix <= h2.GetXaxis()->GetNbins(); ++ix) {
1067 
1068  const Double_t w = W * (bin_width ? h2.GetXaxis()->GetBinWidth(ix) : 1.0);
1069 
1070  h2.SetBinContent(ix, iy, h2.GetBinContent(ix,iy) * factor / w);
1071 
1072  if (use_error) {
1073  h2.SetBinError(ix, iy, h2.GetBinError(ix,iy) * factor / w);
1074  }
1075  }
1076  }
1077  }
1078 
1079  } else if (Y) {
1080 
1081  for (Int_t ix = 1; ix <= h2.GetXaxis()->GetNbins(); ++ix) {
1082 
1083  if (normalise) {
1084 
1085  W = 0.0;
1086 
1087  for (Int_t iy = 1; iy <= h2.GetYaxis()->GetNbins(); ++iy) {
1088  W += h2.GetBinContent(ix,iy);
1089  }
1090  }
1091 
1092  if (W != 0.0) {
1093 
1094  for (Int_t iy = 1; iy <= h2.GetYaxis()->GetNbins(); ++iy) {
1095 
1096  const Double_t w = W * (bin_width ? h2.GetYaxis()->GetBinWidth(iy) : 1.0);
1097 
1098  h2.SetBinContent(ix, iy, h2.GetBinContent(ix,iy) / w);
1099 
1100  if (use_error) {
1101  h2.SetBinError(ix, iy, h2.GetBinError(ix,iy) / w);
1102  }
1103  }
1104  }
1105  }
1106  }
1107  }
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 1125 of file JGizmoToolkit.hh.

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

1366  {
1367  using namespace std;
1368 
1369  Double_t ymin = numeric_limits<Double_t>::max();
1370  Double_t ymax = numeric_limits<Double_t>::lowest();
1371 
1372  for (Int_t i = 0; i != g1.GetN(); ++i) {
1373 
1374  const Double_t y = g1.GetY()[i];
1375 
1376  if (y > ymax) { ymax = y; }
1377  if (y < ymin) { ymin = y; }
1378  }
1379 
1380  g1.SetMinimum(ymin);
1381  g1.SetMaximum(ymax);
1382  }
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 1390 of file JGizmoToolkit.hh.

1391  {
1392  using namespace std;
1393 
1394  Double_t zmin = numeric_limits<Double_t>::max();
1395  Double_t zmax = numeric_limits<Double_t>::lowest();
1396 
1397  for (Int_t i = 0; i != g2.GetN(); ++i) {
1398 
1399  const Double_t z = g2.GetZ()[i];
1400 
1401  if (z > zmax) { zmax = z; }
1402  if (z < zmin) { zmin = z; }
1403  }
1404 
1405  g2.SetMinimum(zmin);
1406  g2.SetMaximum(zmax);
1407  }
then usage $script[energy[distance[z of PMT]]] fi case set_variable z
Definition: JDrawPDF.sh:45
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 1417 of file JGizmoToolkit.hh.

1420  {
1421  if (logx) {
1422  xmin = log(xmin);
1423  xmax = log(xmax);
1424  }
1425 
1426  double dx = (xmax - xmin) * 0.1;
1427 
1428  if (logx || xmin >= dx || xmin < 0.0)
1429  xmin -= dx;
1430  else
1431  xmin = 0.0;
1432 
1433  xmax += dx;
1434 
1435  if (logx) {
1436  xmin = exp(xmin);
1437  xmax = exp(xmax);
1438  }
1439  }
const double xmax
Definition: JQuadrature.cc:24
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 1456 of file JGizmoToolkit.hh.

1457  {
1458  using namespace JPP;
1459 
1460  if (axis->GetNbins() == (int) memo.size()) {
1461 
1462  for (int i = 0; i != axis->GetNbins(); ++i) {
1463 
1464  const JPMTPhysicalAddress& address = memo[i];
1465 
1466  axis->SetBinLabel(i + 1, address.toString().c_str());
1467  }
1468 
1469  } else {
1470 
1471  THROW(JValueOutOfRange, "Number of bins " << axis->GetNbins() << " != " << memo.size());
1472  }
1473  }
#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 1487 of file JGizmoToolkit.hh.

1488  {
1489  using namespace JPP;
1490 
1491  TAxis* pax = NULL;
1492 
1493  if (axis == "x" || axis == "X")
1494  pax = h1.GetXaxis();
1495  else if (axis == "y" || axis == "Y")
1496  pax = h1.GetYaxis();
1497  else if (axis == "z" || axis == "Z")
1498  pax = h1.GetZaxis();
1499  else
1500  THROW(JValueOutOfRange, "Invalid axis " << axis);
1501 
1502  if (pax->GetNbins() == (int) memo.size()) {
1503 
1504  for (int i = 0; i != pax->GetNbins(); ++i) {
1505 
1506  const JPMTPhysicalAddress& address = memo.getAddressTranslator(i);
1507 
1508  pax->SetBinLabel(i + 1, address.toString().c_str());
1509  }
1510 
1511  h1.LabelsOption("a", axis.c_str()); // sort labels
1512 
1513  } else {
1514 
1515  THROW(JValueOutOfRange, "Number of bins " << pax->GetNbins() << " != " << memo.size());
1516  }
1517  }
#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 1526 of file JGizmoToolkit.hh.

1527  {
1528  return (key != NULL && TClass::GetClass(key->GetClassName())->IsTObject());
1529  }
TObject* JGIZMO::getObject ( TList *  ls,
const char *const  name 
)
inline

Get first object of which name matches given reguar expression.

Parameters
lspointer to list of objects
nameregular expression
Returns
pointer to object (maybe NULL)

Definition at line 1539 of file JGizmoToolkit.hh.

1540  {
1541  const TRegexp regexp(name);
1542 
1543  TIter iter(ls);
1544 
1545  for (TObject* p1; (p1 = (TObject*) iter.Next()) != NULL; ) {
1546 
1547  const TString tag(p1->GetName());
1548 
1549  if (tag.Contains(regexp)) {
1550  return p1;
1551  }
1552  }
1553 
1554  return NULL;
1555  }
TPaveText * p1
Definition: JRoot.hh:19
then fatal The output file must have the wildcard in the name
Definition: JCanberra.sh:31
TF1* JGIZMO::getFunction ( TH1 *  h1,
const char *const  fcn 
)
inline

Get function.

Parameters
h1histogram
fcnfunction name
Returns
pointer to function (maybe NULL)

Definition at line 1565 of file JGizmoToolkit.hh.

1566  {
1567  return (TF1*) getObject(h1->GetListOfFunctions(), fcn);
1568  }
TObject * getObject(const JRootObjectID &id)
Get first TObject with given identifier.
TF1* JGIZMO::getFunction ( TGraph *  g1,
const char *const  fcn 
)
inline

Get function.

Parameters
g1graph
fcnfunction name
Returns
pointer to function (maybe NULL)

Definition at line 1578 of file JGizmoToolkit.hh.

1579  {
1580  return (TF1*) getObject(g1->GetListOfFunctions(), fcn);
1581  }
TObject * getObject(const JRootObjectID &id)
Get first TObject with given identifier.
Double_t g1(const Double_t x)
Function.
Definition: JQuantiles.cc:25
TF1* JGIZMO::getFunction ( TGraph2D *  g2,
const char *const  fcn 
)
inline

Get function.

Parameters
g2graph
fcnfunction name
Returns
pointer to function (maybe NULL)

Definition at line 1591 of file JGizmoToolkit.hh.

1592  {
1593  return (TF1*) getObject(g2->GetListOfFunctions(), fcn);
1594  }
TObject * getObject(const JRootObjectID &id)
Get first TObject with given identifier.

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 95 of file JGizmoToolkit.hh.

const char JGIZMO::LABEL_TERMINATOR = '&'
static

label terminator

Definition at line 23 of file JRootObject.hh.