BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
BesPaveText Class Reference

#include <BesPaveText.h>

+ Inheritance diagram for BesPaveText:

Public Member Functions

 BesPaveText ()
 
 BesPaveText (Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t *option="br")
 
 BesPaveText (const BesPaveText &pavetext)
 
virtual void SetText (std::vector< TString > infoCon)
 
virtual void SetPos (Int_t px, Int_t py)
 

Protected Attributes

Double_t fTextSize
 
Double_t fdxNDC
 
Double_t fdyNDC
 

Detailed Description

Definition at line 11 of file BesPaveText.h.

Constructor & Destructor Documentation

◆ BesPaveText() [1/3]

BesPaveText::BesPaveText ( )

◆ BesPaveText() [2/3]

BesPaveText::BesPaveText ( Double_t  x1,
Double_t  y1,
Double_t  x2,
Double_t  y2,
Option_t *  option = "br" 
)

Definition at line 18 of file BesPaveText.cxx.

19 :TPaveText(x1,y1,x2,y2,option)
20{
21 SetFillColor(1001);
23 SetCornerRadius(0.2);
24
25 fTextSize = 0.025;
26}
Double_t fTextSize
Definition: BesPaveText.h:14
c1_1 SetBorderSize(2)
c1 SetFillColor(kWhite)

◆ BesPaveText() [3/3]

BesPaveText::BesPaveText ( const BesPaveText pavetext)

Definition at line 29 of file BesPaveText.cxx.

29 : TPaveText()
30{
31
32}

Member Function Documentation

◆ SetPos()

void BesPaveText::SetPos ( Int_t  px,
Int_t  py 
)
virtual

Definition at line 76 of file BesPaveText.cxx.

77{
78 if (!gPad) {
79 cout << "BesPaveText::SetPos, gPad does not exist" << endl;
80 return;
81 }
82
83 Double_t x = gPad->AbsPixeltoX(px+10);
84 Double_t y = gPad->AbsPixeltoY(py-10);
85 Double_t x1, y1, x2, y2, xNDC, yNDC;
86 gPad->GetRange(x1, y1, x2, y2);
87 xNDC = (x-x1)/(x2-x1);
88 yNDC = (y-y1)/(y2-y1);
89 //cout << xNDC << " " << yNDC << endl;
90
91 x1 = xNDC;
92 y1 = yNDC;
93 x2 = xNDC + fdxNDC;
94 y2 = yNDC + fdyNDC;
95
96 Double_t delta = 0.02;
97 if (x2 > 1.0 && y2 > 1.0) {
98 x1 -= (fdxNDC+delta);
99 x2 -= (fdxNDC+delta);
100 y1 -= (fdyNDC+delta);
101 y2 -= (fdyNDC+delta);
102 }
103 else if (x2 > 1.0) {
104 x1 -= fdxNDC;
105 x2 -= fdxNDC;
106 }
107 if (y2 > 1.0) {
108 y1 -= fdyNDC;
109 y2 -= fdyNDC;
110 }
111
112 SetX1NDC(x1);
113 SetY1NDC(y1);
114 SetX2NDC(x2);
115 SetY2NDC(y2);
116 ConvertNDCtoPad();
117}
Double_t x[10]
Double_t fdxNDC
Definition: BesPaveText.h:15
Double_t fdyNDC
Definition: BesPaveText.h:15

Referenced by BesGeoTrack::ExecuteEvent(), Emc2DCrystal::ExecuteEvent(), Mdc2DWire::ExecuteEvent(), Muc2DStrip::ExecuteEvent(), and Tof2DScin::ExecuteEvent().

◆ SetText()

void BesPaveText::SetText ( std::vector< TString >  infoCon)
virtual

Definition at line 35 of file BesPaveText.cxx.

36{
37 Int_t n = infoCon.size();
38 Double_t margin = GetMargin();
39 Double_t dy = (1.0-margin*2)/n;
40
41 Double_t coordx = 0.0;
42 Double_t coordy = 0.0;
43 for (Int_t i = 0; i < n; i++) {
44 coordy = 1.0 - (i+1)*dy;
45 if (n == 1) coordy = 1.0;
46
47 TText* tdata = AddText(coordx, coordy, infoCon[i].Data());
48 tdata->SetTextSize(fTextSize/1.2);
49 tdata->SetTextFont(42);
50 if (i == 0 && n > 4) {
51 tdata->SetTextSize(fTextSize);
52 tdata->SetTextFont(62);
53 }
54 tdata->SetTextColor(1);
55 tdata->SetTextAlign(12);
56
57 if (infoCon[i] == TString("Fired")) {
58 tdata->SetTextColor(kRed);
59 //tdata->SetTextSize(fTextSize);
60 tdata->SetTextFont(72);
61 }
62 }
63
64 fdxNDC = fTextSize * fLongest / 2.2;
65 fdyNDC = fTextSize * n * 1.2; //fLines->GetSize() * 1.2;
66
67 ConvertNDCtoPad();
68 // This is necessary, or when fTip was drawn the first time, it will in center, as its fX1 fX2 fY1 fY2 have not been changed.
69 SetX1NDC(0.0);
70 SetY1NDC(0.0);
71 SetX2NDC(fdxNDC);
72 SetY2NDC(fdyNDC);
73}
const Int_t n

Referenced by BesGeoTrack::CloseInfo(), Emc2DCrystal::CloseInfo(), Mdc2DWire::CloseInfo(), Muc2DStrip::CloseInfo(), and Tof2DScin::CloseInfo().

Member Data Documentation

◆ fdxNDC

Double_t BesPaveText::fdxNDC
protected

Definition at line 15 of file BesPaveText.h.

Referenced by SetPos(), and SetText().

◆ fdyNDC

Double_t BesPaveText::fdyNDC
protected

Definition at line 15 of file BesPaveText.h.

Referenced by SetPos(), and SetText().

◆ fTextSize

Double_t BesPaveText::fTextSize
protected

Definition at line 14 of file BesPaveText.h.

Referenced by BesPaveText(), and SetText().


The documentation for this class was generated from the following files: