Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TCreatePrimitives.cxx
Go to the documentation of this file.
1// @(#)root/gpad:$Id: TCreatePrimitives.cxx,v 1.0
2
3/*************************************************************************
4 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11/** \class TCreatePrimitives
12\ingroup gpad
13
14Creates new primitives.
15
16The functions in this static class are called by TPad::ExecuteEvent
17to create new primitives in gPad from the TPad toolbar.
18*/
19
20#include "TCanvas.h"
21#include "TStyle.h"
22#include "TGraph.h"
23#include "TMarker.h"
24#include "TGroupButton.h"
25#include "TVirtualPad.h"
26#include "TCreatePrimitives.h"
27#include "TROOT.h"
28#include "TSystem.h"
29#include "TMath.h"
30#include "KeySymbols.h"
31#include "TCutG.h"
32
47
48////////////////////////////////////////////////////////////////////////////////
49/// TCreatePrimitives default constructor.
50
52{
53}
54
55////////////////////////////////////////////////////////////////////////////////
56/// TCreatePrimitives destructor.
57
59{
60}
61
62////////////////////////////////////////////////////////////////////////////////
63/// Create a new arc/ellipse in this gPad.
64///
65/// - Click left button to indicate arrow starting position.
66/// - Release left button to terminate the arrow.
67
69{
70 static Double_t x0, y0;
71 Double_t x1,y1,xc,yc,r1,r2,xold,yold;
72
73 switch (event) {
74
75 case kButton1Down:
76 x0 = gPad->AbsPixeltoX(px);
77 if (gPad->GetLogx())
78 x0 = TMath::Power(10,x0);
79 y0 = gPad->AbsPixeltoY(py);
80 if (gPad->GetLogy())
81 y0 = TMath::Power(10,y0);
82 break;
83
84 case kButton1Motion:
85 xold = gPad->AbsPixeltoX(px);
86 yold = gPad->AbsPixeltoY(py);
87
88 if (gPad->GetLogx())
89 xold = TMath::Power(10,xold);
90 if (gPad->GetLogy())
91 yold = TMath::Power(10,yold);
92
93 xc = 0.5*(x0+xold);
94 yc = 0.5*(y0+yold);
95 if (mode == kArc) {
96 r1 = 0.5*TMath::Abs(xold-x0);
97 if (fgArc) {
98 fgArc->SetR1(r1);
99 fgArc->SetR2(r1);
100 fgArc->SetX1(xc);
101 fgArc->SetY1(yc);
102 } else {
103 fgArc = new TArc(xc, yc, r1);
104 fgArc->Draw();
105 }
106 gPad->Modified(kTRUE);
107 gPad->Update();
108 }
109 if (mode == kEllipse) {
110 r1 = 0.5*TMath::Abs(xold-x0);
111 r2 = 0.5*TMath::Abs(yold-y0);
112 if (fgEllipse) {
113 fgEllipse->SetR1(r1);
114 fgEllipse->SetR2(r2);
115 fgEllipse->SetX1(xc);
116 fgEllipse->SetY1(yc);
117 } else {
118 fgEllipse = new TEllipse(xc, yc, r1, r2);
119 fgEllipse->Draw();
120 }
121 gPad->Modified(kTRUE);
122 gPad->Update();
123 }
124 break;
125
126 case kButton1Up:
127 x1 = gPad->AbsPixeltoX(px);
128 y1 = gPad->AbsPixeltoY(py);
129 if (gPad->GetLogx())
130 x1 = TMath::Power(10,x1);
131 if (gPad->GetLogy())
132 y1 = TMath::Power(10,y1);
133
134 if (mode == kArc) {
135 gPad->GetCanvas()->Selected(gPad, fgArc, kButton1Down);
136 fgArc = nullptr;
137 }
138 if (mode == kEllipse) {
139 gPad->GetCanvas()->Selected(gPad, fgEllipse, kButton1Down);
140 fgEllipse = nullptr;
141 }
142
143 gROOT->SetEditorMode();
144 break;
145 }
146}
147
148////////////////////////////////////////////////////////////////////////////////
149/// Create a new line/arrow in this gPad.
150///
151/// - Click left button to indicate arrow starting position.
152/// - Release left button to terminate the arrow.
153
155{
156 static Double_t x0, y0, x1, y1;
157
158 static Int_t pxold, pyold;
159 static Int_t px0, py0;
160 Double_t radius, phimin,phimax;
161
162 switch (event) {
163
164 case kButton1Down:
165 x0 = gPad->AbsPixeltoX(px);
166 y0 = gPad->AbsPixeltoY(py);
167 px0 = px; py0 = py;
168 pxold = px; pyold = py;
169 if (gPad->GetLogx()) x0 = TMath::Power(10,x0);
170 if (gPad->GetLogy()) y0 = TMath::Power(10,y0);
171 break;
172
173 case kButton1Motion:
174 pxold = px;
175 pyold = py;
176
177 x1 = gPad->AbsPixeltoX(pxold);
178 y1 = gPad->AbsPixeltoY(pyold);
179 if (gPad->GetLogx()) x1 = TMath::Power(10,x1);
180 if (gPad->GetLogy()) y1 = TMath::Power(10,y1);
181
182 if (mode == kLine) {
183 if (fgLine){
184 fgLine->SetX2(x1);
185 fgLine->SetY2(y1);
186 } else {
187 fgLine = new TLine(x0,y0,x1,y1);
188 fgLine->Draw();
189 }
190 gPad->Modified(kTRUE);
191 gPad->Update();
192 }
193
194 if (mode == kArrow) {
195 if (fgArrow){
196 fgArrow->SetX2(x1);
197 fgArrow->SetY2(y1);
198 } else {
199 fgArrow = new TArrow(x0,y0,x1,y1
202 fgArrow->Draw();
203 }
204 gPad->Modified(kTRUE);
205 gPad->Update();
206 }
207
208 if (mode == kCurlyLine) {
209 if (fgCLine) fgCLine->SetEndPoint(x1, y1);
210 else {
211 fgCLine = new TCurlyLine(x0,y0,x1,y1
214 fgCLine->Draw();
215 }
216 gPad->Modified(kTRUE);
217 gPad->Update();
218 }
219
220 if (mode == kCurlyArc) {
221 //calculate radius in pixels and convert to users x
222 radius = gPad->PixeltoX((Int_t)(TMath::Sqrt((Double_t)((px-px0)*(px-px0) + (py-py0)*(py-py0)))))
223 - gPad->PixeltoX(0);
224 if (fgCArc) {
225 fgCArc->SetStartPoint(x1, y1);
226 fgCArc->SetRadius(radius);
227 } else {
228 phimin = 0;
229 phimax = 360;
230 fgCArc = new TCurlyArc(x0,y0,radius,phimin,phimax
233 fgCArc->Draw();
234 }
235 gPad->Modified(kTRUE);
236 gPad->Update();
237 }
238 break;
239
240 case kButton1Up:
241 if (mode == kLine) {
242 gPad->GetCanvas()->Selected(gPad, fgLine, kButton1Down);
243 fgLine = 0;
244 }
245 if (mode == kArrow) {
246 gPad->GetCanvas()->Selected(gPad, fgArrow, kButton1Down);
247 fgArrow = 0;
248 }
249 if (mode == kCurlyLine) {
250 gPad->GetCanvas()->Selected(gPad, fgCLine, kButton1Down);
251 fgCLine = 0;
252 }
253 if (mode == kCurlyArc) {
254 gPad->GetCanvas()->Selected(gPad, fgCArc, kButton1Down);
255 fgCArc = 0;
256 }
257 gROOT->SetEditorMode();
258 break;
259 }
260}
261
262////////////////////////////////////////////////////////////////////////////////
263/// Create a new pad in gPad.
264///
265/// - Click left button to indicate one corner of the pad.
266/// - Click left button to indicate the opposite corner.
267///
268/// The new pad is inserted in the pad where the first point is selected.
269
271{
272 static Int_t px1old, py1old, px2old, py2old;
273 static Int_t px1, py1, px2, py2, pxl, pyl, pxt, pyt;
274 static TPad *padsav = nullptr;
275 Double_t xlow, ylow, xup, yup;
276 TPad * newpad;
277
278 Int_t n = 0;
279 TObject *obj;
280 TIter next(gPad->GetListOfPrimitives());
281
282 while ((obj = next())) {
283 if (obj->InheritsFrom(TPad::Class())) {
284 n++;
285 }
286 }
287
288 switch (event) {
289
290 case kButton1Down:
291 padsav = (TPad*)gPad;
292 gPad->cd();
293 px1 = gPad->XtoAbsPixel(gPad->GetX1());
294 py1 = gPad->YtoAbsPixel(gPad->GetY1());
295 px2 = gPad->XtoAbsPixel(gPad->GetX2());
296 py2 = gPad->YtoAbsPixel(gPad->GetY2());
297 px1old = px; py1old = py;
298 break;
299
300 case kButton1Motion:
301 px2old = px;
302 px2old = TMath::Max(px2old, px1);
303 px2old = TMath::Min(px2old, px2);
304 py2old = py;
305 py2old = TMath::Max(py2old, py2);
306 py2old = TMath::Min(py2old, py1);
307 pxl = TMath::Min(px1old, px2old);
308 pxt = TMath::Max(px1old, px2old);
309 pyl = TMath::Max(py1old, py2old);
310 pyt = TMath::Min(py1old, py2old);
311
312 if (fgPadBBox) {
313 fgPadBBox->SetX1(gPad->AbsPixeltoX(pxl));
314 fgPadBBox->SetY1(gPad->AbsPixeltoY(pyl));
315 fgPadBBox->SetX2(gPad->AbsPixeltoX(pxt));
316 fgPadBBox->SetY2(gPad->AbsPixeltoY(pyt));
317 } else {
318 fgPadBBox = new TBox(pxl, pyl, pxt, pyt);
319 fgPadBBox->Draw("l");
320 }
321 gPad->Modified(kTRUE);
322 gPad->Update();
323 break;
324
325 case kButton1Up:
326 fgPadBBox->Delete();
327 fgPadBBox = 0;
328 xlow = (Double_t(pxl) - Double_t(px1))/(Double_t(px2) - Double_t(px1));
329 ylow = (Double_t(py1) - Double_t(pyl))/(Double_t(py1) - Double_t(py2));
330 xup = (Double_t(pxt) - Double_t(px1))/(Double_t(px2) - Double_t(px1));
331 yup = (Double_t(py1) - Double_t(pyt))/(Double_t(py1) - Double_t(py2));
332
333 gROOT->SetEditorMode();
334 if (xup <= xlow || yup <= ylow) return;
335 newpad = new TPad(Form("%s_%d",gPad->GetName(),n+1),"newpad",xlow, ylow, xup, yup);
336 if (newpad->IsZombie()) break;
337 newpad->SetFillColor(gStyle->GetPadColor());
338 newpad->Draw();
339 TCanvas *canvas = gPad->GetCanvas();
340 if (canvas) canvas->Selected((TPad*)gPad, newpad, kButton1Down);
341 if (padsav) {
342 padsav->cd();
343 padsav = nullptr;
344 }
345 break;
346 }
347}
348
349////////////////////////////////////////////////////////////////////////////////
350/// Create a new pavetext in gPad.
351///
352/// - Click left button to indicate one corner of the pavelabel.
353/// - Release left button at the opposite corner.
354
356{
357 static Double_t x0, y0;
358 Double_t xp0,xp1,yp0,yp1,xold,yold;
359
360 if (mode == kPaveLabel)
361 ((TPad *)gPad)->EventPave();
362
363 switch (event) {
364
365 case kKeyPress:
366 if (mode == kPaveLabel) {
367 if ((py == kKey_Return) || (py == kKey_Enter)) {
369 Int_t l = s.Length();
370 s.Remove(l-1);
373 gPad->Modified(kTRUE);
374 gROOT->SetEditorMode();
375 gPad->Update();
376 fgPaveLabel = 0;
377 } else if (py == kKey_Backspace) {
379 Int_t l = s.Length();
380 if (l>1) {
381 s.Replace(l-2, 2, "<");
383 gPad->Modified(kTRUE);
384 gPad->Update();
385 }
386 } else if (isprint(py)) {
388 Int_t l = s.Length();
389 s.Insert(l-1,(char)py);
391 gPad->Modified(kTRUE);
392 gPad->Update();
393 }
394 }
395 break;
396
397 case kButton1Down:
398 x0 = gPad->AbsPixeltoX(px);
399 y0 = gPad->AbsPixeltoY(py);
400 break;
401
402 case kButton1Motion:
403 xold = gPad->AbsPixeltoX(px);
404 yold = gPad->AbsPixeltoY(py);
405
406 xp0 = gPad->PadtoX(x0);
407 xp1 = gPad->PadtoX(xold);
408 yp0 = gPad->PadtoY(y0);
409 yp1 = gPad->PadtoY(yold);
410
411 if (mode == kPave) {
412 if (fgPave) {
413 if (xold < x0) {
414 fgPave->SetX1(xold);
415 fgPave->SetX2(x0);
416 } else {
417 fgPave->SetX1(x0);
418 fgPave->SetX2(xold);
419 }
420 if (yold < y0) {
421 fgPave->SetY1(yold);
422 fgPave->SetY2(y0);
423 } else {
424 fgPave->SetY1(y0);
425 fgPave->SetY2(yold);
426 }
427 } else {
428 fgPave = new TPave(xp0,yp0,xp1,yp1);
429 fgPave->Draw();
430 }
431 gPad->Modified(kTRUE);
432 gPad->Update();
433 }
434
435 if (mode == kPaveText ) {
436 if (fgPaveText){
437 if (xold < x0) {
438 fgPaveText->SetX1(xold);
439 fgPaveText->SetX2(x0);
440 } else {
441 fgPaveText->SetX1(x0);
442 fgPaveText->SetX2(xold);
443 }
444 if (yold < y0) {
445 fgPaveText->SetY1(yold);
446 fgPaveText->SetY2(y0);
447 } else {
448 fgPaveText->SetY1(y0);
449 fgPaveText->SetY2(yold);
450 }
451 } else {
452 fgPaveText = new TPaveText(xp0,yp0,xp1,yp1);
453 fgPaveText->Draw();
454 }
455 gPad->Modified(kTRUE);
456 gPad->Update();
457 }
458
459 if (mode == kPavesText) {
460 if (fgPavesText){
461 if (xold < x0) {
462 fgPavesText->SetX1(xold);
463 fgPavesText->SetX2(x0);
464 } else {
465 fgPavesText->SetX1(x0);
466 fgPavesText->SetX2(xold);
467 }
468 if (yold < y0) {
469 fgPavesText->SetY1(yold);
470 fgPavesText->SetY2(y0);
471 } else {
472 fgPavesText->SetY1(y0);
473 fgPavesText->SetY2(yold);
474 }
475 } else {
476 fgPavesText = new TPavesText(xp0,yp0,xp1,yp1);
477 fgPavesText->Draw();
478 }
479 gPad->Modified(kTRUE);
480 gPad->Update();
481 }
482
483 if (mode == kPaveLabel) {
484 if (fgPaveLabel){
485 if (xold < x0) {
486 fgPaveLabel->SetX1(xold);
487 fgPaveLabel->SetX2(x0);
488 } else {
489 fgPaveLabel->SetX1(x0);
490 fgPaveLabel->SetX2(xold);
491 }
492 if (yold < y0) {
493 fgPaveLabel->SetY1(yold);
494 fgPaveLabel->SetY2(y0);
495 } else {
496 fgPaveLabel->SetY1(y0);
497 fgPaveLabel->SetY2(yold);
498 }
499 } else {
500 fgPaveLabel = new TPaveLabel(xp0,yp0,xp1,yp1,">");
501 fgPaveLabel->Draw();
502 }
503 gPad->Modified(kTRUE);
504 gPad->Update();
505 }
506
507 if (mode == kDiamond) {
508 if (fgDiamond){
509 if (xold < x0) {
510 fgDiamond->SetX1(xold);
511 fgDiamond->SetX2(x0);
512 } else {
513 fgDiamond->SetX1(x0);
514 fgDiamond->SetX2(xold);
515 }
516 if (yold < y0) {
517 fgDiamond->SetY1(yold);
518 fgDiamond->SetY2(y0);
519 } else {
520 fgDiamond->SetY1(y0);
521 fgDiamond->SetY2(yold);
522 }
523 } else {
524 fgDiamond = new TDiamond(x0,y0,xold,yold);
525 fgDiamond->Draw();
526 }
527 gPad->Modified(kTRUE);
528 gPad->Update();
529 }
530 break;
531
532 case kButton1Up:
533 gPad->GetCanvas()->Selected(gPad, fgPave, kButton1Down);
534 if (mode == kPave) {
535 gPad->GetCanvas()->Selected(gPad, fgPave, kButton1Down);
536 fgPave = 0;
537 }
538 if (mode == kPaveText ) {
539 gPad->GetCanvas()->Selected(gPad, fgPaveText, kButton1Down);
540 fgPaveText = 0;
541 }
542 if (mode == kPavesText) {
543 gPad->GetCanvas()->Selected(gPad, fgPavesText, kButton1Down);
544 fgPavesText = 0;
545 }
546 if (mode == kDiamond) {
547 gPad->GetCanvas()->Selected(gPad, fgDiamond, kButton1Down);
548 fgDiamond = 0;
549 }
550 if (mode == kPaveLabel) {
551 gPad->GetCanvas()->Selected(gPad, fgPaveLabel, kButton1Down);
552 ((TPad *)gPad)->StartEditing();
554 if (mode == kPaveLabel) {
555 gPad->Modified(kTRUE);
556 gPad->Update();
557 break;
558 }
559 }
560 gROOT->SetEditorMode();
561 break;
562 }
563}
564
565////////////////////////////////////////////////////////////////////////////////
566/// Create a new PolyLine in gPad.
567///
568/// - Click left button to indicate a new point.
569/// - Click left button at same place or double click to close the polyline.
570
572{
573 static Int_t pxnew, pynew, pxold, pyold, dp;
574 Double_t xnew, ynew, xold, yold;
575 static Int_t npoints = 0;
576
577 switch (event) {
578
579 case kButton1Down:
580 pxnew = px;
581 pynew = py;
582 npoints++;
583 if (fgPolyLine) {
585 fgPolyLine->SetPoint(npoints, gPad->PadtoX(gPad->AbsPixeltoX(pxnew)),
586 gPad->PadtoY(gPad->AbsPixeltoY(pynew)));
587 // stop collecting new points if new point is close to previous point
588 if (npoints > 1) {
589 xnew = gPad->PadtoX(gPad->AbsPixeltoX(pxnew));
590 ynew = gPad->PadtoY(gPad->AbsPixeltoY(pynew));
591 fgPolyLine->GetPoint(fgPolyLine->GetN()-3, xold, yold);
592 pxold = gPad->XtoAbsPixel(xold);
593 pyold = gPad->YtoAbsPixel(yold);
594 dp = TMath::Abs(pxnew-pxold) +TMath::Abs(pynew-pyold);
595 if (dp < 7) {
596 if (mode == kPolyLine) {
597 fgPolyLine->Set(npoints-1);
598 } else {
599 fgPolyLine->GetPoint(0, xnew, ynew);
600 fgPolyLine->SetPoint(npoints, xnew, ynew);
601 }
602 gPad->GetCanvas()->Selected(gPad, fgPolyLine, kButton1Down);
603 fgPolyLine = 0;
604 npoints = 0;
605 gPad->Modified();
606 gPad->Update();
607 gROOT->SetEditorMode();
608 }
609 }
610 } else {
611 if (mode == kPolyLine) {
612 fgPolyLine = new TGraph(1);
614 } else { // TCutG case
615 fgPolyLine = (TGraph*) new TCutG("CUTG",1);
616 }
617 fgPolyLine->SetPoint(0, gPad->PadtoX(gPad->AbsPixeltoX(pxnew)),
618 gPad->PadtoY(gPad->AbsPixeltoY(pynew)));
619 fgPolyLine->Draw("L");
620 }
621 break;
622
623 case kButton1Double:
624 if (fgPolyLine) {
625 if (mode == kPolyLine) {
626 fgPolyLine->Set(npoints);
627 } else {
628 fgPolyLine->GetPoint(0, xnew, ynew);
629 fgPolyLine->SetPoint(npoints, xnew, ynew);
630 }
631 gPad->GetCanvas()->Selected(gPad, fgPolyLine, kButton1Down);
632 fgPolyLine = 0;
633 npoints = 0;
634 gPad->Modified();
635 gPad->Update();
636 gROOT->SetEditorMode();
637 }
638 fgPolyLine = 0;
639 break;
640
641 case kMouseMotion:
642 pxnew = px;
643 pynew = py;
644 if (fgPolyLine) {
645 fgPolyLine->SetPoint(npoints, gPad->PadtoX(gPad->AbsPixeltoX(pxnew)),
646 gPad->PadtoY(gPad->AbsPixeltoY(pynew)));
647 gPad->Modified();
648 gPad->Update();
649
650 }
651 break;
652 }
653}
654
655////////////////////////////////////////////////////////////////////////////////
656/// Create a new TLatex at the cursor position in gPad.
657///
658/// - Click left button to indicate the text position.
659
661{
662 static Double_t x, y;
663
664 switch (event) {
665
666 case kKeyPress:
667 if ((py == kKey_Return) || (py == kKey_Enter)) {
668 TString s(fgText->GetTitle());
669 Int_t l = s.Length();
670 s.Remove(l-1);
671 fgText->SetText(x,y,s.Data());
673 gPad->Modified(kTRUE);
674 gROOT->SetEditorMode();
675 gPad->Update();
676 gPad->GetCanvas()->Selected(gPad, fgText, kButton1Down);
677 fgText = 0;
678 } else if (py == kKey_Backspace) {
679 TString s(fgText->GetTitle());
680 Int_t l = s.Length();
681 if (l>1) {
682 s.Replace(l-2, 2, "<");
683 fgText->SetText(x,y,s.Data());
684 gPad->Modified(kTRUE);
685 gPad->Update();
686 }
687 } else if (isprint(py)) {
688 TString s(fgText->GetTitle());
689 Int_t l = s.Length();
690 s.Insert(l-1,(char)py);
691 fgText->SetText(x,y,s.Data());
692 gPad->Modified(kTRUE);
693 gPad->Update();
694 }
695 break;
696
697 case kButton1Down:
698 if (fgText) {
699 TString s(fgText->GetTitle());
700 Int_t l = s.Length();
701 s.Remove(l-1);
702 fgText->SetText(x,y,s.Data());
703 }
704
705 x = gPad->AbsPixeltoX(px);
706 y = gPad->AbsPixeltoY(py);
707 if (gPad->GetLogx()) x = TMath::Power(10,x);
708 if (gPad->GetLogy()) y = TMath::Power(10,y);
709
710 if (mode == kMarker) {
711 TMarker *marker;
712 marker = new TMarker(x,y,28);
713 gPad->GetCanvas()->Selected(gPad, marker, kButton1Down);
714 marker->Draw();
715 gROOT->SetEditorMode();
716 break;
717 }
718
719 ((TPad *)gPad)->StartEditing();
721
722 fgText = new TLatex(x,y,"<");
723 fgText->Draw();
724 gPad->Modified(kTRUE);
725 gPad->Update();
726 break;
727 }
728}
@ kMouseMotion
Definition Buttons.h:23
@ kKeyPress
Definition Buttons.h:20
@ kButton1Double
Definition Buttons.h:24
@ kButton1Motion
Definition Buttons.h:20
@ kButton1Up
Definition Buttons.h:19
@ kButton1Down
Definition Buttons.h:17
@ kMarker
Definition Buttons.h:34
@ kCurlyArc
Definition Buttons.h:38
@ kPolyLine
Definition Buttons.h:28
@ kDiamond
Definition Buttons.h:37
@ kPave
Definition Buttons.h:31
@ kArrow
Definition Buttons.h:33
@ kPaveText
Definition Buttons.h:32
@ kLine
Definition Buttons.h:33
@ kPavesText
Definition Buttons.h:32
@ kCurlyLine
Definition Buttons.h:38
@ kPaveLabel
Definition Buttons.h:31
@ kEllipse
Definition Buttons.h:32
@ kArc
Definition Buttons.h:33
@ kKey_Return
Definition KeySymbols.h:30
@ kKey_Backspace
Definition KeySymbols.h:29
@ kKey_Enter
Definition KeySymbols.h:31
static const double x1[5]
double Double_t
Definition RtypesCore.h:59
const Bool_t kTRUE
Definition RtypesCore.h:100
#define gROOT
Definition TROOT.h:404
char * Form(const char *fmt,...)
R__EXTERN TStyle * gStyle
Definition TStyle.h:413
R__EXTERN TSystem * gSystem
Definition TSystem.h:559
#define gPad
Create an Arc.
Definition TArc.h:26
Draw all kinds of Arrows.
Definition TArrow.h:29
static Option_t * GetDefaultOption()
Get default option.
Definition TArrow.cxx:427
virtual void Draw(Option_t *option="")
Draw this arrow with its current attributes.
Definition TArrow.cxx:120
static Float_t GetDefaultArrowSize()
Get default arrow size.
Definition TArrow.cxx:417
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition TAttFill.h:37
Create a Box.
Definition TBox.h:22
virtual void SetY2(Double_t y2)
Definition TBox.h:64
virtual void SetX1(Double_t x1)
Definition TBox.h:61
virtual void Draw(Option_t *option="")
Draw this box with its current attributes.
Definition TBox.cxx:195
virtual void SetX2(Double_t x2)
Definition TBox.h:62
virtual void SetY1(Double_t y1)
Definition TBox.h:63
The Canvas class.
Definition TCanvas.h:23
virtual void Selected(TVirtualPad *pad, TObject *obj, Int_t event)
Emit Selected() signal.
Definition TCanvas.cxx:1639
static void Pave(Int_t event, Int_t px, Int_t py, Int_t mode)
Create a new pavetext in gPad.
static TPavesText * fgPavesText
static TPave * fgPave
static TLatex * fgText
static TCurlyLine * fgCLine
static TArrow * fgArrow
static void Line(Int_t event, Int_t px, Int_t py, Int_t mode)
Create a new line/arrow in this gPad.
static TEllipse * fgEllipse
static void PolyLine(Int_t event, Int_t px, Int_t py, Int_t mode)
Create a new PolyLine in gPad.
static void Text(Int_t event, Int_t px, Int_t py, Int_t mode)
Create a new TLatex at the cursor position in gPad.
virtual ~TCreatePrimitives()
TCreatePrimitives destructor.
static void Ellipse(Int_t event, Int_t px, Int_t py, Int_t mode)
Create a new arc/ellipse in this gPad.
static TBox * fgPadBBox
static TCurlyArc * fgCArc
static TGraph * fgPolyLine
static TPaveText * fgPaveText
static TPaveLabel * fgPaveLabel
static TLine * fgLine
TCreatePrimitives()
TCreatePrimitives default constructor.
static void Pad(Int_t event, Int_t px, Int_t py, Int_t)
Create a new pad in gPad.
static TDiamond * fgDiamond
Implements curly or wavy arcs used to draw Feynman diagrams.
Definition TCurlyArc.h:18
virtual void SetRadius(Double_t radius)
Set Curly Arc radius.
static Double_t GetDefaultWaveLength()
Get default wave length.
static Double_t GetDefaultAmplitude()
Get default wave amplitude.
Implements curly or wavy polylines used to draw Feynman diagrams.
Definition TCurlyLine.h:19
virtual void SetStartPoint(Double_t x1, Double_t y1)
Set start point.
static Double_t GetDefaultWaveLength()
Get default wave length.
static Double_t GetDefaultAmplitude()
Get default amplitude.
virtual void SetEndPoint(Double_t x2, Double_t y2)
Set end point.
Graphical cut class.
Definition TCutG.h:20
Draw a Diamond.
Definition TDiamond.h:17
virtual void Draw(Option_t *option="")
Draw this diamond with its current attributes.
Definition TDiamond.cxx:93
Draw Ellipses.
Definition TEllipse.h:23
virtual void SetR1(Double_t r1)
Definition TEllipse.h:64
virtual void SetX1(Double_t x1)
Definition TEllipse.h:67
virtual void Draw(Option_t *option="")
Draw this ellipse with its current attributes.
Definition TEllipse.cxx:168
virtual void SetY1(Double_t y1)
Definition TEllipse.h:68
virtual void SetR2(Double_t r2)
Definition TEllipse.h:65
A TGraph is an object made of two arrays X and Y with npoints each.
Definition TGraph.h:41
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
Definition TGraph.cxx:2298
@ kClipFrame
Clip to the frame boundary.
Definition TGraph.h:71
Int_t GetN() const
Definition TGraph.h:125
virtual void Draw(Option_t *chopt="")
Draw this graph with its current attributes.
Definition TGraph.cxx:769
virtual void Set(Int_t n)
Set number of points in the graph Existing coordinates are preserved New coordinates above fNpoints a...
Definition TGraph.cxx:2233
virtual Int_t GetPoint(Int_t i, Double_t &x, Double_t &y) const
Get x and y values for point number i.
Definition TGraph.cxx:1601
To draw Mathematical Formula.
Definition TLatex.h:18
Use the TLine constructor to create a simple line.
Definition TLine.h:22
virtual void SetY2(Double_t y2)
Definition TLine.h:68
virtual void SetX2(Double_t x2)
Definition TLine.h:66
Manages Markers.
Definition TMarker.h:22
virtual void Draw(Option_t *option="")
Draw this marker with its current attributes.
Definition TMarker.cxx:198
virtual const char * GetTitle() const
Returns title of object.
Definition TNamed.h:48
Mother of all ROOT objects.
Definition TObject.h:41
R__ALWAYS_INLINE Bool_t IsZombie() const
Definition TObject.h:153
virtual void Delete(Option_t *option="")
Delete this object.
Definition TObject.cxx:241
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:515
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition TObject.cxx:267
void ResetBit(UInt_t f)
Definition TObject.h:200
The most important graphics class in the ROOT system.
Definition TPad.h:26
virtual void EventPave()
Definition TPad.h:405
TCanvas * GetCanvas() const override
Definition TPad.h:256
TVirtualPad * cd(Int_t subpadnumber=0) override
Set Current pad.
Definition TPad.cxx:604
void Draw(Option_t *option="") override
Draw Pad in Current pad (re-parent pad if necessary).
Definition TPad.cxx:1300
A Pave (see TPave) with a text centered in the Pave.
Definition TPaveLabel.h:20
const char * GetTitle() const
Returns title of object.
Definition TPaveLabel.h:43
virtual void Draw(Option_t *option="")
Draw this pavelabel with its current attributes.
virtual void SetLabel(const char *label)
Definition TPaveLabel.h:48
A Pave (see TPave) with text, lines or/and boxes inside.
Definition TPaveText.h:21
virtual void Draw(Option_t *option="")
Draw this pavetext with its current attributes.
A TBox with a bordersize and a shadow option.
Definition TPave.h:19
virtual void SetX2(Double_t x2)
Set the X2 value.
Definition TPave.cxx:664
virtual void SetY2(Double_t y2)
Set the Y2 value.
Definition TPave.cxx:690
virtual void Draw(Option_t *option="")
Draw this pave with its current attributes.
Definition TPave.cxx:228
virtual void SetX1(Double_t x1)
Set the X1 value.
Definition TPave.cxx:651
virtual void SetY1(Double_t y1)
Set the Y1 value.
Definition TPave.cxx:677
A PaveText (see TPaveText) with several stacked paves.
Definition TPavesText.h:18
virtual void Draw(Option_t *option="")
Draw this pavestext with its current attributes.
virtual void Draw(Option_t *option="")
Draw this polyline with its current attributes.
Basic string class.
Definition TString.h:136
Ssiz_t Length() const
Definition TString.h:410
TString & Insert(Ssiz_t pos, const char *s)
Definition TString.h:649
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
Definition TString.h:682
const char * Data() const
Definition TString.h:369
TString & Remove(Ssiz_t pos)
Definition TString.h:673
Color_t GetPadColor() const
Definition TStyle.h:199
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Definition TSystem.cxx:419
virtual void SetText(Double_t x, Double_t y, const char *text)
Definition TText.h:74
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
Short_t Max(Short_t a, Short_t b)
Definition TMathBase.h:208
Double_t Sqrt(Double_t x)
Definition TMath.h:641
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Definition TMath.h:685
Short_t Min(Short_t a, Short_t b)
Definition TMathBase.h:176
Short_t Abs(Short_t d)
Definition TMathBase.h:120
auto * l
Definition textangle.C:4