Hello everybody,
I’m using ROOT 4.03.02 to build a very simple geometry with a top volume and a module volume inside. Now I want to move around the module quite often to calculate different intersections with a track. So I do something like
which gives a big memory leak. To avoid this I tried to free some memory when I ClearNodes by using
TObjArray* del=top->GetNodes();
if (del) del->SetOwner(kTRUE); //I guess otherwise matrices would keep being around
top->ClearNodes();
if (del) delete del;
This fixes about 90% of memory usage, but somehow can’t be used on more complicated geometries.
Is there a supposed way to move around existing volumes in a geometry? Can’t you just alter the transformation matrix and let the geometry manager know?
In the geometry package there are unfortunatelly still several methods that should be private or protected but they are not because they have to be called by external classes for internal purposes. TGeoVolume::ClearNodes() is one of them (as well as getting the pointer of the nodes array and deleting by hand).
Yes, there is an easier way of doing what you want:
// Create a "physical node" by specifying the path to your module
TGeoPhysicalNode *physical = gGeoManager->MakePhysicalNode("/TOP_1/MODULE_1");
// Get the pointer to the current local matrix of MODULE w.r.to TOP
TGeoMatrix *matrix = physical->GetNode()->GetMatrix();
// Change the matrix yourself or define a new one (you do not have to delete the old one)
...
// Now re-align your module with this matrix
physical->Align(matrix);
Your geometry now will have a new position for MODULE_1 and you can ask for crossing distance or whatever. You can do the Align part in a loop if you want, without deleting the physical node object. See also: $ROOTSYS/tutorials/geodemo.C in methods ideal() and align()
[
Hope this helps,
sorry to bother you again,
I checked out the two packages. Can I just compile those two seperately on my local directory and use the rest of ROOT from the institute-wide installation? (For example by setting the LD_LIBRARY_PATH variable)
Or do I have to install my own complete copy of ROOT?
Are these Module.mk makefiles that can be used standalone?
The Module.mk is not standalone, but of course you might be able to change it to do what you want.
However, is it so difficult for you to make a local installation from CVS? It would make things a bit easier…