File indexing completed on 2024-04-06 12:21:53
0001 {
0002
0003
0004
0005
0006
0007
0008
0009
0010 gROOT->Reset();
0011
0012
0013
0014 const float leftMargin = 23;
0015 const float rightMargin = 33;
0016 const float topMargin = 13;
0017 const float bottomMargin = 14;
0018
0019 gStyle->SetOptTitle(0);
0020 gStyle->SetOptStat("");
0021 gStyle->SetPadGridX(false);
0022 gStyle->SetPadGridY(false);
0023
0024 const float trkInRad = 20;
0025 const float trkOutRad = 110;
0026 const float trkLength = 270;
0027 const float beamLen = 15;
0028
0029 const unsigned int nSec = 9;
0030 const float chosenR = 50;
0031 const unsigned int nSecEdges = nSec + 1;
0032
0033 const float eta[nSecEdges] = {0, 0.31, 0.61, 0.89, 1.16, 1.43, 1.7, 1.95, 2.16, 2.4};
0034
0035
0036 const unsigned int nSubSec = 2;
0037 const unsigned int nSubSecEdges = nSubSec + 1;
0038
0039
0040 const bool drawStub = true;
0041 const int iDigi_RT = 492;
0042 const int iDigi_Z = -1403;
0043
0044 TCanvas d1("d1", "d1", 1000, 800);
0045
0046
0047
0048
0049 TImage *img = TImage::Open("TrackerLayout.png");
0050 img->Draw("x");
0051 d1.Update();
0052
0053
0054 TPad p("p", "p", 0, 0, 1, 1);
0055 p.Range(-beamLen - leftMargin, -1 - bottomMargin, trkLength + 30 + rightMargin, trkOutRad + 15 + topMargin);
0056 p.SetFillStyle(4000);
0057 p.SetFrameFillStyle(4000);
0058 p.Draw();
0059 p.cd();
0060
0061 TPolyLine trackerBorder;
0062
0063 trackerBorder.SetNextPoint(0., 0.);
0064 trackerBorder.SetNextPoint(295., 0.);
0065 trackerBorder.SetNextPoint(295., 123.);
0066 trackerBorder.SetNextPoint(0., 123.);
0067 trackerBorder.SetNextPoint(0., 0.);
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111 TPolyLine secBoundary[nSecEdges];
0112
0113
0114 for (unsigned int k = 0; k < nSecEdges; k++) {
0115
0116 float z = chosenR / tan(2.0 * atan(exp(-eta[k])));
0117
0118
0119 float rPeriphNeg = trkOutRad;
0120 float rPeriphPos = trkOutRad;
0121 float zPeriphNeg = -beamLen + (z + beamLen) * (rPeriphNeg / chosenR);
0122 float zPeriphPos = beamLen + (z - beamLen) * (rPeriphNeg / chosenR);
0123
0124 if (std::abs(zPeriphNeg) > trkLength) {
0125 int whichEndcap = (zPeriphNeg + beamLen > 0) ? 1 : -1;
0126 zPeriphNeg = whichEndcap * trkLength;
0127 rPeriphNeg = chosenR * (zPeriphNeg + beamLen) / (z + beamLen);
0128 }
0129 if (std::abs(zPeriphPos) > trkLength) {
0130 int whichEndcap = (zPeriphPos - beamLen > 0) ? 1 : -1;
0131 zPeriphPos = whichEndcap * trkLength;
0132 rPeriphPos = chosenR * (zPeriphPos - beamLen) / (z - beamLen);
0133 }
0134 secBoundary[k].SetNextPoint(-beamLen, 0);
0135 secBoundary[k].SetNextPoint(zPeriphNeg, rPeriphNeg);
0136 secBoundary[k].SetNextPoint(zPeriphPos, rPeriphPos);
0137 secBoundary[k].SetNextPoint(beamLen, 0);
0138 secBoundary[k].SetNextPoint(-beamLen, 0);
0139 secBoundary[k].SetFillColor(kGreen - 2);
0140
0141 unsigned int iHash = 3405 + k * 9;
0142 secBoundary[k].SetFillStyle(iHash);
0143 secBoundary[k].Draw("f");
0144 d1.Update();
0145 }
0146
0147
0148
0149
0150
0151
0152
0153
0154 TLine chosen(0, chosenR, trkLength, chosenR);
0155 chosen.SetLineWidth(3);
0156 chosen.SetLineStyle(2);
0157 chosen.SetLineColor(kRed);
0158 chosen.Draw();
0159
0160 TLine beam(-beamLen, 0., beamLen, 0.);
0161 beam.SetLineWidth(5);
0162 beam.SetLineColor(kRed);
0163 beam.Draw();
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177 d1.Update();
0178
0179 cout << "Writing EtaSectors.png" << endl;
0180 d1.Print("EtaSectors.png");
0181
0182 cin.get();
0183 }