TNodeX Class Reference

#include <TNodeX.h>

Inheritance diagram for TNodeX:
UgliPlnNode UgliScintMdlNode UgliStripNode UgliScintPlnNode UgliSteelPlnNode

List of all members.

Public Member Functions

 TNodeX ()
 TNodeX (const char *name, const char *title, const char *shapename, Double_t x=0, Double_t y=0, Double_t z=0, const char *matrixname="", Option_t *option="")
 TNodeX (const char *name, const char *title, TShape *shape, Double_t x=0, Double_t y=0, Double_t z=0, TRotMatrix *matrix=0, Option_t *option="")
virtual ~TNodeX ()
TNode * GetNodeToDepth (const char *name, Int_t maxdepth=65536)
virtual void SetParent (TNode *parent)
virtual void UpdateMatrixVect ()
virtual void Local2MasterVect (const Double_t *local, Double_t *master) const
virtual void Master2LocalVect (const Double_t *master, Double_t *local) const

Detailed Description

Definition at line 18 of file TNodeX.h.


Constructor & Destructor Documentation

TNodeX::TNodeX (  ) 

Definition at line 31 of file TNodeX.cxx.

Referenced by UgliSteelPlnNode::UgliSteelPlnNode().

00031 : TNode() {;}

TNodeX::TNodeX ( const char *  name,
const char *  title,
const char *  shapename,
Double_t  x = 0,
Double_t  y = 0,
Double_t  z = 0,
const char *  matrixname = "",
Option_t *  option = "" 
)

Definition at line 32 of file TNodeX.cxx.

00035    : TNode(name,title,shapename,x,y,z,matrixname,option)
00036 { ; } // { cout << "TNodeX " << name << " @ " << this << " ctor1 " << endl; }

TNodeX::TNodeX ( const char *  name,
const char *  title,
TShape *  shape,
Double_t  x = 0,
Double_t  y = 0,
Double_t  z = 0,
TRotMatrix *  matrix = 0,
Option_t *  option = "" 
)

Definition at line 37 of file TNodeX.cxx.

00040    : TNode(name,title,shape,x,y,z,matrix,option)
00041 { ; } // { cout << "TNodeX " << name << " @ " << this << " ctor2 " << endl; }

TNodeX::~TNodeX (  )  [virtual]

Definition at line 42 of file TNodeX.cxx.

00043 { ; } // { cout << "TNodeX " << GetName() << " @ " << this << " dtor " << endl; }


Member Function Documentation

TNode * TNodeX::GetNodeToDepth ( const char *  name,
Int_t  maxdepth = 65536 
)

Definition at line 46 of file TNodeX.cxx.

References Nav::GetName(), and GetNodeToDepth().

Referenced by TGeometryX::GetNodeToDepth(), GetNodeToDepth(), UgliGeometry::GetScintPlnNode(), UgliGeometry::GetSteelPlnNode(), and UgliScintPlnNode::GetStripNode().

00047 {
00048    // search node structure only to limited depth
00049 
00050 //*-*-*-*-*-*-*Return pointer to node with name in the node tree*-*-*-*-*
00051 //*-*          =================================================
00052 
00053    if (!strcmp(name, GetName())) return this;
00054    TNodeX *node, *nodefound = 0;
00055    TObject *obj;
00056    if (!fNodes) return 0;
00057    if (maxdepth == 0) return 0;
00058    TIter  next(fNodes);
00059    while ((obj = next())) {
00060 //      node = (TNode*)obj;
00061       node = dynamic_cast<TNodeX*>(obj);
00062       if (!node) continue;
00063       if (!node->TestBit(kNotDeleted)) continue;
00064 //      nodefound = node->GetNodeToDepth(name,maxdepth-1);
00065       nodefound = dynamic_cast<TNodeX*>(node->GetNodeToDepth(name,maxdepth-1));
00066       if (nodefound) return nodefound;
00067    }
00068    return 0;
00069 
00070 }

void TNodeX::Local2MasterVect ( const Double_t *  local,
Double_t *  master 
) const [virtual]

Definition at line 135 of file TNodeX.cxx.

References gGeomLevel, and gRotMatrix.

00136 {
00137    // Convert direction vector from local system to master reference system.
00138    //
00139    //  Note that before invoking this function, the global rotation matrix
00140    //  for this node must have been computed, i.e. 
00141    //  TNode::UpdateMatrixVect should be called before.
00142 
00143    Double_t x,y,z;
00144 
00145    Double_t *matrix      = &gRotMatrix[gGeomLevel][0];
00146 
00147    x = 
00148      + local[0]*matrix[0]
00149      + local[1]*matrix[3]
00150      + local[2]*matrix[6];
00151 
00152    y = 
00153      + local[0]*matrix[1]
00154      + local[1]*matrix[4]
00155      + local[2]*matrix[7];
00156 
00157    z = 
00158      + local[0]*matrix[2]
00159      + local[1]*matrix[5]
00160      + local[2]*matrix[8];
00161 
00162    master[0] = x; master[1] = y; master[2] = z;
00163 
00164 }

void TNodeX::Master2LocalVect ( const Double_t *  master,
Double_t *  local 
) const [virtual]

Definition at line 167 of file TNodeX.cxx.

References gGeomLevel, and gRotMatrix.

00168 {
00169    // Convert direction vector from master system to local reference system.
00170    //
00171    //  Note that before invoking this function, the global rotation matrix
00172    //  for this node must have been computed, i.e. 
00173    //  TNode::UpdateMatrixVect should be called before.
00174 
00175    Double_t x,y,z;
00176 
00177    Double_t *matrix      = &gRotMatrix[gGeomLevel][0];
00178 
00179    Double_t xms = master[0];
00180    Double_t yms = master[1];
00181    Double_t zms = master[2];
00182 
00183    x = xms*matrix[0] + yms*matrix[1] + zms*matrix[2];
00184    y = xms*matrix[3] + yms*matrix[4] + zms*matrix[5];
00185    z = xms*matrix[6] + yms*matrix[7] + zms*matrix[8];
00186 
00187    local[0] = x; local[1] = y; local[2] = z;
00188 
00189 }

void TNodeX::SetParent ( TNode *  parent  )  [virtual]

Definition at line 73 of file TNodeX.cxx.

References Nav::GetName().

Referenced by UgliScintMdlNode::UgliScintMdlNode(), UgliScintPlnNode::UgliScintPlnNode(), UgliSteelPlnNode::UgliSteelPlnNode(), and UgliStripNode::UgliStripNode().

00074 {
00075    // set the pointer to the parent, keep parent informed about who they have
00076 
00077    // may need to touch everyone involved to update visibility bits too
00078    // alas only the final state is saved not the "vis" (-3,-2,-1,0,1,2,3)
00079    // so they'll need to do this by hand
00080 
00081    TNode *pp = parent;
00082    while(pp) {
00083      if (pp == this) {
00084        printf("Error: Cannot set parent node to be a child node:%s\n",GetName());
00085        printf("       Operation not performed!\n");
00086        return;
00087      }
00088      pp = pp->GetParent();
00089    }
00090 
00091    if (fParent)   fParent->GetListOfNodes()->Remove(this);
00092    else         gGeometry->GetListOfNodes()->Remove(this);
00093 
00094    fParent = parent;
00095 
00096    if (fParent) {
00097       fParent->BuildListOfNodes(); // new parent might not have list
00098       fParent->GetListOfNodes()->Add(this);
00099    }
00100    else gGeometry->GetListOfNodes()->Add(this);
00101 }

void TNodeX::UpdateMatrixVect (  )  [virtual]

Definition at line 104 of file TNodeX.cxx.

References gGeomLevel, gRotMatrix, and gTranslation.

00105 {
00106    // Update global rotation matrix vector for this node
00107    // this function must be called before invoking Local2MasterVect
00108 
00109    TNode *nodes[kMAXLEVELS], *node;
00110    Int_t i;
00111    for (i=0;i<kVectorSize;i++) gTranslation[0][i] = 0;
00112    for (i=0;i<kMatrixSize;i++) gRotMatrix[0][i] = 0;
00113    gRotMatrix[0][0] = 1;   gRotMatrix[0][4] = 1;   gRotMatrix[0][8] = 1;
00114 
00115    node     = this;
00116    gGeomLevel  = 0;
00117    //build array of parent nodes                                                
00118    while (node) {
00119       nodes[gGeomLevel] = node;
00120       node = node->GetParent();
00121       gGeomLevel++;
00122    }
00123    gGeomLevel--;
00124    //Update matrices in the hierarchy                                           
00125    for (i=1;i<=gGeomLevel;i++) {
00126       node = nodes[gGeomLevel-i];
00127       UpdateTempMatrix(&(gTranslation[i-1][0]),&gRotMatrix[i-1][0]
00128                       ,node->GetX(),node->GetY(),node->GetZ(),
00129                        node->GetMatrix()->GetMatrix()
00130                       ,&gTranslation[i][0],&gRotMatrix[i][0]);
00131    }
00132 }


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1