TGeoPhysicalNode and path

Hi all,
I’m trying to use TGeoPhysicalNode to represent misalignment in my geometry.
I see in documentation that you supply c’tor with path name:

TGeoPhysicalNode(const char *path);

Well, that’s fine. The point that is preventing me to use misalignment is how to retreive the path information. In examples you provide (e.g. $ROOTSYS/tutorials/geom/building.C) or in the documentation it looks you really type by hand every time the path you are looking at.
I would expect something like this:

Int_t iNode = the_Node_Id_I_Am_Looking_At;
TGeoNode* aNode = gGeoManager->GetNode( iNode );
const char* pathName = aNode->GetPath();
TGeoPhysicalNode *pn1 = gGeoManager->MakePhysicalNode( pathName );

If I am lazy and I don’t want to re-type everytime , what can I do?

Many thanks in advance,

Hi Marco,

If there was possible to have a 1 to 1 correspondence between logical nodes (TGeoNode) and physical nodes why would we need a physical node at all ? No, you cannot make a physical node from a logical one simply because the logical one may be used to position a volume in different parts of the geometry. If you do not want to use the string, you can alternatively use:

gGeoManager->CdDown(i); // moved down on the i-th branch of current volume;

That is navigating the geometry hierarchy (which is not flat - so no indexing) using CdDown()/CdUp()


Hi Andrei,
what I was looking for was something like this:

const char *TGeoNodeCache::GetPath()
// Returns the current geometry path.
   fPath = "";
   for (Int_t level=0;level<fLevel+1; level++) {
      fPath += "/";
      fPath += fNodeBranch[level]->GetName();
   return fPath.Data();

that is here:

Why this kind of feature is not available in TGeoNode class but only in TGeoNodeCache?

BTW, sorry If I looked a bit rude. It was not my intention at all.

Many thanks in advance,

Marco, a TGeoNode knows nothing about the current branch, e.g:
C_3 is positioned in B_5 but also in B_1, B_2, … (it is in B volume). We could put this sort of method in TGeoNode but it would have to ask also TGeoManager/TGeoNodeCache for the current state/path (which is a global thing)… You are maybe confused by names, but there is a big difference between TGeoNode and TGeoPhysicalNode - the first is just a generic object while the second is a precise placement of it.
Yoiu can always navigate by node index (as pointed in my previous post) if you think it is more suitable.
B.t.w, no offense taken (why would I???)