CMS 3D CMS Logo

EcalDrawUtils.h
Go to the documentation of this file.
1  #include "TH2F.h"
2 #include "TLine.h"
3 
4 void DrawEB(TH2F* ebmap, float min, float max) {
5  ebmap->SetXTitle("i#phi");
6  ebmap->SetYTitle("i#eta");
7  ebmap->GetXaxis()->SetNdivisions(-418,kFALSE);
8  ebmap->GetYaxis()->SetNdivisions(-1702,kFALSE);
9  ebmap->GetXaxis()->SetLabelSize(0.03);
10  ebmap->GetYaxis()->SetLabelSize(0.03);
11  ebmap->GetXaxis()->SetTickLength(0.01);
12  ebmap->GetYaxis()->SetTickLength(0.01);
13  ebmap->SetMaximum(max);
14  ebmap->SetMinimum(min);
15  ebmap->Draw("colz");
16  TLine* l = new TLine;
17  l->SetLineWidth(1);
18  for(int i = 0; i <17; i++) {
19  Double_t x = 20.+ (i *20);
20  l = new TLine(x, -85., x, 85.);
21  l->Draw();
22  }
23  l = new TLine(0., 85., 360., 85.);
24  l->Draw();
25  l = new TLine(0., 0., 360., 0.);
26  l->Draw();
27  } // DrawEB method
28 
29  void DrawEE(TH2F* endc, float min, float max) {
30  int ixSectorsEE[202] = {
31  62, 62, 61, 61, 60, 60, 59, 59, 58, 58, 56, 56, 46, 46, 44, 44, 43, 43, 42, 42,
32  41, 41, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 46, 46, 56, 56, 58, 58, 59, 59,
33  60, 60, 61, 61, 62, 62, 0,101,101, 98, 98, 96, 96, 93, 93, 88, 88, 86, 86, 81,
34  81, 76, 76, 66, 66, 61, 61, 41, 41, 36, 36, 26, 26, 21, 21, 16, 16, 14, 14, 9,
35  9, 6, 6, 4, 4, 1, 1, 4, 4, 6, 6, 9, 9, 14, 14, 16, 16, 21, 21, 26,
36  26, 36, 36, 41, 41, 61, 61, 66, 66, 76, 76, 81, 81, 86, 86, 88, 88, 93, 93, 96,
37  96, 98, 98,101,101, 0, 62, 66, 66, 71, 71, 81, 81, 91, 91, 93, 0, 62, 66, 66,
38  91, 91, 98, 0, 58, 61, 61, 66, 66, 71, 71, 76, 76, 81, 81, 0, 51, 51, 0, 44,
39  41, 41, 36, 36, 31, 31, 26, 26, 21, 21, 0, 40, 36, 36, 11, 11, 4, 0, 40, 36,
40  36, 31, 31, 21, 21, 11, 11, 9, 0, 46, 46, 41, 41, 36, 36, 0, 56, 56, 61, 61, 66, 66};
41 
42  int iySectorsEE[202] = {
43  51, 56, 56, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 61, 61, 60, 60, 59, 59, 58,
44  58, 56, 56, 46, 46, 44, 44, 43, 43, 42, 42, 41, 41, 40, 40, 41, 41, 42, 42, 43,
45  43, 44, 44, 46, 46, 51, 0, 51, 61, 61, 66, 66, 76, 76, 81, 81, 86, 86, 88, 88,
46  93, 93, 96, 96, 98, 98,101,101, 98, 98, 96, 96, 93, 93, 88, 88, 86, 86, 81, 81,
47  76, 76, 66, 66, 61, 61, 41, 41, 36, 36, 26, 26, 21, 21, 16, 16, 14, 14, 9, 9,
48  6, 6, 4, 4, 1, 1, 4, 4, 6, 6, 9, 9, 14, 14, 16, 16, 21, 21, 26, 26,
49  36, 36, 41, 41, 51, 0, 46, 46, 41, 41, 36, 36, 31, 31, 26, 26, 0, 51, 51, 56,
50  56, 61, 61, 0, 61, 61, 66, 66, 71, 71, 76, 76, 86, 86, 88, 0, 62,101, 0, 61,
51  61, 66, 66, 71, 71, 76, 76, 86, 86, 88, 0, 51, 51, 56, 56, 61, 61, 0, 46, 46,
52  41, 41, 36, 36, 31, 31, 26, 26, 0, 40, 31, 31, 16, 16, 6, 0, 40, 31, 31, 16, 16, 6};
53 
54  TLine* l = new TLine;
55  l->SetLineWidth(1);
56 
57  endc->SetXTitle("ix");
58  endc->SetYTitle("iy");
59  endc->SetMaximum(max);
60  endc->SetMinimum(min);
61  endc->Draw("colz1");
62  for ( int i=0; i<201; i=i+1) {
63  if ( (ixSectorsEE[i]!=0 || iySectorsEE[i]!=0) &&
64  (ixSectorsEE[i+1]!=0 || iySectorsEE[i+1]!=0) ) {
65  l->DrawLine(ixSectorsEE[i], iySectorsEE[i],
66  ixSectorsEE[i+1], iySectorsEE[i+1]);
67  }
68  }
69  } // DrawEE method
70 
71  void DrawEE_Tower(TH2F* endc, TLine* l, double minScale, double maxScale){
72  endc->SetStats(false);
73  endc->SetMinimum(minScale);
74  endc->SetMaximum(maxScale);
75  endc->Draw("colz");
76 
77  int ixSectorsEE[136] = {
78  8,14,14,17,17,18,18,19,19,20,20,21,21,20,20,19,19,18,18,17,
79  17,14,14, 8, 8, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 2, 2, 3, 3, 4,
80  4, 5, 5, 8, 8, 8, 9, 9,10,10,12,12,13,13,12,12,10,10, 9, 9,
81  10,10, 0,11,11, 0,10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 0,12,13,
82  13,14,14,15,15,16,16,17,17, 0, 9, 8, 8, 3, 3, 1, 0,13,14,14,
83  19,19,21, 0, 9, 8, 8, 7, 7, 5, 5, 3, 3, 2, 0,13,14,14,15,15,
84  17,17,19,19,20, 0,14,14,13,13,12,12,0};
85 
86  int iySectorsEE[136] = {
87  1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 8, 8,14,14,17,17,18,18,19,19,
88  20,20,21,21,20,20,19,19,18,18,17,17,14,14, 8, 8, 5, 5, 4, 4,
89  3, 3, 2, 2, 1, 4, 4, 7, 7, 9, 9,10,10,12,12,13,13,12,12,10,
90  10, 9, 0,13,21, 0,13,13,14,14,15,15,16,16,18,18,19, 0,13,13,
91  14,14,15,15,16,16,18,18,19, 0,11,11,12,12,13,13, 0,11,11,12,
92  12,13,13, 0,10,10, 9, 9, 8, 8, 7, 7, 6, 6, 0,10,10, 9, 9, 8,
93  8, 7, 7, 6, 6, 0, 2, 4, 4, 7, 7, 9, 0} ;
94 
95  for ( int i = 0; i < 136; i=i+1)
96  if ( (ixSectorsEE[i]!=0 || iySectorsEE[i]!=0) && (ixSectorsEE[i+1]!=0 || iySectorsEE[i+1]!=0) )
97  l->DrawLine(ixSectorsEE[i], iySectorsEE[i], ixSectorsEE[i+1], iySectorsEE[i+1]);
98 
99  }//draw EE in case of a tower
100 
101  void drawTable(int nbRows, int nbColumns){
102  TLine* l = new TLine;
103  l->SetLineWidth(1);
104  for (int i = 1; i < nbRows; i++) {
105  double y = (double) i;
106  l = new TLine(0., y, nbColumns, y);
107  l->Draw();
108  }
109 
110  for (int i = 1; i < nbColumns; i++) {
111  double x = (double) i;
112  double y = (double) nbRows;
113  l = new TLine(x, 0., x, y);
114  l->Draw();
115  }
116  }
void DrawEE(TH2F *endc, float min, float max)
Definition: EcalDrawUtils.h:29
void DrawEB(TH2F *ebmap, float min, float max)
Definition: EcalDrawUtils.h:4
void DrawEE_Tower(TH2F *endc, TLine *l, double minScale, double maxScale)
Definition: EcalDrawUtils.h:71
T min(T a, T b)
Definition: MathUtil.h:58
void drawTable(int nbRows, int nbColumns)