Fork me on GitHub

source: svn/trunk/paper/sourceCode/CaloSegmentation.C@ 607

Last change on this file since 607 was 131, checked in by severine ovyn, 16 years ago

real code for caloTowers

File size: 4.4 KB
Line 
1#include "TROOT.h"
2#include "TFile.h"
3#include "TTree.h"
4#include "TCanvas.h"
5#include "TProfile.h"
6#include "TF1.h"
7#include "TGraph.h"
8#include "TLegend.h"
9#include "TH2D.h"
10#include "TLine.h"
11#include "TBox.h"
12
13//#include "interface/FuncDef.h"
14
15void CALO()
16{
17// setTDRStyle();
18 gROOT->Reset();
19
20 TCanvas *c1 = new TCanvas("c1","Calo Segmentation",0,0,1000,650);
21 c1->SetGrayscale();
22 c1->cd();
23
24 TH2D *Calo = new TH2D("","Calorimeter segmentation",100,-5,5,100,0,3.14);
25 // TLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
26
27 Calo->Draw();
28
29 //Eta segmentation
30 double eta[41]={ 0., 0.087, 0.174, 0.261, 0.348, 0.435, 0.522, 0.609, 0.696, 0.783,
31 0.870, 0.957, 1.044, 1.131, 1.218, 1.305, 1.392, 1.479, 1.566, 1.653,
32 1.740, 1.830, 1.930, 2.043, 2.172, 2.322, 2.500, 2.650, 2.868, 2.950,
33 3.125, 3.300, 3.475, 3.650, 3.825, 4.000, 4.175, 4.350, 4.525, 4.700, 5.000};
34 double phi[40]={ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
35 5, 5, 5, 5, 5, 5, 5, 5, 5, 10,
36 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
37 10, 10, 10, 10, 10, 10, 10, 10, 20, 20};
38
39 int color1=1,color2=2,color3=3,color4=4;
40 double xP1,xM1;
41 double yPhi;
42 for(int i=0;i<41;i++)
43 {
44 xP1=eta[i];
45 xM1=-eta[i];
46
47 yPhi=0;
48
49
50 if(i!=40){
51
52 double xPAv=eta[i+1];
53 float etasep=(xPAv-xP1);
54
55 TBox *box = new TBox(xP1, 0,xPAv, 3.13);
56 TBox *boxN = new TBox(-xP1, 0,-xPAv, 3.13);
57 if(((int)phi[i]==5)){
58 if(fabs(etasep - 0.087)<0.001){ box->SetFillColor(10);}
59 if(fabs(etasep - 0.09)<0.001){ box->SetFillColor(kBlue-9);}
60 if(fabs(etasep == 0.1) ){ box->SetFillColor(kBlue-8);}
61 if(fabs(etasep == 0.113)){ box->SetFillColor(kBlue-7);}
62 if(fabs(etasep == 0.129)){ box->SetFillColor(kBlue-6);}
63 if(fabs(etasep == 0.15 )){ box->SetFillColor(kBlue-5);}
64 if(fabs(etasep == 0.178)){ box->SetFillColor(kBlue-4);}
65 if(fabs(etasep == 0.218)){ box->SetFillColor(kBlue-3);}
66 if(fabs(etasep == 0.218)){ box->SetFillColor(kBlue-2);}
67 if(fabs(etasep == 0.082)){ box->SetFillColor(kBlue-1);}
68 if(fabs(etasep == 0.175)){ box->SetFillColor(kBlue+1);}
69 if(fabs(etasep == 0.3 )){ box->SetFillColor(kBlue+2);}
70 }
71
72 if(((int)phi[i]==10)){
73 if(fabs(etasep - 0.087)<0.001){ box->SetFillColor(kRed-10);}
74 if(fabs(etasep - 0.09 )<0.001){ box->SetFillColor(kRed-9);}
75 if(fabs(etasep - 0.1 )<0.001){ box->SetFillColor(kRed-8);}
76 if(fabs(etasep - 0.113)<0.001){ box->SetFillColor(kRed-7);}
77 if(fabs(etasep - 0.129)<0.001){ box->SetFillColor(kRed-6);}
78 if(fabs(etasep - 0.15 )<0.001){ box->SetFillColor(kRed-4);}
79 if(fabs(etasep - 0.178)<0.001){ box->SetFillColor(kRed-5);}
80 if(fabs(etasep - 0.218)<0.001){ box->SetFillColor(kRed-3);}
81 if(fabs(etasep - 0.218)<0.001){ box->SetFillColor(kRed-2);}
82 if(fabs(etasep - 0.082)<0.001){ box->SetFillColor(kRed-1);}
83 if(fabs(etasep - 0.175)<0.001){ box->SetFillColor(kRed);}
84 if(fabs(etasep - 0.3 )<0.001){ box->SetFillColor(kRed+1);}
85 }
86
87 if(((int)phi[i]==20)){
88 if(fabs(etasep - 0.087)<0.001){ box->SetFillColor(kGreen-10);}
89 if(fabs(etasep - 0.09 )<0.001){ box->SetFillColor(kGreen-9);}
90 if(fabs(etasep - 0.1 )<0.001){ box->SetFillColor(kGreen-7);}
91 if(fabs(etasep - 0.113)<0.001){ box->SetFillColor(kGreen-5);}
92 if(fabs(etasep - 0.129)<0.001){ box->SetFillColor(kGreen-4);}
93 if(fabs(etasep - 0.15 )<0.001){ box->SetFillColor(kGreen-3);}
94 if(fabs(etasep - 0.178)<0.001){ box->SetFillColor(kGreen-2);}
95 if(fabs(etasep - 0.218)<0.001){ box->SetFillColor(kGreen-1);}
96 if(fabs(etasep - 0.218)<0.001){ box->SetFillColor(kGreen);}
97 if(fabs(etasep - 0.082)<0.001){ box->SetFillColor(kGreen+1);}
98 if(fabs(etasep - 0.175)<0.001){ box->SetFillColor(kGreen+2);}
99 if(fabs(etasep - 0.3 )<0.001){ box->SetFillColor(kGreen+3);}
100 }
101 boxN->SetFillColor(box->GetFillColor());
102 boxN->Draw();
103 box->Draw();
104
105 //Phi segmentation
106
107 double phiThisEta=phi[i];
108 for(int j=0;j<100;j++)
109 {
110 double yPhiAv=yPhi;
111 yPhi=yPhi+phiThisEta*3.14/180;
112 if(yPhi>3.14)break;
113
114 TLine *phiEtaPos = new TLine(xP1, yPhi,xPAv, yPhi);
115 phiEtaPos->Draw();
116 TLine *phiEtaNeg = new TLine(-xP1, yPhi,-xPAv, yPhi);
117 phiEtaNeg->Draw();
118 j++;
119 }
120 }
121
122 TLine *etaPos = new TLine(xP1, 0.,xP1, 3.14);
123 etaPos->Draw();
124
125 TLine *etaNeg = new TLine(xM1, 0.,xM1, 3.14);
126 etaNeg->Draw();
127
128 }
129}
130
131
132
133void General()
134{
135CALO();
136
137}
138
139
Note: See TracBrowser for help on using the repository browser.