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) {
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) {
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 = nullptr;
244 }
245 if (mode == kArrow) {
246 gPad->GetCanvas()->Selected(gPad, fgArrow, kButton1Down);
247 fgArrow = nullptr;
248 }
249 if (mode == kCurlyLine) {
250 gPad->GetCanvas()->Selected(gPad, fgCLine, kButton1Down);
251 fgCLine = nullptr;
252 }
253 if (mode == kCurlyArc) {
254 gPad->GetCanvas()->Selected(gPad, fgCArc, kButton1Down);
255 fgCArc = nullptr;
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 TVirtualPad *padsav = nullptr;
275 Double_t xlow, ylow, xup, yup;
276
277 Int_t n = 0;
278 TObject *obj;
279 TIter next(gPad->GetListOfPrimitives());
280
281 while ((obj = next())) {
282 if (obj->InheritsFrom(TPad::Class())) {
283 n++;
284 }
285 }
286
287 switch (event) {
288
289 case kButton1Down:
290 padsav = gPad;
291 gPad->cd();
292 px1 = gPad->XtoAbsPixel(gPad->GetX1());
293 py1 = gPad->YtoAbsPixel(gPad->GetY1());
294 px2 = gPad->XtoAbsPixel(gPad->GetX2());
295 py2 = gPad->YtoAbsPixel(gPad->GetY2());
296 px1old = px; py1old = py;
297 break;
298
299 case kButton1Motion:
300 px2old = px;
301 px2old = TMath::Max(px2old, px1);
302 px2old = TMath::Min(px2old, px2);
303 py2old = py;
304 py2old = TMath::Max(py2old, py2);
305 py2old = TMath::Min(py2old, py1);
306 pxl = TMath::Min(px1old, px2old);
307 pxt = TMath::Max(px1old, px2old);
308 pyl = TMath::Max(py1old, py2old);
309 pyt = TMath::Min(py1old, py2old);
310
311 if (fgPadBBox) {
312 fgPadBBox->SetX1(gPad->AbsPixeltoX(pxl));
313 fgPadBBox->SetY1(gPad->AbsPixeltoY(pyl));
314 fgPadBBox->SetX2(gPad->AbsPixeltoX(pxt));
315 fgPadBBox->SetY2(gPad->AbsPixeltoY(pyt));
316 } else {
317 fgPadBBox = new TBox(pxl, pyl, pxt, pyt);
318 fgPadBBox->Draw("l");
319 }
320 gPad->Modified(kTRUE);
321 gPad->Update();
322 break;
323
324 case kButton1Up:
325 fgPadBBox->Delete();
326 fgPadBBox = nullptr;
327 xlow = (Double_t(pxl) - Double_t(px1))/(Double_t(px2) - Double_t(px1));
328 ylow = (Double_t(py1) - Double_t(pyl))/(Double_t(py1) - Double_t(py2));
329 xup = (Double_t(pxt) - Double_t(px1))/(Double_t(px2) - Double_t(px1));
330 yup = (Double_t(py1) - Double_t(pyt))/(Double_t(py1) - Double_t(py2));
331
332 gROOT->SetEditorMode();
333 if (xup <= xlow || yup <= ylow) return;
334 auto newpad = new TPad(TString::Format("%s_%d",gPad->GetName(),n+1).Data(),"newpad",xlow, ylow, xup, yup);
335 if (newpad->IsZombie()) break;
336 newpad->SetFillColor(gStyle->GetPadColor());
337 newpad->Draw();
338 auto canvas = gPad->GetCanvas();
339 if (canvas) canvas->Selected((TPad*)gPad, newpad, kButton1Down);
340 if (padsav) {
341 padsav->cd();
342 padsav = nullptr;
343 }
344 break;
345 }
346}
347
348////////////////////////////////////////////////////////////////////////////////
349/// Create a new pavetext in gPad.
350///
351/// - Click left button to indicate one corner of the pavelabel.
352/// - Release left button at the opposite corner.
353
355{
356 static Double_t x0, y0;
357 Double_t xp0,xp1,yp0,yp1,xold,yold;
358
359 if (mode == kPaveLabel)
360 ((TPad *)gPad)->EventPave();
361
362 switch (event) {
363
364 case kKeyPress:
365 if (mode == kPaveLabel) {
366 if ((py == kKey_Return) || (py == kKey_Enter)) {
368 Int_t l = s.Length();
369 s.Remove(l-1);
372 gPad->Modified(kTRUE);
373 gROOT->SetEditorMode();
374 gPad->Update();
375 fgPaveLabel = nullptr;
376 } else if (py == kKey_Backspace) {
378 Int_t l = s.Length();
379 if (l>1) {
380 s.Replace(l-2, 2, "<");
382 gPad->Modified(kTRUE);
383 gPad->Update();
384 }
385 } else if (isprint(py)) {
387 Int_t l = s.Length();
388 s.Insert(l-1,(char)py);
390 gPad->Modified(kTRUE);
391 gPad->Update();
392 }
393 }
394 break;
395
396 case kButton1Down:
397 x0 = gPad->AbsPixeltoX(px);
398 y0 = gPad->AbsPixeltoY(py);
399 break;
400
401 case kButton1Motion:
402 xold = gPad->AbsPixeltoX(px);
403 yold = gPad->AbsPixeltoY(py);
404
405 xp0 = gPad->PadtoX(x0);
406 xp1 = gPad->PadtoX(xold);
407 yp0 = gPad->PadtoY(y0);
408 yp1 = gPad->PadtoY(yold);
409
410 if (mode == kPave) {
411 if (fgPave) {
412 if (xold < x0) {
413 fgPave->SetX1(xold);
414 fgPave->SetX2(x0);
415 } else {
416 fgPave->SetX1(x0);
417 fgPave->SetX2(xold);
418 }
419 if (yold < y0) {
420 fgPave->SetY1(yold);
421 fgPave->SetY2(y0);
422 } else {
423 fgPave->SetY1(y0);
424 fgPave->SetY2(yold);
425 }
426 } else {
427 fgPave = new TPave(xp0,yp0,xp1,yp1);
428 fgPave->Draw();
429 }
430 gPad->Modified(kTRUE);
431 gPad->Update();
432 }
433
434 if (mode == kPaveText ) {
435 if (fgPaveText){
436 if (xold < x0) {
437 fgPaveText->SetX1(xold);
438 fgPaveText->SetX2(x0);
439 } else {
440 fgPaveText->SetX1(x0);
441 fgPaveText->SetX2(xold);
442 }
443 if (yold < y0) {
444 fgPaveText->SetY1(yold);
445 fgPaveText->SetY2(y0);
446 } else {
447 fgPaveText->SetY1(y0);
448 fgPaveText->SetY2(yold);
449 }
450 } else {
451 fgPaveText = new TPaveText(xp0,yp0,xp1,yp1);
452 fgPaveText->Draw();
453 }
454 gPad->Modified(kTRUE);
455 gPad->Update();
456 }
457
458 if (mode == kPavesText) {
459 if (fgPavesText){
460 if (xold < x0) {
461 fgPavesText->SetX1(xold);
462 fgPavesText->SetX2(x0);
463 } else {
464 fgPavesText->SetX1(x0);
465 fgPavesText->SetX2(xold);
466 }
467 if (yold < y0) {
468 fgPavesText->SetY1(yold);
469 fgPavesText->SetY2(y0);
470 } else {
471 fgPavesText->SetY1(y0);
472 fgPavesText->SetY2(yold);
473 }
474 } else {
475 fgPavesText = new TPavesText(xp0,yp0,xp1,yp1);
476 fgPavesText->Draw();
477 }
478 gPad->Modified(kTRUE);
479 gPad->Update();
480 }
481
482 if (mode == kPaveLabel) {
483 if (fgPaveLabel){
484 if (xold < x0) {
485 fgPaveLabel->SetX1(xold);
486 fgPaveLabel->SetX2(x0);
487 } else {
488 fgPaveLabel->SetX1(x0);
489 fgPaveLabel->SetX2(xold);
490 }
491 if (yold < y0) {
492 fgPaveLabel->SetY1(yold);
493 fgPaveLabel->SetY2(y0);
494 } else {
495 fgPaveLabel->SetY1(y0);
496 fgPaveLabel->SetY2(yold);
497 }
498 } else {
499 fgPaveLabel = new TPaveLabel(xp0,yp0,xp1,yp1,">");
500 fgPaveLabel->Draw();
501 }
502 gPad->Modified(kTRUE);
503 gPad->Update();
504 }
505
506 if (mode == kDiamond) {
507 if (fgDiamond){
508 if (xold < x0) {
509 fgDiamond->SetX1(xold);
510 fgDiamond->SetX2(x0);
511 } else {
512 fgDiamond->SetX1(x0);
513 fgDiamond->SetX2(xold);
514 }
515 if (yold < y0) {
516 fgDiamond->SetY1(yold);
517 fgDiamond->SetY2(y0);
518 } else {
519 fgDiamond->SetY1(y0);
520 fgDiamond->SetY2(yold);
521 }
522 } else {
523 fgDiamond = new TDiamond(x0,y0,xold,yold);
524 fgDiamond->Draw();
525 }
526 gPad->Modified(kTRUE);
527 gPad->Update();
528 }
529 break;
530
531 case kButton1Up:
532 gPad->GetCanvas()->Selected(gPad, fgPave, kButton1Down);
533 if (mode == kPave) {
534 gPad->GetCanvas()->Selected(gPad, fgPave, kButton1Down);
535 fgPave = nullptr;
536 }
537 if (mode == kPaveText ) {
538 gPad->GetCanvas()->Selected(gPad, fgPaveText, kButton1Down);
539 fgPaveText = nullptr;
540 }
541 if (mode == kPavesText) {
542 gPad->GetCanvas()->Selected(gPad, fgPavesText, kButton1Down);
543 fgPavesText = nullptr;
544 }
545 if (mode == kDiamond) {
546 gPad->GetCanvas()->Selected(gPad, fgDiamond, kButton1Down);
547 fgDiamond = nullptr;
548 }
549 if (mode == kPaveLabel) {
550 gPad->GetCanvas()->Selected(gPad, fgPaveLabel, kButton1Down);
551 ((TPad *)gPad)->StartEditing();
553 if (mode == kPaveLabel) {
554 gPad->Modified(kTRUE);
555 gPad->Update();
556 break;
557 }
558 }
559 gROOT->SetEditorMode();
560 break;
561 }
562}
563
564////////////////////////////////////////////////////////////////////////////////
565/// Create a new PolyLine in gPad.
566///
567/// - Click left button to indicate a new point.
568/// - Click left button at same place or double click to close the polyline.
569
571{
572 static Int_t pxnew, pynew, pxold, pyold, dp;
573 Double_t xnew, ynew, xold, yold;
574 static Int_t npoints = 0;
575
576 switch (event) {
577
578 case kButton1Down:
579 pxnew = px;
580 pynew = py;
581 npoints++;
582 if (fgPolyLine) {
584 fgPolyLine->SetPoint(npoints, gPad->PadtoX(gPad->AbsPixeltoX(pxnew)),
585 gPad->PadtoY(gPad->AbsPixeltoY(pynew)));
586 // stop collecting new points if new point is close to previous point
587 if (npoints > 1) {
588 xnew = gPad->PadtoX(gPad->AbsPixeltoX(pxnew));
589 ynew = gPad->PadtoY(gPad->AbsPixeltoY(pynew));
590 fgPolyLine->GetPoint(fgPolyLine->GetN()-3, xold, yold);
591 pxold = gPad->XtoAbsPixel(xold);
592 pyold = gPad->YtoAbsPixel(yold);
593 dp = TMath::Abs(pxnew-pxold) +TMath::Abs(pynew-pyold);
594 if (dp < 7) {
595 if (mode == kPolyLine) {
596 fgPolyLine->Set(npoints-1);
597 } else {
598 fgPolyLine->GetPoint(0, xnew, ynew);
599 fgPolyLine->SetPoint(npoints, xnew, ynew);
600 }
601 gPad->GetCanvas()->Selected(gPad, fgPolyLine, kButton1Down);
602 fgPolyLine = nullptr;
603 npoints = 0;
604 gPad->Modified();
605 gPad->Update();
606 gROOT->SetEditorMode();
607 }
608 }
609 } else {
610 if (mode == kPolyLine) {
611 fgPolyLine = new TGraph(1);
613 } else { // TCutG case
614 fgPolyLine = (TGraph*) new TCutG("CUTG",1);
615 }
616 fgPolyLine->SetPoint(0, gPad->PadtoX(gPad->AbsPixeltoX(pxnew)),
617 gPad->PadtoY(gPad->AbsPixeltoY(pynew)));
618 fgPolyLine->Draw("L");
619 }
620 break;
621
622 case kButton1Double:
623 if (fgPolyLine) {
624 if (mode == kPolyLine) {
625 fgPolyLine->Set(npoints);
626 } else {
627 fgPolyLine->GetPoint(0, xnew, ynew);
628 fgPolyLine->SetPoint(npoints, xnew, ynew);
629 }
630 gPad->GetCanvas()->Selected(gPad, fgPolyLine, kButton1Down);
631 fgPolyLine = nullptr;
632 npoints = 0;
633 gPad->Modified();
634 gPad->Update();
635 gROOT->SetEditorMode();
636 }
637 fgPolyLine = nullptr;
638 break;
639
640 case kMouseMotion:
641 pxnew = px;
642 pynew = py;
643 if (fgPolyLine) {
644 fgPolyLine->SetPoint(npoints, gPad->PadtoX(gPad->AbsPixeltoX(pxnew)),
645 gPad->PadtoY(gPad->AbsPixeltoY(pynew)));
646 gPad->Modified();
647 gPad->Update();
648
649 }
650 break;
651 }
652}
653
654////////////////////////////////////////////////////////////////////////////////
655/// Create a new TLatex at the cursor position in gPad.
656///
657/// - Click left button to indicate the text position.
658
660{
661 static Double_t x, y;
662
663 switch (event) {
664
665 case kKeyPress:
666 if ((py == kKey_Return) || (py == kKey_Enter)) {
667 TString s(fgText->GetTitle());
668 Int_t l = s.Length();
669 s.Remove(l-1);
670 fgText->SetText(x,y,s.Data());
672 gPad->Modified(kTRUE);
673 gROOT->SetEditorMode();
674 gPad->Update();
675 gPad->GetCanvas()->Selected(gPad, fgText, kButton1Down);
676 fgText = nullptr;
677 } else if (py == kKey_Backspace) {
678 TString s(fgText->GetTitle());
679 Int_t l = s.Length();
680 if (l>1) {
681 s.Replace(l-2, 2, "<");
682 fgText->SetText(x,y,s.Data());
683 gPad->Modified(kTRUE);
684 gPad->Update();
685 }
686 } else if (isprint(py)) {
687 TString s(fgText->GetTitle());
688 Int_t l = s.Length();
689 s.Insert(l-1,(char)py);
690 fgText->SetText(x,y,s.Data());
691 gPad->Modified(kTRUE);
692 gPad->Update();
693 }
694 break;
695
696 case kButton1Down:
697 if (fgText) {
698 TString s(fgText->GetTitle());
699 Int_t l = s.Length();
700 s.Remove(l-1);
701 fgText->SetText(x,y,s.Data());
702 }
703
704 x = gPad->AbsPixeltoX(px);
705 y = gPad->AbsPixeltoY(py);
706 if (gPad->GetLogx()) x = TMath::Power(10,x);
707 if (gPad->GetLogy()) y = TMath::Power(10,y);
708
709 if (mode == kMarker) {
710 TMarker *marker;
711 marker = new TMarker(x,y,28);
712 gPad->GetCanvas()->Selected(gPad, marker, kButton1Down);
713 marker->Draw();
714 gROOT->SetEditorMode();
715 break;
716 }
717
718 ((TPad *)gPad)->StartEditing();
720
721 fgText = new TLatex(x,y,"<");
722 fgText->Draw();
723 gPad->Modified(kTRUE);
724 gPad->Update();
725 break;
726 }
727}
@ 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
double Double_t
Definition RtypesCore.h:59
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char y1
#define gROOT
Definition TROOT.h:406
R__EXTERN TStyle * gStyle
Definition TStyle.h:436
R__EXTERN TSystem * gSystem
Definition TSystem.h:561
#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:441
void Draw(Option_t *option="") override
Draw this arrow with its current attributes.
Definition TArrow.cxx:120
static Float_t GetDefaultArrowSize()
Get default arrow size.
Definition TArrow.cxx:431
Create a Box.
Definition TBox.h:22
void Draw(Option_t *option="") override
Draw this box with its current attributes.
Definition TBox.cxx:196
virtual void SetY2(Double_t y2)
Definition TBox.h:65
virtual void SetX1(Double_t x1)
Definition TBox.h:62
virtual void SetX2(Double_t x2)
Definition TBox.h:63
virtual void SetY1(Double_t y1)
Definition TBox.h:64
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:16
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
void Draw(Option_t *option="") override
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:65
virtual void SetX1(Double_t x1)
Definition TEllipse.h:68
void Draw(Option_t *option="") override
Draw this ellipse with its current attributes.
Definition TEllipse.cxx:169
virtual void SetY1(Double_t y1)
Definition TEllipse.h:69
virtual void SetR2(Double_t r2)
Definition TEllipse.h:66
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:2342
@ kClipFrame
Clip to the frame boundary.
Definition TGraph.h:76
Int_t GetN() const
Definition TGraph.h:132
void Draw(Option_t *chopt="") override
Draw this graph with its current attributes.
Definition TGraph.cxx:831
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:2277
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:1533
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
void Draw(Option_t *option="") override
Draw this marker with its current attributes.
Definition TMarker.cxx:199
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:48
Mother of all ROOT objects.
Definition TObject.h:41
virtual void Delete(Option_t *option="")
Delete this object.
Definition TObject.cxx:254
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:530
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition TObject.cxx:280
void ResetBit(UInt_t f)
Definition TObject.h:198
The most important graphics class in the ROOT system.
Definition TPad.h:28
static TClass * Class()
A Pave (see TPave) with a text centered in the Pave.
Definition TPaveLabel.h:20
virtual void SetLabel(const char *label)
Definition TPaveLabel.h:42
void Draw(Option_t *option="") override
Draw this pavelabel with its current attributes.
const char * GetTitle() const override
Returns title of object.
Definition TPaveLabel.h:37
A Pave (see TPave) with text, lines or/and boxes inside.
Definition TPaveText.h:21
void Draw(Option_t *option="") override
Draw this pavetext with its current attributes.
A TBox with a bordersize and a shadow option.
Definition TPave.h:19
void SetX2(Double_t x2) override
Set the X2 value.
Definition TPave.cxx:666
void Draw(Option_t *option="") override
Draw this pave with its current attributes.
Definition TPave.cxx:229
void SetX1(Double_t x1) override
Set the X1 value.
Definition TPave.cxx:653
void SetY1(Double_t y1) override
Set the Y1 value.
Definition TPave.cxx:679
void SetY2(Double_t y2) override
Set the Y2 value.
Definition TPave.cxx:692
A PaveText (see TPaveText) with several stacked paves.
Definition TPavesText.h:18
void Draw(Option_t *option="") override
Draw this pavestext with its current attributes.
void Draw(Option_t *option="") override
Draw this polyline with its current attributes.
Basic string class.
Definition TString.h:139
Ssiz_t Length() const
Definition TString.h:417
TString & Insert(Ssiz_t pos, const char *s)
Definition TString.h:661
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
Definition TString.h:694
const char * Data() const
Definition TString.h:376
TString & Remove(Ssiz_t pos)
Definition TString.h:685
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2378
Color_t GetPadColor() const
Definition TStyle.h:208
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Definition TSystem.cxx:416
virtual void SetText(Double_t x, Double_t y, const char *text)
Definition TText.h:74
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
virtual TVirtualPad * cd(Int_t subpadnumber=0)=0
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)
Returns the largest of a and b.
Definition TMathBase.h:250
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition TMath.h:662
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.
Definition TMath.h:721
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Definition TMathBase.h:198
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:123
TLine l
Definition textangle.C:4