BOSS 7.1.1
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(9001);
23 SetCornerRadius(0.2);
24
25 fTextSize = 0.025;
26}
gStyle SetFillColor(0)
text SetBorderSize(0)
Double_t fTextSize
Definition BesPaveText.h:14

◆ 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 86 of file BesPaveText.cxx.

87{
88 if (!gPad) {
89 cout << "BesPaveText::SetPos, gPad does not exist" << endl;
90 return;
91 }
92
93 Double_t x = gPad->AbsPixeltoX(px+10);
94 Double_t y = gPad->AbsPixeltoY(py-10);
95 Double_t x1, y1, x2, y2, xNDC, yNDC;
96 gPad->GetRange(x1, y1, x2, y2);
97 xNDC = (x-x1)/(x2-x1);
98 yNDC = (y-y1)/(y2-y1);
99 //cout << xNDC << " " << yNDC << endl;
100
101 x1 = xNDC;
102 y1 = yNDC;
103 x2 = xNDC + fdxNDC;
104 y2 = yNDC + fdyNDC;
105
106 Double_t delta = 0.02;
107 if (x2 > 1.0 && y2 > 1.0) {
108 x1 -= (fdxNDC+delta);
109 x2 -= (fdxNDC+delta);
110 y1 -= (fdyNDC+delta);
111 y2 -= (fdyNDC+delta);
112 }
113 else if (x2 > 1.0) {
114 x1 -= fdxNDC;
115 x2 -= fdxNDC;
116 }
117 if (y2 > 1.0) {
118 y1 -= fdyNDC;
119 y2 -= fdyNDC;
120 }
121
122 SetX1NDC(x1);
123 SetY1NDC(y1);
124 SetX2NDC(x2);
125 SetY2NDC(y2);
126 ConvertNDCtoPad();
127}
const double delta
Double_t x[10]
Double_t fdxNDC
Definition BesPaveText.h:15
Double_t fdyNDC
Definition BesPaveText.h:15
double y[1000]

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 //Long Peixun's update: If the number of lines is 2, add an empty line to avoid text out of box.
42 if (n == 2) dy = (1.0 - margin * 2) / 3;
43
44 Double_t coordx = 0.0;
45 Double_t coordy = 0.0;
46 for (Int_t i = 0; i < n; i++) {
47 coordy = 1.0 - (i + 1) * dy;
48 if (n == 1) coordy = 1.0;
49
50 TText* tdata = AddText(coordx, coordy, infoCon[i].Data());
51 tdata->SetTextSize(fTextSize/1.2);
52 tdata->SetTextFont(42);
53 if (i == 0 && n > 4) {
54 tdata->SetTextSize(fTextSize);
55 tdata->SetTextFont(62);
56 }
57 tdata->SetTextColor(1);
58 tdata->SetTextAlign(12);
59
60 if (infoCon[i] == TString("Fired")) {
61 tdata->SetTextColor(kRed);
62 //tdata->SetTextSize(fTextSize);
63 tdata->SetTextFont(72);
64 }
65 }
66 //Long Peixun's update: If the number of lines is 2, add an empty line to avoid text out of box.
67 if (infoCon.size() == 2)
68 {
69 coordy = 1.0 - 3 * dy;
70 TText* tdata = AddText(0.0, coordy, "");
71 ++n;
72 }
73
74 fdxNDC = fTextSize * fLongest / 2.2;
75 fdyNDC = fTextSize * n * 1.2; //fLines->GetSize() * 1.2;
76
77 ConvertNDCtoPad();
78 // 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.
79 SetX1NDC(0.0);
80 SetY1NDC(0.0);
81 SetX2NDC(fdxNDC);
82 SetY2NDC(fdyNDC);
83}
const Int_t n
text AddText("Boss 6.5.1")

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: