Logo ROOT   6.07/09
Reference Guide
geom_alice_its.C File Reference

Detailed Description

Shows geometry of ALICE ITS.

eve_geom_alice_its.png
#include "TEveManager.h"
#include "TEveGeoNode.h"
#include "TGeoManager.h"
#include "TGeoNode.h"
#include "TGeoVolume.h"
#include "TGeoMedium.h"
#include "TString.h"
void geom_alice_its()
{
gGeoManager = gEve->GetGeometry("http://root.cern.ch/files/alice.root");
TGeoNode* node = gGeoManager->GetTopVolume()->FindNode("ITSV_1");
}
//==============================================================================
// Demonstrate extraction of volumes matching certain criteria.
//==============================================================================
// Should be run in compiled mode -- CINT has issues with recursion.
//
// 1. Creation:
// root
// .L geom_alice_its.C+
// extract_ssd_modules()
// .q
// This creates file "test-extract.root" in current dir.
//
// 2. Viewing:
// root
// .x show_extract.C("test-extract.root")
TEveGeoNode* descend_extract(TGeoNode* node)
{
// We only return something if:
// - this is a node of interest;
// - one of the daughters returns something of interest.
const TString material("ITS_SI$");
TEveGeoNode *res = 0;
TGeoMedium *medium = node->GetVolume()->GetMedium();
if (medium && material == medium->GetName())
{
// Node of interest - instantiate eve representation and return.
res = new TEveGeoNode(node);
return res;
}
Int_t nd = node->GetNdaughters();
for (Int_t i = 0; i < nd; ++i)
{
TEveGeoNode *ed = descend_extract(node->GetDaughter(i));
if (ed)
{
if (res == 0) res = new TEveGeoNode(node);
res->AddElement(ed);
}
}
return res;
}
void extract_ssd_modules()
{
const TString kEH("extract_ssd_modules");
gGeoManager = gEve->GetGeometry("http://root.cern.ch/files/alice.root");
Bool_t s = gGeoManager->cd("/ITSV_1/ITSD_1/IT56_1");
if (!s) {
Error(kEH, "Start node not found.");
return;
}
TEveGeoNode *egn = descend_extract(node);
if (egn == 0)
{
Warning(kEH, "No matching nodes found.");
return;
}
egn->SaveExtract("test-extract.root", "AliSDD", kTRUE);
}
Author
Matevz Tadel

Definition in file geom_alice_its.C.