HwPCLabel.cxx
Go to the documentation of this file.
2 #include <iostream>
3 #include "TH1.h"
4 #include "TLine.h"
5 #include "TPaveText.h"
6 using namespace om;
7 
8 static const int gsNplPERdb = 64;
9 static const int gsNclPERmod = 32;
10 
12  fNdiblock(0),
13  fNmod(0)
14 {
15  fTextTop1 = new TPaveText(0.1, 0.905, 0.2, 0.925, "NDC");
16  fTextTop2 = new TPaveText(0.3, 0.905, 0.7, 0.925, "NDC");
17  fTextTop3 = new TPaveText(0.8, 0.905, 0.9, 0.925, "NDC");
18 
19  fTextSide1 = new TPaveText(0.04, 0.1, 0.08, 0.2, "NDC");
20  fTextSide2 = new TPaveText(0.04, 0.46, 0.08, 0.49, "NDC");
21  fTextSide3 = new TPaveText(0.04, 0.51, 0.08, 0.54, "NDC");
22  fTextSide4 = new TPaveText(0.04, 0.8, 0.08, 0.9, "NDC");
23 }
24 
25 //......................................................................
26 
27 void HwPCLabel::Config(const TH1* h, bool isXview)
28 {
29  fNdiblock = h->GetNbinsX()/gsNplPERdb;
30  fNmod = h->GetNbinsY()/gsNclPERmod;
31  this->Clear();
32  if(isXview) {
33  this->MakeLabelsX();
34  this->MakeHorizontalLinesX();
35  this->MakeVerticalLinesX();
36  }
37  else {
38  this->MakeLabelsY();
39  this->MakeHorizontalLinesY();
40  this->MakeVerticalLinesY();
41  }
42 }
43 
44 //......................................................................
45 
47 {
48  std::list<TLine*>::const_iterator line(fLine.begin());
49  std::list<TLine*>::const_iterator lineend(fLine.end());
50  for (; line!=lineend; ++line) delete *line;
51  fLine.clear();
52 
53  fTextTop1->Clear();
54  fTextTop2->Clear();
55  fTextTop3->Clear();
56  fTextSide1->Clear();
57  fTextSide2->Clear();
58  fTextSide3->Clear();
59  fTextSide4->Clear();
60 }
61 
62 //......................................................................
63 
65 {
66  this->Clear();
67  if(fTextTop1) { delete fTextTop1; fTextTop1 = 0; }
68  if(fTextTop2) { delete fTextTop2; fTextTop2 = 0; }
69  if(fTextTop3) { delete fTextTop3; fTextTop3 = 0; }
70  if(fTextSide1) { delete fTextSide1; fTextSide1 = 0; }
71  if(fTextSide2) { delete fTextSide2; fTextSide2 = 0; }
72  if(fTextSide3) { delete fTextSide3; fTextSide3 = 0; }
73  if(fTextSide4) { delete fTextSide4; fTextSide4 = 0; }
74 }
75 
76 //......................................................................
77 
79 {
80  std::list<TLine*>::const_iterator line(fLine.begin());
81  std::list<TLine*>::const_iterator lineend(fLine.end());
82  for (; line!=lineend; ++line) (*line)->Draw();
83 
84  fTextTop1->Draw();
85  fTextTop2->Draw();
86  fTextTop3->Draw();
87  fTextSide1->Draw();
88  fTextSide2->Draw();
89  fTextSide3->Draw();
90  fTextSide4->Draw();
91 }
92 
93 //......................................................................
94 
96 {
97  int i;
98  TLine* l;
99  for (i = 0; i <= fNmod; ++i) {
100  l = new TLine(0.5, -1*i*gsNclPERmod+0.5,
101  -1*fNdiblock*gsNplPERdb+0.5, -1*i*gsNclPERmod+0.5);
102  if(i ==0 || i == fNmod) l->SetLineWidth(3);
103  else { l->SetLineStyle(2); l->SetLineWidth(1); }
104  l->SetLineColor(kBlack);
105  l->SetBit(kCannotPick);
106  fLine.push_back(l);
107  }
108 }
109 
110 //......................................................................
111 
113 {
114  int i;
115  TLine* l;
116  for (i = 0; i <= fNmod; ++i) {
117  l = new TLine(0.5, i*gsNclPERmod-0.5,
118  -1*fNdiblock*gsNplPERdb+0.5, i*gsNclPERmod-0.5);
119  if(i ==0 || i == fNmod) l->SetLineWidth(3);
120  else { l->SetLineStyle(2); l->SetLineWidth(1); }
121  l->SetLineColor(kBlack);
122  l->SetBit(kCannotPick);
123  fLine.push_back(l);
124  }
125 }
126 
127 //......................................................................
128 
130 {
131  int i;
132  TLine* l;
133  for (i = 0; i <= fNdiblock; ++i) {
134  l = new TLine(-1*i*gsNplPERdb+0.5, 0.5,
135  -1*i*gsNplPERdb+0.5, -1*fNmod*gsNclPERmod+0.5);
136  l->SetLineWidth(3);
137  l->SetLineColor(kBlack);
138  l->SetBit(kCannotPick);
139  fLine.push_back(l);
140  }
141 }
142 
143 //......................................................................
144 
146 {
147  int i;
148  TLine* l;
149  for (i = 0; i <= fNdiblock; ++i) {
150  l = new TLine(-1*i*gsNplPERdb+0.5, -0.5,
151  -1*i*gsNplPERdb+0.5, fNmod*gsNclPERmod-0.5);
152  l->SetLineWidth(3);
153  l->SetLineColor(kBlack);
154  l->SetBit(kCannotPick);
155  fLine.push_back(l);
156  }
157 }
158 
159 //......................................................................
160 
162 {
163  fTextTop1->AddText("#leftarrow North");
164  fTextTop1->SetLineColor(0);
165  fTextTop1->SetFillColor(0);
166  fTextTop1->SetBorderSize(1);
167  fTextTop1->SetMargin(0.0);
168  fTextTop1->SetTextAlign(21);
169  fTextTop1->SetTextSize(0.03);
170  fTextTop1->SetBit(kCannotPick);
171 
172  fTextTop2->AddText("Planes / Diblocks");
173  fTextTop2->SetLineColor(0);
174  fTextTop2->SetFillColor(0);
175  fTextTop2->SetBorderSize(1);
176  fTextTop2->SetMargin(0.0);
177  fTextTop2->SetTextAlign(21);
178  fTextTop2->SetTextSize(0.03);
179  fTextTop2->SetBit(kCannotPick);
180 
181  fTextTop3->AddText("South #rightarrow");
182  fTextTop3->SetLineColor(0);
183  fTextTop3->SetFillColor(0);
184  fTextTop3->SetBorderSize(1);
185  fTextTop3->SetMargin(0.0);
186  fTextTop3->SetTextAlign(21);
187  fTextTop3->SetTextSize(0.03);
188  fTextTop3->SetBit(kCannotPick);
189 
190  fTextSide1->AddText("#downarrow West");
191  fTextSide1->SetLineColor(0);
192  fTextSide1->SetFillColor(0);
193  fTextSide1->SetBorderSize(1);
194  fTextSide1->SetMargin(0.0);
195  fTextSide1->SetTextAlign(21);
196  fTextSide1->SetTextSize(0.03);
197  fTextSide1->SetBit(kCannotPick);
198 
199  fTextSide2->AddText("Modules");
200  fTextSide2->SetLineColor(0);
201  fTextSide2->SetFillColor(0);
202  fTextSide2->SetBorderSize(1);
203  fTextSide2->SetMargin(0.0);
204  fTextSide2->SetTextAlign(21);
205  fTextSide2->SetTextSize(0.03);
206  fTextSide2->SetBit(kCannotPick);
207 
208  fTextSide3->AddText("Cells /");
209  fTextSide3->SetLineColor(0);
210  fTextSide3->SetFillColor(0);
211  fTextSide3->SetBorderSize(1);
212  fTextSide3->SetMargin(0.0);
213  fTextSide3->SetTextAlign(21);
214  fTextSide3->SetTextSize(0.03);
215  fTextSide3->SetBit(kCannotPick);
216 
217  fTextSide4->AddText("#uparrow East");
218  fTextSide4->SetLineColor(0);
219  fTextSide4->SetFillColor(0);
220  fTextSide4->SetBorderSize(1);
221  fTextSide4->SetMargin(0.0);
222  fTextSide4->SetTextAlign(21);
223  fTextSide4->SetTextSize(0.03);
224  fTextSide4->SetBit(kCannotPick);
225 }
226 
227 //......................................................................
228 
230 {
231  fTextTop1->AddText("#leftarrow North");
232  fTextTop1->SetLineColor(0);
233  fTextTop1->SetFillColor(0);
234  fTextTop1->SetBorderSize(1);
235  fTextTop1->SetMargin(0.0);
236  fTextTop1->SetTextAlign(21);
237  fTextTop1->SetTextSize(0.03);
238  fTextTop1->SetBit(kCannotPick);
239 
240  fTextTop2->AddText("Planes / Diblocks");
241  fTextTop2->SetLineColor(0);
242  fTextTop2->SetFillColor(0);
243  fTextTop2->SetBorderSize(1);
244  fTextTop2->SetMargin(0.0);
245  fTextTop2->SetTextAlign(21);
246  fTextTop2->SetTextSize(0.03);
247  fTextTop2->SetBit(kCannotPick);
248 
249  fTextTop3->AddText("South #rightarrow");
250  fTextTop3->SetLineColor(0);
251  fTextTop3->SetFillColor(0);
252  fTextTop3->SetBorderSize(1);
253  fTextTop3->SetMargin(0.0);
254  fTextTop3->SetTextAlign(21);
255  fTextTop3->SetTextSize(0.03);
256  fTextTop3->SetBit(kCannotPick);
257 
258  fTextSide1->AddText("#downarrow Bottom");
259  fTextSide1->SetLineColor(0);
260  fTextSide1->SetFillColor(0);
261  fTextSide1->SetBorderSize(1);
262  fTextSide1->SetMargin(0.0);
263  fTextSide1->SetTextAlign(21);
264  fTextSide1->SetTextSize(0.03);
265  fTextSide1->SetBit(kCannotPick);
266 
267  fTextSide2->AddText("Modules");
268  fTextSide2->SetLineColor(0);
269  fTextSide2->SetFillColor(0);
270  fTextSide2->SetBorderSize(1);
271  fTextSide2->SetMargin(0.0);
272  fTextSide2->SetTextAlign(21);
273  fTextSide2->SetTextSize(0.03);
274  fTextSide2->SetBit(kCannotPick);
275 
276  fTextSide3->AddText("Cells /");
277  fTextSide3->SetLineColor(0);
278  fTextSide3->SetFillColor(0);
279  fTextSide3->SetBorderSize(1);
280  fTextSide3->SetMargin(0.0);
281  fTextSide3->SetTextAlign(21);
282  fTextSide3->SetTextSize(0.03);
283  fTextSide3->SetBit(kCannotPick);
284 
285  fTextSide4->AddText("#uparrow Top");
286  fTextSide4->SetLineColor(0);
287  fTextSide4->SetFillColor(0);
288  fTextSide4->SetBorderSize(1);
289  fTextSide4->SetMargin(0.0);
290  fTextSide4->SetTextAlign(21);
291  fTextSide4->SetTextSize(0.03);
292  fTextSide4->SetBit(kCannotPick);
293 }
294 
295 //......................................................................
296 
297 void HwPCLabel::DrawNDOS(bool isXview)
298 {
299  // NDOS is an asymmetric little dude, that is different from the ND and FD
300  // so I have to handle drawing his lines as a special case...
301  //
302  // :(
303  //
304  // I decided that I'm just going to skip it for now...
305  //
306  // Take that NDOS!!! How's it feel to be different??!!!
307 
308 
309  // I guess I can draw the text labels though...
310  this->Clear();
311  if(isXview) this->MakeLabelsX();
312  else this->MakeLabelsY();
313 }
314 
315 ////////////////////////////////////////////////////////////////////////
TPaveText * fTextTop2
Text label for the top of the plot.
Definition: HwPCLabel.h:32
TPaveText * fTextSide4
Text label for the side of the plot.
Definition: HwPCLabel.h:37
void DrawNDOS(bool isXview)
Definition: HwPCLabel.cxx:297
TPaveText * fTextSide2
Text label for the side of the plot.
Definition: HwPCLabel.h:35
void MakeLabelsX()
Definition: HwPCLabel.cxx:161
TPaveText * fTextSide1
Text label for the side of the plot.
Definition: HwPCLabel.h:34
void Config(const TH1 *h, bool isXview)
Definition: HwPCLabel.cxx:27
TPaveText * fTextTop3
Text label for the top of the plot.
Definition: HwPCLabel.h:33
void MakeVerticalLinesY()
Definition: HwPCLabel.cxx:145
void MakeHorizontalLinesY()
Definition: HwPCLabel.cxx:112
void Clear()
Definition: HwPCLabel.cxx:46
TPaveText * fTextTop1
Text label for the top of the plot.
Definition: HwPCLabel.h:31
std::list< TLine * > fLine
Collection of line lables.
Definition: HwPCLabel.h:30
void MakeLabelsY()
Definition: HwPCLabel.cxx:229
void MakeVerticalLinesX()
Definition: HwPCLabel.cxx:129
static const int gsNclPERmod
Definition: HwPCLabel.cxx:9
TPaveText * fTextSide3
Text label for the side of the plot.
Definition: HwPCLabel.h:36
void MakeHorizontalLinesX()
Definition: HwPCLabel.cxx:95
static const int gsNplPERdb
Definition: HwPCLabel.cxx:8
Online Monitoring package header.