Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
export.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file export.cxx
1 void init()
2 {
3  gSystem->Load("libGeom");
4  TGeoManager::Import("ALICE_ITS_tgeo.root");
5 }
6 
7 typedef TGeoNode* pTGeoNode;
9 {
10  pTGeoNode node = NULL;
11  dfs(root, name, node);
12 
13  cout << name;
14  if(node != NULL)
15  {
16  cout << " Found!" << endl;
17  }
18  else
19  {
20  cout << " NOT Found!" << endl;
21  }
22  return node;
23 }
24 
25 
26 void dfs(pTGeoNode node, TString name, pTGeoNode& res)
27 {
28  if(res != NULL) return;
29  if(node->GetName() == name) res = node;
30  if(node->GetNdaughters() == 0) return;
31 
32  for(int i = 0; i < node->GetNdaughters(); ++i)
33  {
34  dfs(node->GetDaughter(i), name, res);
35  }
36 }
37 
38 void export()
39 {
40  pTGeoNode root = gGeoManager->GetTopNode();
41 
42  pTGeoNode node_inner = getNode(root, "ITSUWrapVol0_1");
43  pTGeoNode nodeb1 = getNode(node_inner, "Barrel0_1");
44  pTGeoNode nodeb2 = getNode(node_inner, "Barrel1_1");
45  pTGeoNode nodeb3 = getNode(node_inner, "Barrel2_1");
46 
47  TGeoVolume* vol_inner = node_inner->GetVolume();
48  vol_inner->RemoveNode(nodeb1);
49  vol_inner->RemoveNode(nodeb2);
50  vol_inner->RemoveNode(nodeb3);
51 
52  pTGeoNode node_mid = getNode(root, "ITSUWrapVol1_1");
53  pTGeoNode nodeb4 = getNode(node_mid, "Barrel3_1");
54  pTGeoNode nodeb5 = getNode(node_mid, "Barrel4_1");
55 
56  TGeoVolume* vol_mid = node_mid->GetVolume();
57  vol_mid->RemoveNode(nodeb4);
58  vol_mid->RemoveNode(nodeb5);
59 
60  pTGeoNode node_outer = getNode(root, "ITSUWrapVol2_1");
61  pTGeoNode nodeb6 = getNode(node_outer, "Barrel5_1");
62  pTGeoNode nodeb7 = getNode(node_outer, "Barrel6_1");
63 
64  TGeoVolume* vol_outer = node_outer->GetVolume();
65  vol_outer->RemoveNode(nodeb6);
66  vol_outer->RemoveNode(nodeb7);
67 
68  pTGeoNode top = getNode(root, "ITSV_2");
69  gGeoManager->SetTopVolume(top->GetVolume());
70  gROOT->ProcessLine("TGDMLWrite::StartGDMLWriting(gGeoManager,\"all.gdml\",\"\")");
71 }