HwDCMLabel.cxx
Go to the documentation of this file.
2 #include <cstdio>
3 #include <iostream>
4 #include "TH1.h"
5 #include "TText.h"
6 #include "TLine.h"
7 using namespace om;
8 
9 static const unsigned int gsNfebx = 16;
10 static const unsigned int gsNfeby = 4;
11 static const unsigned int gsNpixelx = 4;
12 static const unsigned int gsNpixely = 8;
13 
15 
16 //......................................................................
17 
18 void HwDCMLabel::Config(const TH1* h)
19 {
20  this->Clear();
21  this->MakeFEBLabels();
22  this->MakeVerticalLines();
23  this->MakeHorizontalLines();
24  this->MakePixelKey();
25 }
26 
27 //......................................................................
28 
30 {
31  std::list<TText*>::const_iterator text (fText.begin());
32  std::list<TText*>::const_iterator textEnd(fText.end());
33  for (;text!=textEnd; ++text) delete *text;
34  fText.clear();
35 
36  std::list<TLine*>::const_iterator line (fLine.begin());
37  std::list<TLine*>::const_iterator lineEnd(fLine.end());
38  for (;line!=lineEnd; ++line) delete *line;
39  fLine.clear();
40 }
41 
42 //......................................................................
43 
45 
46 //......................................................................
47 
49 {
50  std::list<TText*>::const_iterator text (fText.begin());
51  std::list<TText*>::const_iterator textEnd(fText.end());
52  for (;text!=textEnd; ++text) (*text)->Draw();
53 
54  std::list<TLine*>::const_iterator line (fLine.begin());
55  std::list<TLine*>::const_iterator lineEnd(fLine.end());
56  for (;line!=lineEnd; ++line) (*line)->Draw();
57 }
58 
59 //......................................................................
60 
62 {
63  unsigned int i;
64  static const char* feblabel[gsNfeby] = {
65  "FEB 48 - 63",
66  "FEB 32 - 47",
67  "FEB 16 - 31",
68  "FEB 00 - 15"
69  };
70 
71  TText* t;
72  float x, y;
73  for (i=0; i<gsNfeby; ++i) {
74 
75  x = -0.01*gsNfebx*gsNpixelx;
76  y = ((float)i+0.95)*gsNpixely;
77 
78  t = new TText(x, y, feblabel[i]);
79 
80  t->SetTextSize(0.022);
81  t->SetTextAlign(32);
82  t->SetBit(kCannotPick);
83 
84  fText.push_back(t);
85  }
86 }
87 
88 //......................................................................
89 
91 {
92  unsigned int i;
93 
94  TLine* l;
95  for (i=0; i<=gsNfebx*gsNpixelx; ++i) {
96  l = new TLine(i, 0,
97  i, gsNfeby*gsNpixely);
98 
99  l->SetLineColor(kBlack);
100  if (i%4==0) l->SetLineWidth(3);
101  else l->SetLineWidth(1);
102 
103  l->SetBit(kCannotPick);
104 
105  fLine.push_back(l);
106  }
107 }
108 
109 //......................................................................
110 
112 {
113  unsigned int i;
114 
115  TLine* l;
116  for (i=0; i<=gsNfeby*gsNpixely; ++i) {
117  l = new TLine(0, i,
118  gsNfebx*gsNpixelx, i);
119  l->SetLineColor(kBlack);
120  if (i%8==0) l->SetLineWidth(3);
121  else l->SetLineWidth(1);
122 
123  l->SetBit(kCannotPick);
124 
125  fLine.push_back(l);
126  }
127 }
128 
129 //......................................................................
130 
132 {
133  unsigned int i;
134  TLine* l;
135  TText* t;
136 
137  float sf = 1.15;
138  float x0, y0; // Center of key
139  float xll, yll; // Lower left corner
140  float xur, yur; // Uppwer right corner
141 
142  x0 = -0.06*gsNfebx*gsNpixelx;
143  y0 = 0.04*gsNfeby*gsNpixely;
144 
145  xll = x0-sf*(gsNpixelx/2);
146  yll = y0-sf*(gsNpixely/2);
147 
148  xur = x0+sf*(gsNpixelx/2);
149  yur = y0+sf*(gsNpixely/2);
150 
151  for (i=0; i<=gsNpixelx; ++i) {
152  l = new TLine(xll+i*sf, yll, xll+i*sf, yur);
153  l->SetLineColor(kBlack);
154  if (i%4==0) l->SetLineWidth(2);
155  else l->SetLineWidth(1);
156  l->SetBit(kCannotPick);
157  fLine.push_back(l);
158  }
159 
160  for (i=0; i<=gsNpixely; ++i) {
161  l = new TLine(xll, yll+i*sf, xur, yll+i*sf);
162  l->SetLineColor(kBlack);
163  if (i%8==0) l->SetLineWidth(2);
164  else l->SetLineWidth(1);
165  l->SetBit(kCannotPick);
166  fLine.push_back(l);
167  }
168 
169  t = new TText(xll-1.1*sf,y0,"APD pixels");
170  t->SetTextSize(0.02);
171  t->SetTextAngle(90);
172  t->SetTextAlign(22);
173  t->SetBit(kCannotPick);
174  fText.push_back(t);
175 
176  static const char* pixel[32] = {
177  "30","31","28","29","26","27","24","25",
178  "22","23","20","21","18","19","17","16",
179  "09","08","11","10","13","12","14","15",
180  "01","00","03","02","05","04","07","06"
181  };
182  for (i=0; i<32; ++i) {
183  unsigned int ii;
184  unsigned int jj;
185  ii = i/8;
186  jj = i%8;
187  t = new TText(xll + sf*(ii+0.5),
188  yll + sf*(jj+0.5),
189  pixel[i]);
190  t->SetTextColor(kGray+2);
191  t->SetTextAlign(22);
192  t->SetTextSize(0.014);
193  t->SetBit(kCannotPick);
194  fText.push_back(t);
195  }
196 }
197 
198 ////////////////////////////////////////////////////////////////////////
static const unsigned int gsNfeby
Definition: HwDCMLabel.cxx:10
void MakePixelKey()
Definition: HwDCMLabel.cxx:131
void Config(const TH1 *h)
Definition: HwDCMLabel.cxx:18
std::list< TLine * > fLine
Definition: HwDCMLabel.h:29
static const unsigned int gsNpixelx
Definition: HwDCMLabel.cxx:11
static const unsigned int gsNpixely
Definition: HwDCMLabel.cxx:12
static const unsigned int gsNfebx
Definition: HwDCMLabel.cxx:9
std::list< TText * > fText
Definition: HwDCMLabel.h:28
void MakeFEBLabels()
Definition: HwDCMLabel.cxx:61
void MakeVerticalLines()
Definition: HwDCMLabel.cxx:90
void MakeHorizontalLines()
Definition: HwDCMLabel.cxx:111
Online Monitoring package header.