Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TASPaletteEditor.cxx
Go to the documentation of this file.
1// @(#)root/asimage:$Id$
2// Author: Reiner Rohlfs 24/03/2002
3
4/*************************************************************************
5 * Copyright (C) 1995-2002, Rene Brun, Fons Rademakers and Reiner Rohlfs *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12/** \class TASPaletteEditor
13\ingroup asimage
14
15This is a GUI window to edit a color palette.
16It is called by a pull down menu item of TASImage.
17*/
18
19#include "TASImage.h"
20#include "TRootEmbeddedCanvas.h"
21#include "TCanvas.h"
22#include "TH1.h"
23#include "TFile.h"
24#include "TASPaletteEditor.h"
25#include "TGXYLayout.h"
26#include "TGButton.h"
27#include "TGComboBox.h"
28#include "TGFileDialog.h"
29#include "TLine.h"
30#include "TROOT.h"
31#include "TMath.h"
32#include "RConfigure.h"
33#include "TVirtualX.h"
34#include "strlcpy.h"
35
36#include <cstdio>
37
38#ifdef R__HAS_COCOA
39# define X_DISPLAY_MISSING 1
40#endif
41
42#ifdef WIN32
43#include "Windows4root.h"
44#endif
45
46#ifndef WIN32
47# include <afterbase.h>
48#else
49# define X_DISPLAY_MISSING 1
50# include <afterbase.h>
51#endif
52# include <afterimage.h>
53extern "C" {
54# include <bmp.h>
55}
56
57
58static const char *gFileTypes[] = {
59 "ROOT palette file", "*.pal.root",
60 "ASCII palette file", "*.pal.txt",
61 nullptr, nullptr
62};
63
64constexpr size_t kNRainbowElems = 10;
65
67 0x0000, 0x7000, 0x0000, 0x0000, 0x0000,
68 0xffff, 0xffff, 0x7000, 0x8000, 0xffff
69};
71 0x0000, 0x0000, 0x0000, 0xffff, 0xffff,
72 0xffff, 0x0000, 0x0000, 0x8000, 0xffff
73};
75 0x0000, 0x7000, 0xffff, 0xffff, 0x0000,
76 0x0000, 0x0000, 0x0000, 0xa000, 0xffff
77};
78
79
80
81////////////////////////////////////////////////////////////////////////////////
82/// Palette editor constructor.
83/// The palette editor allows the editing of the color palette of the image.
84
86 : TPaletteEditor(attImage, w, h), TGMainFrame(nullptr, w, h)
87{
89 fHisto = nullptr;
90 fLimitLine[0] = nullptr;
91 fLimitLine[1] = nullptr;
92 fRampFactor = 0;
94
95 fPaletteList = new TList;
97
98 fPalette = new TImagePalette(attImage->GetPalette());
100
101 // buttons
103
104 button = new TGTextButton(this, "&Apply", 1);
105 button->SetToolTipText("Apply the palette to the image");
106 AddFrame(button, new TGXYLayoutHints(70, 1, 8, 1.8));
107
108 button = new TGTextButton(this, "&Ok", 2);
109 button->SetToolTipText("Same as Apply and Cancel button");
110 AddFrame(button, new TGXYLayoutHints(70, 3, 8, 1.8));
111
112 button = new TGTextButton(this, "&Cancel", 3);
113 button->SetToolTipText("Close this window");
114 AddFrame(button, new TGXYLayoutHints(70, 5, 8, 1.8));
115
116 button = new TGTextButton(this, "&Save", 4);
117 button->SetToolTipText("Save the palette in a ROOT or an ASCII file");
118 AddFrame(button, new TGXYLayoutHints(70, 7.5, 8, 1.8));
119
120 button = new TGTextButton(this, "O&pen", 5);
121 button->SetToolTipText("Read a palette from a ROOT or an ASCII file");
122 AddFrame(button, new TGXYLayoutHints(70, 9.5, 8, 1.8));
123
124 button = new TGTextButton(this, "&New", 6);
125 button->SetToolTipText("Create a new palette (not yet implemented)");
126 button->SetState(kButtonDisabled);
127 AddFrame(button, new TGXYLayoutHints(70, 12, 8, 1.8));
128
129 button = new TGTextButton(this, "&Edit", 7);
130 button->SetToolTipText("Edit a palette (not yet implemented)");
131 button->SetState(kButtonDisabled);
132 AddFrame(button, new TGXYLayoutHints(70, 14, 8, 1.8));
133
134 fAutoUpdate = new TGCheckButton(this, "Auto Update", 13);
135 fAutoUpdate->SetToolTipText("Automatic update of the image (without Apply button)");
136 AddFrame(fAutoUpdate, new TGXYLayoutHints(50, 1, 20, 1.8));
137
138 fUnDoButton = new TGTextButton(this, "&Undo", 20);
139 fUnDoButton->SetToolTipText("Undo the last modification (repeatable)");
140 AddFrame(fUnDoButton, new TGXYLayoutHints(50, 3, 8, 1.8));
141
142 fReDoButton = new TGTextButton(this, "&Redo", 21);
143 fReDoButton->SetToolTipText("Undo the last undo operation (repeatable)");
144 AddFrame(fReDoButton, new TGXYLayoutHints(60, 3, 8, 1.8));
145
146 button = new TGTextButton(this, "&Log", 8);
147 button->SetToolTipText("Apply a log operation to the anchor points of the palette");
148 AddFrame(button, new TGXYLayoutHints(50, 15, 8, 1.8));
149
150 button = new TGTextButton(this, "E&xp", 9);
151 button->SetToolTipText("Apply a exp operation to the anchor points of the palette");
152 AddFrame(button, new TGXYLayoutHints(50, 17, 8, 1.8));
153
154 button = new TGTextButton(this, "L&in", 10);
155 button->SetToolTipText("Make the distance of all anchor points constant");
156 AddFrame(button, new TGXYLayoutHints(50, 19, 8, 1.8));
157
158 button = new TGTextButton(this, "In&vert", 11);
159 button->SetToolTipText("Invert the order of the colors");
160 AddFrame(button, new TGXYLayoutHints(60, 17, 8, 1.8));
161
162 fStepButton = new TGCheckButton(this, "Step", 12);
163 fStepButton->SetToolTipText("Apply a step function to the palette");
164 AddFrame(fStepButton, new TGXYLayoutHints(60, 19, 8, 1.8));
165
166 // ramp: 1, 2 or 4
167 TGGroupFrame *rampFrame = new TGGroupFrame(this, "Ramps");
168 rampFrame->SetLayoutManager(new TGXYLayout(rampFrame));
169 AddFrame(rampFrame, new TGXYLayoutHints(50, 8.5, 14, 6,
172
173 fRamps[0] = new TGRadioButton(rampFrame, "1", 1);
174 fRamps[0]->SetToolTipText("Repeat the palette once");
175 rampFrame->AddFrame(fRamps[0], new TGXYLayoutHints(2, 1.4, 5, 1.8));
176
177 fRamps[1] = new TGRadioButton(rampFrame, "2", 2);
178 fRamps[1]->SetToolTipText("Repeat the palette twice");
179 rampFrame->AddFrame(fRamps[1], new TGXYLayoutHints(2, 3.3, 5, 1.8));
180
181 fRamps[2] = new TGRadioButton(rampFrame, "4", 4);
182 fRamps[2]->SetToolTipText("Repeat the palette four times");
183 rampFrame->AddFrame(fRamps[2], new TGXYLayoutHints(8, 3.3, 5, 1.8));
184
185 fRamps[0]->Associate(this);
186 fRamps[1]->Associate(this);
187 fRamps[2]->Associate(this);
188
189 // the histogram of the data
190 fHistCanvas = new TRootEmbeddedCanvas("data hist", this, 300, 50);
191 AddFrame(fHistCanvas, new TGXYLayoutHints(1, 1, 48, 20,
193
194 const ASImage *image = ((TASImage*)attImage)->GetImage();
195 if (image && image->alt.vector) {
196 Int_t pixel;
197 Double_t *data = image->alt.vector;
198 Int_t numPixel = image->width * image->height;
199 Int_t numBins = numPixel / 20;
200 numBins = (numBins < 10) ? 10 : (numBins > 200) ? 200 : numBins;
201
202 // get min and max value of image
203 fMinValue = fMaxValue = *image->alt.vector;
204 for (pixel = 1; pixel < numPixel; pixel++) {
205 if (fMinValue > *(data + pixel)) fMinValue = *(data + pixel);
206 if (fMaxValue < *(data + pixel)) fMaxValue = *(data + pixel);
207 }
208
209 fHisto = new TH1D("Statistics", "Pixel histogram of unzoomed image ",
210 numBins, fMinValue, fMaxValue);
211 for (pixel = 0; pixel < numPixel; pixel++)
212 fHisto->Fill(*(data + pixel));
213
214 fHisto->Draw("HIST");
219
221 0, fHisto->GetMaximum(), this);
222 fLimitLine[0]->Draw();
224 (fMaxValue - fMinValue), 0, fHisto->GetMaximum(), this);
225 fLimitLine[1]->Draw();
226 }
227
228 // the combobox of different palettes
229 fComboBox = new TGComboBox(this, 100);
230 AddFrame(fComboBox, new TGXYLayoutHints(50, 6, 14, 2));
231
232 fComboBox->AddEntry("Rainbow", 0);
233 fComboBox->AddEntry("Grey", 1);
234 fComboBox->AddEntry("Hot", 2);
235 fComboBox->AddEntry("Cold", 3);
236 fComboBox->AddEntry("Bowlerhat", 4);
237 fComboBox->AddEntry("", 5);
238
239
240 // the palette
241 fPaletteCanvas = new TRootEmbeddedCanvas("palette", this, 300, 50);
242 AddFrame(fPaletteCanvas, new TGXYLayoutHints(1, 22, 78, 2.5,
244
245 fPaintPalette = new PaintPalette(&fPalette, attImage);
247
249 Layout();
250
251 SetWindowName("Palette Editor");
252 SetIconName("Palette Editor");
253
254 MapWindow();
255
257}
258
259////////////////////////////////////////////////////////////////////////////////
260/// Palette editor destructor. Deletes all frames and their layout hints.
261
263{
264 TGFrameElement *ptr;
265
266 // delete all frames and layout hints
267 if (fList) {
268 TIter next(fList);
269 while ((ptr = (TGFrameElement *) next())) {
270 if (ptr->fLayout)
271 delete ptr->fLayout;
272 if (ptr->fFrame)
273 delete ptr->fFrame;
274 }
275 }
276
277 delete fHisto;
278 delete fPaintPalette;
279 delete fLimitLine[0];
280 delete fLimitLine[1];
281 delete fPaletteList;
282}
283
284////////////////////////////////////////////////////////////////////////////////
285/// Close editor.
286
288{
290 delete this;
291}
292
293////////////////////////////////////////////////////////////////////////////////
294/// Process all editor mouse events
295
297{
298 switch (GET_MSG(msg)) {
299
300 case kC_COMMAND:
301 switch (GET_SUBMSG(msg)) {
302
303 case kCM_COMBOBOX:
304 NewPalette(param2);
305 break;
306
307 case kCM_RADIOBUTTON:
308 SetRamp(param1);
309 break;
310
311 case kCM_CHECKBUTTON:
312 if (param1 == 12)
313 SetStep();
314 break;
315
316 case kCM_BUTTON:
317 switch (param1) {
318
319 case 1 : // Apply
322 fImagePad->Update();
323 break;
324
325 case 2 : // OK
328 fImagePad->Update();
329 CloseWindow();
330 break;
331
332 case 3 : // Cancel
333 CloseWindow();
334 break;
335
336 case 4 : // Save
337 Save();
338 break;
339
340 case 5 : // Open
341 Open();
342 break;
343
344 case 8: // log
345 LogPalette();
346 break;
347
348 case 9: // exp
349 ExpPalette();
350 break;
351
352 case 10: // lin
353 LinPalette();
354 break;
355
356 case 11: // invert
358 break;
359
360
361 case 20: // undo
363 if (fAutoUpdate->GetState() == kButtonDown) {
366 fImagePad->Update();
367 }
369 break;
370
371 case 21: // redo
373 if (fAutoUpdate->GetState() == kButtonDown) {
376 fImagePad->Update();
377 }
379 break;
380
381 default: ;
382 }
383 break;
384
385 default: ;
386 }
387 break;
388
389 default: ;
390 }
391
392 return kTRUE;
393}
394
395////////////////////////////////////////////////////////////////////////////////
396/// The newPalette is inserted in the list of palettes (fPaletteList) and
397/// fPalette is set to the newPalette. Protected method,
398
400{
401 // first remove all palettes in the list which are behind the
402 // current palette
403 while (auto obj = fPaletteList->After(fPalette))
404 delete fPaletteList->Remove(obj);
405
406 // add new palette and make it to the current palette
407 fPaletteList->Add(newPalette);
408 fPalette = newPalette;
409
410 // update the image
411 if (fAutoUpdate->GetState() == kButtonDown) {
414 fImagePad->Update();
415 }
416}
417
418////////////////////////////////////////////////////////////////////////////////
419/// Saves the current palette either into a ROOT file or in an ASCII file.
420/// It is called by the Save - button. Protected method.
421
423{
424 TGFileInfo fi;
426 static Bool_t overwr = kFALSE;
427 fi.fOverwrite = overwr;
428
429 new TGFileDialog(gClient->GetRoot(), this, kFDSave, &fi);
430 overwr = fi.fOverwrite;
431 if (!fi.fFilename)
432 return;
433
434 TString fn = fi.fFilename;
435
436 if (fn.EndsWith(".pal.txt")) {
437 // write into an ASCII file
438 FILE *fl = fopen(fn.Data(), "w");
439 if (!fl)
440 return;
441 fprintf(fl, "%u\n", fPalette->fNumPoints);
442 for (Int_t pt = 0; pt < Int_t(fPalette->fNumPoints); pt++)
443 fprintf(fl, "%10.9f %04hx %04hx %04hx %04hx\n", fPalette->fPoints[pt], fPalette->fColorRed[pt],
445 fclose(fl);
446 } else {
447 // write into a ROOT file
448 if (!fn.EndsWith(".pal.root"))
449 fn.Append(".pal.root");
450
451 gROOT->SaveObjectAs(fPalette, fn.Data(), "q");
452 }
453}
454
455////////////////////////////////////////////////////////////////////////////////
456/// Opens either a ROOT file or an ASCII file and reads a palette.
457/// It is called by the Open - button. Protected method.
458
460{
461 TGFileInfo fi;
463
464 new TGFileDialog(gClient->GetRoot(), this, kFDOpen, &fi);
465 if (!fi.fFilename)
466 return;
467
468 TString fn = fi.fFilename;
469
470 TImagePalette *newPalette = nullptr;
471
472 if (fn.EndsWith(".pal.txt")) {
473 FILE *fl = fopen(fn.Data(), "r");
474 if (!fl)
475 return;
476 UInt_t numPoints = 0;
477 if (fscanf(fl, "%u\n", &numPoints) != 1)
478 Error("Open", "Failure reading num points from %s", fn.Data());
479 newPalette = new TImagePalette(numPoints);
480 for (UInt_t pt = 0; pt < numPoints; pt++) {
481 if (fscanf(fl, "%lf %hx %hx %hx %hx\n", newPalette->fPoints + pt, newPalette->fColorRed + pt,
482 newPalette->fColorGreen + pt, newPalette->fColorBlue + pt, newPalette->fColorAlpha + pt) != 5)
483 Error("Open", "Failure reading point %u from %s", pt, fn.Data());
484 }
485 fclose(fl);
486 } else {
487 // read from a ROOT file
488 if (!fn.EndsWith(".pal.root"))
489 fn.Append(".pal.root");
490
491 TDirectory *dirsav = gDirectory;
492
493 auto fsave = TFile::Open(fn.Data(), "READ");
494 if (!fsave || !fsave->IsOpen()) {
495 delete fsave;
496 return;
497 }
498
499 newPalette = (TImagePalette *)fsave->Get("TImagePalette");
500 delete fsave;
501 if (dirsav)
502 dirsav->cd();
503 if (!newPalette)
504 return;
505 }
506
507 InsertNewPalette(newPalette);
509
510 fComboBox->Select(5); // empty entry
511}
512
513////////////////////////////////////////////////////////////////////////////////
514/// All widgets of the screen are updated with the current palette.
515/// Protected method.
516
518{
519 // update the color palette
522
523 if (histoUpdate) {
524 // update the limit lines
526 fLimitLine[0]->SetX1(xPos);
527 fLimitLine[0]->SetX2(xPos);
528
530 fLimitLine[1]->SetX1(xPos);
531 fLimitLine[1]->SetX2(xPos);
532
535 }
536
537 // update undo / redo button
540
541 // test if it is a step palette
543
544 Int_t pt;
545 for (pt = 2; pt < Int_t(fPalette->fNumPoints - 2); pt += 2)
546 if (TMath::Abs(fPalette->fPoints[pt] - fPalette->fPoints[pt + 1]) > 0.0001 ||
550 step = kButtonUp;
551 fStepButton->SetState(step);
552
553 // find the ramp factor
554 fRampFactor = 4;
555 Int_t off = (fPalette->fNumPoints - 2) / 4;
556 for (pt = 0; pt < Int_t(fPalette->fNumPoints - 2) / 4 * 3; pt++)
557 if (fPalette->fColorRed[pt + 1] != fPalette->fColorRed[pt + 1 + off] ||
558 fPalette->fColorGreen[pt + 1] != fPalette->fColorGreen[pt + 1 + off] ||
559 fPalette->fColorBlue[pt + 1] != fPalette->fColorBlue[pt + 1 + off] ||
560 fPalette->fColorAlpha[pt + 1] != fPalette->fColorAlpha[pt + 1 + off]) {
561 fRampFactor = 2;
562 break;
563 }
564
565 off = (fPalette->fNumPoints - 2) / 2;
566 for (pt = 0; pt < Int_t(fPalette->fNumPoints - 2) / 2; pt++)
567 if (fPalette->fColorRed[pt + 1] != fPalette->fColorRed[pt + 1 + off] ||
568 fPalette->fColorGreen[pt + 1] != fPalette->fColorGreen[pt + 1 + off] ||
569 fPalette->fColorBlue[pt + 1] != fPalette->fColorBlue[pt + 1 + off] ||
570 fPalette->fColorAlpha[pt + 1] != fPalette->fColorAlpha[pt + 1 + off]) {
571 fRampFactor = 1;
572 break;
573 }
574
578}
579
580////////////////////////////////////////////////////////////////////////////////
581/// The anchor points are rescaled by a log operation.
582/// It is called by the log - button. Protected method.
583
585{
586 TImagePalette *newPalette = new TImagePalette(*fPalette);
587
589
590 for (Int_t pt = 2; pt < Int_t(fPalette->fNumPoints - 2); pt++)
591 newPalette->fPoints[pt] = fPalette->fPoints[1] +
593 TMath::Log(delta + 1) * delta;
594
595 InsertNewPalette(newPalette);
597}
598
599////////////////////////////////////////////////////////////////////////////////
600/// The anchor points are rescaled by a exp operation.
601/// It is called by the exp - button. Protected method.
602
604{
605 TImagePalette *newPalette = new TImagePalette(*fPalette);
606
608
609 for (Int_t pt = 2; pt < Int_t(fPalette->fNumPoints - 2); pt++)
610 newPalette->fPoints[pt] = fPalette->fPoints[1] +
612 TMath::Log(delta + 1) / delta) - 1;
613
614 InsertNewPalette(newPalette);
616}
617
618////////////////////////////////////////////////////////////////////////////////
619/// The anchor points are rescaled to be linar.
620/// It is called by the lin - button. Protected method.
621
623{
624 TImagePalette *newPalette = new TImagePalette(*fPalette);
625
627 if (fStepButton->GetState() == kButtonUp) {
628 for (Int_t pt = 2; pt < Int_t(fPalette->fNumPoints - 2); pt++)
629 newPalette->fPoints[pt] = fPalette->fPoints[1] +
630 delta * (pt - 1) / (fPalette->fNumPoints - 3);
631 } else {
632 for (Int_t pt = 0; pt < Int_t(fPalette->fNumPoints - 4); pt += 2) {
633 newPalette->fPoints[pt + 3] = fPalette->fPoints[1] + delta * (pt + 2) /
634 (fPalette->fNumPoints - 2) ;
635 newPalette->fPoints[pt + 2] = newPalette->fPoints[pt + 3];
636 }
637 }
638
639 InsertNewPalette(newPalette);
641}
642
643////////////////////////////////////////////////////////////////////////////////
644/// The palette is inverted.
645/// It is called by the invert - button. Protected method.
646
648{
649 TImagePalette *newPalette = new TImagePalette(*fPalette);
650
651 Int_t pt;
652 for (pt = 0; pt < Int_t(fPalette->fNumPoints); pt++) {
653 newPalette->fColorRed[pt] = fPalette->fColorRed[fPalette->fNumPoints - 1 - pt];
654 newPalette->fColorGreen[pt] = fPalette->fColorGreen[fPalette->fNumPoints - 1 - pt];
655 newPalette->fColorBlue[pt] = fPalette->fColorBlue[fPalette->fNumPoints - 1 - pt];
656 newPalette->fColorAlpha[pt] = fPalette->fColorAlpha[fPalette->fNumPoints - 1 - pt];
657 }
658
659 for (pt = 2; pt < Int_t(fPalette->fNumPoints - 2); pt++)
660 newPalette->fPoints[pt] = fPalette->fPoints[1] +
663
664 InsertNewPalette(newPalette);
666}
667
668////////////////////////////////////////////////////////////////////////////////
669/// A new palette is created, depending on the id.
670/// It is called by the combo box. Protected method.
671
673{
674 if (id == 5) // empty entry
675 return;
676
678
679 UInt_t numPt = id == 0 ? kNRainbowElems + 2 : 13;
680 TImagePalette *newPalette = new TImagePalette(numPt);
681
682 Int_t pt;
683 for (pt = 1; pt < Int_t(numPt - 1); pt++) {
684 newPalette->fPoints[pt] = fPalette->fPoints[1] + (pt - 1) * delta / (numPt - 3);
685 newPalette->fColorAlpha[pt] = 0xffff;
686 }
687
688 switch (id) {
689 case 0: // rainbow
690 memcpy(newPalette->fColorRed + 1, gRedRainbow, kNRainbowElems * sizeof(UShort_t));
691 memcpy(newPalette->fColorGreen + 1, gGreenRainbow, kNRainbowElems * sizeof(UShort_t));
692 memcpy(newPalette->fColorBlue + 1, gBlueRainbow, kNRainbowElems * sizeof(UShort_t));
693 break;
694
695 case 1: // gray
696 for (pt = 1; pt < Int_t(numPt - 1); pt++) {
697 newPalette->fColorRed[pt] = 0xffff * (pt - 1) / (numPt - 3);
698 newPalette->fColorGreen[pt] = 0xffff * (pt - 1) / (numPt - 3);
699 newPalette->fColorBlue[pt] = 0xffff * (pt - 1) / (numPt - 3);
700 }
701 break;
702
703 case 2: // hot (red)
704 for (pt = 1; pt < Int_t(numPt - 1) / 2; pt++) {
705 newPalette->fColorRed[pt] = 0xffff * (pt - 1) / ((numPt - 3) / 2);
706 newPalette->fColorGreen[pt] = 0;
707 newPalette->fColorBlue[pt] = 0;
708 }
709
710 for (; pt < Int_t(numPt - 1); pt++) {
711 newPalette->fColorRed[pt] = 0xffff;
712 newPalette->fColorGreen[pt] = 0xffff * (pt - (numPt - 1) / 2) / ((numPt - 3) / 2);
713 newPalette->fColorBlue[pt] = 0xffff * (pt - (numPt - 1) / 2) / ((numPt - 3) / 2);
714 }
715 break;
716
717 case 3: // cold (blue)
718 for (pt = 1; pt < Int_t(numPt - 1) / 2; pt++) {
719 newPalette->fColorRed[pt] = 0;
720 newPalette->fColorGreen[pt] = 0;
721 newPalette->fColorBlue[pt] = 0xffff * (pt - 1) / ((numPt - 3) / 2);
722 }
723
724 for (; pt < Int_t(numPt - 1); pt++) {
725 newPalette->fColorRed[pt] = 0xffff * (pt - (numPt - 1) / 2) / ((numPt - 3) / 2);
726 newPalette->fColorGreen[pt] = 0xffff * (pt - (numPt - 1) / 2) / ((numPt - 3) / 2);
727 newPalette->fColorBlue[pt] = 0xffff;
728 }
729 break;
730
731 case 4: // bolwerhat
732 for (pt = 1; pt < Int_t(numPt + 1) / 2; pt++) {
733 newPalette->fColorRed[pt] = newPalette->fColorRed[numPt - pt - 1]
734 = 0xffff * (pt - 1) / ((numPt - 3) / 2);
735 newPalette->fColorGreen[pt] = newPalette->fColorGreen[numPt - pt - 1]
736 = 0xffff * (pt - 1) / ((numPt - 3) / 2);
737 newPalette->fColorBlue[pt] = newPalette->fColorBlue[numPt - pt - 1]
738 = 0xffff * (pt - 1) / ((numPt - 3) / 2);
739 }
740 break;
741 }
742
743 newPalette->fPoints[0] = 0;
744 newPalette->fColorRed[0] = newPalette->fColorRed[1];
745 newPalette->fColorGreen[0] = newPalette->fColorGreen[1];
746 newPalette->fColorBlue[0] = newPalette->fColorBlue[1];
747 newPalette->fColorAlpha[0] = newPalette->fColorAlpha[1];
748
749 newPalette->fPoints[newPalette->fNumPoints-1] = 1.0;
750 newPalette->fColorRed[newPalette->fNumPoints-1] = newPalette->fColorRed[newPalette->fNumPoints-2];
751 newPalette->fColorGreen[newPalette->fNumPoints-1] = newPalette->fColorGreen[newPalette->fNumPoints-2];
752 newPalette->fColorBlue[newPalette->fNumPoints-1] = newPalette->fColorBlue[newPalette->fNumPoints-2];
753 newPalette->fColorAlpha[newPalette->fNumPoints-1] = newPalette->fColorAlpha[newPalette->fNumPoints-2];
754
755 InsertNewPalette(newPalette);
757}
758
759////////////////////////////////////////////////////////////////////////////////
760/// Create a step palette. This is called by the step - check button.
761/// Protected method.
762
764{
765 TImagePalette *newPalette;
766
767 if (fStepButton->GetState() == kButtonDown) {
768 // change colors in steps
769 newPalette = new TImagePalette(fPalette->fNumPoints * 2 - 2);
771 for (Int_t pt = 1; pt < Int_t(fPalette->fNumPoints - 1); pt++) {
772 newPalette->fPoints[pt * 2 - 1] = fPalette->fPoints[1] + (fPalette->fPoints[pt] - fPalette->fPoints[1]) * fkt;
773 newPalette->fPoints[pt * 2] = fPalette->fPoints[1] + (fPalette->fPoints[pt + 1] - fPalette->fPoints[1]) * fkt;
774 newPalette->fColorRed[pt * 2 - 1] = newPalette->fColorRed[pt * 2] = fPalette->fColorRed[pt];
775 newPalette->fColorGreen[pt * 2 - 1] = newPalette->fColorGreen[pt * 2] = fPalette->fColorGreen[pt];
776 newPalette->fColorBlue[pt * 2 - 1] = newPalette->fColorBlue[pt * 2] = fPalette->fColorBlue[pt];
777 newPalette->fColorAlpha[pt * 2 - 1] = newPalette->fColorAlpha[pt * 2] = fPalette->fColorAlpha[pt];
778 }
779 } else {
780 // continuous change of colors
781 newPalette = new TImagePalette(fPalette->fNumPoints / 2 + 1);
784 for (Int_t pt = 1; pt < Int_t(newPalette->fNumPoints - 1); pt++) {
785 newPalette->fPoints[pt] = fPalette->fPoints[pt * 2 -1] * fkt;
786 newPalette->fColorRed[pt] = fPalette->fColorRed[pt * 2 - 1];
787 newPalette->fColorGreen[pt] = fPalette->fColorGreen[pt * 2 - 1];
788 newPalette->fColorBlue[pt] = fPalette->fColorBlue[pt * 2 - 1];
789 newPalette->fColorAlpha[pt] = fPalette->fColorAlpha[pt * 2 - 1];
790 }
791 }
792
793 newPalette->fPoints[0] = fPalette->fPoints[0];
794 newPalette->fColorRed[0] = fPalette->fColorRed[0];
795 newPalette->fColorGreen[0] = fPalette->fColorGreen[0];
796 newPalette->fColorBlue[0] = fPalette->fColorBlue[0];
797 newPalette->fColorAlpha[0] = fPalette->fColorAlpha[0];
798
799 newPalette->fPoints[newPalette->fNumPoints-2] = fPalette->fPoints[fPalette->fNumPoints-2];
800 newPalette->fPoints[newPalette->fNumPoints-1] = fPalette->fPoints[fPalette->fNumPoints-1];
801 newPalette->fColorRed[newPalette->fNumPoints-1] = fPalette->fColorRed[fPalette->fNumPoints-1];
802 newPalette->fColorGreen[newPalette->fNumPoints-1] = fPalette->fColorGreen[fPalette->fNumPoints-1];
803 newPalette->fColorBlue[newPalette->fNumPoints-1] = fPalette->fColorBlue[fPalette->fNumPoints-1];
804 newPalette->fColorAlpha[newPalette->fNumPoints-1] = fPalette->fColorAlpha[fPalette->fNumPoints-1];
805
806 InsertNewPalette(newPalette);
808}
809
810////////////////////////////////////////////////////////////////////////////////
811/// The palette is repeated up to 4 times.
812/// This is called by one of the ramp radio buttons. Protected method.
813
815{
816 if (ramp == fRampFactor)
817 return;
818
819 Int_t ptPerRamp = (fPalette->fNumPoints - 2) / fRampFactor;
820 TImagePalette *newPalette = new TImagePalette(ptPerRamp * ramp + 2);
821
823 for (Int_t rp = 0; rp < ramp; rp++) {
824 for (Int_t pt = 0; pt < ptPerRamp; pt++) {
825 newPalette->fPoints[1 + pt + rp * ptPerRamp] = fPalette->fPoints[1] +
826 delta / ramp * rp +
827 (fPalette->fPoints[1+pt] - fPalette->fPoints[1]) * fRampFactor / ramp;
828 newPalette->fColorRed [1 + pt + rp * ptPerRamp] = fPalette->fColorRed [1 + pt];
829 newPalette->fColorGreen[1 + pt + rp * ptPerRamp] = fPalette->fColorGreen[1 + pt];
830 newPalette->fColorBlue [1 + pt + rp * ptPerRamp] = fPalette->fColorBlue [1 + pt];
831 newPalette->fColorAlpha[1 + pt + rp * ptPerRamp] = fPalette->fColorAlpha[1 + pt];
832 }
833 }
834
835 newPalette->fPoints[0] = fPalette->fPoints[0];
836 newPalette->fColorRed[0] = fPalette->fColorRed[0];
837 newPalette->fColorGreen[0] = fPalette->fColorGreen[0];
838 newPalette->fColorBlue[0] = fPalette->fColorBlue[0];
839 newPalette->fColorAlpha[0] = fPalette->fColorAlpha[0];
840
841 newPalette->fPoints[newPalette->fNumPoints-2] = fPalette->fPoints[fPalette->fNumPoints-2];
842 newPalette->fPoints[newPalette->fNumPoints-1] = fPalette->fPoints[fPalette->fNumPoints-1];
843 newPalette->fColorRed[newPalette->fNumPoints-1] = fPalette->fColorRed[fPalette->fNumPoints-1];
844 newPalette->fColorGreen[newPalette->fNumPoints-1] = fPalette->fColorGreen[fPalette->fNumPoints-1];
845 newPalette->fColorBlue[newPalette->fNumPoints-1] = fPalette->fColorBlue[fPalette->fNumPoints-1];
846 newPalette->fColorAlpha[newPalette->fNumPoints-1] = fPalette->fColorAlpha[fPalette->fNumPoints-1];
847
848 InsertNewPalette(newPalette);
850}
851
852////////////////////////////////////////////////////////////////////////////////
853/// Updates the range of the palette.
854/// This is called after the blue limit lines were moved to define
855/// a new range.
856
858{
859 if (fMaxValue == fMinValue)
860 return;
861
862 TImagePalette *newPalette = new TImagePalette(*fPalette);
863
864 Double_t l0 = fLimitLine[0]->GetX1();
865 Double_t l1 = fLimitLine[1]->GetX1();
866 l0 = (l0 < fMinValue) ? fMinValue : ((l0 > fMaxValue) ? fMaxValue : l0);
867 l1 = (l1 < fMinValue) ? fMinValue : ((l1 > fMaxValue) ? fMaxValue : l1);
868 if (l0 > l1) {
869 Double_t tmp = l0;
870 l0 = l1;
871 l1 = tmp;
872 }
873
875 Double_t newDelta = (l1 - l0) / (fMaxValue - fMinValue);
876 Double_t newOff = (l0 - fMinValue) / (fMaxValue - fMinValue);
877
878 if (newDelta < 0.001 || oldDelta < 0.001)
879 return;
880
881 for (Int_t pt = 1; pt < Int_t(fPalette->fNumPoints - 1); pt++)
882 newPalette->fPoints[pt] = newOff +
883 (fPalette->fPoints[pt] - fPalette->fPoints[1]) * newDelta / oldDelta;
884
885 InsertNewPalette(newPalette);
887}
888
889////////////////////////////////////////////////////////////////////////////////
890/// Actually paint the paletter.
891
893{
894 // get geometry of pad
895 Int_t to_w = TMath::Abs(gPad->XtoPixel(gPad->GetX2()) -
896 gPad->XtoPixel(gPad->GetX1()));
897 Int_t to_h = TMath::Abs(gPad->YtoPixel(gPad->GetY2()) -
898 gPad->YtoPixel(gPad->GetY1()));
899
900 ASGradient grad;
901
902 grad.npoints = (*fPalette)->fNumPoints - 2;
903 grad.type = GRADIENT_Left2Right;
904 grad.color = new ARGB32[grad.npoints];
905 grad.offset = new double[grad.npoints];
906 for (Int_t pt = 0; pt < grad.npoints; pt++) {
907 grad.offset[pt] = ((*fPalette)->fPoints[pt + 1] - (*fPalette)->fPoints[1]) /
908 ((*fPalette)->fPoints[(*fPalette)->fNumPoints - 2] - (*fPalette)->fPoints[1]);
909 grad.color[pt] = (((ARGB32)((*fPalette)->fColorBlue[pt + 1] & 0xff00)) >> 8) |
910 (((ARGB32)((*fPalette)->fColorGreen[pt + 1] & 0xff00)) ) |
911 (((ARGB32)((*fPalette)->fColorRed[pt + 1] & 0xff00)) << 8) |
912 (((ARGB32)((*fPalette)->fColorAlpha[pt + 1] & 0xff00)) << 16);
913 }
914
915 ASImage * grad_im = make_gradient((ASVisual*)TASImage::GetVisual(), &grad , to_w, to_h,
916 SCL_DO_COLOR, ASA_ARGB32, 0,
918 delete [] grad.color;
919 delete [] grad.offset;
920
921 Window_t wid = (Window_t)gVirtualX->GetWindowID(gPad->GetPixmapID());
922 TASImage::Image2Drawable(grad_im, wid, 0, 0);
923 destroy_asimage(&grad_im);
924}
925
926////////////////////////////////////////////////////////////////////////////////
927/// The blue limit line in the pixel value histogram.
928
937
938////////////////////////////////////////////////////////////////////////////////
939/// Paint the limit lines.
940
942{
943 fY1 = gPad->GetUymin();
944 fY2 = gPad->GetUymax();
945
947}
948
949////////////////////////////////////////////////////////////////////////////////
950
952{
953 if (!gPad) return;
954
955 auto &parent = *gPad;
956
957 switch(event) {
958 case kMouseMotion:
959 parent.SetCursor(kMove);
960 break;
961
962 case kButton1Motion: {
963 Double_t xx[2], yy[2] = { GetY1(), GetY2() };
964 xx[0] = xx[1] = parent.AbsPixeltoX(px);
965 parent.PaintPolyLine(2, xx, yy, "iaspaletteline");
966 parent.UpdateAsync();
967 break;
968 }
969 case kButton1Up:
970 fX1 = fX2 = parent.AbsPixeltoX(px);
971 fY1 = parent.GetUymin();
972 fY2 = parent.GetUymax();
973 fGui->UpdateRange();
974 parent.Modified();
975 parent.UpdateAsync();
976 break;
977 }
978}
@ kMouseMotion
Definition Buttons.h:23
@ kButton1Motion
Definition Buttons.h:20
@ kButton1Up
Definition Buttons.h:19
@ kMove
Definition GuiTypes.h:375
Handle_t Window_t
Window handle.
Definition GuiTypes.h:29
#define h(i)
Definition RSha256.hxx:106
cudaEvent_t event
unsigned short UShort_t
Unsigned Short integer 2 bytes (unsigned short)
Definition RtypesCore.h:55
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:60
long Longptr_t
Integer large enough to hold a pointer (platform-dependent)
Definition RtypesCore.h:90
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
Definition RtypesCore.h:69
constexpr Bool_t kFALSE
Definition RtypesCore.h:109
double Double_t
Double 8 bytes.
Definition RtypesCore.h:74
constexpr Bool_t kTRUE
Definition RtypesCore.h:108
const char Option_t
Option string (const char)
Definition RtypesCore.h:81
static UShort_t gGreenRainbow[kNRainbowElems]
static UShort_t gRedRainbow[kNRainbowElems]
constexpr size_t kNRainbowElems
static UShort_t gBlueRainbow[kNRainbowElems]
static const char * gFileTypes[]
#define gDirectory
Definition TDirectory.h:385
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:208
EButtonState
Definition TGButton.h:52
@ kButtonDown
Definition TGButton.h:54
@ kButtonDisabled
Definition TGButton.h:56
@ kButtonUp
Definition TGButton.h:53
#define gClient
Definition TGClient.h:157
@ kFDOpen
@ kFDSave
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t SetLineWidth
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void pixel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize wid
Option_t Option_t SetLineColor
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t button
Option_t Option_t TPoint TPoint const char y1
#define gROOT
Definition TROOT.h:417
#define gPad
#define gVirtualX
Definition TVirtualX.h:379
Int_t GET_MSG(Long_t val)
@ kCM_COMBOBOX
@ kC_COMMAND
@ kCM_BUTTON
@ kCM_RADIOBUTTON
@ kCM_CHECKBUTTON
Int_t GET_SUBMSG(Long_t val)
Image class.
Definition TASImage.h:32
static const ASVisual * GetVisual()
Return visual.
static void Image2Drawable(ASImage *im, Drawable_t wid, Int_t x, Int_t y, Int_t xsrc=0, Int_t ysrc=0, UInt_t wsrc=0, UInt_t hsrc=0, Option_t *opt="")
Draw asimage on drawable.
void Paint(Option_t *option="") override
Paint the limit lines.
LimitLine(Coord_t x, Coord_t y1, Coord_t y2, TASPaletteEditor *gui)
The blue limit line in the pixel value histogram.
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to an event at (px,py).
void Paint(Option_t *option="") override
Actually paint the paletter.
This is a GUI window to edit a color palette.
void UpdateScreen(Bool_t histoUpdate)
All widgets of the screen are updated with the current palette.
PaintPalette * fPaintPalette
void UpdateRange()
Updates the range of the palette.
TGTextButton * fUnDoButton
TVirtualPad * fImagePad
TImagePalette * fPalette
current palette
TGCheckButton * fStepButton
TGTextButton * fReDoButton
Double_t fMinValue
min value of image
void Open()
Opens either a ROOT file or an ASCII file and reads a palette.
TList * fPaletteList
list of palettes for undo and redo
void ExpPalette()
The anchor points are rescaled by a exp operation.
void InsertNewPalette(TImagePalette *newPalette)
The newPalette is inserted in the list of palettes (fPaletteList) and fPalette is set to the newPalet...
void CloseWindow() override
Close editor.
TGRadioButton * fRamps[3]
TASPaletteEditor(TAttImage *attImage, UInt_t w, UInt_t h)
Palette editor constructor.
Bool_t ProcessMessage(Longptr_t msg, Longptr_t param1, Longptr_t param2) override
Process all editor mouse events.
TRootEmbeddedCanvas * fHistCanvas
canvas to draw the histogram
TGComboBox * fComboBox
TH1D * fHisto
histogram of image pixels
~TASPaletteEditor() override
Palette editor destructor. Deletes all frames and their layout hints.
void Save()
Saves the current palette either into a ROOT file or in an ASCII file.
TGCheckButton * fAutoUpdate
void NewPalette(Long_t id)
A new palette is created, depending on the id.
void LinPalette()
The anchor points are rescaled to be linar.
LimitLine * fLimitLine[2]
void SetRamp(Long_t ramp)
The palette is repeated up to 4 times.
void InvertPalette()
The palette is inverted.
void SetStep()
Create a step palette.
Double_t fMaxValue
max value of image
void LogPalette()
The anchor points are rescaled by a log operation.
TRootEmbeddedCanvas * fPaletteCanvas
canvas to draw the current palette
virtual void SetLabelSize(Float_t size=0.04)
Set size of axis labels.
Definition TAttAxis.cxx:184
virtual void SetLabelFont(Style_t font=62)
Set labels' font.
Definition TAttAxis.cxx:161
TImage attributes.
Definition TAttImage.h:59
virtual void SetPalette(const TImagePalette *palette)
Set a new palette for the image.
EImageQuality GetImageQuality() const
Definition TAttImage.h:87
virtual const TImagePalette & GetPalette() const
Definition TAttImage.h:88
void Update() override
Update canvas pad buffers.
Definition TCanvas.cxx:2520
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
Describe directory structure in memory.
Definition TDirectory.h:45
virtual Bool_t cd()
Change current directory to "this" directory.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
Definition TFile.cxx:3802
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition TGButton.cxx:439
virtual EButtonState GetState() const
Definition TGButton.h:112
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition TGButton.cxx:229
Selects different options.
Definition TGButton.h:264
void SetState(EButtonState state, Bool_t emit=kFALSE) override
Set check button state.
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
Definition TGComboBox.h:47
virtual void AddEntry(TGString *s, Int_t id)
Definition TGComboBox.h:86
virtual void Select(Int_t id, Bool_t emit=kTRUE)
Make the selected item visible in the combo box window and emit signals according to the second param...
virtual void SetLayoutManager(TGLayoutManager *l)
Set the layout manager for the composite frame.
Definition TGFrame.cxx:993
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1110
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1157
void Layout() override
Layout the elements of the composite frame.
Definition TGFrame.cxx:1250
TList * fList
container of frame elements
Definition TGFrame.h:294
This class creates a file selection dialog.
char * fFilename
selected file name
const char ** fFileTypes
file types used to filter selectable files
Bool_t fOverwrite
if true overwrite the file with existing name on save
TGLayoutHints * fLayout
Definition TGLayout.h:114
TGFrame * fFrame
Definition TGLayout.h:112
void MapWindow() override
map window
Definition TGFrame.h:206
A composite frame with a border and a title.
Definition TGFrame.h:532
Defines top level windows that interact with the system Window Manager.
Definition TGFrame.h:399
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition TGFrame.cxx:1793
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
Definition TGFrame.cxx:1780
Selects different options.
Definition TGButton.h:321
void SetState(EButtonState state, Bool_t emit=kFALSE) override
Set radio button state.
Yield an action as soon as it is clicked.
Definition TGButton.h:142
virtual void Associate(const TGWindow *w)
Definition TGWidget.h:72
This layout hint must be used for the TGXYLayout manager!
Definition TGXYLayout.h:19
Is a layout manager where the position and the size of each widget in the frame are defined by X / Y ...
Definition TGXYLayout.h:58
1-D histogram with a double per channel (see TH1 documentation)
Definition TH1.h:926
TAxis * GetXaxis()
Definition TH1.h:571
virtual Double_t GetMaximum(Double_t maxval=FLT_MAX) const
Return maximum value smaller than maxval of bins in the range, unless the value has been overridden b...
Definition TH1.cxx:8778
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
Definition TH1.cxx:3489
TAxis * GetYaxis()
Definition TH1.h:572
void Draw(Option_t *option="") override
Draw this histogram with options.
Definition TH1.cxx:3193
A class to define a conversion from pixel values to pixel color.
Definition TAttImage.h:33
UShort_t * fColorRed
[fNumPoints] red color at each anchor point
Definition TAttImage.h:38
Double_t * fPoints
[fNumPoints] value of each anchor point [0..1]
Definition TAttImage.h:37
UShort_t * fColorGreen
[fNumPoints] green color at each anchor point
Definition TAttImage.h:39
UShort_t * fColorBlue
[fNumPoints] blue color at each anchor point
Definition TAttImage.h:40
UInt_t fNumPoints
number of anchor points
Definition TAttImage.h:36
UShort_t * fColorAlpha
[fNumPoints] alpha at each anchor point
Definition TAttImage.h:41
Use the TLine constructor to create a simple line.
Definition TLine.h:22
virtual void SetX2(Double_t x2)
Definition TLine.h:68
void Paint(Option_t *option="") override
Paint this line with its current attributes.
Definition TLine.cxx:250
virtual void SetX1(Double_t x1)
Definition TLine.h:67
Double_t GetX1() const
Definition TLine.h:50
A doubly linked list.
Definition TList.h:38
TObject * After(const TObject *obj) const override
Returns the object after object obj.
Definition TList.cxx:460
TObject * Before(const TObject *obj) const override
Returns the object before object obj.
Definition TList.cxx:501
void Add(TObject *obj) override
Definition TList.h:81
TObject * Remove(TObject *obj) override
Remove object from the list.
Definition TList.cxx:952
TObject * Last() const override
Return the last object in the list. Returns 0 when list is empty.
Definition TList.cxx:823
TObject * First() const override
Return the first object in the list. Returns 0 when list is empty.
Definition TList.cxx:789
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition TObject.cxx:292
void Modified(Bool_t flag=true) override
Mark pad modified Will be repainted when TCanvas::Update() will be called next time.
Definition TPad.cxx:7313
Edit the palette via a GUI.
Definition TAttImage.h:19
virtual void CloseWindow()
Closes the window and deletes itself.
TAttImage * fAttImage
Definition TAttImage.h:22
This class creates a TGCanvas in which a TCanvas is created.
TCanvas * GetCanvas() const
Basic string class.
Definition TString.h:137
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Definition TString.cxx:2325
const char * Data() const
Definition TString.h:385
TString & Append(const char *cs)
Definition TString.h:582
virtual void Modified(Bool_t flag=1)=0
virtual void Update()=0
TPaveText * pt
Double_t x[n]
Definition legend1.C:17
Double_t Exp(Double_t x)
Returns the base-e exponential function of x, which is e raised to the power x.
Definition TMath.h:722
Double_t Log(Double_t x)
Returns the natural logarithm of x.
Definition TMath.h:769
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:122