StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StDraw3D.cxx
1 // $Id: StDraw3D.cxx,v 1.105 2013/11/12 17:50:22 perev Exp $
2 //*-- Author : Valery Fine(fine@bnl.gov) 27/04/2008
3 #include "StDraw3D.h"
4 #include "TCanvas.h"
5 #include "TCanvasImp.h"
6 #include "TTRAP.h"
7 #include "TGeometry.h"
8 #include "TVolume.h"
9 #include "TVolumePosition.h"
10 #include "TRotMatrix.h"
11 #include "TMath.h"
12 #include "TPolyMarker3D.h"
13 #include "TPolyLine3D.h"
14 #include "TSystem.h"
15 // #include "TROOT.h"
16 #include "TColor.h"
17 #include "TEnv.h"
18 #include "StCheckQtEnv.h"
19 #include "TStyle.h"
20 #include "TVirtualViewer3D.h"
21 #include <cassert>
22 #include <cmath>
23 
24 static Color_t colorDefault = Color_t(-1);
25 static Style_t styDefault = Style_t(-1);
26 static Size_t sizDefault = Size_t (-1);
27 
28 Color_t StDraw3D::fgColorDefault = Color_t(-1);
29 Style_t StDraw3D::fgStyDefault = Style_t(-1);
30 Size_t StDraw3D::fgSizDefault = Size_t (-1);
31 Color_t StDraw3D::fgBkColor = kBlack;
32 
33 // Canvas counter to create the Unique Canvas names
34 Int_t StDraw3D::fDrawCanvasCounter = -1;
35 
36 namespace {
37  const double p2 = TMath::PiOver2();
38  //__________________________________________________________________________________________
39  static inline void ForceAnimate(unsigned int times=0, int msecDelay=0)
40  {
41  unsigned int counter = times;
42  while( (!times || counter) && !gSystem->ProcessEvents()) { --counter; if (msecDelay) gSystem->Sleep(msecDelay);}
43  }
44 }
45 
46 //___________________________________________________
47 static inline TVirtualViewer3D *InitCoin(TVirtualPad *pad,const char *detectorName)
48 {
49  TVirtualViewer3D *viewer = 0;
50  // check Coin env and load if present
51  bool CheckCoin = true;
52  if (!StCheckQtEnv::SetQtEnv(false)) { CheckCoin = true; }
53 
54 // if (CheckCoin && pad ) {
55  if (CheckCoin) {
56  // define the background image
57  TString backShape = detectorName;
58  backShape.ReplaceAll(",",".iv,");
59  backShape+= ".iv";
60  printf(" Setting the background shape to be %s\n", backShape.Data());
61  gEnv->SetValue("Gui.InventorShapeDir",":.:StRoot/macros/graphics:$STAR/StRoot/macros/graphics:/afs/rhic.bnl.gov/star/doc/www/comp/2/vis/iv");
62  if ( (viewer = TVirtualViewer3D::Viewer3D(pad,"oiv") )) {
63  viewer->SetDrawOption(backShape.Data());
64  // Create Open GL viewer
65 // TGQt::SetCoinFlag(1);
66  viewer->BeginScene();
67  viewer->EndScene();
68  }
69  }
70  return viewer;
71 }
73 
77 //___________________________________________________
78 Color_t StDraw3DStyle::Pt2Color(double pt)
79 {
80  const Int_t lightness = 50;
81  const Int_t saturation = 100;
82  Int_t hue = (pt > 1.5 ) ? 0 : Int_t(256.*(1.-pt/1.5)); //color code from StuPostscript
83  Int_t r,g,b;
84  TColor::HLS2RGB(hue, lightness, saturation, r, g, b);
85  // Normalize
86  float factor = 1./sqrt(1.*r*r+1.*g*g+1.*b*b);
87  return TColor::GetColor(r*factor,g*factor,b*factor);
88 }
89 //___________________________________________________
90 //
91 // view_3D
92 //___________________________________________________
93 class view_3D {
94  private:
95  TObject *fModel;
96  TString fComment;
97  TString fObjectInfo;
98  void makeInfo()
99  {
100  fObjectInfo="";
101  if (fModel) {
102  fObjectInfo = Form("( %s *)%p ",fModel->ClassName(),fModel);
103  }
104  if (!fComment.IsNull()) fObjectInfo += fComment;
105  }
106  public:
107  view_3D(TObject *model = 0, const char *comment="") : fModel(model),fComment(comment)
108  { makeInfo(); }
109  ~view_3D(){;}
110  TObject *model() const { return fModel; }
111  void setModel(TObject *model) { fModel = model ; makeInfo(); }
112  void setComment(const char *comment) { fComment = comment; makeInfo(); }
113  void addComment(const char *comment) { fComment += comment; makeInfo(); }
114  const TString &info() const { return fObjectInfo; }
115 };
116 namespace {
117 //___________________________________________________
118 //
119 // poly_line_3D
120 //___________________________________________________
121 class poly_line_3D : public TPolyLine3D, public view_3D {
122  public:
123  poly_line_3D(Int_t n, Float_t *p, Option_t *option="") : TPolyLine3D(n,p),view_3D()
124  { SetBit(kCanDelete);}
125  poly_line_3D(Int_t n, Double_t *p, Option_t *option="") : TPolyLine3D(n,p),view_3D()
126  { SetBit(kCanDelete);}
127  virtual ~poly_line_3D(){;}
128  virtual char *GetObjectInfo(Int_t x, Int_t y) const
129  {
130  const TString &customInfo = info();
131  const char *info = 0;
132  if (customInfo.IsNull())
133  info = TPolyLine3D::GetObjectInfo(x,y);
134  else
135  info = customInfo.Data();
136  return (char *)info;
137  }
138  void Inspect() const {
139  if ( model() ) model()->Inspect();
140  else TPolyLine3D::Inspect();
141  }
142 };
143 
144 //___________________________________________________
145 //
146 // poly_marker_3D
147 //___________________________________________________
148 class poly_marker_3D : public TPolyMarker3D, public view_3D {
149  public:
150  poly_marker_3D(Int_t n, Float_t *p, Option_t *option="") : TPolyMarker3D(n,p,1,option),view_3D()
151  { SetBit(kCanDelete);}
152  poly_marker_3D(Int_t n, Double_t *p, Option_t *option="") : TPolyMarker3D(n,p,1,option),view_3D()
153  { SetBit(kCanDelete);}
154  virtual ~poly_marker_3D(){;}
155  virtual char *GetObjectInfo(Int_t x, Int_t y) const
156  {
157  const TString &customInfo = info();
158  const char *info = 0;
159  if (customInfo.IsNull())
160  info = TPolyMarker3D::GetObjectInfo(x,y);
161  else
162  info = customInfo.Data();
163  return (char *)info;
164  }
165  void Inspect() const {
166  if ( model() ) model()->Inspect();
167  else TPolyMarker3D::Inspect();
168  }
169 };
170 
171 //___________________________________________________
172 //
173 // TVolume_3D
174 //___________________________________________________
175 class volume_view_3D : public TVolume, public view_3D {
176  public:
177  volume_view_3D(const Text_t *name, const Text_t *title, TShape *shape, Option_t *option="")
178  : TVolume(name,title, shape,option),view_3D()
179  { SetBit(kCanDelete); }
180  volume_view_3D() : TVolume(),view_3D()
181  { SetBit(kCanDelete); }
182  virtual ~volume_view_3D(){
183  if (fListOfShapes) fListOfShapes->Delete();
184  ; }
185  virtual char *GetObjectInfo(Int_t x, Int_t y) const
186  {
187  const TString &customInfo = info();
188  const char *info = 0;
189  if (customInfo.IsNull())
190  info = TVolume::GetObjectInfo(x,y);
191  else
192  info = customInfo.Data();
193  return (char *)info;
194  }
195  void Inspect() const {
196  if ( model() ) model()->Inspect();
197  else TVolume::Inspect();
198  }
199 };
200 }
201 
203 
247 //___________________________________________________
248 StDraw3D::StDraw3D(const char *detectorName,TVirtualPad *pad): fPad(pad),fBkColor(fgBkColor),fViewer(0),fView(0)
249  , fDetectorName(detectorName),fMaster(0),fTopVolume(0),fWantPad(0),fOwnViewer(kTRUE),fOwnPad(pad?kFALSE:kTRUE)
250 {
251 
252  // The detectorName is a comma separated list of the OpenInventor files with no extension
253  // For all names on the list one should provide the iv file with the "iv extension:
254  // <name>.iv
255  Init();
256 }
257 //__________________________________________________________________________________________
258 void StDraw3D::Init()
259 {
260  static const Style_t UHitSty = 4; static const Size_t UHitSiz = 0.0; static const Color_t UHitCol=kBlue;
261  static const Style_t NHitSty = 2; static const Size_t NHitSiz = 0.0; static const Color_t NHitCol=kGreen;
262  static const Style_t TrakSty = 1; static const Size_t TrakSiz = 2.00; static const Color_t TrakCol=kRed;
263  static const Style_t VertSty = 5; static const Size_t VertSiz = 3.50; static const Color_t VertCol=kYellow;
264  AddStyle(kVtx, VertCol,VertSty,VertSiz);
265  AddStyle(kPrimaryTrack,TrakCol,TrakSty,TrakSiz);
266  AddStyle(kGlobalTrack, TrakCol,TrakSty,TrakSiz);
267  AddStyle(kTrackBegin, VertCol,VertSty,VertSiz);
268  AddStyle(kTrackEnd, VertCol,VertSty,VertSiz);
269  AddStyle(kUsedHit, UHitCol,UHitSty,UHitSiz);
270  AddStyle(kUnusedHit, NHitCol,NHitSty,NHitSiz);
271 }
272 //__________________________________________________________________________________________
274 
276 StDraw3D::StDraw3D(TVirtualViewer3D *viewer,TVirtualPad *pad): fPad(pad),fBkColor(fgBkColor),fViewer(viewer),fView(0)
277  , fDetectorName(),fMaster(),fTopVolume(),fWantPad(0),fOwnViewer(kFALSE),fOwnPad(kFALSE)
278 {
279  Init();
280 }
281 
282 //__________________________________________________________________________________
283 TVirtualPad *StDraw3D::InitPad()
284 {
285  if (fMaster) fMaster->InitPad();
286  else if (!fPad && !fWantPad ) {
287  fDrawCanvasCounter++;
288  TString canvasName = "STAR";
289  TString canvasTitle;
290  if (fDrawCanvasCounter) {
291  canvasName+="_";
292  canvasName += fDrawCanvasCounter;
293  canvasTitle += fDrawCanvasCounter;
294  canvasTitle += " : ";
295  }
296  canvasTitle += "STAR Event Viewer";
297  fPad = new TCanvas(canvasName.Data(),canvasTitle.Data(), 400,400);
298  fPad->SetFillColor(fBkColor);
299  fPad->Modified();
300  fPad->Update();
301  fPad->GetCanvas()->GetCanvasImp()->Iconify();
302  }
303  return Pad();
304 }
305 //__________________________________________________________________________________
306 void StDraw3D::InitViewer()
307 {
308  //Create 3D viewer if no master provided
309 
310  if (fMaster) fMaster->InitViewer();
311  else if ( !fViewer ) fViewer = InitCoin(fPad,fDetectorName);
312  assert(Viewer());
313 }
314 //___________________________________________________
315 StDraw3D::~StDraw3D()
316 {
317  if (fPad) {
318  if (!fMaster) fPad->Clear();
319  if (fOwnPad) delete fPad; // TPad will destroy the viewer
320  fPad = 0;
321  fMaster = 0;
322  fTopVolume = 0;
323  fViewer = 0;
324  }
325 }
326 
327 
328 //__________________________________________________________________________________________
330 //__________________________________________________________________________________
331 const TString &StDraw3D::DetectorNames() const
332 {
333  // return the list of the names
334  return fDetectorName;
335 }
336 
337 //__________________________________________________________________________________________
340 //__________________________________________________________________________________
341 TVirtualPad *StDraw3D::Pad() const
342 {
343  return fMaster ? fMaster->Pad() : fPad;
344 }
345 
346 //__________________________________________________________________________________________
348 //__________________________________________________________________________________
349 TVirtualViewer3D *StDraw3D::Viewer() const
350 {
351  return fMaster ? fMaster->Viewer() : fViewer;
352 }
353 
354 //__________________________________________________________________________________________
356 
361 //__________________________________________________________________________________
362 void StDraw3D::SetDetectors(const char*nameDetectors)
363 {
364  // The detectorName is a comma separated list of the OpenInventor files with no extension
365  // For all names on the list one should provide the iv file with the "iv extension:
366  // <name>.iv
367  if (fViewer) {
368  Warning("StDraw3D::SetDetectors","Can not change the detector names. It is too late. The viewer had been created");
369  } else {
370  fDetectorName = nameDetectors;
371  }
372 }
373 
374 //__________________________________________________________________________________________
376 
381 //__________________________________________________________________________________
382 void StDraw3D::AddDetectors(const char*nameDetectors)
383 {
384  // The detectorName is a comma separated list of the OpenInventor files with no extension
385  // For all names on the list one should provide the iv file with the "iv extension:
386  // <name>.iv
387 
388  if (fViewer) {
389  Warning("StDraw3D::AddDetectors","Can not the change detector names. It is too late. The viewer had been created");
390  } else if (nameDetectors && nameDetectors[0]){
391  fDetectorName += ",";
392  fDetectorName += nameDetectors;
393  }
394 }
395 
397 //___________________________________________________
398 void StDraw3D::Clear(Option_t *opt)
399 {
400  // Clear the view
401  TVirtualPad *pad = Pad();
402  if (pad) {
403  pad->Clear();
404  fTopVolume = 0;
405  if ( !strcmp(opt,"update") ) Update();
406  } else if ( TVirtualViewer3D *viewer = Viewer() ) {
407  viewer->Clear();
408  }
409  if (gGeometry) {
410  gGeometry->GetListOfMatrices()->Clear();
411  gGeometry->GetListOfShapes()->Delete();
412  }
413  TCollection::EmptyGarbageCollection();
414 }
415 
416 //___________________________________________________
417 TObject *StDraw3D::Draw(TObject *o,const char *option)
418 {
419  // Draw the 3d object
420  // and set the new background color if needed
421  if (o) {
422  TVirtualPad *sav = gPad;
423  if (!Pad()) InitPad();
424  TVirtualPad *thisPad = Pad();
425  if (thisPad) {
426  if (thisPad != sav) thisPad->cd();
427  assert (fPad==gPad);
428  o->Draw(option);
429  }
430  if (thisPad && sav && (thisPad != sav)) sav->cd();
431  if (!Viewer()) InitViewer();
432  if (!thisPad) {
433  // no TPad was provided by the user
434  // Use TVirtualViewer3D directly
435  Viewer()->ObjectPaint(o,option);
436  }
437  }
438  return o;
439 }
440 
441 //__________________________________________________________________________________________
443 
446 //___________________________________________________
447 void StDraw3D::SetBkColor(Color_t newBkColor)
448 {
449  // Set the canvas background color;
450  fBkColor = newBkColor;
451  TVirtualPad *pad = Pad();
452  if (pad && pad->GetFillColor() != fBkColor)
453  pad->SetFillColor(fBkColor);
454 }
455 
456 
457 //__________________________________________________________________________________________
459 
468 //___________________________________________________
469 const StDraw3DStyle &StDraw3D::AddStyle(EDraw3DStyle type,Color_t col,Style_t sty,Size_t siz)
470 {
471  fStyles.insert(std::pair<EDraw3DStyle,StDraw3DStyle>(type,StDraw3DStyle(type,col,sty,siz)));
472  return Style(type);
473 }
474 
475 
476 //__________________________________________________________________________________________
478 
481 //__________________________________________________________________________________________
482 const StDraw3DStyle &StDraw3D::Style(EDraw3DStyle type) const
483 {
484  return fStyles.find(type)->second;
485 }
486 
487 //__________________________________________________________________________________________
488 StDraw3DStyle &StDraw3D::Style(EDraw3DStyle type)
489 {
490  return fStyles[type];
491 }
492 
493 //__________________________________________________________________________________________
495 
503 //__________________________________________________________________________________________
504 TObject *StDraw3D::Points(int n, const float *xyz, Color_t col,Style_t sty,Size_t siz)
505 {
506  //
507  // Draw "n" points of the "xyz" array of the float coordinates
508  // with ROOT TPolyMarker3D class
509  // with the ROOT color, style, size attributes
510  //
511 
512  poly_marker_3D *plMk = new poly_marker_3D(n,(Float_t*)xyz);
513  if (col != colorDefault) plMk->SetMarkerColor(col);
514  if (sty != styDefault) plMk->SetMarkerStyle(sty);
515  if (siz != sizDefault) plMk->SetMarkerSize(siz);
516  fView = plMk;
517  return Draw(plMk);
518 }
519 
520 //__________________________________________________________________________________________
522 
530 //__________________________________________________________________________________________
531 TObject *StDraw3D::Points(int n, const double *xyz, Color_t col,Style_t sty,Size_t siz)
532 {
533  //
534  // Draw "n" points of the "xyz" array of the float coordinates
535  // with ROOT TPolyMarker3D class
536  // with the ROOT color, style, size attributes
537  //
538 
539  poly_marker_3D *plMk = new poly_marker_3D(n,(Double_t*)xyz);
540  if (col != colorDefault) plMk->SetMarkerColor(col);
541  if (sty != styDefault) plMk->SetMarkerStyle(sty);
542  if (siz != sizDefault) plMk->SetMarkerSize(siz);
543  fView = plMk;
544  return Draw(plMk);
545 }
546 
547 //__________________________________________________________________________________________
549 
556 //__________________________________________________________________________________________
557 TObject *StDraw3D::Points(const std::vector<float> &xyz, Color_t col,Style_t sty,Size_t siz)
558 {
559  //
560  // Draw the "xyz" vector of the float coordinates
561  // with ROOT TPolyMarker3D class
562  // with the ROOT color, style, size attributes
563  //
564  return Points(xyz.size()/3,&xyz[0],col,sty,siz);
565 }
566 
567 //__________________________________________________________________________________________
569 
576 //__________________________________________________________________________________________
577 TObject *StDraw3D::Points(const std::vector<double> &xyz, Color_t col,Style_t sty,Size_t siz)
578 {
579  //
580  // Draw the "xyz" vector of the float coordinates
581  // with ROOT TPolyMarker3D class
582  // with the ROOT color, style, size attributes
583  //
584  return Points(xyz.size()/3,&xyz[0],col,sty,siz);
585 }
586 
587 //__________________________________________________________________________________________
589 
595 //__________________________________________________________________________________________
596 TObject *StDraw3D::Points(int n, const float *xyz, EDraw3DStyle sty)
597 {
598  //
599  // Draw "n" points of the "xyz" array of the float coordinates
600  // with ROOT TPolyMarker3D class and the predefined attrbutes
601  //
602  // This is an overloaded member function, provided for convenience.
603  // It behaves essentially like the above function.
604  //
605 
606  const StDraw3DStyle &style = Style(sty);
607  return Points(n, xyz, style.Col(),style.Sty(),style.Siz());
608 }
609 
610 //__________________________________________________________________________________________
612 
618 //__________________________________________________________________________________________
619 TObject *StDraw3D::Points(int n, const double *xyz, EDraw3DStyle sty)
620 {
621  //
622  // Draw "n" points of the "xyz" array of the float coordinates
623  // with ROOT TPolyMarker3D class and the predefined attrbutes
624  //
625  // This is an overloaded member function, provided for convenience.
626  // It behaves essentially like the above function.
627  //
628 
629  const StDraw3DStyle &style = Style(sty);
630  return Points(n, xyz, style.Col(),style.Sty(),style.Siz());
631 }
632 
633 //__________________________________________________________________________________________
635 
640 //__________________________________________________________________________________________
641 TObject *StDraw3D::Points(const std::vector<float> &xyz, EDraw3DStyle sty)
642 {
643  //
644  // Draw "xyz" vector of the float coordinates
645  // with ROOT TPolyMarker3D class and the predefined attrbutes
646  //
647  // This is an overloaded member function, provided for convenience.
648  // It behaves essentially like the above function.
649  //
650 
651  const StDraw3DStyle &style = Style(sty);
652  return Points(xyz, style.Col(),style.Sty(),style.Siz());
653 }
654 
655 //__________________________________________________________________________________________
657 
662 //__________________________________________________________________________________________
663 TObject *StDraw3D::Points(const std::vector<double> &xyz, EDraw3DStyle sty)
664 {
665  //
666  // Draw "xyz" vector of the float coordinates
667  // with ROOT TPolyMarker3D class and the predefined attrbutes
668  //
669  // This is an overloaded member function, provided for convenience.
670  // It behaves essentially like the above function.
671  //
672 
673  const StDraw3DStyle &style = Style(sty);
674  return Points(xyz, style.Col(),style.Sty(),style.Siz());
675 }
676 
677 //__________________________________________________________________________________________
679 
685 //___________________________________________________
686 TObject *StDraw3D::Draw3D(int n, const float *xyz)
687 {
688  //
689  // Draw "n" points of the "xyz" array of the float coordinates
690  // and the kVtx attrbute
691  //
692  // This is an overloaded member function, provided for convenience.
693  // It behaves essentially like the above function.
694  //
695  return Points(n,xyz,kVtx);
696 }
697 
698 //__________________________________________________________________________________________
700 
706 //___________________________________________________
707 TObject *StDraw3D::Draw3D(int n, const double *xyz)
708 {
709  //
710  // Draw "n" points of the "xyz" array of the float coordinates
711  // and the kVtx attrbute
712  //
713  // This is an overloaded member function, provided for convenience.
714  // It behaves essentially like the above function.
715  //
716  return Points(n,xyz,kVtx);
717 }
718 //___________________________________________________
719 TObject *StDraw3D::Point(float x, float y, float z, Color_t col,Style_t sty,Size_t siz)
720 {
721  //
722  // Draw ONE 3D marker with ROOT TPolyMarker3D class at x,y,z position
723  // with the ROOT color, style, size attributes
724  //
725 
726  float xyz[]={x,y,z};
727  return Points(1,xyz,col,sty,siz);
728 }
729 
730 //___________________________________________________
731 TObject *StDraw3D::Point(float x, float y, float z, EDraw3DStyle sty)
732 {
733  //
734  // Draw ONE 3D marker with ROOT TPolyMarker3D class at x,y,z position
735  // and the predefined attrbutes
736  //
737  // This is an overloaded member function, provided for convenience.
738  // It behaves essentially like the above function.
739  //
740  const StDraw3DStyle &style = Style(sty);
741  return Point(x,y, z, style.Col(),style.Sty(),style.Siz());
742 }
743 
744 //__________________________________________________________________________________________
746 
754 //__________________________________________________________________________________________
755 TObject *StDraw3D::Line(int n, const float *xyz, Color_t col,Style_t sty,Size_t siz)
756 {
757  //
758  // Draw "n" connected points of the "xyz" array of the float coordinates
759  // with ROOT TPolyline3D class
760  // with the ROOT color, style, size attributes
761  //
762  poly_line_3D *plLine = new poly_line_3D(n,(Float_t*)xyz);
763  if (col != colorDefault) plLine->SetLineColor(col);
764  if (sty != styDefault) plLine->SetLineStyle(sty);
765  if (siz != sizDefault) plLine->SetLineWidth(Width_t(siz));
766  fView = plLine;
767  return Draw(plLine);
768 }
769 
770 //__________________________________________________________________________________________
772 
780 //__________________________________________________________________________________________
781 TObject *StDraw3D::Line(float x0, float y0, float z0, float x1, float y1, float z1, Color_t col,Style_t sty,Size_t siz)
782 {
783  //
784  // Draw "n" connected points of the "xyz" array of the float coordinates
785  // with ROOT TPolyline3D class
786  // with the ROOT color, style, size attributes
787  //
788  std::vector<float> line(6);
789  int i = 0;
790  line[i++]=x0;line[i++]=y0;line[i++]=z0;
791  line[i++]=x1;line[i++]=y1;line[i++]=z1;
792  return Line(line,col,sty,siz);
793 }
794 
795 
796 //__________________________________________________________________________________________
798 
806 //__________________________________________________________________________________________
807 TObject *StDraw3D::Line(int n, const double *xyz, Color_t col,Style_t sty,Size_t siz)
808 {
809  //
810  // Draw "n" connected points of the "xyz" array of the float coordinates
811  // with ROOT TPolyline3D class
812  // with the ROOT color, style, size attributes
813  //
814  poly_line_3D *plLine = new poly_line_3D(n,(Double_t*)xyz);
815  if (col != colorDefault) plLine->SetLineColor(col);
816  if (sty != styDefault) plLine->SetLineStyle(sty);
817  if (siz != sizDefault) plLine->SetLineWidth(Width_t(siz));
818  fView = plLine;
819  return Draw(plLine);
820 }
821 //__________________________________________________________________________________________
823 
830 //__________________________________________________________________________________________
831 TObject *StDraw3D::Line(const std::vector<float> &xyz, Color_t col,Style_t sty,Size_t siz)
832 {
833  //
834  // Draw the "xyz" vector of the float coordinates
835  // with ROOT TPolyline3D class
836  // with the ROOT color, style, size attributes
837  //
838  return Line(xyz.size()/3, &xyz[0], col,sty,siz);
839 }
840 
841 //__________________________________________________________________________________________
843 
850 //__________________________________________________________________________________________
851 TObject *StDraw3D::Line(const std::vector<double> &xyz, Color_t col,Style_t sty,Size_t siz)
852 {
853  //
854  // Draw the "xyz" vector of the float coordinates
855  // with ROOT TPolyline3D class
856  // with the ROOT color, style, size attributes
857  //
858  return Line(xyz.size()/3, &xyz[0], col,sty,siz);
859 }
860 
861 //__________________________________________________________________________________________
863 
868 //___________________________________________________
869 TObject *StDraw3D::Line(const std::vector<float> &xyz, EDraw3DStyle sty)
870 {
871  //
872  // Draw "n" connected points of the "xyz" array of the float coordinates
873  // with ROOT TPolyLine3D class and the predefined attrbutes
874  //
875  // This is an overloaded member function, provided for convenience.
876  // It behaves essentially like the above function.
877  //
878  const StDraw3DStyle &style = Style(sty);
879  return Line(xyz, style.Col(),style.Sty(),style.Siz() );
880 }
881 
882 //__________________________________________________________________________________________
884 
889 //___________________________________________________
890 TObject *StDraw3D::Line(const std::vector<double> &xyz, EDraw3DStyle sty)
891 {
892  //
893  // Draw "n" connected points of the "xyz" array of the float coordinates
894  // with ROOT TPolyLine3D class and the predefined attrbutes
895  //
896  // This is an overloaded member function, provided for convenience.
897  // It behaves essentially like the above function.
898  //
899  const StDraw3DStyle &style = Style(sty);
900  return Line(xyz, style.Col(),style.Sty(),style.Siz() );
901 }
902 
903 //__________________________________________________________________________________________
905 
911 //___________________________________________________
912 TObject *StDraw3D::Line(int n, const float *xyz,EDraw3DStyle sty)
913 {
914  //
915  // Draw "n" connected points of the "xyz" array of the float coordinates
916  // with ROOT TPolyLine3D class and the predefined attrbutes
917  //
918  // This is an overloaded member function, provided for convenience.
919  // It behaves essentially like the above function.
920  //
921  const StDraw3DStyle &style = Style(sty);
922  return Line(n,xyz, style.Col(),style.Sty(),style.Siz() );
923 }
924 
925 //__________________________________________________________________________________________
927 
933 //___________________________________________________
934 TObject *StDraw3D::Line(int n, const double *xyz,EDraw3DStyle sty)
935 {
936  //
937  // Draw "n" connected points of the "xyz" array of the float coordinates
938  // with ROOT TPolyLine3D class and the predefined attrbutes
939  //
940  // This is an overloaded member function, provided for convenience.
941  // It behaves essentially like the above function.
942  //
943  const StDraw3DStyle &style = Style(sty);
944  return Line(n,xyz, style.Col(),style.Sty(),style.Siz() );
945 }
946 
947 //___________________________________________________
948 void StDraw3D::Joint(StDraw3D *dsp)
949 {
950  // The method to force two different instances
951  // of the StDraw3D class paint onto one and the same
952  // TPad.
953 
954  // Force "dsp" to share the fPad of this object
955  // As result of the "Joint" method both objects
956  // "this" as well as "dsp" will share the TPad of "this" object.
957  // The original TPad of "dsp" is to be abandoned if exists
958 
959  if (dsp) dsp->SetMaster(this);
960 }
961 //___________________________________________________
962 void StDraw3D::Redraw()
963 {
964  // Move all existent view to the master window if any
965  if (fMaster && fPad) {
966  TList *p = fPad->GetListOfPrimitives();
967  if (p) {
968  TObject *o = 0;
969  TIter next(p);
970  while ( (o=next()) ) Draw(o);
971  p->Clear();
972  }
973  }
974 }
975 //___________________________________________________
976 void StDraw3D::SetMaster(StDraw3D *master)
977 {
978  //Make this object slave of the "master" object
979  if (fMaster != master) {
980  if (fMaster)
981  Error("StDraw3D::SetMaster"
982  ,"The object (StDraw3D*)%p already has another master %p", this, fMaster);
983  fMaster = master;
984  Redraw();
985  }
986 }
987 
988 //___________________________________________________
989 void StDraw3D::SetModel(TObject *model)
990 {
991  // add the "model" reference to the current view
992  if (fView) fView->setModel(model);
993 }
994 
995 //___________________________________________________
996 void StDraw3D::SetComment(const char *cmnt)
997 {
998  // set the "model" comment for the current view
999  if (fView) fView->setComment(cmnt);
1000 }
1001 
1002 //___________________________________________________
1003 void StDraw3D::AddComment(const char *cmnt)
1004 {
1005  // add the "model" comment for the current view
1006  if (fView) fView->addComment(cmnt);
1007 }
1008 
1009 //___________________________________________________
1011 
1031 //___________________________________________________
1032 void StDraw3D::Print(const char *filename) const
1033 {
1034  Save(filename,"wrl");
1035 }
1036 
1038 
1044 //___________________________________________________
1045 void StDraw3D::Print(const char *filename, const char*type) const
1046 {
1047  Save(filename,type);
1048 }
1049 
1050 //___________________________________________________
1052 
1058 //___________________________________________________
1059 void StDraw3D::Save(const char *filename, const char*type) const
1060 {
1061  if ( TVirtualViewer3D *viewer = Viewer() ) {
1062  viewer->Print(filename);
1063 // viewer->PrintObjects();
1064  }
1065  else if (Pad()) Pad()->Print(filename,type);
1066 }
1067 
1068 
1069 //___________________________________________________
1071 
1096 //___________________________________________________
1097 void StDraw3D::SetDrawOption(Option_t *options)
1098 {
1099  if ( TVirtualViewer3D *viewer = Viewer() )
1100  viewer->SetDrawOption(options);
1101 }
1102 
1103 //___________________________________________________
1105 
1108 //___________________________________________________
1109 void StDraw3D::Update(bool asap)
1110 {
1111  TVirtualPad *pad = Pad();
1112  if (pad) {
1113  TVirtualPad *sav = gPad;
1114  if (pad != sav) pad->cd();
1115  assert (pad==gPad);
1116  pad->Update();
1117  if (sav && (pad != sav)) sav->cd();
1118  } else {
1119  UpdateViewer(0);
1120  }
1121  if (asap) ForceAnimate(1);
1122 }
1123 
1124 //___________________________________________________
1125 void StDraw3D::Modified()
1126 {
1127  // One doesn't need to call this method
1128  // because one can not change any object yet
1129  TVirtualPad *pad = Pad();
1130  if (pad) {
1131  TVirtualPad *sav = gPad;
1132  if (pad != sav) pad->cd();
1133  assert (pad==gPad);
1134  pad->Modified();
1135  if (sav && (pad != sav)) sav->cd();
1136  }
1137 }
1138 
1139 //_______________________________________________________________
1140 void StDraw3D::UpdateModified()
1141 {
1142  // One doesn't need to call this method
1143  // because one can not change any object yet
1144  TVirtualPad *pad = Pad();
1145  if (pad) {
1146  TVirtualPad *sav = gPad;
1147  if (pad != sav) pad->cd();
1148  assert (pad==gPad);
1149  pad->Modified();
1150  pad->Update();
1151  if (sav && (pad != sav)) sav->cd();
1152  }
1153 }
1154 
1155 //_______________________________________________________________
1156 void StDraw3D::UpdateViewer(TVirtualPad *pad)
1157 {
1158  TVirtualViewer3D *viewer = Viewer();
1159  if (viewer) {
1160  if (fTopVolume) Draw(fTopVolume,"same");
1161  viewer->PadPaint(pad);
1162  }
1163 }
1164 
1165 //___________________________________________________
1167 
1177 //___________________________________________________
1179  // ------------------------------------------------
1180  // The method to test the class
1181  // It should produce the 3D Coin widget:
1182  // <begin_html> <img src="http://www.star.bnl.gov/public/comp/vis/StDraw3D/examples/Draw3DClass.png">end_html
1183  // ------------------------------------------------
1184  // x y z
1185  // ------------------------------------------------
1186  float xyz[] = { 189.195, 27.951, 123.966
1187  ,187.195, 28.6187, 122.89
1188  ,181.195 ,30.6788 ,119.556
1189  ,179.195 ,31.3387 ,118.454
1190  ,177.195 ,32.0065 ,117.328
1191  ,175.195 ,32.6132 ,116.26
1192  ,173.195 ,33.2385 ,115.146
1193  ,171.195 ,33.8552 ,114.016
1194  ,169.195 ,34.3924 ,112.964
1195  };
1196 
1197  int sizeXYZ = sizeof(xyz)/sizeof(float)/3;
1198 
1199  Draw3D(sizeXYZ,xyz);
1200  SetComment("The hits from the TPC sector");
1201 
1202  Line(sizeXYZ,xyz,kGlobalTrack);
1203  SetComment("The recontstructed track");
1204 
1205  Tower(192,0.365*p2,TMath::Pi()/22
1206  ,TMath::Pi()/65,TMath::Pi()/80
1207  ,kYellow, kBarrelStyle+4050, 250);
1208  SetComment(Form("The EMC tower lambda=%f phi=%f energy=%f",0.365*p2,TMath::Pi()/22,250.0));
1209  Tower(192,-0.365*p2,-TMath::Pi()/22-TMath::Pi()/4
1210  ,TMath::Pi()/65,TMath::Pi()/80
1211  ,kBlue, kBarrelStyle+4050, 50);
1212  Tower(230,-0.365*p2,-TMath::Pi()/22-3*TMath::Pi()/4
1213  ,TMath::Pi()/65,TMath::Pi()/80
1214  ,kCyan, 4050, 50);
1215  SetComment(Form("The EndCup tower lambda=%f phi=%f energy=%f",-0.365*p2,-TMath::Pi()/22,50.0));
1216  Tower(230,0.365*p2,-TMath::Pi()/22+p2
1217  ,TMath::Pi()/65,TMath::Pi()/80
1218  ,kGreen, 0, 150);
1219  // Use the pseudorapidity units:
1220  int sector=20;
1221  double stepEta = (1.0-0.0)/sector;
1222  StarRoot::StEta eta(1-stepEta,stepEta);
1223  StarRoot::StEta eta2(1,stepEta);
1224  StarRoot::StEta eta3(-1,stepEta);
1225  StarRoot::StEta eta4(-1+stepEta,stepEta);
1226  float phi = 0;
1227  int n = sector;
1228  for (int i=0;i<n;i++) {
1229  Tower(193,eta,phi,TMath::Pi()/120,(i+1)%8,kBarrelStyle,5*i+25);
1230  SetComment(Form("The East EMC tower pseudorapidity=%f phi=%f energy=%f",eta.Eta(),phi,5*i+25.));
1231 
1232  Tower(193,eta4,phi+0.2,TMath::Pi()/120,(i+1)%8,kBarrelStyle,5*i+25);
1233  SetComment(Form("The West EMC tower pseudorapidity=%f phi=%f energy=%f",eta4.Eta(),phi+0.2,5*i+25.));
1234 
1235  Tower(230,eta2,phi+0.1,TMath::Pi()/60,(i+2)%8,4060,10*i+40);
1236  SetComment(Form("The East Endcap tower pseudorapidity=%f phi=%f energy=%f",eta2.Eta(),phi,10*i+40.));
1237 
1238  Tower(230,eta3,phi+0.1,TMath::Pi()/60,(i+2)%8,4060,10*i+40);
1239  SetComment(Form("The West Endcap tower pseudorapidity=%f phi=%f energy=%f",eta2.Eta(),phi,10*i+40.));
1240 
1241  eta -=stepEta;
1242  eta2 +=stepEta;
1243  eta3 -=stepEta;
1244  eta4 +=stepEta;
1245  phi += 4*TMath::Pi()/n;
1246  }
1247  if (!Pad()) Update();
1248 }
1249 
1250 //______________________________________________________________________________
1251 void StDraw3D::ShowDetectorTest(const char *detectorName)
1252 {
1253  // Test to show the detector geometry only
1254  StDraw3D *viewer = new StDraw3D(detectorName);
1255  if (!viewer->Viewer()) viewer->InitViewer();
1256 }
1257 //______________________________________________________________________________
1258 void StDraw3D::ShowTest()
1259 {
1260  // More complex test.
1261  //
1262  // It creates TWO different widgets
1263  // One is decorated with the detector geometry,
1264  // another one "plain"
1265  //
1266  // Method does not recreate the widgets when it is called
1267  // for several times
1268  //
1269  // It creates the widget at once and reuses it with each call.
1270 
1271  static StDraw3D *fine[2]={0};
1272  if (!fine[0]) {
1273  fine[0] = new StDraw3D;
1274  fine[1] = new StDraw3D(0);// View with no detector geometry decoration
1275  } else {
1276  fine[0]->Clear();
1277  fine[1]->Clear();
1278  }
1279 // P G P G
1280  float NodX[100][3]= {{189.195, 27.951, 123.966}
1281  ,{187.195, 28.6187, 122.89 }
1282  ,{181.195 ,30.6788 ,119.556}
1283  ,{179.195 ,31.3387 ,118.454}
1284  ,{177.195 ,32.0065 ,117.328}
1285  ,{175.195 ,32.6132 ,116.26 }
1286  ,{173.195 ,33.2385 ,115.146}
1287  ,{171.195 ,33.8552 ,114.016}
1288  ,{169.195 ,34.3924 ,112.964}};
1289 
1290  float HitX[100][3]= {{189.195, 27.951, 123.966}
1291  ,{187.195, 28.6187, 122.89 }
1292  ,{181.195 ,30.6788 ,119.556}
1293  ,{179.195 ,31.3387 ,118.454}
1294  ,{177.195 ,32.0065 ,117.328}
1295  ,{175.195 ,32.6132 ,116.26 }
1296  ,{173.195 ,33.2385 ,115.146}
1297  ,{171.195 ,33.8552 ,114.016}
1298  ,{169.195 ,34.3924 ,112.964}};
1299 
1300  float NodL[100][3]= {{189.195+5, 27.951+10, 123.966-50}
1301  ,{187.195+5, 28.6187+10, 122.89-50 }
1302  ,{181.195+5 ,30.6788+10 ,119.556-50}
1303  ,{179.195+5 ,31.3387+10 ,118.454-50}
1304  ,{177.195+5 ,32.0065+10 ,117.328-50}
1305  ,{175.195+5 ,32.6132+10 ,116.26-50 }
1306  ,{173.195+5 ,33.2385+10 ,115.146-50}
1307  ,{171.195+5 ,33.8552+10 ,114.016-50}};
1308  float HitL[100][3]= {{189.195+5, 27.951+10, 123.966-50}
1309  ,{187.195+5, 28.6187+10, 122.89-50 }
1310  ,{181.195+5 ,30.6788+10 ,119.556-50}
1311  ,{179.195+5 ,31.3387+10 ,118.454-50}
1312  ,{177.195+5 ,32.0065+10 ,117.328-50}
1313  ,{175.195+5 ,32.6132+10 ,116.26-50 }
1314  ,{173.195+5 ,33.2385+10 ,115.146-50}
1315  ,{171.195+5 ,33.8552+10 ,114.016-50}};
1316  int nN=9,nH=9;
1317  // Draw the test points
1318  fine[0]->Points(nH, HitX[0], kVtx);
1319  fine[0]->SetComment("Hits and Geometry");
1320 
1321  fine[0]->Line (nN, NodX[0], kGlobalTrack);
1322  fine[0]->SetComment("Track and Geometry");
1323 
1324  fine[1]->Points(nH, HitL[0], kVtx);
1325  fine[1]->SetComment("Hits no Geometry");
1326 
1327  fine[1]->Line (nN, NodL[0], kGlobalTrack);
1328  fine[1]->SetComment("Track no Geometry");
1329  for (int i=0;i<2;i++) { fine[i]->UpdateModified(); }
1330 // while(!gSystem->ProcessEvents()){};
1331 }
1332 
1334 
1373 //__________________________________________________________________________________________
1374 TObject *StDraw3D::Tower(float radius
1375  , float lambda, float phi
1376  , float dlambda, float dphi
1377  , Color_t col,Style_t sty, Size_t siz)
1378 {
1379  float d2 = dlambda/2;
1380  return Tower(radius, lambda,lambda-d2, lambda+d2,phi, dphi, col, sty, siz);
1381 }
1383 
1424 //__________________________________________________________________________________________
1425 TObject *StDraw3D::Tower(float radius, float lambda, float lambda1, float lambda2, float phi,float dphi, Color_t col,Style_t sty, Size_t siz)
1426 {
1427  if (gGeometry) {
1428  gGeometry->GetListOfMatrices()->Clear();
1429  }
1430  if (lambda2-lambda1 < 0 ) {
1431  Warning("StDraw3D::Tower", "The illegal negative value for dlambda = %f", lambda2-lambda1);
1432  float swp = lambda1;
1433  lambda1 = lambda2;
1434  lambda2 = swp;
1435  }
1436  if (dphi < 0 ) {
1437  Warning("StDraw3D::Tower", "The illegal negative value for dphi = %f", dphi);
1438  dphi = -dphi;
1439  }
1440  float zNear, xNear, x1Near,x2Near, yNear, y1Near,y2Near, zFar, xFar, yFar, x1Far,x2Far, y1Far, y2Far;
1441  // redefine size
1442  siz = siz *TMath::Cos(lambda);
1443 
1444  bool barrel = (sty >= kBarrelStyle);
1445  if (barrel) {
1446  lambda = -lambda;
1447  // dlambda1 = -dlambda1;
1448  // dlambda2 = -dlambda2;
1449  }
1450 
1451  zNear = radius;
1452 
1453  yNear = zNear*TMath::Tan(lambda);
1454  y1Near = zNear*TMath::Tan(lambda1);
1455  y2Near = zNear*TMath::Tan(lambda2);
1456 
1457  xNear = 0;
1458  x1Near = TMath::Sqrt(y1Near*y1Near + zNear*zNear) * TMath::Tan(dphi/2);
1459  x2Near = TMath::Sqrt(y2Near*y2Near + zNear*zNear) * TMath::Tan(dphi/2);
1460 
1461  zFar = radius+siz;
1462 
1463  yFar = zFar*TMath::Tan(lambda);
1464  y1Far = zFar*TMath::Tan(lambda1);
1465  y2Far = zFar*TMath::Tan(lambda2);
1466 
1467  xFar = 0;
1468  x1Far = TMath::Sqrt(y1Far*y1Far + zFar*zFar) * TMath::Tan(dphi/2);
1469  x2Far = TMath::Sqrt(y2Far*y2Far + zFar*zFar) * TMath::Tan(dphi/2);
1470 
1471  float dy = TMath::Tan(lambda )*siz/2;
1472 
1473  // to fight Rene Brun one has to assign an unique name fro each tower. Weird !
1474 
1475  // const char *towerName= gGeometry ? Form("CALO%d", gGeometry->GetListOfShapes()->GetSize()): "CALO";
1476 
1477  TTRAP *trap = new TTRAP( "CALO", Form("Angle%d",int(lambda/M_PI*180))
1478  , "Barrel" // Material
1479  , siz/2 // dz
1480  , lambda*TMath::RadToDeg()// Float_t theta (ROOT needs degree)
1481  , 90 // Float_t phi (ROOT needs degree)
1482  , (y2Near-y1Near )/2 // Float_t h1
1483  , x1Near // Float_t bl1
1484  , x2Near // Float_t tl1
1485  , 0 // Float_t alpha1 (ROOT needs degree)
1486  , (y2Far-y1Far )/2 // Float_t h2
1487  , x1Far // Float_t bl2
1488  , x2Far // Float_t tl2
1489  , 0 // Float_t alpha2 (ROOT needs degree)
1490  );
1491  if (gGeometry) gGeometry->GetListOfShapes()->Remove(trap);
1492  bool draw = false;
1493  if (!fTopVolume) {
1494  draw = true;
1495  fTopVolume = new volume_view_3D();
1496  }
1497  volume_view_3D *thisShape = new volume_view_3D(Form("Lamda=%f : Phi=%f; ",lambda,phi),"tower",trap);
1498 
1499  static double rotmatrixZ[] = { 1, 0, 0
1500  , 0, 0, -1
1501  , 0, 1, 0
1502  };
1503  static double rotmatrixZNeg[] = { 1, 0, 0
1504  , 0, -1, 0
1505  , 0, 0, -1
1506  }; // for the lambda < 0 and End_Cup style
1507  float a = -phi+p2;
1508  double rotmatrixX[] = { cos(a), -sin(a), 0
1509  , sin(a), cos(a), 0
1510  , 0, 0, 1
1511  };
1512  TRotMatrix *rootMatrixX = new TRotMatrix("rotx","rotx",rotmatrixX);
1513  if (gGeometry) gGeometry->GetListOfMatrices()->Remove(rootMatrixX);
1514  TVolumePosition *position = fTopVolume->Add(thisShape,0,0,0,rootMatrixX);
1515  position->SetMatrixOwner();
1516  if (barrel) {
1517  TRotMatrix *rootMatrixZ = new TRotMatrix("rotz","rotZ",rotmatrixZ);
1518  if (gGeometry) gGeometry->GetListOfMatrices()->Remove(rootMatrixZ);
1519  TVolumePosition zpos(thisShape,0,0,0,rootMatrixZ);
1520  zpos.SetMatrixOwner();
1521  position->Mult(zpos);
1522  } else if (lambda < 0) {
1523  TRotMatrix *rootMatrixZ = new TRotMatrix("rotz","rotZ",rotmatrixZNeg);
1524  if (gGeometry) gGeometry->GetListOfMatrices()->Remove(rootMatrixZ);
1525  TVolumePosition zpos(thisShape,0,0,0,rootMatrixZ);
1526  zpos.SetMatrixOwner();
1527  position->Mult(zpos);
1528  }
1529  TVolumePosition rpos(thisShape,0,yNear+dy,zNear + siz/2);
1530  position->Mult(rpos);
1531  thisShape->SetFillColor(col);
1532  thisShape->SetLineColor(col);
1533  thisShape->SetFillStyle(barrel ? sty-kBarrelStyle : sty );
1534  if ( draw /* && Pad() */ ) {
1535  Draw(fTopVolume,"same");
1536  }
1537  fView = thisShape;
1538  return thisShape;
1539 }
1541 
1579 //__________________________________________________________________________________________
1580 TObject *StDraw3D::Tower( float radius, const StarRoot::StEta &eta
1581  , float phi, float dphi
1582  , Color_t col,Style_t sty, Size_t siz)
1583 {
1584  bool barrel = (sty >= kBarrelStyle);
1585  double lambda,lambda1,lambda2;
1586  lambda = eta;
1587  if ( lambda > p2 ) lambda -= 2*p2;
1588  if (barrel) {
1589  lambda = p2-eta;
1590  lambda2 = p2-eta.dLambda2();
1591  lambda1 = p2-eta.dLambda1();
1592  } else {
1593  lambda2 = eta.dLambda1();
1594  lambda1 = eta.dLambda2();
1595  }
1596  return Tower(radius,lambda,lambda1,lambda2, phi, dphi, col, sty, siz);
1597 }
1599 
1602 //__________________________________________________________________________________________
1603 void StDraw3D::SetFooter(const char *footer)
1604 {
1605  TString viewerFooter = "{footer:";
1606  viewerFooter += footer; viewerFooter += "}";
1607  SetDrawOption(viewerFooter.Data());
1608 }
1609 
1610 //__________________________________________________________________________________________
1612 
1623 //__________________________________________________________________________________________
1625 {
1626  TVirtualPad *pad = Pad();
1627  if (pad && pad->IsModified()) {
1628  Update();
1629  }
1630  ForceAnimate(0,200);
1631 }
1632 
1633 
1634 ClassImp(StDraw3D)
Definition: FJcore.h:367
virtual void Update(bool asap=false)
Render all items from the current display list onto the screen and refesh the screen immiately if asa...
Definition: StDraw3D.cxx:1109
virtual const StDraw3DStyle & Style(EDraw3DStyle type) const
Return the reference to the predefined StDraw3DStyle object.
Definition: StDraw3D.cxx:482
StDraw3DStyle maps &quot;STAR event&quot; EDraw3DStyle onto ROOT (color,style,size) attributes.
Definition: StDraw3D.h:29
virtual void SetBkColor(Color_t newBkColor)
Set the ROOT color as the widget background.
Definition: StDraw3D.cxx:447
static Color_t Pt2Color(double pt)
Maps the track pt to the STAR StTrack track color code.
Definition: StDraw3D.cxx:78
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.
Definition: StDraw3D.cxx:1425
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.
Definition: StDraw3D.cxx:807
Class StDraw3D - to draw the 3D primitives like 3D points and 3D lines decorated with the STAR detect...
Definition: StDraw3D.h:165
StDraw3D(const char *detectorName="TPC", TVirtualPad *pad=0)
StDraw3D( const char *detectorName,TVirtualPad *pad) ctor.
Definition: StDraw3D.cxx:248
virtual const TString & DetectorNames() const
Definition: StDraw3D.cxx:331
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...
Definition: StDraw3D.cxx:469
virtual void SetFooter(const char *footer)
Set the footer (caption) defined by the input footer text string.
Definition: StDraw3D.cxx:1603
virtual TObject * Points(int n, const float *xyz, EDraw3DStyle sty)
This is an overloaded member function, provided for convenience.
Definition: StDraw3D.cxx:596
virtual void SetDetectors(const char *nameDetectors)
Set the list of the detector names to be used as the event &quot;background&quot;.
Definition: StDraw3D.cxx:362
virtual void Save(const char *filename, const char *type="png") const
This is an overloaded member function, provided for convenience.
Definition: StDraw3D.cxx:1059
void Draw3DTest()
The built-in quick test to check the application environment and test the basic methods.
Definition: StDraw3D.cxx:1178
virtual char * GetObjectInfo(Int_t px, Int_t py) const
to be documented
Definition: TVolume.cxx:531
virtual void Print(const char *filename) const
Save the current 3D scene using &quot;wrl&quot; file format.
Definition: StDraw3D.cxx:1032
TVirtualViewer3D * Viewer() const
Definition: StDraw3D.cxx:349
TVirtualPad * Pad() const
Definition: StDraw3D.cxx:341
virtual TObject * Draw3D(int n, const float *xyz)
This is an overloaded member function, provided for convenience.
Definition: StDraw3D.cxx:686
virtual void SetDrawOption(Option_t *option="")
Set the varous drawing option. The method passes the input options to TQtCoinWidget::SetDrawOption me...
Definition: StDraw3D.cxx:1097
virtual void Clear(Option_t *opt="update")
Remove all objects from the list and update the screen if opt is &quot;update&quot;.
Definition: StDraw3D.cxx:398
virtual void AddDetectors(const char *nameDetectors)
Append the detector names to the list of the event &quot;background&quot; shapes.
Definition: StDraw3D.cxx:382
virtual void Animate()
Animate the viewer from the gdb session.
Definition: StDraw3D.cxx:1624