]>
Commit | Line | Data |
---|---|---|
ab2f6604 | 1 | // -*- C++ -*- |
2 | // | |
3 | // 1998/10/19 | |
4 | // --------------------------------------------------------------------------- | |
5 | // | |
6 | // AliGCone Class | |
7 | // | |
8 | // This file is part of the ALICE Geometry Database . | |
9 | // | |
10 | // By: Joana E. Santo & David Collados | |
11 | // | |
12 | // --------------------------------------------------------------------------- | |
13 | ||
14 | #include <TView.h> | |
15 | #include <TVirtualPad.h> | |
16 | #include <iostream.h> | |
17 | #include <TGLKernelABC.h> | |
18 | #include <TCanvas.h> | |
19 | #include "AliGCone.h" | |
20 | #include "TROOT.h" | |
21 | ||
22 | ClassImp(AliGCone) | |
23 | ||
24 | AliGCone::AliGCone() : AliGTube() | |
25 | { | |
26 | /* Default Constructor */ | |
27 | fRmax2 = 0.; // outside radius at the high z limit | |
28 | fRmin2 = 0.; // inside radius at the high z limit | |
29 | ||
30 | //SetLineColor(5); // Yellow | |
31 | } | |
32 | ||
33 | //------------------------------------------------------------------------- | |
34 | ||
35 | AliGCone::AliGCone(Text_t *name, Text_t *title, Float_t dz, Float_t rmin1, Float_t rmax1, Float_t rmin2, Float_t rmax2) : AliGTube(name, title, rmin1, rmax1, dz) | |
36 | { | |
37 | /* Constructor */ | |
38 | fRmax2 = rmax2; | |
39 | fRmin2 = rmin2; | |
40 | ||
41 | //SetLineColor(5); // Yellow | |
42 | } | |
43 | ||
44 | //------------------------------------------------------------------------- | |
45 | ||
46 | AliGCone::AliGCone(AliGCone *cone) | |
47 | { | |
48 | /* Copy Constructor */ | |
49 | fRmax2 = cone->fRmax2; | |
50 | fRmin2 = cone->fRmin2; | |
51 | fColor = cone->fColor; | |
52 | ||
53 | //SetLineColor(5); // Yellow | |
54 | } | |
55 | ||
56 | //------------------------------------------------------------------------- | |
57 | ||
58 | AliGCone::AliGCone(Text_t *name, Text_t *title, Float_t dz, Float_t rmax1, Float_t rmax2) : AliGTube(name, title, 0, rmax1, dz) | |
59 | { | |
60 | /* Simplified Constructor */ | |
61 | fRmin2 = 0; | |
62 | fRmax2 = rmax2; | |
63 | ||
64 | //SetLineColor(5); // Yellow | |
65 | } | |
66 | ||
67 | //------------------------------------------------------------------------- | |
68 | ||
69 | AliGCone::~AliGCone() { | |
70 | /* Destructor */ | |
71 | } | |
72 | ||
73 | //------------------------------------------------------------------------- | |
74 | ||
75 | void AliGCone::DrawShape(Option_t *option) | |
76 | { | |
77 | Draw(option); | |
78 | gPad->Update(); | |
79 | } | |
80 | ||
81 | //------------------------------------------------------------------------- | |
82 | ||
83 | void AliGCone::Draw(Option_t *option) | |
84 | { | |
85 | cout << " Entra en " << this->GetName() << "::Draw " << endl; | |
86 | TString opt = option; | |
87 | opt.ToLower(); | |
88 | ||
89 | if( !gPad ) { | |
90 | //TCanvas* Cone = new TCanvas("AliGCone","AliGCone",0,0,400,300); | |
91 | gPad = new TCanvas("AliGCone","AliGCone",0,0,400,300); | |
92 | gPad->Range(0,0,1,1); | |
93 | gPad->SetFillColor(32); // Light Green | |
94 | gPad->SetBorderSize(3); | |
95 | gPad->SetBorderMode(0); // -1 (down) 0 (no) 1 (up) | |
96 | } | |
97 | else { | |
98 | if( !opt.Contains("same") ) { | |
99 | gPad->Clear(); | |
100 | gPad->SetName("AliGCone"); | |
101 | gPad->SetTitle("AliGCone"); | |
102 | } | |
103 | else { | |
104 | gPad->SetName("AliShapes"); | |
105 | gPad->SetTitle("AliShapes"); | |
106 | } | |
107 | } | |
108 | ||
109 | AppendPad(option); | |
110 | TView *view = gPad->GetView(); | |
111 | ||
112 | if (!view) | |
113 | view = new TView(1); | |
114 | ||
115 | view->SetAutoRange(kTRUE); | |
116 | Paint(option); | |
117 | view->SetAutoRange(kFALSE); | |
118 | cout << " Sale de " << this->GetName() << "::Draw " << endl; | |
119 | } | |
120 | ||
121 | //------------------------------------------------------------------------- | |
122 | ||
123 | void AliGCone::SetPoints(Float_t *buff) | |
124 | { | |
125 | //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*Create CONE points*-*-*-*-*-*-*-*-*-*-*-*-*-*-* | |
126 | //*-* ================== | |
127 | ||
128 | //cout << " Entra en " << this->GetName() << "::Paint " << endl; | |
129 | SetLineColor( GetCol() ); | |
130 | ||
131 | Float_t rmin1, rmax1, dz; | |
132 | Int_t j, n; | |
133 | ||
134 | n = GetNumberOfDivisions(); | |
135 | ||
136 | rmin1 = AliGTube::fRmin; | |
137 | rmax1 = AliGTube::fRmax; | |
138 | dz = AliGTube::fDz; | |
139 | ||
140 | Int_t indx = 0; | |
141 | ||
142 | //*-* We've to checxk whether the table does exist and create it | |
143 | //*-* since fCoTab/fSiTab are not saved with any TShape::Streamer function | |
144 | if (!fCoTab) MakeTableOfCoSin(); | |
145 | ||
146 | if (buff) { | |
147 | for (j = 0; j < n; j++) { | |
148 | buff[indx++] = rmin1 * fCoTab[j]; | |
149 | buff[indx++] = rmin1 * fSiTab[j]; | |
150 | buff[indx++] = -dz; | |
151 | } | |
152 | for (j = 0; j < n; j++) { | |
153 | ||
154 | buff[indx++] = rmax1 * fCoTab[j]; | |
155 | buff[indx++] = rmax1 * fSiTab[j]; | |
156 | buff[indx++] = -dz; | |
157 | } | |
158 | ||
159 | for (j = 0; j < n; j++) { | |
160 | buff[indx++] = fRmin2 * fCoTab[j]; | |
161 | buff[indx++] = fRmin2 * fSiTab[j]; | |
162 | buff[indx++] = dz; | |
163 | } | |
164 | ||
165 | for (j = 0; j < n; j++) { | |
166 | buff[indx++] = fRmax2 * fCoTab[j]; | |
167 | buff[indx++] = fRmax2 * fSiTab[j]; | |
168 | buff[indx++] = dz; | |
169 | } | |
170 | } | |
171 | ||
172 | //cout << " Sale de " << this->GetName() << "::Paint " << endl; | |
173 | } | |
174 | ||
175 | //------------------------------------------------------------------------- | |
176 | ||
177 |