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, x1, y1;
71 Double_t xc,yc,r1,r2,xold,yold;
72
73 switch (event) {
74
75 case kButton1Down:
76 x0 = gPad->AbsPixeltoX(px);
77 y0 = gPad->AbsPixeltoY(py);
78 xold = gPad->AbsPixeltoX(px);
79 yold = gPad->AbsPixeltoY(py);
80 break;
81
82 case kButton1Motion:
83 xold = gPad->AbsPixeltoX(px);
84 yold = gPad->AbsPixeltoY(py);
85
86 if (gPad->GetLogx()) xold = TMath::Power(10,xold);
87 if (gPad->GetLogy()) yold = TMath::Power(10,yold);
88
89 xc = 0.5*(x0+xold);
90 yc = 0.5*(y0+yold);
91 if (mode == kArc) {
92 r1 = 0.5*TMath::Abs(xold-x0);
93 if (fgArc) {
94 fgArc->SetR1(r1);
95 fgArc->SetR2(r1);
96 fgArc->SetX1(xc);
97 fgArc->SetY1(yc);
98 } else {
99 fgArc = new TArc(xc, yc, r1);
100 fgArc->Draw();
101 }
102 gPad->Modified(kTRUE);
103 gPad->Update();
104 }
105 if (mode == kEllipse) {
106 r1 = 0.5*TMath::Abs(xold-x0);
107 r2 = 0.5*TMath::Abs(yold-y0);
108 if (fgEllipse) {
109 fgEllipse->SetR1(r1);
110 fgEllipse->SetR2(r2);
111 fgEllipse->SetX1(xc);
112 fgEllipse->SetY1(yc);
113 } else {
114 fgEllipse = new TEllipse(xc, yc, r1, r2);
115 fgEllipse->Draw();
116 }
117 gPad->Modified(kTRUE);
118 gPad->Update();
119 }
120 break;
121
122 case kButton1Up:
123 x1 = gPad->AbsPixeltoX(px);
124 y1 = gPad->AbsPixeltoY(py);
125 if (gPad->GetLogx()) {
126 x0 = TMath::Power(10,x0);
127 x1 = TMath::Power(10,x1);
128 }
129 if (gPad->GetLogy()) {
130 y0 = TMath::Power(10,y0);
131 y1 = TMath::Power(10,y1);
132 }
133 xc = 0.5*(x0+x1);
134 yc = 0.5*(y0+y1);
135
136 if (mode == kArc) {
137 gPad->GetCanvas()->Selected(gPad, fgArc, kButton1Down);
138 fgArc = 0;
139 }
140 if (mode == kEllipse) {
141 gPad->GetCanvas()->Selected(gPad, fgEllipse, kButton1Down);
142 fgEllipse = 0;
143 }
144
145 gROOT->SetEditorMode();
146 break;
147 }
148}
149
150////////////////////////////////////////////////////////////////////////////////
151/// Create a new line/arrow in this gPad.
152///
153/// - Click left button to indicate arrow starting position.
154/// - Release left button to terminate the arrow.
155
157{
158 static Double_t x0, y0, x1, y1;
159
160 static Int_t pxold, pyold;
161 static Int_t px0, py0;
162 Double_t radius, phimin,phimax;
163
164 switch (event) {
165
166 case kButton1Down:
167 x0 = gPad->AbsPixeltoX(px);
168 y0 = gPad->AbsPixeltoY(py);
169 px0 = px; py0 = py;
170 pxold = px; pyold = py;
171 if (gPad->GetLogx()) x0 = TMath::Power(10,x0);
172 if (gPad->GetLogy()) y0 = TMath::Power(10,y0);
173 break;
174
175 case kButton1Motion:
176 pxold = px;
177 pyold = py;
178
179 x1 = gPad->AbsPixeltoX(pxold);
180 y1 = gPad->AbsPixeltoY(pyold);
181 if (gPad->GetLogx()) x1 = TMath::Power(10,x1);
182 if (gPad->GetLogy()) y1 = TMath::Power(10,y1);
183
184 if (mode == kLine) {
185 if (fgLine){
186 fgLine->SetX2(x1);
187 fgLine->SetY2(y1);
188 } else {
189 fgLine = new TLine(x0,y0,x1,y1);
190 fgLine->Draw();
191 }
192 gPad->Modified(kTRUE);
193 gPad->Update();
194 }
195
196 if (mode == kArrow) {
197 if (fgArrow){
198 fgArrow->SetX2(x1);
199 fgArrow->SetY2(y1);
200 } else {
201 fgArrow = new TArrow(x0,y0,x1,y1
204 fgArrow->Draw();
205 }
206 gPad->Modified(kTRUE);
207 gPad->Update();
208 }
209
210 if (mode == kCurlyLine) {
211 if (fgCLine) fgCLine->SetEndPoint(x1, y1);
212 else {
213 fgCLine = new TCurlyLine(x0,y0,x1,y1
216 fgCLine->Draw();
217 }
218 gPad->Modified(kTRUE);
219 gPad->Update();
220 }
221
222 if (mode == kCurlyArc) {
223 //calculate radius in pixels and convert to users x
224 radius = gPad->PixeltoX((Int_t)(TMath::Sqrt((Double_t)((px-px0)*(px-px0) + (py-py0)*(py-py0)))))
225 - gPad->PixeltoX(0);
226 if (fgCArc) {
227 fgCArc->SetStartPoint(x1, y1);
228 fgCArc->SetRadius(radius);
229 } else {
230 phimin = 0;
231 phimax = 360;
232 fgCArc = new TCurlyArc(x0,y0,radius,phimin,phimax
235 fgCArc->Draw();
236 }
237 gPad->Modified(kTRUE);
238 gPad->Update();
239 }
240 break;
241
242 case kButton1Up:
243 if (mode == kLine) {
244 gPad->GetCanvas()->Selected(gPad, fgLine, kButton1Down);
245 fgLine = 0;
246 }
247 if (mode == kArrow) {
248 gPad->GetCanvas()->Selected(gPad, fgArrow, kButton1Down);
249 fgArrow = 0;
250 }
251 if (mode == kCurlyLine) {
252 gPad->GetCanvas()->Selected(gPad, fgCLine, kButton1Down);
253 fgCLine = 0;
254 }
255 if (mode == kCurlyArc) {
256 gPad->GetCanvas()->Selected(gPad, fgCArc, kButton1Down);
257 fgCArc = 0;
258 }
259 gROOT->SetEditorMode();
260 break;
261 }
262}
263
264////////////////////////////////////////////////////////////////////////////////
265/// Create a new pad in gPad.
266///
267/// - Click left button to indicate one corner of the pad.
268/// - Click left button to indicate the opposite corner.
269///
270/// The new pad is inserted in the pad where the first point is selected.
271
273{
274 static Int_t px1old, py1old, px2old, py2old;
275 static Int_t px1, py1, px2, py2, pxl, pyl, pxt, pyt;
276 static TPad *padsav;
277 Double_t xlow, ylow, xup, yup;
278 TPad * newpad;
279
280 Int_t n = 0;
281 TObject *obj;
282 TIter next(gPad->GetListOfPrimitives());
283
284 while ((obj = next())) {
285 if (obj->InheritsFrom(TPad::Class())) {
286 n++;
287 }
288 }
289
290 switch (event) {
291
292 case kButton1Down:
293 padsav = (TPad*)gPad;
294 gPad->cd();
295 px1 = gPad->XtoAbsPixel(gPad->GetX1());
296 py1 = gPad->YtoAbsPixel(gPad->GetY1());
297 px2 = gPad->XtoAbsPixel(gPad->GetX2());
298 py2 = gPad->YtoAbsPixel(gPad->GetY2());
299 px1old = px; py1old = py;
300 break;
301
302 case kButton1Motion:
303 px2old = px;
304 px2old = TMath::Max(px2old, px1);
305 px2old = TMath::Min(px2old, px2);
306 py2old = py;
307 py2old = TMath::Max(py2old, py2);
308 py2old = TMath::Min(py2old, py1);
309 pxl = TMath::Min(px1old, px2old);
310 pxt = TMath::Max(px1old, px2old);
311 pyl = TMath::Max(py1old, py2old);
312 pyt = TMath::Min(py1old, py2old);
313
314 if (fgPadBBox) {
315 fgPadBBox->SetX1(gPad->AbsPixeltoX(pxl));
316 fgPadBBox->SetY1(gPad->AbsPixeltoY(pyl));
317 fgPadBBox->SetX2(gPad->AbsPixeltoX(pxt));
318 fgPadBBox->SetY2(gPad->AbsPixeltoY(pyt));
319 } else {
320 fgPadBBox = new TBox(pxl, pyl, pxt, pyt);
321 fgPadBBox->Draw("l");
322 }
323 gPad->Modified(kTRUE);
324 gPad->Update();
325 break;
326
327 case kButton1Up:
328 fgPadBBox->Delete();
329 fgPadBBox = 0;
330 xlow = (Double_t(pxl) - Double_t(px1))/(Double_t(px2) - Double_t(px1));
331 ylow = (Double_t(py1) - Double_t(pyl))/(Double_t(py1) - Double_t(py2));
332 xup = (Double_t(pxt) - Double_t(px1))/(Double_t(px2) - Double_t(px1));
333 yup = (Double_t(py1) - Double_t(pyt))/(Double_t(py1) - Double_t(py2));
334
335 gROOT->SetEditorMode();
336 if (xup <= xlow || yup <= ylow) return;
337 newpad = new TPad(Form("%s_%d",gPad->GetName(),n+1),"newpad",xlow, ylow, xup, yup);
338 if (newpad->IsZombie()) break;
339 newpad->SetFillColor(gStyle->GetPadColor());
340 newpad->Draw();
341 TCanvas *canvas = gPad->GetCanvas();
342 if (canvas) canvas->Selected((TPad*)gPad, newpad, kButton1Down);
343 padsav->cd();
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 = 0;
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 = 0;
536 }
537 if (mode == kPaveText ) {
538 gPad->GetCanvas()->Selected(gPad, fgPaveText, kButton1Down);
539 fgPaveText = 0;
540 }
541 if (mode == kPavesText) {
542 gPad->GetCanvas()->Selected(gPad, fgPavesText, kButton1Down);
543 fgPavesText = 0;
544 }
545 if (mode == kDiamond) {
546 gPad->GetCanvas()->Selected(gPad, fgDiamond, kButton1Down);
547 fgDiamond = 0;
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 = 0;
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 = 0;
632 npoints = 0;
633 gPad->Modified();
634 gPad->Update();
635 gROOT->SetEditorMode();
636 }
637 fgPolyLine = 0;
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 = 0;
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
static const double x1[5]
double Double_t
Definition RtypesCore.h:59
const Bool_t kTRUE
Definition RtypesCore.h:91
#define gROOT
Definition TROOT.h:406
char * Form(const char *fmt,...)
R__EXTERN TStyle * gStyle
Definition TStyle.h:412
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:1641
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:2284
@ kClipFrame
clip to the frame boundary
Definition TGraph.h:70
Int_t GetN() const
Definition TGraph.h:124
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:2219
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:1607
To draw Mathematical Formula.
Definition TLatex.h:18
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:180
virtual const char * GetTitle() const
Returns title of object.
Definition TNamed.h:48
Mother of all ROOT objects.
Definition TObject.h:37
R__ALWAYS_INLINE Bool_t IsZombie() const
Definition TObject.h:149
virtual void Delete(Option_t *option="")
Delete this object.
Definition TObject.cxx:171
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:445
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition TObject.cxx:197
void ResetBit(UInt_t f)
Definition TObject.h:186
The most important graphics class in the ROOT system.
Definition TPad.h:26
TCanvas * GetCanvas() const override
Definition TPad.h:256
TVirtualPad * cd(Int_t subpadnumber=0) override
Set Current pad.
Definition TPad.cxx:603
void Draw(Option_t *option="") override
Draw Pad in Current pad (re-parent pad if necessary).
Definition TPad.cxx:1299
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:36
virtual void Draw(Option_t *option="")
Draw this pavelabel with its current attributes.
virtual void SetLabel(const char *label)
Definition TPaveLabel.h:41
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:417
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:212
Double_t Sqrt(Double_t x)
Definition TMath.h:691
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Definition TMath.h:735
Short_t Min(Short_t a, Short_t b)
Definition TMathBase.h:180
Short_t Abs(Short_t d)
Definition TMathBase.h:120
auto * l
Definition textangle.C:4