StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
DrawBoth.C
1 class StEpdGeom;
2 class StBbcGeom;
3 
4 void DrawBoth(){
5 
6  gSystem->Load("StEpdUtil");
7  StBbcGeom* Bgeo = new StBbcGeom();
8  StEpdGeom* geo = new StEpdGeom();
9 
10 
11  TCanvas* cBoth = new TCanvas("BothCan","BothCan",1400,700);
12  cBoth->Divide(2);
13  cBoth->Draw();
14  TPad* EastPad=cBoth->cd(1);
15  TPad* WestPad=cBoth->cd(2);
16 
17 
18  TH2D* hEastFrame = new TH2D("East","East",500,-100,100,500,-100,100);
19  EastPad->cd();
20  EastPad->SetGrid(0,0);
21  hEastFrame->Draw();
22 
23  Short_t EW=-1;
24  Double_t x[6];
25  Double_t y[6];
26  Int_t nCorners;
27  for (Short_t PP=1; PP<=12; PP++){
28  for (Short_t TT=1; TT<=31; TT++){
29 
30  geo->GetCorners(PP,TT,EW,&nCorners,x,y);
31 
32  x[nCorners]=x[0]; y[nCorners]=y[0]; // closes the polyline
33  TPolyLine* pline = new TPolyLine(nCorners+1,x,y);
34  pline->Draw();
35 
36  Double_t xcent = geo->TileCenter(PP,TT,EW).X();
37  Double_t ycent = geo->TileCenter(PP,TT,EW).Y();
38  TText* lab = new TText(xcent,ycent,Form("%d.%d",PP,TT));
39  lab->SetTextAlign(22); lab->SetTextSize(0.01); lab->SetTextColor(1);
40  lab->Draw();
41 
42  }
43  }
44 
45  for (short tileId=-18; tileId<0; tileId++){ // NOTE negative tileId because East Bbc
46  TVector3 cent = Bgeo->TileCenter(tileId);
47 
48  TText* txt = new TText(cent.X(),cent.Y(),Form("%d",tileId));
49  txt->SetTextSize(.02);
50  txt->SetTextAlign(22);
51  txt->Draw();
52 
53  double xc[7];
54  double yc[7];
55  Bgeo->GetCorners(tileId,xc,yc);
56  xc[6]=xc[0]; yc[6]=yc[0];
57  TPolyLine* pline = new TPolyLine(7,xc,yc);
58  pline->SetLineColor(4);
59  pline->SetLineWidth(2);
60  pline->Draw();
61 
62 
63  unsigned short pmtNumber = Bgeo->PmtOfTile(abs(tileId));
64  TText* Ptxt = new TText(cent.X(),cent.Y()-5.0,Form("%d",pmtNumber));
65  Ptxt->SetTextSize(0.01);
66  Ptxt->SetTextColor(2);
67  Ptxt->Draw();
68 
69  }
70 
71 
72  //-----------------------------
73 
74  TH2D* hWestFrame = new TH2D("West","West",500,-100,100,500,-100,100);
75  WestPad->cd();
76  WestPad->SetGrid(0,0);
77  hWestFrame->Draw();
78 
79  Short_t EW=1;
80  Double_t x[6];
81  Double_t y[6];
82  Int_t nCorners;
83  for (Short_t PP=1; PP<=12; PP++){
84  for (Short_t TT=1; TT<=31; TT++){
85 
86  geo->GetCorners(PP,TT,EW,&nCorners,x,y);
87 
88  x[nCorners]=x[0]; y[nCorners]=y[0]; // closes the polyline
89  TPolyLine* pline = new TPolyLine(nCorners+1,x,y);
90  pline->Draw();
91 
92  Double_t xcent = geo->TileCenter(PP,TT,EW).X();
93  Double_t ycent = geo->TileCenter(PP,TT,EW).Y();
94  TText* lab = new TText(xcent,ycent,Form("%d.%d",PP,TT));
95  lab->SetTextAlign(22); lab->SetTextSize(0.01); lab->SetTextColor(1);
96  lab->Draw();
97 
98  }
99  }
100 
101  for (short tileId=1; tileId<19; tileId++){
102  TVector3 cent = Bgeo->TileCenter(tileId);
103 
104  TText* txt = new TText(cent.X(),cent.Y(),Form("%d",tileId));
105  txt->SetTextSize(.02);
106  txt->SetTextAlign(22);
107  txt->Draw();
108 
109  double xc[7];
110  double yc[7];
111  Bgeo->GetCorners(tileId,xc,yc);
112  xc[6]=xc[0]; yc[6]=yc[0];
113  TPolyLine* pline = new TPolyLine(7,xc,yc);
114  pline->SetLineColor(4);
115  pline->SetLineWidth(2);
116  pline->Draw();
117 
118 
119  unsigned short pmtNumber = Bgeo->PmtOfTile(abs(tileId));
120  TText* Ptxt = new TText(cent.X(),cent.Y()-5.0,Form("%d",pmtNumber));
121  Ptxt->SetTextSize(0.01);
122  Ptxt->SetTextColor(2);
123  Ptxt->Draw();
124 
125  }
126 
127 
128  cBoth->SaveAs("Both.pdf");
129 
130 
131 
132 }
133 
134 
135 
136 
Definition: T.h:18
unsigned short PmtOfTile(unsigned short tileNumber)
Definition: StBbcGeom.h:148
TVector3 TileCenter(short tileId)
Definition: StBbcGeom.cxx:107
void GetCorners(short tileId, double *x, double *y)
Definition: StBbcGeom.cxx:121