1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
19 /// \file MUONGenerateGentleGeometry.C
20 /// \brief Macro for generating a simplified geometry used by the
21 /// event display alieve. The generated file gentle_geo_muon.root
22 /// must be placed in EVE/alice-data/. The input is the sensitive
23 /// volumes list file svmap.dat and the geometry file geometry.root
25 /// To be run from aliroot:
27 /// .x MUONGenerateGentleGeometry.C
30 /// \author: M. Tadel, CERN and B. Vulpescu LPC, Clermont-Ferrand
32 #if !defined(__CINT__) || defined(__MAKECINT__)
35 #include <TEveManager.h>
36 #include <TEveGeoNode.h>
37 #include <TGeoManager.h>
40 #include <TObjArray.h>
41 #include <Riostream.h>
45 void AddNodes(TGeoNode *node, TEveGeoNode *parent, Int_t depth, Int_t depthmax,
48 void MUONGenerateGentleGeometry() {
50 gSystem->Load("libGeom");
52 TEveManager::Create();
54 TGeoManager::Import("geometry.root");
55 TGeoNode* tnode = gGeoManager->GetTopNode();
56 TEveGeoTopNode* eve_tnode = new TEveGeoTopNode(gGeoManager, tnode);
57 tnode->SetVisibility(kFALSE);
58 eve_tnode->SetVisLevel(0);
60 gEve->AddGlobalElement(eve_tnode);
67 ifstream in("data/svmap.dat", ios::in);
74 if (!path.Contains("ALIC")) continue;
76 list = path.Tokenize("/");
77 depth = list->GetEntries();
78 AddNodes(tnode,eve_tnode,depth,depth,list);
81 eve_tnode->SaveExtract("gentle_geo_muon.root", "Gentle MUON", kTRUE);
85 //_____________________________________________________________________________
86 void AddNodes(TGeoNode *node, TEveGeoNode *parent, Int_t depth, Int_t depthmax,
92 TObjString *nname = (TObjString*)list->At(depthmax-depth);
93 TString sname = nname->GetString();
95 TObjArray *nlist = node->GetVolume()->GetNodes();
96 if (nlist == 0x0) return;
97 Int_t nNodes = nlist->GetEntries();
99 for (Int_t in = 0; in < nNodes; in++)
101 TGeoNode *node2 = (TGeoNode*) nlist->At(in);
103 if (strcmp(node2->GetName(),sname.Data()) == 0)
105 son = dynamic_cast<TEveGeoNode*>(parent->FindChild(nname->GetName()));
108 son = new TEveGeoNode(node2);
109 parent->AddElement(son);
114 AddNodes(node2,son, depth, depthmax, list);