]> git.uio.no Git - u/mrichter/AliRoot.git/blame - GEODB/AliGCone.cxx
Updated VZERO source
[u/mrichter/AliRoot.git] / GEODB / AliGCone.cxx
CommitLineData
4c039060 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/*
17$Log$
18*/
19
ab2f6604 20// -*- C++ -*-
21//
22// 1998/10/19
23// ---------------------------------------------------------------------------
24//
25// AliGCone Class
26//
27// This file is part of the ALICE Geometry Database .
28//
29// By: Joana E. Santo & David Collados
30//
31// ---------------------------------------------------------------------------
32
33#include <TView.h>
34#include <TVirtualPad.h>
35#include <iostream.h>
36#include <TGLKernelABC.h>
37#include <TCanvas.h>
38#include "AliGCone.h"
39#include "TROOT.h"
40
41ClassImp(AliGCone)
42
43AliGCone::AliGCone() : AliGTube()
44{
45 /* Default Constructor */
46 fRmax2 = 0.; // outside radius at the high z limit
47 fRmin2 = 0.; // inside radius at the high z limit
48
49 //SetLineColor(5); // Yellow
50}
51
52//-------------------------------------------------------------------------
53
54AliGCone::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)
55{
56 /* Constructor */
57 fRmax2 = rmax2;
58 fRmin2 = rmin2;
59
60 //SetLineColor(5); // Yellow
61}
62
63//-------------------------------------------------------------------------
64
65AliGCone::AliGCone(AliGCone *cone)
66{
67 /* Copy Constructor */
68 fRmax2 = cone->fRmax2;
69 fRmin2 = cone->fRmin2;
70 fColor = cone->fColor;
71
72 //SetLineColor(5); // Yellow
73}
74
75//-------------------------------------------------------------------------
76
77AliGCone::AliGCone(Text_t *name, Text_t *title, Float_t dz, Float_t rmax1, Float_t rmax2) : AliGTube(name, title, 0, rmax1, dz)
78{
79 /* Simplified Constructor */
80 fRmin2 = 0;
81 fRmax2 = rmax2;
82
83 //SetLineColor(5); // Yellow
84}
85
86//-------------------------------------------------------------------------
87
88AliGCone::~AliGCone() {
89 /* Destructor */
90}
91
92//-------------------------------------------------------------------------
93
94void AliGCone::DrawShape(Option_t *option)
95{
96 Draw(option);
97 gPad->Update();
98}
99
100//-------------------------------------------------------------------------
101
102void AliGCone::Draw(Option_t *option)
103{
104 cout << " Entra en " << this->GetName() << "::Draw " << endl;
105 TString opt = option;
106 opt.ToLower();
107
108 if( !gPad ) {
109 //TCanvas* Cone = new TCanvas("AliGCone","AliGCone",0,0,400,300);
110 gPad = new TCanvas("AliGCone","AliGCone",0,0,400,300);
111 gPad->Range(0,0,1,1);
112 gPad->SetFillColor(32); // Light Green
113 gPad->SetBorderSize(3);
114 gPad->SetBorderMode(0); // -1 (down) 0 (no) 1 (up)
115 }
116 else {
117 if( !opt.Contains("same") ) {
118 gPad->Clear();
119 gPad->SetName("AliGCone");
120 gPad->SetTitle("AliGCone");
121 }
122 else {
123 gPad->SetName("AliShapes");
124 gPad->SetTitle("AliShapes");
125 }
126 }
127
128 AppendPad(option);
129 TView *view = gPad->GetView();
130
131 if (!view)
132 view = new TView(1);
133
134 view->SetAutoRange(kTRUE);
135 Paint(option);
136 view->SetAutoRange(kFALSE);
137 cout << " Sale de " << this->GetName() << "::Draw " << endl;
138}
139
140//-------------------------------------------------------------------------
141
142void AliGCone::SetPoints(Float_t *buff)
143{
144//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*Create CONE points*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
145//*-* ==================
146
147 //cout << " Entra en " << this->GetName() << "::Paint " << endl;
148 SetLineColor( GetCol() );
149
150 Float_t rmin1, rmax1, dz;
151 Int_t j, n;
152
153 n = GetNumberOfDivisions();
154
155 rmin1 = AliGTube::fRmin;
156 rmax1 = AliGTube::fRmax;
157 dz = AliGTube::fDz;
158
159 Int_t indx = 0;
160
161//*-* We've to checxk whether the table does exist and create it
162//*-* since fCoTab/fSiTab are not saved with any TShape::Streamer function
163 if (!fCoTab) MakeTableOfCoSin();
164
165 if (buff) {
166 for (j = 0; j < n; j++) {
167 buff[indx++] = rmin1 * fCoTab[j];
168 buff[indx++] = rmin1 * fSiTab[j];
169 buff[indx++] = -dz;
170 }
171 for (j = 0; j < n; j++) {
172
173 buff[indx++] = rmax1 * fCoTab[j];
174 buff[indx++] = rmax1 * fSiTab[j];
175 buff[indx++] = -dz;
176 }
177
178 for (j = 0; j < n; j++) {
179 buff[indx++] = fRmin2 * fCoTab[j];
180 buff[indx++] = fRmin2 * fSiTab[j];
181 buff[indx++] = dz;
182 }
183
184 for (j = 0; j < n; j++) {
185 buff[indx++] = fRmax2 * fCoTab[j];
186 buff[indx++] = fRmax2 * fSiTab[j];
187 buff[indx++] = dz;
188 }
189 }
190
191 //cout << " Sale de " << this->GetName() << "::Paint " << endl;
192}
193
194//-------------------------------------------------------------------------
195
196