Skip to content

Commit 0b26819

Browse files
Rene BrunRene Brun
authored andcommitted
From Andrei and Mihaela Gheata:
New package to edit/create detector geometries 1. Using the geombuilder with a geometry from scratch: root[0] new TGeoManager("test", "test geometry builder"); root[1] gGeoManager->Edit(); In this case forcing TGeoManager::Edit() is mandatory because the geometry cannot be yet drawn in the pad. There are few steps to create a valid geometry: - create at least one material from the "Materials" shutter item category. Generally for creating objects, the interface is always in the TGeoManagerEditor in different categories - one should just provide a name and requested params. - create a shape for the top volume within the "Shapes" category. For the moment the shapes that have editors are: Box, Trd1, Trd2, Tube, Tube segment, Cone, Cone segment and Sphere. More to come... - create a medium from one of the existing materials from the "Medium" category. You will notice that some categories as: "Volume" and "Medium" are inactive at the beginning because at that time there is no material yet (for making a medium) and no shape (for making a volume). These categories are dynamically activated once all the required components are defined. - create a volume from the "Volumes" category. You will notice that contrary to the other editors, the volume editor is opened in a tab, not transient - this is because it is more complex. - go back to "General" category and select the newly created volume as the top one (you can do it also from the volume category) This is just to start. To create really some hierarchy, one has to create several other volumes and the matrices to position them. Once this is done, use the volume editor interface to: - add/remove daughters, change shape, edit position of daughters - change visualization settings - divide the volume (only if there are no daughters yet) The TGeoManagerEditor GUI allows: - editing the geometry name/title, setting top volume, closing the geometry, exporting the geometry as .root or .C file - creation of new elements (shapes, volumes, materials, media, matrices) - editing existing elements (they can be browsed from transient dialogs) IMPORTANT: To access the manager editor if this is not in the "Style" tab one can either: - left-click on the top-right corner of the pad if something is drawn - call gGeoManager->Edit() 2. Editing an existing geometry (probably you should start with this first) - Just load the geometry in memory: root[0] .x $ROOTSYS/tutorials/rootgeom.C - draw some volume (if not already) then do View/Editor, then click on the top-right corner to get the manager editor. Clicking a volume will open the volume editor in the Style tab, but here I could not get rid of the TAttFill editor that is useless for volumes. - work with existing TGeoManagerEditor categories as explained at 1. git-svn-id: http://root.cern.ch/svn/root/trunk@15405 27541ba8-7e3a-0410-8455-c3a389f83636
1 parent 760c3c0 commit 0b26819

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+10340
-10
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ MODULES = build cint metautils pcre utils base cont meta net auth zip \
5555
clib matrix newdelete hist tree freetype graf g3d gpad gui \
5656
minuit histpainter treeplayer treeviewer physics postscript \
5757
rint html eg geom geompainter vmc fumili mlp gedold ged quadp \
58-
guibuilder xml foam splot smatrix sql tmva
58+
guibuilder xml foam splot smatrix sql tmva geombuilder
5959

6060
ifeq ($(ARCH),win32)
6161
MODULES += winnt win32gdk

config/mimes.unix.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,10 @@ pattern = TGeoGtra
366366
icon = geogtra_s.xpm geogtra_t.xpm
367367
action = ->Browse()
368368

369-
#[root/tgeocompositeshape]
370-
#pattern = TGeoCompositeShape
371-
#icon = geocomposite_s.xpm geocomposite_t.xpm
372-
#action = ->Browse()
369+
[root/tgeocompositeshape]
370+
pattern = TGeoCompositeShape
371+
icon = geocomposite_s.xpm geocomposite_t.xpm
372+
action = ->Browse()
373373

374374
#[root/tgeohalfspace]
375375
#pattern = TGeoHalfSpace

config/mimes.win32.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,10 @@ pattern = TGeoGtra
366366
icon = geogtra_s.xpm geogtra_t.xpm
367367
action = ->Browse()
368368

369-
#[root/tgeocompositeshape]
370-
#pattern = TGeoCompositeShape
371-
#icon = geocomposite_s.xpm geocomposite_t.xpm
372-
#action = ->Browse()
369+
[root/tgeocompositeshape]
370+
pattern = TGeoCompositeShape
371+
icon = geocomposite_s.xpm geocomposite_t.xpm
372+
action = ->Browse()
373373

374374
#[root/tgeohalfspace]
375375
#pattern = TGeoHalfSpace

config/rootrc.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# @(#)root/config:$Name: $:$Id: rootrc.in,v 1.141 2006/06/09 01:21:43 rdm Exp $
1+
# @(#)root/config:$Name: $:$Id: rootrc.in,v 1.142 2006/06/09 08:07:25 rdm Exp $
22
# Author: Fons Rademakers 22/09/95
33

44
# ROOT Environment settings are handled via the class TEnv. To see
@@ -455,6 +455,7 @@ Plugin.TVirtualTreePlayer: * TTreePlayer TreePlayer "TTreePlayer()"
455455
Plugin.TVirtualTreeViewer: * TTreeViewer TreeViewer "TTreeViewer(const TTree*)"
456456
Plugin.TSessionViewer: * TSessionViewer TreeViewer "TSessionViewer()"
457457
Plugin.TVirtualGeoPainter: * TGeoPainter GeomPainter "TGeoPainter(TGeoManager*)"
458+
Plugin.TGeoManagerEditor: * TGeoManagerEditor GeomBuilder "LoadLib()"
458459
Plugin.TVirtualUtil3D: * TUtil3D Graf3d "TUtil3D()"
459460
Plugin.TVirtualUtilHist: * TUtilHist Hist "TUtilHist()"
460461
Plugin.TVirtualUtilPad: * TUtilPad Gpad "TUtilPad()"

geombuilder/Module.mk

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Module.mk for geom module
2+
# Copyright (c) 2000 Rene Brun and Fons Rademakers
3+
#
4+
# Author: Fons Rademakers, 29/2/2000
5+
6+
MODDIR := geombuilder
7+
MODDIRS := $(MODDIR)/src
8+
MODDIRI := $(MODDIR)/inc
9+
10+
GEOMBUILDERDIR := $(MODDIR)
11+
GEOMBUILDERDIRS := $(GEOMBUILDERDIR)/src
12+
GEOMBUILDERDIRI := $(GEOMBUILDERDIR)/inc
13+
14+
##### libGeomBuilder #####
15+
GEOMBUILDERL := $(MODDIRI)/LinkDef.h
16+
GEOMBUILDERDS := $(MODDIRS)/G__GeomBuilder.cxx
17+
GEOMBUILDERDO := $(GEOMBUILDERDS:.cxx=.o)
18+
GEOMBUILDERDH := $(GEOMBUILDERDS:.cxx=.h)
19+
20+
GEOMBUILDERH := TGeoVolumeEditor.h TGeoBBoxEditor.h TGeoMediumEditor.h \
21+
TGeoNodeEditor.h TGeoMatrixEditor.h TGeoManagerEditor.h \
22+
TGeoTubeEditor.h TGeoConeEditor.h TGeoTrd1Editor.h TGeoTrd2Editor.h \
23+
TGeoMaterialEditor.h TGeoTabManager.h TGeoSphereEditor.h
24+
GEOMBUILDERH := $(patsubst %,$(MODDIRI)/%,$(GEOMBUILDERH))
25+
GEOMBUILDERS := $(filter-out $(MODDIRS)/G__%,$(wildcard $(MODDIRS)/*.cxx))
26+
GEOMBUILDERO := $(GEOMBUILDERS:.cxx=.o)
27+
28+
GEOMBUILDERDEP := $(GEOMBUILDERO:.o=.d) $(GEOMBUILDERDO:.o=.d)
29+
30+
GEOMBUILDERLIB := $(LPATH)/libGeomBuilder.$(SOEXT)
31+
32+
# used in the main Makefile
33+
ALLHDRS += $(patsubst $(MODDIRI)/%.h,include/%.h,$(GEOMBUILDERH))
34+
ALLLIBS += $(GEOMBUILDERLIB)
35+
36+
# include all dependency files
37+
INCLUDEFILES += $(GEOMBUILDERDEP)
38+
39+
##### local rules #####
40+
include/%.h: $(GEOMBUILDERDIRI)/%.h
41+
cp $< $@
42+
43+
$(GEOMBUILDERLIB): $(GEOMBUILDERO) $(GEOMBUILDERDO) $(ORDER_) $(MAINLIBS) $(GEOMBUILDERLIBDEP)
44+
@$(MAKELIB) $(PLATFORM) $(LD) "$(LDFLAGS)" \
45+
"$(SOFLAGS)" libGeomBuilder.$(SOEXT) $@ "$(GEOMBUILDERO) $(GEOMBUILDERDO)" \
46+
"$(GEOMBUILDERLIBEXTRA)"
47+
48+
$(GEOMBUILDERDS): $(GEOMBUILDERH) $(GEOMBUILDERL) $(ROOTCINTTMPEXE)
49+
@echo "Generating dictionary $@..."
50+
$(ROOTCINTTMP) -f $@ -c $(GEOMBUILDERH) $(GEOMBUILDERL)
51+
52+
$(GEOMBUILDERDO): $(GEOMBUILDERDS)
53+
$(CXX) $(NOOPT) $(CXXFLAGS) -I. -o $@ -c $<
54+
55+
all-geombuilder: $(GEOMBUILDERLIB)
56+
57+
map-geombuilder: $(RLIBMAP)
58+
$(RLIBMAP) -r $(ROOTMAP) -l $(GEOMBUILDERLIB) \
59+
-d $(GEOMBUILDERLIBDEP) -c $(GEOMBUILDERL)
60+
61+
map:: map-geom
62+
63+
clean-geombuilder:
64+
@rm -f $(GEOMBUILDERO) $(GEOMBUILDERDO)
65+
66+
clean:: clean-geombuilder
67+
68+
distclean-geombuilder: clean-geombuilder
69+
@rm -f $(GEOMBUILDERDEP) $(GEOMBUILDERDS) $(GEOMBUILDERDH) $(GEOMBUILDERLIB)
70+
71+
distclean:: distclean-geombuilder

geombuilder/inc/LinkDef.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// @(#)$Name: $:$Id: Exp $
2+
/*************************************************************************
3+
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
4+
* All rights reserved. *
5+
* *
6+
* For the licensing terms see $ROOTSYS/LICENSE. *
7+
* For the list of contributors see $ROOTSYS/README/CREDITS. *
8+
*************************************************************************/
9+
10+
#ifdef __CINT__
11+
12+
#pragma link off all globals;
13+
#pragma link off all classes;
14+
#pragma link off all functions;
15+
16+
#pragma link C++ class TGeoVolumeEditor;
17+
#pragma link C++ class TGeoBBoxEditor;
18+
#pragma link C++ class TGeoTubeEditor;
19+
#pragma link C++ class TGeoTubeSegEditor;
20+
#pragma link C++ class TGeoConeEditor;
21+
#pragma link C++ class TGeoConeSegEditor;
22+
#pragma link C++ class TGeoTrd1Editor;
23+
#pragma link C++ class TGeoTrd2Editor;
24+
#pragma link C++ class TGeoSphereEditor;
25+
#pragma link C++ class TGeoMediumEditor;
26+
#pragma link C++ class TGeoMaterialEditor;
27+
#pragma link C++ class TGeoNodeEditor;
28+
#pragma link C++ class TGeoTranslationEditor;
29+
#pragma link C++ class TGeoRotationEditor;
30+
#pragma link C++ class TGeoCombiTransEditor;
31+
#pragma link C++ class TGeoManagerEditor;
32+
#pragma link C++ class TGeoTabManager;
33+
#pragma link C++ class TGeoTransientPanel;
34+
#pragma link C++ class TGeoTreeDialog;
35+
#pragma link C++ class TGeoVolumeDialog;
36+
#pragma link C++ class TGeoShapeDialog;
37+
#pragma link C++ class TGeoMatrixDialog;
38+
#pragma link C++ class TGeoMediumDialog;
39+
#pragma link C++ class TGeoMaterialDialog;
40+
41+
#endif

geombuilder/inc/TGeoBBoxEditor.h

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
// @(#):$Name: $:$Id: Exp $
2+
// Author: M.Gheata
3+
/*************************************************************************
4+
* Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. *
5+
* All rights reserved. *
6+
* *
7+
* For the licensing terms see $ROOTSYS/LICENSE. *
8+
* For the list of contributors see $ROOTSYS/README/CREDITS. *
9+
*************************************************************************/
10+
11+
#ifndef ROOT_TGeoBBoxEditor
12+
#define ROOT_TGeoBBoxEditor
13+
14+
//////////////////////////////////////////////////////////////////////////
15+
// //
16+
// TGeoBBoxEditor //
17+
// //
18+
// Editor for a TGeoBBox. //
19+
// //
20+
//////////////////////////////////////////////////////////////////////////
21+
22+
#ifndef ROOT_TGButton
23+
#include "TGWidget.h"
24+
#endif
25+
#ifndef ROOT_TGedFrame
26+
#include "TGedFrame.h"
27+
#endif
28+
29+
class TGeoBBox;
30+
class TGeoTabManager;
31+
class TGTextEntry;
32+
class TGNumberEntry;
33+
class TGTab;
34+
class TGComboBox;
35+
class TGTextButton;
36+
class TString;
37+
38+
class TGeoBBoxEditor : public TGedFrame {
39+
40+
protected:
41+
42+
Double_t fDxi; // Initial box dx
43+
Double_t fDyi; // Initial box dy
44+
Double_t fDzi; // Initial box dz
45+
Double_t fOrigi[3]; // Initial origin
46+
TString fNamei; // Initial name
47+
TGeoBBox *fShape; // Shape object
48+
Bool_t fIsModified; // Flag that volume was modified
49+
Bool_t fIsShapeEditable; // Flag that the shape can be changed
50+
TGeoTabManager *fTabMgr; // Tab manager
51+
TGTextEntry *fShapeName; // Shape name text entry
52+
TGNumberEntry *fBoxDx; // Number entry for box DX
53+
TGNumberEntry *fBoxDy; // Number entry for box DY
54+
TGNumberEntry *fBoxDz; // Number entry for box DZ
55+
TGNumberEntry *fBoxOx; // Number entry for box OX
56+
TGNumberEntry *fBoxOy; // Number entry for box OY
57+
TGNumberEntry *fBoxOz; // Number entry for box OZ
58+
TGTextButton *fApply; // Apply-Button to accept changes
59+
TGTextButton *fCancel; // Cancel-Button
60+
TGTextButton *fUndo; // Undo-Button
61+
62+
virtual void ConnectSignals2Slots(); // Connect the signals to the slots
63+
64+
public:
65+
TGeoBBoxEditor(const TGWindow *p, Int_t id,
66+
Int_t width = 140, Int_t height = 30,
67+
UInt_t options = kChildFrame,
68+
Pixel_t back = GetDefaultFrameBackground());
69+
virtual ~TGeoBBoxEditor();
70+
virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event);
71+
72+
void DoDx();
73+
void DoDy();
74+
void DoDz();
75+
void DoModified();
76+
void DoName();
77+
Bool_t DoBoxParameters();
78+
void DoApply();
79+
void DoCancel();
80+
void DoUndo();
81+
82+
ClassDef(TGeoBBoxEditor,0) // TGeoBBox editor
83+
};
84+
85+
#endif

geombuilder/inc/TGeoConeEditor.h

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
// @(#):$Name: $:$Id: Exp $
2+
// Author: M.Gheata
3+
/*************************************************************************
4+
* Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. *
5+
* All rights reserved. *
6+
* *
7+
* For the licensing terms see $ROOTSYS/LICENSE. *
8+
* For the list of contributors see $ROOTSYS/README/CREDITS. *
9+
*************************************************************************/
10+
11+
#ifndef ROOT_TGeoConeEditor
12+
#define ROOT_TGeoConeEditor
13+
14+
//////////////////////////////////////////////////////////////////////////
15+
// //
16+
// TGeoConeEditor //
17+
// //
18+
// Editor for a TGeoCone. //
19+
// //
20+
//////////////////////////////////////////////////////////////////////////
21+
22+
#ifndef ROOT_TGButton
23+
#include "TGWidget.h"
24+
#endif
25+
#ifndef ROOT_TGedFrame
26+
#include "TGedFrame.h"
27+
#endif
28+
29+
class TGeoCone;
30+
class TGeoConeSeg;
31+
class TGeoTabManager;
32+
class TGTextEntry;
33+
class TGNumberEntry;
34+
class TGTab;
35+
class TGComboBox;
36+
class TGTextButton;
37+
class TString;
38+
39+
class TGeoConeEditor : public TGedFrame {
40+
41+
protected:
42+
43+
Double_t fRmini1; // Initial inner radius at -dz
44+
Double_t fRmaxi1; // Initial outer radius at -dz
45+
Double_t fRmini2; // Initial inner radius at +dz
46+
Double_t fRmaxi2; // Initial outer radius at +dz
47+
Double_t fDzi; // Initial box dz
48+
TString fNamei; // Initial name
49+
TGeoCone *fShape; // Shape object
50+
Bool_t fIsModified; // Flag that volume was modified
51+
Bool_t fIsShapeEditable; // Flag that the shape can be changed
52+
TGeoTabManager *fTabMgr; // Tab manager
53+
TGTextEntry *fShapeName; // Shape name text entry
54+
TGNumberEntry *fERmin1; // Number entry for rmin1
55+
TGNumberEntry *fERmin2; // Number entry for rmin2
56+
TGNumberEntry *fERmax1; // Number entry for rmax1
57+
TGNumberEntry *fERmax2; // Number entry for rmax2
58+
TGNumberEntry *fEDz; // Number entry for DZ
59+
TGTextButton *fApply; // Apply-Button to accept changes
60+
TGTextButton *fCancel; // Cancel-Button
61+
TGTextButton *fUndo; // Undo-Button
62+
63+
virtual void ConnectSignals2Slots(); // Connect the signals to the slots
64+
65+
public:
66+
TGeoConeEditor(const TGWindow *p, Int_t id,
67+
Int_t width = 140, Int_t height = 30,
68+
UInt_t options = kChildFrame,
69+
Pixel_t back = GetDefaultFrameBackground());
70+
virtual ~TGeoConeEditor();
71+
virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event);
72+
73+
void DoRmin1();
74+
void DoRmin2();
75+
void DoRmax1();
76+
void DoRmax2();
77+
void DoDz();
78+
void DoModified();
79+
void DoName();
80+
virtual void DoApply();
81+
virtual void DoCancel();
82+
virtual void DoUndo();
83+
84+
ClassDef(TGeoConeEditor,0) // TGeoCone editor
85+
};
86+
87+
//////////////////////////////////////////////////////////////////////////
88+
// //
89+
// TGeoConeSegEditor //
90+
// //
91+
// Editor for a cone segment. //
92+
// //
93+
//////////////////////////////////////////////////////////////////////////
94+
95+
class TGDoubleVSlider;
96+
97+
class TGeoConeSegEditor : public TGeoConeEditor {
98+
99+
protected:
100+
101+
Bool_t fLock; // Phi lock
102+
Double_t fPmini; // Initial phi min
103+
Double_t fPmaxi; // Initial phi max
104+
TGDoubleVSlider *fSPhi; // Phi slider
105+
TGNumberEntry *fEPhi1; // Number entry for phi1
106+
TGNumberEntry *fEPhi2; // Number entry for phi2
107+
108+
virtual void ConnectSignals2Slots(); // Connect the signals to the slots
109+
110+
public:
111+
TGeoConeSegEditor(const TGWindow *p, Int_t id,
112+
Int_t width = 140, Int_t height = 30,
113+
UInt_t options = kChildFrame,
114+
Pixel_t back = GetDefaultFrameBackground());
115+
virtual ~TGeoConeSegEditor();
116+
virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event);
117+
118+
void DoPhi();
119+
void DoPhi1();
120+
void DoPhi2();
121+
virtual void DoApply();
122+
virtual void DoUndo();
123+
virtual void DoCancel();
124+
125+
ClassDef(TGeoConeSegEditor,0) // TGeoConeSeg editor
126+
};
127+
128+
#endif

0 commit comments

Comments
 (0)