StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
draw_survey_pAu.C
1 // draws boxes representing FMS Pb-glass cells, in units of mm
2 
3 void draw_survey()
4 {
5  TFile * infile = new TFile("geotr.root","READ");
6  TTree * tr = (TTree*) infile->Get("geotr");
7  Int_t nstb,row,col;
8  tr->SetBranchAddress("nstb",&nstb);
9  tr->SetBranchAddress("row",&row);
10  tr->SetBranchAddress("col",&col);
11 
12  const Double_t large_width = 58.0; // large cell width
13  const Double_t small_width = 38.0; // small cell width
14 
15  Double_t x,y,z,x1,y1,x2,y2;
16  Int_t it=0;
17  Int_t color;
18  TLine * cell[4][1264];
19 
20  for(Int_t i=0; i<tr->GetEntries(); i++)
21  {
22  tr->GetEntry(i);
23  switch(nstb)
24  {
25  case 1:
26  x = -24.0 - 25.0 - 58.6 * col;
27  y = 965.5 - 58.5 * row;
28  z = 7208;
29  color = (Int_t) kMagenta;
30  break;
31  case 2:
32  x = -24.0 - 8.0 + 66.6 + 58.4 * col; //new position May 5 2015
33  y = 965.1 - 58.6 * row;
34  z = 7188;
35  color = (Int_t) kRed;
36  break;
37  case 3:
38  if(row>16.5)
39  {
40  x = -22.0 - 17.7 - 38.2 * col;
41  y = 422.7 - 37.9 * row;
42  z = 7208;
43  color = (Int_t) kBlue;
44  }
45  else
46  {
47  x = -22.0 - 17.7 - 38.2 * col;
48  y = 4.75 + 438.9 - 39.0 * row;
49  z = 7204;
50  color = (Int_t) kCyan;
51  };
52  break;
53  case 4:
54  x = -22.0 - 8.0 + 60. + 38.4 * col; // new position May 5 2015
55  y = 444. - 38.7 * row;
56  z = 7188;
57  color = (Int_t) kGreen+2;
58  break;
59  };
60 
61  if(nstb<=2)
62  {
63  x1 = x - large_width/2.0;
64  x2 = x + large_width/2.0;
65  y1 = y - large_width/2.0;
66  y2 = y + large_width/2.0;
67  }
68  else
69  {
70  x1 = x - small_width/2.0;
71  x2 = x + small_width/2.0;
72  y1 = y - small_width/2.0;
73  y2 = y + small_width/2.0;
74  };
75 
76  cell[0][it] = new TLine(x1,y1,x2,y1); //t
77  cell[1][it] = new TLine(x1,y2,x2,y2); //b
78  cell[2][it] = new TLine(x1,y1,x1,y2); //l
79  cell[3][it] = new TLine(x2,y1,x2,y2); //r
80  for(Int_t j=0; j<4; j++) cell[j][it]->SetLineColor(color);
81  it++;
82  };
83 
84  Double_t md = 1200;
85  Int_t factor = 1; // bins per millimeter... set this too high and you'll get a memory leak!
86  factor *= 2;
87  TH2D * bg = new TH2D("survey","FMS cells survey [mm]",factor*md,-1*md,md,factor*md,-1*md,md);
88  TCanvas * survey = new TCanvas("survey","survey",700,700);
89  gStyle->SetOptStat(0);
90  bg->Draw();
91  for(Int_t i=0; i<1264; i++) for(Int_t j=0; j<4; j++) cell[j][i]->Draw();
92 };