89 static Int_t counter = 0;
104 fMatrix =
new TRotMatrix(
"Identity",
"Identity matrix",90,0,90,90,0,0);
108 Printf(
"Error Referenced shape does not exist: %s",shapename);
114 fParent->BuildListOfNodes();
115 fParent->GetListOfNodes()->Add(
this);
154 fMatrix =
new TRotMatrix(
"Identity",
"Identity matrix",90,0,90,90,0,0);
157 if(!shape) {
Printf(
"Illegal referenced shape");
return;}
160 fParent->BuildListOfNodes();
161 fParent->GetListOfNodes()->Add(
this);
186 fVisibility(no.fVisibility)
218 if (fParent) fParent->GetListOfNodes()->Remove(
this);
220 if (fNodes) fNodes->
Delete();
244 if (!fNodes) fNodes =
new TList;
263 const Int_t big = 9999;
264 const Int_t inaxis = 7;
265 const Int_t maxdist = 5;
273 if (px < puxmin - inaxis)
return big;
274 if (py > puymin + inaxis)
return big;
275 if (px > puxmax + inaxis)
return big;
276 if (py < puymax - inaxis)
return big;
279 if (!view)
return big;
288 if (fVisibility && fShape->GetVisibility()) {
291 if (dist < maxdist) {
292 gPad->SetSelected(
this);
301 if (fNodes) nsons = fNodes->GetSize();
308 while ((obj =
next())) {
311 if (dnode <= 0)
break;
312 if (dnode < dist) dist = dnode;
330 gROOT->MakeDefCanvas();
351 gPad->GetViewer3D(option);
381 TNode *node, *nodefound;
382 if (!fNodes)
return 0;
383 TObjLink *lnk = fNodes->FirstLink();
387 nodefound = node->
GetNode(name);
388 if (nodefound)
return nodefound;
400 const char *snull =
"";
401 if (!
gPad)
return (
char*)snull;
403 info.
Form(
"%s/%s, shape=%s/%s",
GetName(),
GetTitle(),fShape->GetName(),fShape->ClassName());
404 return const_cast<char*
>(info.
Data());
421 TObjLink *lnk = fNodes->FirstLink();
434 if (fNodes)
return kTRUE;
454 x = bomb*translation[0]
457 + local[2]*matrix[6];
459 y = bomb*translation[1]
462 + local[2]*matrix[7];
464 z = bomb*translation[2]
467 + local[2]*matrix[8];
469 master[0] =
x; master[1] =
y; master[2] = z;
488 x = bomb*translation[0]
491 + local[2]*matrix[6];
493 y = bomb*translation[1]
496 + local[2]*matrix[7];
498 z = bomb*translation[2]
501 + local[2]*matrix[8];
503 master[0] =
x; master[1] =
y; master[2] = z;
518 if (opt.
Contains(
"1")) maxlevel = 1;
519 if (opt.
Contains(
"2")) maxlevel = 2;
520 if (opt.
Contains(
"3")) maxlevel = 3;
521 if (opt.
Contains(
"4")) maxlevel = 4;
522 if (opt.
Contains(
"5")) maxlevel = 5;
528 if (fNodes) nsons = fNodes->GetSize();
529 const char *shapename, *matrixname;
530 if (fShape) shapename = fShape->IsA()->GetName();
531 else shapename =
"????";
538 std::cout<<
" NumPoints="<<
gSize3D.numPoints;
539 std::cout<<
" NumSegs ="<<
gSize3D.numSegs;
540 std::cout<<
" NumPolys ="<<
gSize3D.numPolys;
542 std::cout<<
" X="<<fX<<
" Y="<<fY<<
" Z="<<
fZ;
543 if (nsons) std::cout<<
" Sons="<<nsons;
544 if (fMatrix) matrixname = fMatrix->GetName();
545 else matrixname =
"Identity";
546 if(strcmp(matrixname,
"Identity")) std::cout<<
" Rot="<<matrixname;
548 std::cout<<std::endl;
550 if (gGeomLevel >= maxlevel)
return;
576 Double_t xms = master[0] - bomb*translation[0];
577 Double_t yms = master[1] - bomb*translation[1];
578 Double_t zms = master[2] - bomb*translation[2];
580 x = xms*matrix[0] + yms*matrix[1] + zms*matrix[2];
581 y = xms*matrix[3] + yms*matrix[4] + zms*matrix[5];
582 z = xms*matrix[6] + yms*matrix[7] + zms*matrix[8];
584 local[0] =
x; local[1] =
y; local[2] = z;
603 Double_t xms = master[0] - bomb*translation[0];
604 Double_t yms = master[1] - bomb*translation[1];
605 Double_t zms = master[2] - bomb*translation[2];
607 x = xms*matrix[0] + yms*matrix[1] + zms*matrix[2];
608 y = xms*matrix[3] + yms*matrix[4] + zms*matrix[5];
609 z = xms*matrix[6] + yms*matrix[7] + zms*matrix[8];
611 local[0] =
x; local[1] =
y; local[2] = z;
634 if (fNodes) nsons = fNodes->GetSize();
641 if (fVisibility && fShape->GetVisibility()) {
659 Int_t reqSections = viewer3D->
AddObject(buffer, &viewerWantsSons);
662 fShape->GetBuffer3D(reqSections);
663 viewer3D->
AddObject(buffer, &viewerWantsSons);
670 if(!nsons || !viewerWantsSons)
return;
676 while ((obj =
next())) {
688 if (fNodes && dynamic_cast<TNode*>(obj) ) fNodes->RecursiveRemove(obj);
700 if (fParent) fParent->GetListOfNodes()->Remove(
this);
702 if (fParent) fParent->GetListOfNodes()->Add(
this);
714 if (fParent) fParent->GetListOfNodes()->Remove(
this);
717 if (fParent) fParent->GetListOfNodes()->Add(
this);
728 printf(
"Error: Cannot set parent node to be a child node:%s\n",
GetName());
729 printf(
" Operation not performed!\n");
742 fParent->GetListOfNodes()->Add(
this);
765 if (!fNodes) { fVisibility = 1;
return;}
767 }
else if (vis == -3 ) {
769 if (!fNodes) { fVisibility = 1;
return;}
772 }
else if (vis == -2) {
776 }
else if (vis == -1) {
780 }
else if (vis == 0) {
783 }
else if (vis == 1) {
786 }
else if (vis == 2) {
787 fVisibility = 0;
if (!fNodes)
return;
790 }
else if (vis == 3) {
791 fVisibility = 1;
if (!fNodes)
return;
801 if (fVisibility && fShape && fShape->GetVisibility()) {
810 while ((obj =
next())) {
819 void TNode::Streamer(
TBuffer &b)
830 TAttLine::Streamer(b);
831 TAttFill::Streamer(b);
841 else fVisibility = fShape->GetVisibility();
858 for (i=0;i<
kVectorSize;i++) gTranslation[0][i] = 0;
860 gRotMatrix[0][0] = 1; gRotMatrix[0][4] = 1; gRotMatrix[0][8] = 1;
873 node = nodes[gGeomLevel-i];
876 ,&gTranslation[i][0],&gRotMatrix[i][0]);
893 dxnew[0] = dx[0] + x*rmat[0] + y*rmat[3] + z*rmat[6];
894 dxnew[1] = dx[1] + x*rmat[1] + y*rmat[4] + z*rmat[7];
895 dxnew[2] = dx[2] + x*rmat[2] + y*rmat[5] + z*rmat[8];
897 rmatnew[0] = rmat[0]*matrix[0] + rmat[3]*matrix[1] + rmat[6]*matrix[2];
898 rmatnew[1] = rmat[1]*matrix[0] + rmat[4]*matrix[1] + rmat[7]*matrix[2];
899 rmatnew[2] = rmat[2]*matrix[0] + rmat[5]*matrix[1] + rmat[8]*matrix[2];
900 rmatnew[3] = rmat[0]*matrix[3] + rmat[3]*matrix[4] + rmat[6]*matrix[5];
901 rmatnew[4] = rmat[1]*matrix[3] + rmat[4]*matrix[4] + rmat[7]*matrix[5];
902 rmatnew[5] = rmat[2]*matrix[3] + rmat[5]*matrix[4] + rmat[8]*matrix[5];
903 rmatnew[6] = rmat[0]*matrix[6] + rmat[3]*matrix[7] + rmat[6]*matrix[8];
904 rmatnew[7] = rmat[1]*matrix[6] + rmat[4]*matrix[7] + rmat[7]*matrix[8];
905 rmatnew[8] = rmat[2]*matrix[6] + rmat[5]*matrix[7] + rmat[8]*matrix[8];
TList * GetListOfNodes() const
virtual const char * GetTitle() const
Returns title of object.
virtual Double_t * GetMatrix()
virtual Style_t GetLineStyle() const
virtual Style_t GetFillStyle() const
virtual void SetLineWidth(Width_t lwidth)
virtual void Draw(Option_t *option="")
Draw Referenced node with current parameters.
virtual Double_t GetY() const
static Double_t gTranslation[kMAXLEVELS][kVectorSize]
double dist(Rotation3D const &r1, Rotation3D const &r2)
static Int_t DecreaseDirLevel()
Decrease the indentation level for ls().
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
virtual void RecursiveRemove(TObject *obj)
Recursively remove object from the list of nodes of this node.
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
virtual void Local2Master(const Double_t *local, Double_t *master)
Convert one point from local system to master reference system.
virtual void SetNameTitle(const char *name, const char *title)
Change the name and title of this Node.
virtual void SetAutoRange(Bool_t autorange=kTRUE)=0
virtual void cd(const char *path=0)
Change Current Reference node to this.
Use this attribute class when an object should have 3D capabilities.
Buffer base class used for serializing objects.
virtual void DrawOnly(Option_t *option="")
Draw only Sons of this node.
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
void ToLower()
Change string to lower-case.
virtual void SetFillStyle(Style_t fstyle)
virtual TNode * GetNode(const char *name) const
Return pointer to node with name in the node tree.
virtual ~TNode()
Node default destructor.
virtual void Modify()
Change current line attributes if necessary.
virtual void Paint(Option_t *option="")
Paint Referenced node with current parameters.
virtual void Sizeof3D() const
Return total size of this 3-D Node with its attributes.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
const char * Data() const
Fill Area Attributes class.
virtual void SetVisibility(Int_t vis=1)
Set visibility for this node and its sons.
The TNamed class is the base class for all named ROOT classes.
TRotMatrix * GetRotMatrix(const char *name) const
Return pointer to RotMatrix with name.
TShape * GetShape(const char *name) const
Return pointer to Shape with name.
virtual void Modify()
Change current fill area attributes if necessary.
virtual void SetParent(TNode *parent)
Set the pointer to the parent, keep parents informed about who they have.
virtual Int_t PushLevel()
Abstract 3D shapes viewer.
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
TNode * GetCurrentNode() const
virtual Double_t GetX() const
virtual void SetLineColor(Color_t lcolor)
Bool_t IsFolder() const
Return TRUE if node contains nodes, FALSE otherwise.
virtual void Delete(Option_t *option="")
Delete this object.
Using a TBrowser one can browse all ROOT objects.
virtual void UpdateMatrix()
Update global rotation matrix/translation vector for this node this function must be called before in...
This is the base class for all geometry shapes.
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
Manages a detector rotation matrix.
virtual void SetFillColor(Color_t fcolor)
virtual TObject * Remove(TObject *obj)
Remove object from the list.
virtual void BuildListOfNodes()
Create the list to support sons of this node.
virtual Color_t GetFillColor() const
virtual Double_t GetZ() const
TObject * GetObject() const
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
virtual Int_t AddObject(const TBuffer3D &buffer, Bool_t *addChildren=0)=0
Bool_t TestBit(UInt_t f) const
TList * GetListOfNodes() const
virtual void UpdateTempMatrix(const Double_t *dx1, const Double_t *rmat1, Double_t x, Double_t y, Double_t z, Double_t *matrix, Double_t *dxnew, Double_t *rmatnew)
Compute new translation vector and global matrix.
Generic 3D primitive description class.
virtual const char * GetName() const
Returns name of object.
virtual void ImportShapeAttributes()
Copy shape attributes as node attributes.
virtual Color_t GetLineColor() const
virtual void SetCurrentNode(TNode *node)
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
Wrapper around a TObject so it can be stored in a TList.
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
virtual void SetGeomLevel(Int_t level=0)
virtual void SetLineStyle(Style_t lstyle)
static TView * CreateView(Int_t system=1, const Double_t *rmin=0, const Double_t *rmax=0)
Create a concrete default 3-d view via the plug-in manager.
Binding & operator=(OUT(*fun)(void))
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a Node.
Mother of all ROOT objects.
virtual void UpdateTempMatrix(Double_t x=0, Double_t y=0, Double_t z=0, TRotMatrix *matrix=0)
Update temp matrix.
static Int_t IncreaseDirLevel()
Increase the indentation level for ls().
virtual TRotMatrix * GetMatrix() const
virtual void ls(Option_t *option="2") const
List Referenced object with current parameters.
virtual void Add(TObject *obj)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
static Double_t gRotMatrix[kMAXLEVELS][kMatrixSize]
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
virtual void Master2Local(const Double_t *master, Double_t *local)
Convert one point from master system to local reference system.
virtual TNode * GetParent() const
virtual void Browse(TBrowser *b)
Browse.
virtual Width_t GetLineWidth() const
virtual void SetName(const char *name)
Change the name of this Node.
R__EXTERN TGeometry * gGeometry
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Get object info.
TNode & operator=(const TNode &)
assignment operator
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0