5 #include "TCanvasImp.h"
9 #include "TVolumePosition.h"
10 #include "TRotMatrix.h"
12 #include "TPolyMarker3D.h"
13 #include "TPolyLine3D.h"
18 #include "StCheckQtEnv.h"
20 #include "TVirtualViewer3D.h"
24 static Color_t colorDefault = Color_t(-1);
25 static Style_t styDefault = Style_t(-1);
26 static Size_t sizDefault = Size_t (-1);
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;
34 Int_t StDraw3D::fDrawCanvasCounter = -1;
37 const double p2 = TMath::PiOver2();
39 static inline void ForceAnimate(
unsigned int times=0,
int msecDelay=0)
41 unsigned int counter = times;
42 while( (!times || counter) && !gSystem->ProcessEvents()) { --counter;
if (msecDelay) gSystem->Sleep(msecDelay);}
47 static inline TVirtualViewer3D *InitCoin(TVirtualPad *pad,
const char *detectorName)
49 TVirtualViewer3D *viewer = 0;
51 bool CheckCoin =
true;
52 if (!StCheckQtEnv::SetQtEnv(
false)) { CheckCoin =
true; }
57 TString backShape = detectorName;
58 backShape.ReplaceAll(
",",
".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());
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));
84 TColor::HLS2RGB(hue, lightness, saturation, r, g, b);
86 float factor = 1./sqrt(1.*r*r+1.*g*g+1.*b*b);
87 return TColor::GetColor(r*factor,g*factor,b*factor);
102 fObjectInfo = Form(
"( %s *)%p ",fModel->ClassName(),fModel);
104 if (!fComment.IsNull()) fObjectInfo += fComment;
107 view_3D(TObject *model = 0,
const char *comment=
"") : fModel(model),fComment(comment)
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; }
121 class poly_line_3D :
public TPolyLine3D,
public view_3D {
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
130 const TString &customInfo = info();
131 const char *info = 0;
132 if (customInfo.IsNull())
133 info = TPolyLine3D::GetObjectInfo(x,y);
135 info = customInfo.Data();
138 void Inspect()
const {
139 if ( model() ) model()->Inspect();
140 else TPolyLine3D::Inspect();
148 class poly_marker_3D :
public TPolyMarker3D,
public view_3D {
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
157 const TString &customInfo = info();
158 const char *info = 0;
159 if (customInfo.IsNull())
160 info = TPolyMarker3D::GetObjectInfo(x,y);
162 info = customInfo.Data();
165 void Inspect()
const {
166 if ( model() ) model()->Inspect();
167 else TPolyMarker3D::Inspect();
177 volume_view_3D(
const Text_t *name,
const Text_t *title, TShape *shape, Option_t *option=
"")
179 { SetBit(kCanDelete); }
181 { SetBit(kCanDelete); }
182 virtual ~volume_view_3D(){
183 if (fListOfShapes) fListOfShapes->Delete();
187 const TString &customInfo = info();
188 const char *info = 0;
189 if (customInfo.IsNull())
192 info = customInfo.Data();
195 void Inspect()
const {
196 if ( model() ) model()->Inspect();
197 else TVolume::Inspect();
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)
258 void StDraw3D::Init()
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);
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)
283 TVirtualPad *StDraw3D::InitPad()
285 if (fMaster) fMaster->InitPad();
286 else if (!fPad && !fWantPad ) {
287 fDrawCanvasCounter++;
288 TString canvasName =
"STAR";
290 if (fDrawCanvasCounter) {
292 canvasName += fDrawCanvasCounter;
293 canvasTitle += fDrawCanvasCounter;
294 canvasTitle +=
" : ";
296 canvasTitle +=
"STAR Event Viewer";
297 fPad =
new TCanvas(canvasName.Data(),canvasTitle.Data(), 400,400);
298 fPad->SetFillColor(fBkColor);
301 fPad->GetCanvas()->GetCanvasImp()->Iconify();
306 void StDraw3D::InitViewer()
310 if (fMaster) fMaster->InitViewer();
311 else if ( !fViewer ) fViewer = InitCoin(fPad,fDetectorName);
315 StDraw3D::~StDraw3D()
318 if (!fMaster) fPad->Clear();
319 if (fOwnPad)
delete fPad;
334 return fDetectorName;
343 return fMaster ? fMaster->
Pad() : fPad;
351 return fMaster ? fMaster->
Viewer() : fViewer;
368 Warning(
"StDraw3D::SetDetectors",
"Can not change the detector names. It is too late. The viewer had been created");
370 fDetectorName = nameDetectors;
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;
401 TVirtualPad *pad =
Pad();
405 if ( !strcmp(opt,
"update") )
Update();
406 }
else if ( TVirtualViewer3D *viewer =
Viewer() ) {
410 gGeometry->GetListOfMatrices()->Clear();
411 gGeometry->GetListOfShapes()->Delete();
413 TCollection::EmptyGarbageCollection();
417 TObject *StDraw3D::Draw(TObject *o,
const char *option)
422 TVirtualPad *sav = gPad;
423 if (!
Pad()) InitPad();
424 TVirtualPad *thisPad =
Pad();
426 if (thisPad != sav) thisPad->cd();
430 if (thisPad && sav && (thisPad != sav)) sav->cd();
431 if (!
Viewer()) InitViewer();
435 Viewer()->ObjectPaint(o,option);
450 fBkColor = newBkColor;
451 TVirtualPad *pad =
Pad();
452 if (pad && pad->GetFillColor() != fBkColor)
453 pad->SetFillColor(fBkColor);
471 fStyles.insert(std::pair<EDraw3DStyle,StDraw3DStyle>(type,
StDraw3DStyle(type,col,sty,siz)));
484 return fStyles.find(type)->second;
490 return fStyles[type];
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);
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);
557 TObject *
StDraw3D::Points(
const std::vector<float> &xyz, Color_t col,Style_t sty,Size_t siz)
564 return Points(xyz.size()/3,&xyz[0],col,sty,siz);
577 TObject *
StDraw3D::Points(
const std::vector<double> &xyz, Color_t col,Style_t sty,Size_t siz)
584 return Points(xyz.size()/3,&xyz[0],col,sty,siz);
607 return Points(n, xyz, style.Col(),style.Sty(),style.Siz());
630 return Points(n, xyz, style.Col(),style.Sty(),style.Siz());
652 return Points(xyz, style.Col(),style.Sty(),style.Siz());
674 return Points(xyz, style.Col(),style.Sty(),style.Siz());
695 return Points(n,xyz,kVtx);
716 return Points(n,xyz,kVtx);
719 TObject *StDraw3D::Point(
float x,
float y,
float z, Color_t col,Style_t sty,Size_t siz)
727 return Points(1,xyz,col,sty,siz);
731 TObject *StDraw3D::Point(
float x,
float y,
float z, EDraw3DStyle sty)
741 return Point(x,y, z, style.Col(),style.Sty(),style.Siz());
755 TObject *
StDraw3D::Line(
int n,
const float *xyz, Color_t col,Style_t sty,Size_t siz)
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));
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)
788 std::vector<float> line(6);
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);
807 TObject *
StDraw3D::Line(
int n,
const double *xyz, Color_t col,Style_t sty,Size_t siz)
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));
831 TObject *
StDraw3D::Line(
const std::vector<float> &xyz, Color_t col,Style_t sty,Size_t siz)
838 return Line(xyz.size()/3, &xyz[0], col,sty,siz);
851 TObject *
StDraw3D::Line(
const std::vector<double> &xyz, Color_t col,Style_t sty,Size_t siz)
858 return Line(xyz.size()/3, &xyz[0], col,sty,siz);
879 return Line(xyz, style.Col(),style.Sty(),style.Siz() );
900 return Line(xyz, style.Col(),style.Sty(),style.Siz() );
922 return Line(n,xyz, style.Col(),style.Sty(),style.Siz() );
944 return Line(n,xyz, style.Col(),style.Sty(),style.Siz() );
959 if (dsp) dsp->SetMaster(
this);
962 void StDraw3D::Redraw()
965 if (fMaster && fPad) {
966 TList *p = fPad->GetListOfPrimitives();
970 while ( (o=next()) ) Draw(o);
976 void StDraw3D::SetMaster(
StDraw3D *master)
979 if (fMaster != master) {
981 Error(
"StDraw3D::SetMaster"
982 ,
"The object (StDraw3D*)%p already has another master %p",
this, fMaster);
989 void StDraw3D::SetModel(TObject *model)
992 if (fView) fView->setModel(model);
996 void StDraw3D::SetComment(
const char *cmnt)
999 if (fView) fView->setComment(cmnt);
1003 void StDraw3D::AddComment(
const char *cmnt)
1006 if (fView) fView->addComment(cmnt);
1034 Save(filename,
"wrl");
1047 Save(filename,type);
1061 if ( TVirtualViewer3D *viewer =
Viewer() ) {
1062 viewer->Print(filename);
1065 else if (
Pad())
Pad()->Print(filename,type);
1099 if ( TVirtualViewer3D *viewer =
Viewer() )
1100 viewer->SetDrawOption(options);
1111 TVirtualPad *pad =
Pad();
1113 TVirtualPad *sav = gPad;
1114 if (pad != sav) pad->cd();
1117 if (sav && (pad != sav)) sav->cd();
1121 if (asap) ForceAnimate(1);
1125 void StDraw3D::Modified()
1129 TVirtualPad *pad =
Pad();
1131 TVirtualPad *sav = gPad;
1132 if (pad != sav) pad->cd();
1135 if (sav && (pad != sav)) sav->cd();
1140 void StDraw3D::UpdateModified()
1144 TVirtualPad *pad =
Pad();
1146 TVirtualPad *sav = gPad;
1147 if (pad != sav) pad->cd();
1151 if (sav && (pad != sav)) sav->cd();
1156 void StDraw3D::UpdateViewer(TVirtualPad *pad)
1158 TVirtualViewer3D *viewer =
Viewer();
1160 if (fTopVolume) Draw(fTopVolume,
"same");
1161 viewer->PadPaint(pad);
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
1197 int sizeXYZ =
sizeof(xyz)/
sizeof(
float)/3;
1200 SetComment(
"The hits from the TPC sector");
1202 Line(sizeXYZ,xyz,kGlobalTrack);
1203 SetComment(
"The recontstructed track");
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
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
1221 double stepEta = (1.0-0.0)/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.));
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.));
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.));
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.));
1245 phi += 4*TMath::Pi()/n;
1251 void StDraw3D::ShowDetectorTest(
const char *detectorName)
1255 if (!viewer->
Viewer()) viewer->InitViewer();
1258 void StDraw3D::ShowTest()
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}};
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}};
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}};
1318 fine[0]->
Points(nH, HitX[0], kVtx);
1319 fine[0]->SetComment(
"Hits and Geometry");
1321 fine[0]->
Line (nN, NodX[0], kGlobalTrack);
1322 fine[0]->SetComment(
"Track and Geometry");
1324 fine[1]->
Points(nH, HitL[0], kVtx);
1325 fine[1]->SetComment(
"Hits no Geometry");
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(); }
1375 ,
float lambda,
float phi
1376 ,
float dlambda,
float dphi
1377 , Color_t col,Style_t sty, Size_t siz)
1379 float d2 = dlambda/2;
1380 return Tower(radius, lambda,lambda-d2, lambda+d2,phi, dphi, col, sty, siz);
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)
1428 gGeometry->GetListOfMatrices()->Clear();
1430 if (lambda2-lambda1 < 0 ) {
1431 Warning(
"StDraw3D::Tower",
"The illegal negative value for dlambda = %f", lambda2-lambda1);
1432 float swp = lambda1;
1437 Warning(
"StDraw3D::Tower",
"The illegal negative value for dphi = %f", dphi);
1440 float zNear, xNear, x1Near,x2Near, yNear, y1Near,y2Near, zFar, xFar, yFar, x1Far,x2Far, y1Far, y2Far;
1442 siz = siz *TMath::Cos(lambda);
1444 bool barrel = (sty >= kBarrelStyle);
1453 yNear = zNear*TMath::Tan(lambda);
1454 y1Near = zNear*TMath::Tan(lambda1);
1455 y2Near = zNear*TMath::Tan(lambda2);
1458 x1Near = TMath::Sqrt(y1Near*y1Near + zNear*zNear) * TMath::Tan(dphi/2);
1459 x2Near = TMath::Sqrt(y2Near*y2Near + zNear*zNear) * TMath::Tan(dphi/2);
1463 yFar = zFar*TMath::Tan(lambda);
1464 y1Far = zFar*TMath::Tan(lambda1);
1465 y2Far = zFar*TMath::Tan(lambda2);
1468 x1Far = TMath::Sqrt(y1Far*y1Far + zFar*zFar) * TMath::Tan(dphi/2);
1469 x2Far = TMath::Sqrt(y2Far*y2Far + zFar*zFar) * TMath::Tan(dphi/2);
1471 float dy = TMath::Tan(lambda )*siz/2;
1477 TTRAP *trap =
new TTRAP(
"CALO", Form(
"Angle%d",
int(lambda/M_PI*180))
1480 , lambda*TMath::RadToDeg()
1482 , (y2Near-y1Near )/2
1491 if (gGeometry) gGeometry->GetListOfShapes()->Remove(trap);
1495 fTopVolume =
new volume_view_3D();
1497 volume_view_3D *thisShape =
new volume_view_3D(Form(
"Lamda=%f : Phi=%f; ",lambda,phi),
"tower",trap);
1499 static double rotmatrixZ[] = { 1, 0, 0
1503 static double rotmatrixZNeg[] = { 1, 0, 0
1508 double rotmatrixX[] = { cos(a), -sin(a), 0
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();
1517 TRotMatrix *rootMatrixZ =
new TRotMatrix(
"rotz",
"rotZ",rotmatrixZ);
1518 if (gGeometry) gGeometry->GetListOfMatrices()->Remove(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);
1526 zpos.SetMatrixOwner();
1527 position->Mult(zpos);
1530 position->Mult(rpos);
1531 thisShape->SetFillColor(col);
1532 thisShape->SetLineColor(col);
1533 thisShape->SetFillStyle(barrel ? sty-kBarrelStyle : sty );
1535 Draw(fTopVolume,
"same");
1581 ,
float phi,
float dphi
1582 , Color_t col,Style_t sty, Size_t siz)
1584 bool barrel = (sty >= kBarrelStyle);
1585 double lambda,lambda1,lambda2;
1587 if ( lambda > p2 ) lambda -= 2*p2;
1590 lambda2 = p2-eta.dLambda2();
1591 lambda1 = p2-eta.dLambda1();
1593 lambda2 = eta.dLambda1();
1594 lambda1 = eta.dLambda2();
1596 return Tower(radius,lambda,lambda1,lambda2, phi, dphi, col, sty, siz);
1605 TString viewerFooter =
"{footer:";
1606 viewerFooter += footer; viewerFooter +=
"}";
1626 TVirtualPad *pad =
Pad();
1627 if (pad && pad->IsModified()) {
1630 ForceAnimate(0,200);
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 char * GetObjectInfo(Int_t px, Int_t py) const
to be documented
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.