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