14 class TVirtualViewer3D;
17 enum EDraw3DStyle {kVtx
37 , Color_t col = Color_t(-1)
38 , Style_t sty = Style_t(-1)
39 , Size_t siz = Size_t (-1))
40 : fType(typ),fColor(col),fSty(sty),fSiz(siz) {}
41 Color_t Col()
const {
return fColor;}
42 Style_t Sty()
const {
return fSty; }
43 Size_t Siz()
const {
return fSiz; }
44 EDraw3DStyle Type()
const {
return fType; }
45 Color_t &Col() {
return fColor;}
46 Style_t &Sty() {
return fSty; }
47 Size_t &Siz() {
return fSiz; }
48 EDraw3DStyle &Type() {
return fType; }
49 void SetCol(Color_t col) { Col() = col;}
50 void SetSty(Style_t sty) { Sty() = sty;}
51 void SetSiz(Size_t siz) { Siz() = siz;}
52 void SetType(Color_t col, Style_t sty, Size_t siz)
53 { SetCol(col); SetSiz(siz); SetSty(sty); }
65 StEta &SetAngle(
double eta,
double dEta);
67 StEta(
double eta,
double dEta);
73 double Lambda()
const;
74 double LambdaDeg()
const ;
75 static double Lambda(
double eta);
76 double dLambda1()
const;
77 double dLambda2()
const;
78 operator double()
const;
79 const StEta operator-(
double eta);
80 const StEta operator+(
double eta);
85 StEta &operator+=(
double eta);
87 StEta &operator-=(
double eta);
90 inline StEta &StEta::SetAngle(
double eta,
double dEta) {
91 fEta = eta; fDEta = dEta;
92 fLambda = Lambda(eta);
93 fDLambda1 = Lambda(eta-dEta/2);
94 fDLambda2 = Lambda(eta+dEta/2);
97 inline double StEta::Lambda()
const {
return fLambda; }
99 inline double StEta::Lambda(
double eta) {
100 return 2*TMath::ATan(TMath::Exp(-eta));
103 inline StEta::StEta(
double eta,
double dEta) { SetAngle(eta,dEta); }
104 inline StEta::StEta(
const StEta &eta){
105 fLambda = eta.fLambda; fDLambda1 = eta.fDLambda1; fDLambda2 = eta.fDLambda2;
106 fEta = eta.fEta; fDEta = eta.fDEta;
108 inline StEta &StEta::operator=(
const StEta &eta) {
109 fLambda = eta.fLambda; fDLambda1 = eta.fDLambda1; fDLambda2 = eta.fDLambda2;
110 fEta = eta.fEta; fDEta = eta.fDEta;
113 inline double StEta::Deta()
const {
return fDEta; }
114 inline double StEta::Eta()
const {
return fEta; }
115 inline double StEta::LambdaDeg()
const{
return fLambda*TMath::RadToDeg(); }
116 inline double StEta::dLambda1()
const {
return fDLambda1; }
117 inline double StEta::dLambda2()
const {
return fDLambda2; }
118 inline StEta::operator double()
const {
return fLambda; }
119 inline const StEta StEta::operator-(
double eta) {
return StEta(fEta-eta,fDEta); }
120 inline const StEta StEta::operator+(
double eta) {
return StEta(fEta+eta,fDEta); }
121 inline const StEta StEta::operator-(
const StEta &eta) {
return operator-(eta.fEta); }
122 inline const StEta StEta::operator+(
const StEta &eta) {
return operator+(eta.fEta); }
124 inline StEta &StEta::operator+=(
const StEta &eta) {
return operator+=(eta.fEta); }
125 inline StEta &StEta::operator+=(
double eta) {
return SetAngle(fEta+eta,fDEta); }
126 inline StEta &StEta::operator-=(
const StEta &eta) {
return operator-=(eta.fEta); }
127 inline StEta &StEta::operator-=(
double eta) {
return SetAngle(fEta-eta,fDEta); }
168 static int fgDraw_3d_init;
169 std::map<EDraw3DStyle,StDraw3DStyle> fStyles;
172 TVirtualViewer3D *fViewer;
174 TString fDetectorName;
181 static Color_t fgColorDefault;
182 static Style_t fgStyDefault;
183 static Size_t fgSizDefault;
184 static Color_t fgBkColor;
185 static Int_t fDrawCanvasCounter;
186 TVirtualPad *InitPad();
191 virtual void UpdateViewer(TVirtualPad *pad=0);
194 StDraw3D(
const char *detectorName=
"TPC",TVirtualPad *pad = 0);
195 StDraw3D(TVirtualViewer3D *viewer,TVirtualPad *pad);
198 TVirtualPad *
Pad()
const;
199 TVirtualViewer3D *
Viewer()
const;
200 virtual void Clear(Option_t *opt=
"update");
201 virtual TObject *Draw(TObject *o,
const char *option=
"");
205 virtual void Draw(Option_t *option=
"") {TObject::Draw(option);}
210 virtual TObject *
Draw3D(
int n,
const float *xyz);
212 virtual TObject *
Draw3D(
int n,
const double *xyz);
214 virtual TObject *
Points(
int n,
const float *xyz
217 virtual TObject *
Points(
int n,
const double *xyz
220 virtual TObject *
Points(
int n,
const float *xyz
221 , Color_t col= Color_t(-1)
222 , Style_t sty= Style_t(-1)
223 , Size_t siz = Size_t (-1));
225 virtual TObject *
Points(
int n,
const double *xyz
226 , Color_t col= Color_t(-1)
227 , Style_t sty= Style_t(-1)
228 , Size_t siz = Size_t (-1));
230 virtual TObject *
Points(
const std::vector<float> &xyz
233 virtual TObject *
Points(
const std::vector<double> &xyz
236 virtual TObject *
Points(
const std::vector<float> &xyz
237 , Color_t col= Color_t(-1)
238 , Style_t sty= Style_t(-1)
239 , Size_t siz = Size_t (-1));
241 virtual TObject *
Points(
const std::vector<double> &xyz
242 , Color_t col= Color_t(-1)
243 , Style_t sty= Style_t(-1)
244 , Size_t siz = Size_t (-1));
246 virtual TObject *Point(
float x,
float y,
float z
247 , Color_t col= Color_t(-1)
248 , Style_t sty= Style_t(-1)
249 , Size_t siz = Size_t (-1));
251 virtual TObject *Point(
float x,
float y,
float z
254 virtual TObject *
Line(
int n,
const double *xyz
255 , Color_t col= Color_t(-1)
256 , Style_t sty= Style_t(-1)
257 , Size_t siz = Size_t (-1));
259 virtual TObject *
Line(
float x0,
float y0,
float z0
260 ,
float x1,
float y1,
float z1
261 , Color_t col= Color_t(-1)
262 , Style_t sty= Style_t(-1)
263 , Size_t siz = Size_t (-1));
265 virtual TObject *
Line(
int n,
const float *xyz
266 , Color_t col= Color_t(-1)
267 , Style_t sty= Style_t(-1)
268 , Size_t siz = Size_t (-1));
270 virtual TObject *
Line(
const std::vector<float> &xyz
271 , Color_t col= Color_t(-1)
272 , Style_t sty= Style_t(-1)
273 , Size_t siz = Size_t (-1));
275 virtual TObject *
Line(
const std::vector<double> &xyz
276 , Color_t col= Color_t(-1)
277 , Style_t sty= Style_t(-1)
278 , Size_t siz = Size_t (-1));
280 virtual TObject *
Line(
int n,
const float *xyz
283 virtual TObject *
Line(
int n,
const double *xyz
286 virtual TObject *
Line(
const std::vector<float> &xyz
289 virtual TObject *
Line(
const std::vector<double> &xyz
292 virtual TObject *
Tower(
float radius
293 ,
float lambda,
float lambda1,
float lambda2
294 ,
float phi,
float dphi
295 , Color_t col,Style_t sty, Size_t siz);
296 virtual TObject *
Tower(
float radius,
float lambda,
float phi
297 ,
float dlambda,
float dphi
298 , Color_t col,Style_t sty, Size_t siz);
300 ,
float phi,
float dphi
301 , Color_t col,Style_t sty, Size_t siz);
304 virtual void SetModel(TObject *model);
305 virtual void SetComment(
const char *cmnt);
306 virtual void AddComment(
const char *cmnt);
307 virtual void Print(
const char *filename)
const ;
308 virtual void Print(
const char *filename,
const char*type)
const ;
309 virtual void Save(
const char *filename,
const char*type=
"png")
const ;
310 virtual void Update(
bool asap=
false);
311 virtual void Modified();
312 virtual void UpdateModified();
314 virtual void SetFooter(
const char *footer);
318 static void ShowTest();
319 static void ShowDetectorTest(
const char *detectorName=
"StarDetectorUnfolding");
virtual void Update(bool asap=false)
Render all items from the current display list onto the screen and refesh the screen immiately if asa...
virtual const StDraw3DStyle & Style(EDraw3DStyle type) const
Return the reference to the predefined StDraw3DStyle object.
StDraw3DStyle maps "STAR event" EDraw3DStyle onto ROOT (color,style,size) attributes.
virtual void SetBkColor(Color_t newBkColor)
Set the ROOT color as the widget background.
static Color_t Pt2Color(double pt)
Maps the track pt to the STAR StTrack track color code.
virtual TObject * Tower(float radius, float lambda, float lambda1, float lambda2, float phi, float dphi, Color_t col, Style_t sty, Size_t siz)
This is an overloaded member function, provided for convenience.
virtual TObject * Line(int n, const double *xyz, Color_t col=Color_t(-1), Style_t sty=Style_t(-1), Size_t siz=Size_t(-1))
This is an overloaded member function, provided for convenience.
Class StDraw3D - to draw the 3D primitives like 3D points and 3D lines decorated with the STAR detect...
StDraw3D(const char *detectorName="TPC", TVirtualPad *pad=0)
StDraw3D( const char *detectorName,TVirtualPad *pad) ctor.
virtual const TString & DetectorNames() const
virtual const StDraw3DStyle & AddStyle(EDraw3DStyle type, Color_t col, Style_t sty, Size_t siz)
Map the predefined style type to the ROOT graphical attributes col color sty style siz size...
virtual void SetFooter(const char *footer)
Set the footer (caption) defined by the input footer text string.
virtual TObject * Points(int n, const float *xyz, EDraw3DStyle sty)
This is an overloaded member function, provided for convenience.
virtual void SetDetectors(const char *nameDetectors)
Set the list of the detector names to be used as the event "background".
virtual void Save(const char *filename, const char *type="png") const
This is an overloaded member function, provided for convenience.
void Draw3DTest()
The built-in quick test to check the application environment and test the basic methods.
virtual void Print(const char *filename) const
Save the current 3D scene using "wrl" file format.
TVirtualViewer3D * Viewer() const
TVirtualPad * Pad() const
virtual TObject * Draw3D(int n, const float *xyz)
This is an overloaded member function, provided for convenience.
virtual void SetDrawOption(Option_t *option="")
Set the varous drawing option. The method passes the input options to TQtCoinWidget::SetDrawOption me...
virtual void Clear(Option_t *opt="update")
Remove all objects from the list and update the screen if opt is "update".
virtual void AddDetectors(const char *nameDetectors)
Append the detector names to the list of the event "background" shapes.
virtual void Animate()
Animate the viewer from the gdb session.