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#include "snprintf.h"
36
37#ifdef R__HAS_COCOA
38# define X_DISPLAY_MISSING 1
39#endif
40
41#ifdef WIN32
42#include "Windows4root.h"
43#endif
44
45#ifndef WIN32
46# include <afterbase.h>
47#else
48# include <win32/config.h>
49# include <win32/afterbase.h>
50#endif
51# include <afterimage.h>
52extern "C" {
53# include <bmp.h>
54}
55
56
57static const char *gFileTypes[] = {
58 "ROOT palette file", "*.pal.root",
59 "ASCII palette file", "*.pal.txt",
60 0, 0
61};
62
63static UShort_t gRedRainbow[12] = {
64 0x0000, 0x7000, 0x0000, 0x0000, 0x0000,
65 0xffff, 0xffff, 0x7000, 0x8000, 0xffff
66};
67static UShort_t gGreenRainbow[12] = {
68 0x0000, 0x0000, 0x0000, 0xffff, 0xffff,
69 0xffff, 0x0000, 0x0000, 0x8000, 0xffff
70};
71static UShort_t gBlueRainbow[12] = {
72 0x0000, 0x7000, 0xffff, 0xffff, 0x0000,
73 0x0000, 0x0000, 0x0000, 0xa000, 0xffff
74};
75
76
78
79////////////////////////////////////////////////////////////////////////////////
80/// Palette editor constructor.
81/// The palette editor allows the editing of the color palette of the image.
82
84 : TPaletteEditor(attImage, w, h), TGMainFrame(0, w, h)
85{
87 fHisto = 0;
88 fLimitLine[0] = 0;
89 fLimitLine[1] = 0;
90 fRampFactor = 0;
92
93 fPaletteList = new TList;
95
96 fPalette = new TImagePalette(attImage->GetPalette());
98
99 // buttons
100 TGTextButton *button;
101
102 button = new TGTextButton(this, "&Apply", 1);
103 button->SetToolTipText("Apply the palette to the image");
104 AddFrame(button, new TGXYLayoutHints(70, 1, 8, 1.8));
105
106 button = new TGTextButton(this, "&Ok", 2);
107 button->SetToolTipText("Same as Apply and Cancel button");
108 AddFrame(button, new TGXYLayoutHints(70, 3, 8, 1.8));
109
110 button = new TGTextButton(this, "&Cancel", 3);
111 button->SetToolTipText("Close this window");
112 AddFrame(button, new TGXYLayoutHints(70, 5, 8, 1.8));
113
114 button = new TGTextButton(this, "&Save", 4);
115 button->SetToolTipText("Save the palette in a ROOT or an ASCII file");
116 AddFrame(button, new TGXYLayoutHints(70, 7.5, 8, 1.8));
117
118 button = new TGTextButton(this, "O&pen", 5);
119 button->SetToolTipText("Read a palette from a ROOT or an ASCII file");
120 AddFrame(button, new TGXYLayoutHints(70, 9.5, 8, 1.8));
121
122 button = new TGTextButton(this, "&New", 6);
123 button->SetToolTipText("Create a new palette (not yet implemented)");
124 button->SetState(kButtonDisabled);
125 AddFrame(button, new TGXYLayoutHints(70, 12, 8, 1.8));
126
127 button = new TGTextButton(this, "&Edit", 7);
128 button->SetToolTipText("Edit a palette (not yet implemented)");
129 button->SetState(kButtonDisabled);
130 AddFrame(button, new TGXYLayoutHints(70, 14, 8, 1.8));
131
132 fAutoUpdate = new TGCheckButton(this, "Auto Update", 13);
133 fAutoUpdate->SetToolTipText("Automatic update of the image (without Apply button)");
134 AddFrame(fAutoUpdate, new TGXYLayoutHints(50, 1, 20, 1.8));
135
136 fUnDoButton = new TGTextButton(this, "&Undo", 20);
137 fUnDoButton->SetToolTipText("Undo the last modification (repeatable)");
138 AddFrame(fUnDoButton, new TGXYLayoutHints(50, 3, 8, 1.8));
139
140 fReDoButton = new TGTextButton(this, "&Redo", 21);
141 fReDoButton->SetToolTipText("Undo the last undo operation (repeatable)");
142 AddFrame(fReDoButton, new TGXYLayoutHints(60, 3, 8, 1.8));
143
144 button = new TGTextButton(this, "&Log", 8);
145 button->SetToolTipText("Apply a log operation to the anchor points of the palette");
146 AddFrame(button, new TGXYLayoutHints(50, 15, 8, 1.8));
147
148 button = new TGTextButton(this, "E&xp", 9);
149 button->SetToolTipText("Apply a exp operation to the anchor points of the palette");
150 AddFrame(button, new TGXYLayoutHints(50, 17, 8, 1.8));
151
152 button = new TGTextButton(this, "L&in", 10);
153 button->SetToolTipText("Make the distance of all anchor points constant");
154 AddFrame(button, new TGXYLayoutHints(50, 19, 8, 1.8));
155
156 button = new TGTextButton(this, "In&vert", 11);
157 button->SetToolTipText("Invert the order of the colors");
158 AddFrame(button, new TGXYLayoutHints(60, 17, 8, 1.8));
159
160 fStepButton = new TGCheckButton(this, "Step", 12);
161 fStepButton->SetToolTipText("Apply a step function to the palette");
162 AddFrame(fStepButton, new TGXYLayoutHints(60, 19, 8, 1.8));
163
164 // ramp: 1, 2 or 4
165 TGGroupFrame *rampFrame = new TGGroupFrame(this, "Ramps");
166 rampFrame->SetLayoutManager(new TGXYLayout(rampFrame));
167 AddFrame(rampFrame, new TGXYLayoutHints(50, 8.5, 14, 6,
170
171 fRamps[0] = new TGRadioButton(rampFrame, "1", 1);
172 fRamps[0]->SetToolTipText("Repeat the palette once");
173 rampFrame->AddFrame(fRamps[0], new TGXYLayoutHints(2, 1.4, 5, 1.8));
174
175 fRamps[1] = new TGRadioButton(rampFrame, "2", 2);
176 fRamps[1]->SetToolTipText("Repeat the palette twice");
177 rampFrame->AddFrame(fRamps[1], new TGXYLayoutHints(2, 3.3, 5, 1.8));
178
179 fRamps[2] = new TGRadioButton(rampFrame, "4", 4);
180 fRamps[2]->SetToolTipText("Repeat the palette four times");
181 rampFrame->AddFrame(fRamps[2], new TGXYLayoutHints(8, 3.3, 5, 1.8));
182
183 fRamps[0]->Associate(this);
184 fRamps[1]->Associate(this);
185 fRamps[2]->Associate(this);
186
187 // the histogram of the data
188 fHistCanvas = new TRootEmbeddedCanvas("data hist", this, 300, 50);
189 AddFrame(fHistCanvas, new TGXYLayoutHints(1, 1, 48, 20,
191
192 const ASImage *image = ((TASImage*)attImage)->GetImage();
193 if (image && image->alt.vector) {
194 Int_t pixel;
195 Double_t *data = image->alt.vector;
196 Int_t numPixel = image->width * image->height;
197 Int_t numBins = numPixel / 20;
198 numBins = (numBins < 10) ? 10 : (numBins > 200) ? 200 : numBins;
199
200 // get min and max value of image
201 fMinValue = fMaxValue = *image->alt.vector;
202 for (pixel = 1; pixel < numPixel; pixel++) {
203 if (fMinValue > *(data + pixel)) fMinValue = *(data + pixel);
204 if (fMaxValue < *(data + pixel)) fMaxValue = *(data + pixel);
205 }
206
207 fHisto = new TH1D("Statistics", "Pixel histogram of unzoomed image ",
208 numBins, fMinValue, fMaxValue);
209 for (pixel = 0; pixel < numPixel; pixel++)
210 fHisto->Fill(*(data + pixel));
211
212 fHisto->Draw("HIST");
217
219 0, fHisto->GetMaximum(), this);
220 fLimitLine[0]->Draw();
222 (fMaxValue - fMinValue), 0, fHisto->GetMaximum(), this);
223 fLimitLine[1]->Draw();
224 }
225
226 // the combobox of different palettes
227 fComboBox = new TGComboBox(this, 100);
228 AddFrame(fComboBox, new TGXYLayoutHints(50, 6, 14, 2));
229
230 fComboBox->AddEntry("Rainbow", 0);
231 fComboBox->AddEntry("Grey", 1);
232 fComboBox->AddEntry("Hot", 2);
233 fComboBox->AddEntry("Cold", 3);
234 fComboBox->AddEntry("Bowlerhat", 4);
235 fComboBox->AddEntry("", 5);
236
237
238 // the palette
239 fPaletteCanvas = new TRootEmbeddedCanvas("palette", this, 300, 50);
240 AddFrame(fPaletteCanvas, new TGXYLayoutHints(1, 22, 78, 2.5,
242
243 fPaintPalette = new PaintPalette(&fPalette, attImage);
245
247 Layout();
248
249 SetWindowName("Palette Editor");
250 SetIconName("Palette Editor");
251
252 MapWindow();
253
255}
256
257////////////////////////////////////////////////////////////////////////////////
258/// Palette editor destructor. Deletes all frames and their layout hints.
259
261{
262 TGFrameElement *ptr;
263
264 // delete all frames and layout hints
265 if (fList) {
266 TIter next(fList);
267 while ((ptr = (TGFrameElement *) next())) {
268 if (ptr->fLayout)
269 delete ptr->fLayout;
270 if (ptr->fFrame)
271 delete ptr->fFrame;
272 }
273 }
274
275 delete fHisto;
276 delete fPaintPalette;
277 delete fLimitLine[0];
278 delete fLimitLine[1];
279 delete fPaletteList;
280}
281
282////////////////////////////////////////////////////////////////////////////////
283/// Close editor.
284
286{
288 delete this;
289}
290
291////////////////////////////////////////////////////////////////////////////////
292/// Process all editor mouse events
293
295{
296 switch (GET_MSG(msg)) {
297
298 case kC_COMMAND:
299 switch (GET_SUBMSG(msg)) {
300
301 case kCM_COMBOBOX:
302 NewPalette(param2);
303 break;
304
305 case kCM_RADIOBUTTON:
306 SetRamp(param1);
307 break;
308
309 case kCM_CHECKBUTTON:
310 if (param1 == 12)
311 SetStep();
312 break;
313
314 case kCM_BUTTON:
315 switch (param1) {
316
317 case 1 : // Apply
320 fImagePad->Update();
321 break;
322
323 case 2 : // OK
326 fImagePad->Update();
327 CloseWindow();
328 break;
329
330 case 3 : // Cancel
331 CloseWindow();
332 break;
333
334 case 4 : // Save
335 Save();
336 break;
337
338 case 5 : // Open
339 Open();
340 break;
341
342 case 8: // log
343 LogPalette();
344 break;
345
346 case 9: // exp
347 ExpPalette();
348 break;
349
350 case 10: // lin
351 LinPalette();
352 break;
353
354 case 11: // invert
356 break;
357
358
359 case 20: // undo
361 if (fAutoUpdate->GetState() == kButtonDown) {
364 fImagePad->Update();
365 }
367 break;
368
369 case 21: // redo
371 if (fAutoUpdate->GetState() == kButtonDown) {
374 fImagePad->Update();
375 }
377 break;
378
379 default: ;
380 }
381 break;
382
383 default: ;
384 }
385 break;
386
387 default: ;
388 }
389
390 return kTRUE;
391}
392
393////////////////////////////////////////////////////////////////////////////////
394/// The newPalette is inserted in the list of palettes (fPaletteList) and
395/// fPalette is set to the newPalette. Protected method,
396
398{
399 // first remove all palettes in the list which are behind the
400 // current palette
401 TObject *obj;
402 while ((obj = fPaletteList->After(fPalette)) != 0)
403 delete fPaletteList->Remove(obj);
404
405 // add new palette and make it to the current palette
406 fPaletteList->Add(newPalette);
407 fPalette = newPalette;
408
409 // update the image
410 if (fAutoUpdate->GetState() == kButtonDown) {
413 fImagePad->Update();
414 }
415}
416
417////////////////////////////////////////////////////////////////////////////////
418/// Saves the current palette either into a ROOT file or in an ASCII file.
419/// It is called by the Save - button. Protected method.
420
422{
423 TGFileInfo fi;
425 static Bool_t overwr = kFALSE;
426 fi.fOverwrite = overwr;
427
428 new TGFileDialog(gClient->GetRoot(), this, kFDSave, &fi);
429 overwr = fi.fOverwrite;
430 if (fi.fFilename == 0)
431 return;
432
433 if (strcmp(".pal.txt", fi.fFilename + strlen(fi.fFilename) - 8) == 0) {
434 // write into an ASCII file
435 FILE *fl = fopen(fi.fFilename, "w");
436 if (!fl) return;
437 fprintf(fl, "%u\n", fPalette->fNumPoints);
438 for (Int_t pt = 0; pt < Int_t(fPalette->fNumPoints); pt++)
439 fprintf(fl, "%10.9f %04hx %04hx %04hx %04hx\n",
445 fclose(fl);
446 } else {
447 // write into a ROOT file
448 char fn[512];
449 if (strcmp(".pal.root", fi.fFilename + strlen(fi.fFilename) - 9) != 0)
450 snprintf(fn,512, "%s%s", fi.fFilename, ".pal.root");
451 else
452 strlcpy(fn, fi.fFilename,512);
453
454 gROOT->ProcessLine(Form("gROOT->SaveObjectAs((TASPaletteEditor*)0x%zx,\"%s\",\"%s\");",(size_t)this,fn,"q"));
455 }
456}
457
458////////////////////////////////////////////////////////////////////////////////
459/// Opens either a ROOT file or an ASCII file and reads a palette.
460/// It is called by the Open - button. Protected method.
461
463{
464 TGFileInfo fi;
466
467 new TGFileDialog(gClient->GetRoot(), this, kFDOpen, &fi);
468 if (fi.fFilename == 0)
469 return;
470
471 TImagePalette *newPalette;
472
473 if (strcmp(".pal.txt", fi.fFilename + strlen(fi.fFilename) - 8) == 0) {
474 FILE *fl = fopen(fi.fFilename, "r");
475 if (!fl) return;
476 UInt_t numPoints;
477 // coverity [Calling risky function : FALSE]
478 if (fscanf(fl, "%u\n", &numPoints)) {;}
479 newPalette = new TImagePalette(numPoints);
480 for (Int_t pt = 0; pt < Int_t(numPoints); pt++)
481 // coverity [Calling risky function : FALSE]
482 if (fscanf(fl, "%lf %hx %hx %hx %hx\n",
483 newPalette->fPoints + pt,
484 newPalette->fColorRed + pt,
485 newPalette->fColorGreen + pt,
486 newPalette->fColorBlue + pt,
487 newPalette->fColorAlpha + pt )) {;}
488 fclose(fl);
489 } else {
490 // read from a ROOT file
491 char fn[512];
492 if (strcmp(".pal.root", fi.fFilename + strlen(fi.fFilename) - 9) != 0)
493 snprintf(fn,512, "%s%s", fi.fFilename, ".pal.root");
494 else
495 strlcpy(fn, fi.fFilename,512);
496 TDirectory *dirsav = gDirectory;
497
498 TFile *fsave = new TFile(fn, "READ");
499 if (!fsave->IsOpen()) {
500 delete fsave;
501 return;
502 }
503
504 newPalette = (TImagePalette*)fsave->Get("TImagePalette");
505 delete fsave;
506 if (dirsav) dirsav->cd();
507 if (!newPalette)
508 return;
509 }
510
511 InsertNewPalette(newPalette);
513
514 fComboBox->Select(5); // empty entry
515}
516
517////////////////////////////////////////////////////////////////////////////////
518/// All widgets of the screen are updated with the current palette.
519/// Protected method.
520
522{
523 // update the color palette
526
527 if (histoUpdate) {
528 // update the limit lines
530 fLimitLine[0]->SetX1(xPos);
531 fLimitLine[0]->SetX2(xPos);
532
534 fLimitLine[1]->SetX1(xPos);
535 fLimitLine[1]->SetX2(xPos);
536
539 }
540
541 // update undo / redo button
544
545 // test if it is a step palette
547
548 Int_t pt;
549 for (pt = 2; pt < Int_t(fPalette->fNumPoints - 2); pt += 2)
550 if (TMath::Abs(fPalette->fPoints[pt] - fPalette->fPoints[pt + 1]) > 0.0001 ||
554 step = kButtonUp;
555 fStepButton->SetState(step);
556
557 // find the ramp factor
558 fRampFactor = 4;
559 Int_t off = (fPalette->fNumPoints - 2) / 4;
560 for (pt = 0; pt < Int_t(fPalette->fNumPoints - 2) / 4 * 3; pt++)
561 if (fPalette->fColorRed[pt + 1] != fPalette->fColorRed[pt + 1 + off] ||
562 fPalette->fColorGreen[pt + 1] != fPalette->fColorGreen[pt + 1 + off] ||
563 fPalette->fColorBlue[pt + 1] != fPalette->fColorBlue[pt + 1 + off] ||
564 fPalette->fColorAlpha[pt + 1] != fPalette->fColorAlpha[pt + 1 + off]) {
565 fRampFactor = 2;
566 break;
567 }
568
569 off = (fPalette->fNumPoints - 2) / 2;
570 for (pt = 0; pt < Int_t(fPalette->fNumPoints - 2) / 2; pt++)
571 if (fPalette->fColorRed[pt + 1] != fPalette->fColorRed[pt + 1 + off] ||
572 fPalette->fColorGreen[pt + 1] != fPalette->fColorGreen[pt + 1 + off] ||
573 fPalette->fColorBlue[pt + 1] != fPalette->fColorBlue[pt + 1 + off] ||
574 fPalette->fColorAlpha[pt + 1] != fPalette->fColorAlpha[pt + 1 + off]) {
575 fRampFactor = 1;
576 break;
577 }
578
582}
583
584////////////////////////////////////////////////////////////////////////////////
585/// The anchor points are rescaled by a log operation.
586/// It is called by the log - button. Protected method.
587
589{
590 TImagePalette *newPalette = new TImagePalette(*fPalette);
591
593
594 for (Int_t pt = 2; pt < Int_t(fPalette->fNumPoints - 2); pt++)
595 newPalette->fPoints[pt] = fPalette->fPoints[1] +
597 TMath::Log(delta + 1) * delta;
598
599 InsertNewPalette(newPalette);
601}
602
603////////////////////////////////////////////////////////////////////////////////
604/// The anchor points are rescaled by a exp operation.
605/// It is called by the exp - button. Protected method.
606
608{
609 TImagePalette *newPalette = new TImagePalette(*fPalette);
610
612
613 for (Int_t pt = 2; pt < Int_t(fPalette->fNumPoints - 2); pt++)
614 newPalette->fPoints[pt] = fPalette->fPoints[1] +
616 TMath::Log(delta + 1) / delta) - 1;
617
618 InsertNewPalette(newPalette);
620}
621
622////////////////////////////////////////////////////////////////////////////////
623/// The anchor points are rescaled to be linar.
624/// It is called by the lin - button. Protected method.
625
627{
628 TImagePalette *newPalette = new TImagePalette(*fPalette);
629
631 if (fStepButton->GetState() == kButtonUp) {
632 for (Int_t pt = 2; pt < Int_t(fPalette->fNumPoints - 2); pt++)
633 newPalette->fPoints[pt] = fPalette->fPoints[1] +
634 delta * (pt - 1) / (fPalette->fNumPoints - 3);
635 } else {
636 for (Int_t pt = 0; pt < Int_t(fPalette->fNumPoints - 4); pt += 2) {
637 newPalette->fPoints[pt + 3] = fPalette->fPoints[1] + delta * (pt + 2) /
638 (fPalette->fNumPoints - 2) ;
639 newPalette->fPoints[pt + 2] = newPalette->fPoints[pt + 3];
640 }
641 }
642
643 InsertNewPalette(newPalette);
645}
646
647////////////////////////////////////////////////////////////////////////////////
648/// The palette is inverted.
649/// It is called by the invert - button. Protected method.
650
652{
653 TImagePalette *newPalette = new TImagePalette(*fPalette);
654
655 Int_t pt;
656 for (pt = 0; pt < Int_t(fPalette->fNumPoints); pt++) {
657 newPalette->fColorRed[pt] = fPalette->fColorRed[fPalette->fNumPoints - 1 - pt];
658 newPalette->fColorGreen[pt] = fPalette->fColorGreen[fPalette->fNumPoints - 1 - pt];
659 newPalette->fColorBlue[pt] = fPalette->fColorBlue[fPalette->fNumPoints - 1 - pt];
660 newPalette->fColorAlpha[pt] = fPalette->fColorAlpha[fPalette->fNumPoints - 1 - pt];
661 }
662
663 for (pt = 2; pt < Int_t(fPalette->fNumPoints - 2); pt++)
664 newPalette->fPoints[pt] = fPalette->fPoints[1] +
667
668 InsertNewPalette(newPalette);
670}
671
672////////////////////////////////////////////////////////////////////////////////
673/// A new palette is created, depending on the id.
674/// It is called by the combo box. Protected method.
675
677{
678 if (id == 5) // empty entry
679 return;
680
681 TImagePalette *newPalette;
682
684 UInt_t numPt;
685
686 numPt = id == 0 ? 12 : 13;
687 newPalette = new TImagePalette(numPt);
688 Int_t pt;
689 for (pt = 1; pt < Int_t(numPt - 1); pt++) {
690 newPalette->fPoints[pt] = fPalette->fPoints[1] + (pt - 1) * delta / (numPt - 3);
691 newPalette->fColorAlpha[pt] = 0xffff;
692 }
693
694 switch (id) {
695 case 0: // rainbow
696 memcpy(newPalette->fColorRed + 1, gRedRainbow, 12 * sizeof(UShort_t));
697 memcpy(newPalette->fColorGreen + 1, gGreenRainbow, 12 * sizeof(UShort_t));
698 memcpy(newPalette->fColorBlue + 1, gBlueRainbow, 12 * sizeof(UShort_t));
699 break;
700
701 case 1: // gray
702 for (pt = 1; pt < Int_t(numPt - 1); pt++) {
703 newPalette->fColorRed[pt] = 0xffff * (pt - 1) / (numPt - 3);
704 newPalette->fColorGreen[pt] = 0xffff * (pt - 1) / (numPt - 3);
705 newPalette->fColorBlue[pt] = 0xffff * (pt - 1) / (numPt - 3);
706 }
707 break;
708
709 case 2: // hot (red)
710 for (pt = 1; pt < Int_t(numPt - 1) / 2; pt++) {
711 newPalette->fColorRed[pt] = 0xffff * (pt - 1) / ((numPt - 3) / 2);
712 newPalette->fColorGreen[pt] = 0;
713 newPalette->fColorBlue[pt] = 0;
714 }
715
716 for (; pt < Int_t(numPt - 1); pt++) {
717 newPalette->fColorRed[pt] = 0xffff;
718 newPalette->fColorGreen[pt] = 0xffff * (pt - (numPt - 1) / 2) / ((numPt - 3) / 2);
719 newPalette->fColorBlue[pt] = 0xffff * (pt - (numPt - 1) / 2) / ((numPt - 3) / 2);
720 }
721 break;
722
723 case 3: // cold (blue)
724 for (pt = 1; pt < Int_t(numPt - 1) / 2; pt++) {
725 newPalette->fColorRed[pt] = 0;
726 newPalette->fColorGreen[pt] = 0;
727 newPalette->fColorBlue[pt] = 0xffff * (pt - 1) / ((numPt - 3) / 2);
728 }
729
730 for (; pt < Int_t(numPt - 1); pt++) {
731 newPalette->fColorRed[pt] = 0xffff * (pt - (numPt - 1) / 2) / ((numPt - 3) / 2);
732 newPalette->fColorGreen[pt] = 0xffff * (pt - (numPt - 1) / 2) / ((numPt - 3) / 2);
733 newPalette->fColorBlue[pt] = 0xffff;
734 }
735 break;
736
737 case 4: // bolwerhat
738 for (pt = 1; pt < Int_t(numPt + 1) / 2; pt++) {
739 newPalette->fColorRed[pt] = newPalette->fColorRed[numPt - pt - 1]
740 = 0xffff * (pt - 1) / ((numPt - 3) / 2);
741 newPalette->fColorGreen[pt] = newPalette->fColorGreen[numPt - pt - 1]
742 = 0xffff * (pt - 1) / ((numPt - 3) / 2);
743 newPalette->fColorBlue[pt] = newPalette->fColorBlue[numPt - pt - 1]
744 = 0xffff * (pt - 1) / ((numPt - 3) / 2);
745 }
746 break;
747 }
748
749 newPalette->fPoints[0] = 0;
750 newPalette->fColorRed[0] = newPalette->fColorRed[1];
751 newPalette->fColorGreen[0] = newPalette->fColorGreen[1];
752 newPalette->fColorBlue[0] = newPalette->fColorBlue[1];
753 newPalette->fColorAlpha[0] = newPalette->fColorAlpha[1];
754
755 newPalette->fPoints[newPalette->fNumPoints-1] = 1.0;
756 newPalette->fColorRed[newPalette->fNumPoints-1] = newPalette->fColorRed[newPalette->fNumPoints-2];
757 newPalette->fColorGreen[newPalette->fNumPoints-1] = newPalette->fColorGreen[newPalette->fNumPoints-2];
758 newPalette->fColorBlue[newPalette->fNumPoints-1] = newPalette->fColorBlue[newPalette->fNumPoints-2];
759 newPalette->fColorAlpha[newPalette->fNumPoints-1] = newPalette->fColorAlpha[newPalette->fNumPoints-2];
760
761 InsertNewPalette(newPalette);
763}
764
765////////////////////////////////////////////////////////////////////////////////
766/// Create a step palette. This is called by the step - check button.
767/// Protected method.
768
770{
771 TImagePalette *newPalette;
772
773 if (fStepButton->GetState() == kButtonDown) {
774 // change colors in steps
775 newPalette = new TImagePalette(fPalette->fNumPoints * 2 - 2);
777 for (Int_t pt = 1; pt < Int_t(fPalette->fNumPoints - 1); pt++) {
778 newPalette->fPoints[pt * 2 - 1] = fPalette->fPoints[1] + (fPalette->fPoints[pt] - fPalette->fPoints[1]) * fkt;
779 newPalette->fPoints[pt * 2] = fPalette->fPoints[1] + (fPalette->fPoints[pt + 1] - fPalette->fPoints[1]) * fkt;
780 newPalette->fColorRed[pt * 2 - 1] = newPalette->fColorRed[pt * 2] = fPalette->fColorRed[pt];
781 newPalette->fColorGreen[pt * 2 - 1] = newPalette->fColorGreen[pt * 2] = fPalette->fColorGreen[pt];
782 newPalette->fColorBlue[pt * 2 - 1] = newPalette->fColorBlue[pt * 2] = fPalette->fColorBlue[pt];
783 newPalette->fColorAlpha[pt * 2 - 1] = newPalette->fColorAlpha[pt * 2] = fPalette->fColorAlpha[pt];
784 }
785 } else {
786 // continuous change of colors
787 newPalette = new TImagePalette(fPalette->fNumPoints / 2 + 1);
790 for (Int_t pt = 1; pt < Int_t(newPalette->fNumPoints - 1); pt++) {
791 newPalette->fPoints[pt] = fPalette->fPoints[pt * 2 -1] * fkt;
792 newPalette->fColorRed[pt] = fPalette->fColorRed[pt * 2 - 1];
793 newPalette->fColorGreen[pt] = fPalette->fColorGreen[pt * 2 - 1];
794 newPalette->fColorBlue[pt] = fPalette->fColorBlue[pt * 2 - 1];
795 newPalette->fColorAlpha[pt] = fPalette->fColorAlpha[pt * 2 - 1];
796 }
797 }
798
799 newPalette->fPoints[0] = fPalette->fPoints[0];
800 newPalette->fColorRed[0] = fPalette->fColorRed[0];
801 newPalette->fColorGreen[0] = fPalette->fColorGreen[0];
802 newPalette->fColorBlue[0] = fPalette->fColorBlue[0];
803 newPalette->fColorAlpha[0] = fPalette->fColorAlpha[0];
804
805 newPalette->fPoints[newPalette->fNumPoints-2] = fPalette->fPoints[fPalette->fNumPoints-2];
806 newPalette->fPoints[newPalette->fNumPoints-1] = fPalette->fPoints[fPalette->fNumPoints-1];
807 newPalette->fColorRed[newPalette->fNumPoints-1] = fPalette->fColorRed[fPalette->fNumPoints-1];
808 newPalette->fColorGreen[newPalette->fNumPoints-1] = fPalette->fColorGreen[fPalette->fNumPoints-1];
809 newPalette->fColorBlue[newPalette->fNumPoints-1] = fPalette->fColorBlue[fPalette->fNumPoints-1];
810 newPalette->fColorAlpha[newPalette->fNumPoints-1] = fPalette->fColorAlpha[fPalette->fNumPoints-1];
811
812 InsertNewPalette(newPalette);
814}
815
816////////////////////////////////////////////////////////////////////////////////
817/// The palette is repeated up to 4 times.
818/// This is called by one of the ramp radio buttons. Protected method.
819
821{
822 if (ramp == fRampFactor)
823 return;
824
825 Int_t ptPerRamp = (fPalette->fNumPoints - 2) / fRampFactor;
826 TImagePalette *newPalette = new TImagePalette(ptPerRamp * ramp + 2);
827
829 for (Int_t rp = 0; rp < ramp; rp++) {
830 for (Int_t pt = 0; pt < ptPerRamp; pt++) {
831 newPalette->fPoints[1 + pt + rp * ptPerRamp] = fPalette->fPoints[1] +
832 delta / ramp * rp +
833 (fPalette->fPoints[1+pt] - fPalette->fPoints[1]) * fRampFactor / ramp;
834 newPalette->fColorRed [1 + pt + rp * ptPerRamp] = fPalette->fColorRed [1 + pt];
835 newPalette->fColorGreen[1 + pt + rp * ptPerRamp] = fPalette->fColorGreen[1 + pt];
836 newPalette->fColorBlue [1 + pt + rp * ptPerRamp] = fPalette->fColorBlue [1 + pt];
837 newPalette->fColorAlpha[1 + pt + rp * ptPerRamp] = fPalette->fColorAlpha[1 + pt];
838 }
839 }
840
841 newPalette->fPoints[0] = fPalette->fPoints[0];
842 newPalette->fColorRed[0] = fPalette->fColorRed[0];
843 newPalette->fColorGreen[0] = fPalette->fColorGreen[0];
844 newPalette->fColorBlue[0] = fPalette->fColorBlue[0];
845 newPalette->fColorAlpha[0] = fPalette->fColorAlpha[0];
846
847 newPalette->fPoints[newPalette->fNumPoints-2] = fPalette->fPoints[fPalette->fNumPoints-2];
848 newPalette->fPoints[newPalette->fNumPoints-1] = fPalette->fPoints[fPalette->fNumPoints-1];
849 newPalette->fColorRed[newPalette->fNumPoints-1] = fPalette->fColorRed[fPalette->fNumPoints-1];
850 newPalette->fColorGreen[newPalette->fNumPoints-1] = fPalette->fColorGreen[fPalette->fNumPoints-1];
851 newPalette->fColorBlue[newPalette->fNumPoints-1] = fPalette->fColorBlue[fPalette->fNumPoints-1];
852 newPalette->fColorAlpha[newPalette->fNumPoints-1] = fPalette->fColorAlpha[fPalette->fNumPoints-1];
853
854 InsertNewPalette(newPalette);
856}
857
858////////////////////////////////////////////////////////////////////////////////
859/// Updates the range of the palette.
860/// This is called after the blue limit lines were moved to define
861/// a new range.
862
864{
865 if (fMaxValue == fMinValue)
866 return;
867
868 TImagePalette *newPalette = new TImagePalette(*fPalette);
869
870 Double_t l0 = fLimitLine[0]->GetX1();
871 Double_t l1 = fLimitLine[1]->GetX1();
872 l0 = (l0 < fMinValue) ? fMinValue : ((l0 > fMaxValue) ? fMaxValue : l0);
873 l1 = (l1 < fMinValue) ? fMinValue : ((l1 > fMaxValue) ? fMaxValue : l1);
874 if (l0 > l1) {
875 Double_t tmp = l0;
876 l0 = l1;
877 l1 = tmp;
878 }
879
881 Double_t newDelta = (l1 - l0) / (fMaxValue - fMinValue);
882 Double_t newOff = (l0 - fMinValue) / (fMaxValue - fMinValue);
883
884 if (newDelta < 0.001 || oldDelta < 0.001)
885 return;
886
887 for (Int_t pt = 1; pt < Int_t(fPalette->fNumPoints - 1); pt++)
888 newPalette->fPoints[pt] = newOff +
889 (fPalette->fPoints[pt] - fPalette->fPoints[1]) * newDelta / oldDelta;
890
891 InsertNewPalette(newPalette);
893}
894
895////////////////////////////////////////////////////////////////////////////////
896/// Actually paint the paletter.
897
899{
900 // get geometry of pad
901 Int_t to_w = TMath::Abs(gPad->XtoPixel(gPad->GetX2()) -
902 gPad->XtoPixel(gPad->GetX1()));
903 Int_t to_h = TMath::Abs(gPad->YtoPixel(gPad->GetY2()) -
904 gPad->YtoPixel(gPad->GetY1()));
905
906 ASGradient grad;
907
908 grad.npoints = (*fPalette)->fNumPoints - 2;
909 grad.type = GRADIENT_Left2Right;
910 grad.color = new ARGB32[grad.npoints];
911 grad.offset = new double[grad.npoints];
912 for (Int_t pt = 0; pt < grad.npoints; pt++) {
913 grad.offset[pt] = ((*fPalette)->fPoints[pt + 1] - (*fPalette)->fPoints[1]) /
914 ((*fPalette)->fPoints[(*fPalette)->fNumPoints - 2] - (*fPalette)->fPoints[1]);
915 grad.color[pt] = (((ARGB32)((*fPalette)->fColorBlue[pt + 1] & 0xff00)) >> 8) |
916 (((ARGB32)((*fPalette)->fColorGreen[pt + 1] & 0xff00)) ) |
917 (((ARGB32)((*fPalette)->fColorRed[pt + 1] & 0xff00)) << 8) |
918 (((ARGB32)((*fPalette)->fColorAlpha[pt + 1] & 0xff00)) << 16);
919 }
920
921 ASImage * grad_im = make_gradient((ASVisual*)TASImage::GetVisual(), &grad , to_w, to_h,
922 SCL_DO_COLOR, ASA_ARGB32, 0,
924 delete [] grad.color;
925 delete [] grad.offset;
926
927 Window_t wid = (Window_t)gVirtualX->GetWindowID(gPad->GetPixmapID());
928 TASImage::Image2Drawable(grad_im, wid, 0, 0);
929 destroy_asimage(&grad_im);
930}
931
932////////////////////////////////////////////////////////////////////////////////
933/// The blue limit line in the pixel value histogram.
934
936 TASPaletteEditor *gui)
937 : TLine(x, y1, x, y2)
938{
939 fGui = gui;
940 SetLineColor(4);
941 SetLineWidth(2);
942}
943
944////////////////////////////////////////////////////////////////////////////////
945/// Paint the limit lines.
946
948{
949 fY1 = gPad->GetUymin();
950 fY2 = gPad->GetUymax();
951
952 TLine::Paint(option);
953}
954
955////////////////////////////////////////////////////////////////////////////////
956
958 Int_t px, Int_t /*py*/)
959{
960 static Int_t oldX;
961
962 if (!gPad) return;
963
964 switch(event) {
965 case kMouseMotion:
966 gPad->SetCursor(kMove);
967 break;
968
969 case kButton1Down:
970 gVirtualX->SetLineColor(-1);
971 TAttLine::Modify(); //Change line attributes only if necessary
972 oldX = gPad->XtoAbsPixel(fX1);
973 break;
974
975 case kButton1Motion:
976 gVirtualX->DrawLine(oldX, gPad->YtoPixel(fY1), oldX, gPad->YtoPixel(fY2));
977 oldX = px;
978 gVirtualX->DrawLine(oldX, gPad->YtoPixel(fY1), oldX, gPad->YtoPixel(fY2));
979 gVirtualX->Update();
980 break;
981
982 case kButton1Up:
983 gVirtualX->SetLineColor(-1);
984 TAttLine::Modify(); //Change line attributes only if necessary
985 fX1 = fX2 = gPad->AbsPixeltoX(oldX);
986 fGui->UpdateRange();
987 gPad->Modified(kTRUE);
988 gPad->Update();
989 break;
990
991 default:
992 break;
993 }
994}
@ kMouseMotion
Definition Buttons.h:23
@ kButton1Motion
Definition Buttons.h:20
@ kButton1Up
Definition Buttons.h:19
@ kButton1Down
Definition Buttons.h:17
@ kMove
Definition GuiTypes.h:374
Handle_t Window_t
Window handle.
Definition GuiTypes.h:29
#define h(i)
Definition RSha256.hxx:106
double Coord_t
Definition RtypesCore.h:94
unsigned short UShort_t
Definition RtypesCore.h:40
int Int_t
Definition RtypesCore.h:45
long Longptr_t
Definition RtypesCore.h:82
const Bool_t kFALSE
Definition RtypesCore.h:101
long Long_t
Definition RtypesCore.h:54
double Double_t
Definition RtypesCore.h:59
const Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:364
static UShort_t gRedRainbow[12]
static UShort_t gBlueRainbow[12]
static UShort_t gGreenRainbow[12]
static const char * gFileTypes[]
#define gDirectory
Definition TDirectory.h:385
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
#define gROOT
Definition TROOT.h:404
char * Form(const char *fmt,...)
#define gPad
#define gVirtualX
Definition TVirtualX.h:338
Int_t GET_MSG(Long_t val)
@ kCM_COMBOBOX
@ kC_COMMAND
@ kCM_BUTTON
@ kCM_RADIOBUTTON
@ kCM_CHECKBUTTON
Int_t GET_SUBMSG(Long_t val)
#define snprintf
Definition civetweb.c:1540
Image class.
Definition TASImage.h:31
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)
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.
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
void Paint(Option_t *option)
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
void CloseWindow()
Close editor.
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...
TGRadioButton * fRamps[3]
TASPaletteEditor(TAttImage *attImage, UInt_t w, UInt_t h)
Palette editor constructor.
TRootEmbeddedCanvas * fHistCanvas
canvas to draw the histogram
TGComboBox * fComboBox
TH1D * fHisto
histogram of image pixels
void Save()
Saves the current palette either into a ROOT file or in an ASCII file.
TGCheckButton * fAutoUpdate
virtual ~TASPaletteEditor()
Palette editor destructor. Deletes all frames and their layout hints.
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.
Bool_t ProcessMessage(Longptr_t msg, Longptr_t param1, Longptr_t param2)
Process all editor mouse events.
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:205
virtual void SetLabelFont(Style_t font=62)
Set labels' font.
Definition TAttAxis.cxx:183
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
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition TAttLine.h:43
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition TAttLine.h:40
virtual void Modify()
Change current line attributes if necessary.
Definition TAttLine.cxx:245
void Update() override
Update canvas pad buffers.
Definition TCanvas.cxx:2502
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
TObject * Get(const char *namecycle) override
Return pointer to object identified by namecycle.
Describe directory structure in memory.
Definition TDirectory.h:45
virtual Bool_t cd()
Change current directory to "this" directory.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition TFile.h:54
virtual Bool_t IsOpen() const
Returns kTRUE in case file is open and kFALSE if file is not open.
Definition TFile.cxx:1407
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition TGButton.cxx:445
virtual EButtonState GetState() const
Definition TGButton.h:112
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition TGButton.cxx:235
Selects different options.
Definition TGButton.h:264
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
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:1000
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
virtual void Layout()
Layout the elements of the composite frame.
Definition TGFrame.cxx:1257
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1164
TList * fList
container of frame elements
Definition TGFrame.h:292
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
virtual void MapWindow()
map window
Definition TGFrame.h:204
A composite frame with a border and a title.
Definition TGFrame.h:523
Defines top level windows that interact with the system Window Manager.
Definition TGFrame.h:398
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition TGFrame.cxx:1801
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
Definition TGFrame.cxx:1788
Selects different options.
Definition TGButton.h:322
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
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:618
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
Definition TH1.h:320
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:8375
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
Definition TH1.cxx:3351
TAxis * GetYaxis()
Definition TH1.h:321
virtual void Draw(Option_t *option="")
Draw this histogram with options.
Definition TH1.cxx:3074
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:66
virtual void SetX1(Double_t x1)
Definition TLine.h:65
Double_t GetX1() const
Definition TLine.h:50
virtual void Paint(Option_t *option="")
Paint this line with its current attributes.
Definition TLine.cxx:388
A doubly linked list.
Definition TList.h:38
virtual void Add(TObject *obj)
Definition TList.h:81
virtual TObject * After(const TObject *obj) const
Returns the object after object obj.
Definition TList.cxx:330
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Definition TList.cxx:822
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
Definition TList.cxx:693
virtual TObject * Before(const TObject *obj) const
Returns the object before object obj.
Definition TList.cxx:371
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition TList.cxx:659
Mother of all ROOT objects.
Definition TObject.h:41
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition TObject.cxx:267
void Modified(Bool_t flag=1) override
Definition TPad.h:413
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
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)
Definition TMath.h:677
Double_t Log(Double_t x)
Definition TMath.h:710
Short_t Abs(Short_t d)
Definition TMathBase.h:120