Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGeoManagerEditor.cxx
Go to the documentation of this file.
1// @(#):$Id$
2// Author: M.Gheata
3
4/*************************************************************************
5 * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12/** \class TGeoManagerEditor
13\ingroup Geometry_builder
14
15Editor for TGeoManager class. Provides also builder functionality for the
16main TGeo objects: TGeoVolume, TGeoShape - derived classes, TGeoMaterial,
17TGeoMatrix - derived transformations and TGeoMedium.
18The GUI represents the main entry point for editing geometry classes. It
19can be started either by:
20
21 1. TGeoManager::Edit(). The method must be used when starting from a new
22 geometry.
23 2. Left-click on the 40x40 pixels top-right corner of a pad containing a
24 drawn volume. The region is always accesible when drawing geometry elements
25 and allows also restoring the manager editor in the "Style" tab of the GED
26 editor anytime.
27
28The TGeoManager editor is vertically split by a TGShutter widget into the
29following categories:
30
31 - General. This allows changing the name/title of the geometry, setting the
32 top volume, closing the geometry and saving the geometry in a file. The name
33 of the geometry file is formed by geometry_name.C/.root depending if the geometry
34 need to be saved as a C macro or a .root file.
35 - Shapes. The category provide buttons for creation of all supported shapes. The
36 new shape name is chosen by the interface, but can be changed from the shape
37 editor GUI. Existing shapes can be browsed and edited from the same category.
38 - Volumes. The category allows the creation of a new volume having a given name,
39 shape and medium. For creating a volume assembly only the name is relevant.
40 Existing volumes can be browsed or edited from this category.
41 - Materials. Allows creation of new materials/mixtures or editing existing ones.
42 - Media. The same for creation/editing of tracking media (materials having a set
43 of properties related to tracking)
44 - Matrices. Allows creation of translations, rotations or combined transformations.
45 Existing matrices can also be browser/edited.
46*/
47
48#include "TVirtualPad.h"
49#include "TCanvas.h"
50#include "TGTab.h"
51#include "TG3DLine.h"
52#include "TGComboBox.h"
53#include "TGButton.h"
54#include "TGButtonGroup.h"
55#include "TGTextEntry.h"
56#include "TGNumberEntry.h"
57#include "TGLabel.h"
58#include "TGShutter.h"
59
60#include "TGeoVolumeEditor.h"
61#include "TGeoNodeEditor.h"
62#include "TGeoTabManager.h"
63#include "TGeoVolume.h"
64#include "TGeoManager.h"
65#include "TGeoMatrix.h"
66#include "TGeoBBox.h"
67#include "TGeoPara.h"
68#include "TGeoArb8.h"
69#include "TGeoTube.h"
70#include "TGeoEltu.h"
71#include "TGeoHype.h"
72#include "TGeoTorus.h"
73#include "TGeoTrd1.h"
74#include "TGeoTrd2.h"
75#include "TGeoCone.h"
76#include "TGeoSphere.h"
77#include "TGeoPcon.h"
78#include "TGeoPgon.h"
79#include "TGeoElement.h"
80#include "TGeoMaterial.h"
81#include "TView.h"
82
83#include "TGeoManagerEditor.h"
84#include "TGedEditor.h"
85
86
152
153////////////////////////////////////////////////////////////////////////////////
154/// Constructor for manager editor.
155
157 : TGedFrame(p, width, height, options | kVerticalFrame, back)
158{
160 fTabMgr = nullptr;
161 fTab = nullptr;
162 fConnectedCanvas = nullptr;
163
166 TGLabel *label;
167
168 // TGShutter for categories
170
172 Pixel_t color;
173 // General settings
175 container = (TGCompositeFrame *)si->GetContainer();
176 container->SetBackgroundColor(GetDefaultFrameBackground());
178 // TextEntry for manager name
180 f1->AddFrame(label = new TGLabel(f1, "Name/Title"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
181 f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
182 gClient->GetColorByName("#ff0000", color);
183 label->SetTextColor(color);
184 container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
187 fManagerName->SetToolTipText("Enter the geometry name");
188 container->AddFrame(fManagerName, new TGLayoutHints(kLHintsLeft, 3, 1, 0, 0));
191 fManagerTitle->SetToolTipText("Enter the geometry name");
192 container->AddFrame(fManagerTitle, new TGLayoutHints(kLHintsLeft, 3, 1, 0, 0));
194 f1->AddFrame(label = new TGLabel(f1, "Export geometry"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
195 f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
196 gClient->GetColorByName("#ff0000", color);
197 label->SetTextColor(color);
198 container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 6, 0));
199 TString stitle = "Options";
202 fExportOption[0] = new TGRadioButton(bg, ".root", kEXPORT_ROOT);
203 fExportOption[1] = new TGRadioButton(bg, ".C", kEXPORT_C);
205 bg->SetRadioButtonExclusive();
206 bg->SetButton(kEXPORT_ROOT);
207 bg->Show();
208 f1->AddFrame(bg, new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
209 f1->AddFrame(fExportButton, new TGLayoutHints(kLHintsLeft, 20, 2, 22, 0));
210 container->AddFrame(f1, new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 2, 2));
211 // Close geometry
214 f1->AddFrame(label = new TGLabel(f1, "Close geometry"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
215 f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
216 gClient->GetColorByName("#ff0000", color);
217 label->SetTextColor(color);
218 f7->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
220 fLSelTop = new TGLabel(f1, "Select top");
221 gClient->GetColorByName("#0000ff", color);
222 fLSelTop->SetTextColor(color);
224 f1->AddFrame(fLSelTop, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2));
226 fBSelTop->SetToolTipText("Select the top volume");
227 fBSelTop->Associate(this);
228 f1->AddFrame(fBSelTop, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
229 fCloseGeometry = new TGTextButton(f1, "Close");
230 f1->AddFrame(fCloseGeometry, new TGLayoutHints(kLHintsRight, 1, 1, 2, 2));
231 fCloseGeometry->SetToolTipText("Close geometry to make it ready for tracking");
233 f7->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
234 container->AddFrame(f7, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
235
236 si = new TGShutterItem(fCategories, new TGHotString("Shapes"), kCAT_SHAPES);
237 container = (TGCompositeFrame *)si->GetContainer();
238 container->SetBackgroundColor(GetDefaultFrameBackground());
240
241 // Shape creators
243 f1->AddFrame(label = new TGLabel(f1, "Create new shape"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
244 f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
245 gClient->GetColorByName("#ff0000", color);
246 label->SetTextColor(color);
247 container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
248 TGLayoutHints *lhb = new TGLayoutHints(kLHintsLeft, 0, 4, 0, 0);
250 Int_t ipict;
252 fShapeButton[0] = new TGPictureButton(f1, fClient->GetPicture("geobbox_t.xpm"), kCREATE_BOX);
253 fShapeButton[0]->SetToolTipText("Create a box");
254 fShapeButton[1] = new TGPictureButton(f1, fClient->GetPicture("geopara_t.xpm"), kCREATE_PARA);
255 fShapeButton[1]->SetToolTipText("Create a parallelipiped");
256 fShapeButton[2] = new TGPictureButton(f1, fClient->GetPicture("geotrd1_t.xpm"), kCREATE_TRD1);
257 fShapeButton[2]->SetToolTipText("Create a TRD1 trapezoid");
258 fShapeButton[3] = new TGPictureButton(f1, fClient->GetPicture("geotrd2_t.xpm"), kCREATE_TRD2);
259 fShapeButton[3]->SetToolTipText("Create a TRD2 trapezoid");
260 fShapeButton[4] = new TGPictureButton(f1, fClient->GetPicture("geotrap_t.xpm"), kCREATE_TRAP);
261 fShapeButton[4]->SetToolTipText("Create a general trapezoid");
262 fShapeButton[5] = new TGPictureButton(f1, fClient->GetPicture("geogtra_t.xpm"), kCREATE_GTRA);
263 fShapeButton[5]->SetToolTipText("Create a general twisted trapezoid");
264 for (ipict = 0; ipict < 6; ipict++)
265 f1->AddFrame(fShapeButton[ipict], lhb);
266 container->AddFrame(f1, lhf1);
268 fShapeButton[6] = new TGPictureButton(f1, fClient->GetPicture("geoxtru_t.xpm"), kCREATE_XTRU);
269 fShapeButton[6]->SetToolTipText("Create a extruded polygone");
270 fShapeButton[7] = new TGPictureButton(f1, fClient->GetPicture("geoarb8_t.xpm"), kCREATE_ARB8);
271 fShapeButton[7]->SetToolTipText("Create an arbitrary trapezoid with 8 vertices");
272 fShapeButton[8] = new TGPictureButton(f1, fClient->GetPicture("geotube_t.xpm"), kCREATE_TUBE);
273 fShapeButton[8]->SetToolTipText("Create a cylindrical pipe");
274 fShapeButton[9] = new TGPictureButton(f1, fClient->GetPicture("geotubeseg_t.xpm"), kCREATE_TUBS);
275 fShapeButton[9]->SetToolTipText("Create a cylindrical pipe within a phi range");
276 fShapeButton[10] = new TGPictureButton(f1, fClient->GetPicture("geocone_t.xpm"), kCREATE_CONE);
277 fShapeButton[10]->SetToolTipText("Create a conical pipe");
278 fShapeButton[11] = new TGPictureButton(f1, fClient->GetPicture("geoconeseg_t.xpm"), kCREATE_CONS);
279 fShapeButton[11]->SetToolTipText("Create a conical pipe within a phi range");
280 for (ipict = 0; ipict < 6; ipict++)
281 f1->AddFrame(fShapeButton[ipict + 6], lhb);
282 container->AddFrame(f1, lhf1);
284 fShapeButton[12] = new TGPictureButton(f1, fClient->GetPicture("geosphere_t.xpm"), kCREATE_SPHE);
285 fShapeButton[12]->SetToolTipText("Create a spherical sector");
286 fShapeButton[13] = new TGPictureButton(f1, fClient->GetPicture("geoctub_t.xpm"), kCREATE_CTUB);
287 fShapeButton[13]->SetToolTipText("Create a cut tube");
288 fShapeButton[14] = new TGPictureButton(f1, fClient->GetPicture("geoeltu_t.xpm"), kCREATE_ELTU);
289 fShapeButton[14]->SetToolTipText("Create an elliptical tube");
290 fShapeButton[15] = new TGPictureButton(f1, fClient->GetPicture("geotorus_t.xpm"), kCREATE_TORUS);
291 fShapeButton[15]->SetToolTipText("Create a toroidal tube with a phi range");
292 fShapeButton[16] = new TGPictureButton(f1, fClient->GetPicture("geopcon_t.xpm"), kCREATE_PCON);
293 fShapeButton[16]->SetToolTipText("Create a polycone shape");
294 fShapeButton[17] = new TGPictureButton(f1, fClient->GetPicture("geopgon_t.xpm"), kCREATE_PGON);
295 fShapeButton[17]->SetToolTipText("Create a polygon shape");
296 for (ipict = 0; ipict < 6; ipict++)
297 f1->AddFrame(fShapeButton[ipict + 12], lhb);
298 container->AddFrame(f1, lhf1);
300 fShapeButton[18] = new TGPictureButton(f1, fClient->GetPicture("geohype_t.xpm"), kCREATE_HYPE);
301 fShapeButton[18]->SetToolTipText("Create a hyperboloid");
302 fShapeButton[19] = new TGPictureButton(f1, fClient->GetPicture("geoparab_t.xpm"), kCREATE_PARAB);
303 fShapeButton[19]->SetToolTipText("Create a paraboloid");
304 fShapeButton[20] = new TGPictureButton(f1, fClient->GetPicture("geocomposite_t.xpm"), kCREATE_COMP);
305 fShapeButton[20]->SetToolTipText("Create a composite shape");
306 for (ipict = 0; ipict < 3; ipict++)
307 f1->AddFrame(fShapeButton[ipict + 18], lhb);
308 container->AddFrame(f1, lhf1);
309
310 // List of shapes
313 f1->AddFrame(label = new TGLabel(f1, "Existing shapes"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
314 f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
315 gClient->GetColorByName("#ff0000", color);
316 label->SetTextColor(color);
317 f2->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 0, 0));
319 fSelectedShape = nullptr;
320 fLSelShape = new TGLabel(f1, "Select shape");
321 gClient->GetColorByName("#0000ff", color);
322 fLSelShape->SetTextColor(color);
324 f1->AddFrame(fLSelShape, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2));
326 fBSelShape->SetToolTipText("Select one of the existing shapes");
327 fBSelShape->Associate(this);
328 f1->AddFrame(fBSelShape, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
329 fEditShape = new TGTextButton(f1, "Edit");
330 f1->AddFrame(fEditShape, new TGLayoutHints(kLHintsRight, 1, 1, 2, 2));
331 fEditShape->SetToolTipText("Edit selected shape");
332 fEditShape->Associate(this);
333 f2->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
334 container->AddFrame(f2, new TGLayoutHints(kLHintsLeft, 0, 0, 6, 0));
335
336 // Volumes category
337 si = new TGShutterItem(fCategories, new TGHotString("Volumes"), kCAT_VOLUMES);
338 container = (TGCompositeFrame *)si->GetContainer();
339 container->SetBackgroundColor(GetDefaultFrameBackground());
341
343 f1->AddFrame(label = new TGLabel(f1, "Create new volume"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
344 f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
345 gClient->GetColorByName("#ff0000", color);
346 label->SetTextColor(color);
347 container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
348
350 f1->AddFrame(new TGLabel(f1, "Name"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
353 fVolumeName->SetToolTipText("Enter the name for the new volume");
354 f1->AddFrame(fVolumeName, new TGLayoutHints(kLHintsRight, 3, 1, 2, 5));
355 container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
356
357 // ComboBox for shape component
359 fSelectedShape2 = nullptr;
360 fLSelShape2 = new TGLabel(f1, "Select shape");
361 gClient->GetColorByName("#0000ff", color);
364 f1->AddFrame(fLSelShape2, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2));
366 fBSelShape2->SetToolTipText("Select one of the existing shapes");
367 fBSelShape2->Associate(this);
368 f1->AddFrame(fBSelShape2, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
369 container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
370
371 // ComboBox for medium component
373 fSelectedMedium2 = nullptr;
374 fLSelMedium2 = new TGLabel(f1, "Select medium");
375 gClient->GetColorByName("#0000ff", color);
378 f1->AddFrame(fLSelMedium2, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2));
380 fBSelMedium2->SetToolTipText("Select one of the existing media");
381 fBSelMedium2->Associate(this);
382 f1->AddFrame(fBSelMedium2, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
383 container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
384 // Picture buttons for different volumes
386 f1->AddFrame(new TGLabel(f1, "Create..."), new TGLayoutHints(kLHintsLeft, 1, 5, 6, 0));
387 fVolumeButton[0] = new TGPictureButton(f1, fClient->GetPicture("geovolume_t.xpm"), kCREATE_VOLUME);
388 fVolumeButton[0]->SetToolTipText("Create a new volume from shape and medium");
389 fVolumeButton[1] = new TGPictureButton(f1, fClient->GetPicture("geoassembly_t.xpm"), kCREATE_ASSEMBLY);
390 fVolumeButton[1]->SetToolTipText("Create a new volume assembly having the selected name");
391 for (ipict = 0; ipict < 2; ipict++)
392 f1->AddFrame(fVolumeButton[ipict], lhb);
393 container->AddFrame(f1, lhf1);
394 // List of volumes
397 f1->AddFrame(label = new TGLabel(f1, "Existing volumes"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
398 f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
399 gClient->GetColorByName("#ff0000", color);
400 label->SetTextColor(color);
401 f3->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 0, 0));
403 fSelectedVolume = nullptr;
404 fLSelVolume = new TGLabel(f1, "Select volume");
405 gClient->GetColorByName("#0000ff", color);
408 f1->AddFrame(fLSelVolume, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2));
410 fBSelVolume->SetToolTipText("Select one of the existing volumes");
411 fBSelVolume->Associate(this);
412 f1->AddFrame(fBSelVolume, new TGLayoutHints(kLHintsRight, 1, 1, 2, 2));
413 f3->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
415 fEditVolume = new TGTextButton(f1, " Edit ");
416 f1->AddFrame(fEditVolume, new TGLayoutHints(kLHintsLeft, 20, 1, 2, 2));
417 fEditVolume->SetToolTipText("Edit selected volume");
418 fEditVolume->Associate(this);
419 fSetTopVolume = new TGTextButton(f1, "Set top");
420 f1->AddFrame(fSetTopVolume, new TGLayoutHints(kLHintsRight, 1, 20, 2, 2));
421 fSetTopVolume->SetToolTipText("Set top volume for geometry");
423 f3->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
424 container->AddFrame(f3, new TGLayoutHints(kLHintsLeft, 0, 0, 6, 0));
425
426 // Materials category
427 si = new TGShutterItem(fCategories, new TGHotString("Materials"), kCAT_MATERIALS);
428 container = (TGCompositeFrame *)si->GetContainer();
429 container->SetBackgroundColor(GetDefaultFrameBackground());
431
432 // Material creators
435 f1->AddFrame(label = new TGLabel(f1, "Create material/mixt."), new TGLayoutHints(kLHintsLeft, 2, 1, 0, 0));
436 f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
437 gClient->GetColorByName("#ff0000", color);
438 label->SetTextColor(color);
439 container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
441 f1->AddFrame(new TGLabel(f1, "Name"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
444 fMaterialName->SetToolTipText("Enter the new material name");
445 f1->AddFrame(fMaterialName, new TGLayoutHints(kLHintsRight, 3, 1, 2, 5));
446 container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
447
449 f1->AddFrame(new TGLabel(f1, "Element"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
453 if (table) {
455 for (Int_t i = 0; i < table->GetNelements(); i++) {
456 element = table->GetElement(i);
457 fElementList->AddEntry(element->GetTitle(), i);
458 }
459 }
461 f1->AddFrame(fElementList, new TGLayoutHints(kLHintsRight, 2, 2, 4, 4));
462 container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
463 // Number entry for density
465 f1->AddFrame(new TGLabel(f1, "Density"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
471 nef->SetToolTipText("Enter material/mixture density");
474 f1->AddFrame(fEntryDensity, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2));
475 container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
476 // Buttons for creating materials/mixtures
477 // Picture buttons for different volumes
479 f1->AddFrame(new TGLabel(f1, "Create..."), new TGLayoutHints(kLHintsLeft, 1, 5, 6, 0));
480 fMaterialButton[0] = new TGPictureButton(f1, fClient->GetPicture("geomaterial_t.xpm"), kCREATE_MATERIAL);
481 fMaterialButton[0]->SetToolTipText("Create a new material from element and density");
482 fMaterialButton[1] = new TGPictureButton(f1, fClient->GetPicture("geomixture_t.xpm"), kCREATE_MIXTURE);
483 fMaterialButton[1]->SetToolTipText("Create a new mixture with selected density");
484 for (ipict = 0; ipict < 2; ipict++)
485 f1->AddFrame(fMaterialButton[ipict], lhb);
486 container->AddFrame(f1, lhf1);
487
488 // List of materials
491 f1->AddFrame(label = new TGLabel(f1, "Existing materials"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
492 f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
493 gClient->GetColorByName("#ff0000", color);
494 label->SetTextColor(color);
495 f4->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 0, 0));
497 fSelectedMaterial = nullptr;
498 fLSelMaterial = new TGLabel(f1, "Select material");
499 gClient->GetColorByName("#0000ff", color);
504 fBSelMaterial->SetToolTipText("Select one of the existing materials");
506 f1->AddFrame(fBSelMaterial, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
507 fEditMaterial = new TGTextButton(f1, "Edit");
508 f1->AddFrame(fEditMaterial, new TGLayoutHints(kLHintsRight, 1, 1, 2, 2));
509 fEditMaterial->SetToolTipText("Edit selected material");
511 f4->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
512 container->AddFrame(f4, new TGLayoutHints(kLHintsLeft, 0, 0, 6, 0));
513
514 si = new TGShutterItem(fCategories, new TGHotString("Media"), kCAT_MEDIA);
515 container = (TGCompositeFrame *)si->GetContainer();
516 container->SetBackgroundColor(GetDefaultFrameBackground());
518
519 // Media category
521 f1->AddFrame(label = new TGLabel(f1, "Create new medium"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
522 f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
523 gClient->GetColorByName("#ff0000", color);
524 label->SetTextColor(color);
525 container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
526
528 f1->AddFrame(new TGLabel(f1, "Name"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
531 fMediumName->SetToolTipText("Enter the new medium name");
532 f1->AddFrame(fMediumName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5));
533
534 fMediumId = new TGNumberEntry(f1, 0., 5, kMEDIUM_ID);
539 nef->SetToolTipText("Enter medium ID");
541 fMediumId->Associate(this);
542 f1->AddFrame(fMediumId, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2));
543 f1->AddFrame(new TGLabel(f1, "ID"), new TGLayoutHints(kLHintsRight, 1, 1, 6, 0));
544 container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 0));
545 // ComboBox for materials
547 fSelectedMaterial2 = nullptr;
548 fLSelMaterial2 = new TGLabel(f1, "Select material");
549 gClient->GetColorByName("#0000ff", color);
554 fBSelMaterial2->SetToolTipText("Select one of the existing materials");
556 f1->AddFrame(fBSelMaterial2, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
557 container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 0, 0));
559 f1->AddFrame(new TGLabel(f1, "Create..."), new TGLayoutHints(kLHintsLeft, 1, 5, 6, 0));
561 fMediumButton->SetToolTipText("Create a new medium from selected material");
563 f1->AddFrame(fMediumButton, new TGLayoutHints(kLHintsLeft, 5, 2, 2, 2));
564 container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
565
566 // List of media
569 f1->AddFrame(label = new TGLabel(f1, "Existing media"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
570 f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
571 gClient->GetColorByName("#ff0000", color);
572 label->SetTextColor(color);
573 f5->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 0, 0));
575 fSelectedMedium = nullptr;
576 fLSelMedium = new TGLabel(f1, "Select medium");
577 gClient->GetColorByName("#0000ff", color);
580 f1->AddFrame(fLSelMedium, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2));
582 fBSelMedium->SetToolTipText("Select one of the existing media");
583 fBSelMedium->Associate(this);
584 f1->AddFrame(fBSelMedium, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
585 fEditMedium = new TGTextButton(f1, "Edit");
586 f1->AddFrame(fEditMedium, new TGLayoutHints(kLHintsRight, 1, 1, 2, 2));
587 fEditMedium->SetToolTipText("Edit selected medium");
588 fEditMedium->Associate(this);
589 f5->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
590 container->AddFrame(f5, new TGLayoutHints(kLHintsLeft, 0, 0, 6, 0));
591
592 // Matrix category
593 si = new TGShutterItem(fCategories, new TGHotString("Matrices"), kCAT_MATRICES);
594 container = (TGCompositeFrame *)si->GetContainer();
595 container->SetBackgroundColor(GetDefaultFrameBackground());
597 // Name entry
599 f1->AddFrame(label = new TGLabel(f1, "Create new matrix"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
600 f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
601 gClient->GetColorByName("#ff0000", color);
602 label->SetTextColor(color);
603 container->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
604
606 f1->AddFrame(new TGLabel(f1, "Name"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
609 fMatrixName->SetToolTipText("Enter the new matrix name");
610 f1->AddFrame(fMatrixName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5));
611 container->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 0));
612 // Picture buttons for different matrices
614 f1->AddFrame(new TGLabel(f1, "Create..."), new TGLayoutHints(kLHintsLeft, 1, 5, 6, 0));
615 fMatrixButton[0] = new TGPictureButton(f1, fClient->GetPicture("geotranslation_t.xpm"), kCREATE_TRANSLATION);
616 fMatrixButton[0]->SetToolTipText("Create a translation");
617 fMatrixButton[1] = new TGPictureButton(f1, fClient->GetPicture("georotation_t.xpm"), kCREATE_ROTATION);
618 fMatrixButton[1]->SetToolTipText("Create a rotation");
619 fMatrixButton[2] = new TGPictureButton(f1, fClient->GetPicture("geocombi_t.xpm"), kCREATE_COMBI);
620 fMatrixButton[2]->SetToolTipText("Create a rotation + translation");
621 for (ipict = 0; ipict < 3; ipict++)
622 f1->AddFrame(fMatrixButton[ipict], lhb);
623 container->AddFrame(f1, lhf1);
624 // List of matrices
627 f1->AddFrame(label = new TGLabel(f1, "Existing matrices"), new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
628 f1->AddFrame(new TGHorizontal3DLine(f1), new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
629 gClient->GetColorByName("#ff0000", color);
630 label->SetTextColor(color);
631 f6->AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
633 fSelectedMatrix = nullptr;
634 fLSelMatrix = new TGLabel(f1, "Select matrix");
635 gClient->GetColorByName("#0000ff", color);
638 f1->AddFrame(fLSelMatrix, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 1, 1, 2, 2));
640 fBSelMatrix->SetToolTipText("Select one of the existing matrices");
641 fBSelMatrix->Associate(this);
642 f1->AddFrame(fBSelMatrix, new TGLayoutHints(kLHintsLeft, 1, 1, 2, 2));
643 fEditMatrix = new TGTextButton(f1, "Edit");
644 f1->AddFrame(fEditMatrix, new TGLayoutHints(kLHintsRight, 1, 1, 2, 2));
645 fEditMatrix->SetToolTipText("Edit selected matrix");
646 fEditMatrix->Associate(this);
647 f6->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
648 container->AddFrame(f6, new TGLayoutHints(kLHintsLeft, 0, 0, 6, 0));
649
650 fCategories->Resize(163, 370);
652
654
655 // Set the fTab and disconnect editor from the canvas.
659 if (edCanvas != fConnectedCanvas) {
661 if (edCanvas)
664 }
665}
666
667////////////////////////////////////////////////////////////////////////////////
668/// Destructor.
669
702
703////////////////////////////////////////////////////////////////////////////////
704/// Connected to TCanvas::Selected. TGeoManagerEditor takes this
705/// function from TGedEditor and only uses it if obj is a TGeoVolume.
706
708{
709 if (event == kButton1 && obj->InheritsFrom(TGeoVolume::Class())) {
710 TGeoVolume *v = (TGeoVolume *)obj;
712 fTabMgr->SetTab();
714 v->Draw();
715 }
716}
717
719{
720 // Connect to TCanvas::Selected.
721
722 c->Connect("Selected(TVirtualPad*,TObject*,Int_t)", "TGeoManagerEditor", this,
723 "SelectedSlot(TVirtualPad*,TObject*,Int_t)");
724}
725
727{
728 // Disconnect from TCanvas::Selected.
729
731 Disconnect(fConnectedCanvas, "Selected(TVirtualPad*,TObject*,Int_t)", this,
732 "SelectedSlot(TVirtualPad*,TObject*,Int_t)");
733}
734
735////////////////////////////////////////////////////////////////////////////////
736/// Connect signals to slots.
737
739{
740 fManagerName->Connect("TextChanged(const char *)", "TGeoManagerEditor", this, "DoName()");
741 fManagerTitle->Connect("TextChanged(const char *)", "TGeoManagerEditor", this, "DoName()");
742 fExportButton->Connect("Clicked()", "TGeoManagerEditor", this, "DoExportGeometry()");
743 fCloseGeometry->Connect("Clicked()", "TGeoManagerEditor", this, "DoCloseGeometry()");
744 fShapeButton[0]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateBox()");
745 fShapeButton[1]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreatePara()");
746 fShapeButton[2]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateTrd1()");
747 fShapeButton[3]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateTrd2()");
748 fShapeButton[4]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateTrap()");
749 fShapeButton[5]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateGtra()");
750 fShapeButton[6]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateXtru()");
751 fShapeButton[7]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateArb8()");
752 fShapeButton[8]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateTube()");
753 fShapeButton[9]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateTubs()");
754 fShapeButton[10]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateCone()");
755 fShapeButton[11]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateCons()");
756 fShapeButton[12]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateSphe()");
757 fShapeButton[13]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateCtub()");
758 fShapeButton[14]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateEltu()");
759 fShapeButton[15]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateTorus()");
760 fShapeButton[16]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreatePcon()");
761 fShapeButton[17]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreatePgon()");
762 fShapeButton[18]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateHype()");
763 fShapeButton[19]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateParab()");
764 fShapeButton[20]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateComposite()");
765 fMatrixButton[0]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateTranslation()");
766 fMatrixButton[1]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateRotation()");
767 fMatrixButton[2]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateCombi()");
768 fVolumeButton[0]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateVolume()");
769 fVolumeButton[1]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateAssembly()");
770 fBSelTop->Connect("Clicked()", "TGeoManagerEditor", this, "DoSelectTopVolume()");
771 fBSelVolume->Connect("Clicked()", "TGeoManagerEditor", this, "DoSelectVolume()");
772 fBSelShape->Connect("Clicked()", "TGeoManagerEditor", this, "DoSelectShape()");
773 fBSelShape2->Connect("Clicked()", "TGeoManagerEditor", this, "DoSelectShape2()");
774 fBSelMatrix->Connect("Clicked()", "TGeoManagerEditor", this, "DoSelectMatrix()");
775 fBSelMaterial->Connect("Clicked()", "TGeoManagerEditor", this, "DoSelectMaterial()");
776 fBSelMaterial2->Connect("Clicked()", "TGeoManagerEditor", this, "DoSelectMaterial2()");
777 fBSelMedium->Connect("Clicked()", "TGeoManagerEditor", this, "DoSelectMedium()");
778 fBSelMedium2->Connect("Clicked()", "TGeoManagerEditor", this, "DoSelectMedium2()");
779 fSetTopVolume->Connect("Clicked()", "TGeoManagerEditor", this, "DoSetTopVolume()");
780 fEditShape->Connect("Clicked()", "TGeoManagerEditor", this, "DoEditShape()");
781 fEditMedium->Connect("Clicked()", "TGeoManagerEditor", this, "DoEditMedium()");
782 fEditMaterial->Connect("Clicked()", "TGeoManagerEditor", this, "DoEditMaterial()");
783 fEditMatrix->Connect("Clicked()", "TGeoManagerEditor", this, "DoEditMatrix()");
784 fEditVolume->Connect("Clicked()", "TGeoManagerEditor", this, "DoEditVolume()");
785
786 fMaterialButton[0]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateMaterial()");
787 fMaterialButton[1]->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateMixture()");
788 fMediumButton->Connect("Clicked()", "TGeoManagerEditor", this, "DoCreateMedium()");
789}
790
791////////////////////////////////////////////////////////////////////////////////
792/// Refresh editor according the selected obj.
793
795{
796 fGeometry = (TGeoManager *)obj;
803 // Check if master volume can be set
806 else
808 // Check if geometry is already closed
809 if (!fGeometry->IsClosed())
811 else {
814 }
815 // Check if volumes category can be activated
818 else
822 else
826 else
830 else
834 else
836
837 // Check if media category can be activated
841 } else {
844 }
845
846 fTab->SetTab(0);
848 if (fTabMgr == nullptr) {
851 }
852 if (fInit)
854 // SetActive();
855}
856
857////////////////////////////////////////////////////////////////////////////////
858/// Change name/title of the geometry
859
865
866////////////////////////////////////////////////////////////////////////////////
867/// Export geometry as .root or .C file
868
870{
873 s = s.Strip();
874 s.Remove(20);
875 const char *name;
876 if (asroot)
877 name = TString::Format("%s.root", s.Data());
878 else
879 name = TString::Format("%s.C", s.Data());
881}
882
883////////////////////////////////////////////////////////////////////////////////
884/// Create a box.
885
887{
889 fSelectedShape = new TGeoBBox(TString::Format("box_%i", id), 1., 1., 1.);
891 // Check if volumes category can be activated
894 DoEditShape();
895}
896
897////////////////////////////////////////////////////////////////////////////////
898/// Create a parallelipiped.
899
901{
903 fSelectedShape = new TGeoPara(TString::Format("para_%i", id), 1., 1., 1., 30., 20., 45.);
907 DoEditShape();
908}
909
910////////////////////////////////////////////////////////////////////////////////
911/// Create a Trd1.
912
914{
916 fSelectedShape = new TGeoTrd1(TString::Format("trd1_%i", id), 0.5, 1., 1., 1.);
920 DoEditShape();
921}
922
923////////////////////////////////////////////////////////////////////////////////
924/// Create a Trd2.
925
927{
929 fSelectedShape = new TGeoTrd2(TString::Format("trd2_%i", id), 0.5, 1., 0.5, 1., 1.);
933 DoEditShape();
934}
935
936////////////////////////////////////////////////////////////////////////////////
937/// Create a general trapezoid.
938
940{
942 fSelectedShape = new TGeoTrap(TString::Format("trap_%i", id), 1., 15., 45., 0.5, 0.3, 0.5, 30., 0.5, 0.3, 0.5, 30.);
946 DoEditShape();
947}
948
949////////////////////////////////////////////////////////////////////////////////
950/// Create a twisted trapezoid.
951
953{
956 new TGeoGtra(TString::Format("gtra_%i", id), 1., 15., 45., 45., 0.5, 0.3, 0.5, 30., 0.5, 0.3, 0.5, 30.);
960 DoEditShape();
961}
962
963////////////////////////////////////////////////////////////////////////////////
964/// Create an extruded polygone.
965
967
968////////////////////////////////////////////////////////////////////////////////
969/// Create an arbitrary polygone with maximum 8 vertices sitting on 2 parallel
970/// planes
971
973
974////////////////////////////////////////////////////////////////////////////////
975/// Create a tube.
976
978{
980 fSelectedShape = new TGeoTube(TString::Format("tube_%i", id), 0.5, 1., 1.);
984 DoEditShape();
985}
986
987////////////////////////////////////////////////////////////////////////////////
988/// Create a tube segment.
989
991{
993 fSelectedShape = new TGeoTubeSeg(TString::Format("tubs_%i", id), 0.5, 1., 1., 0., 45.);
997 DoEditShape();
998}
999
1000////////////////////////////////////////////////////////////////////////////////
1001/// Create a cone.
1002
1004{
1006 fSelectedShape = new TGeoCone(TString::Format("cone_%i", id), 0.5, 0.5, 1., 1.5, 2.);
1009 fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
1010 DoEditShape();
1011}
1012
1013////////////////////////////////////////////////////////////////////////////////
1014/// Create a cone segment.
1015
1017{
1019 fSelectedShape = new TGeoConeSeg(TString::Format("cons_%i", id), 0.5, 0.5, 1., 1.5, 2., 0., 45.);
1022 fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
1023 DoEditShape();
1024}
1025
1026////////////////////////////////////////////////////////////////////////////////
1027/// Create a sphere.
1028
1030{
1032 fSelectedShape = new TGeoSphere(TString::Format("sphere_%i", id), 0.5, 1., 0., 180., 0., 360.);
1035 fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
1036 DoEditShape();
1037}
1038
1039////////////////////////////////////////////////////////////////////////////////
1040/// Create a cut tube.
1041
1043{
1045 fSelectedShape = new TGeoCtub(TString::Format("ctub_%i", id), 0.5, 1., 1., 0., 45., 0., 0., -1, 0., 0., 1);
1048 fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
1049 DoEditShape();
1050}
1051
1052////////////////////////////////////////////////////////////////////////////////
1053/// Create an elliptical tube.
1054
1056{
1058 fSelectedShape = new TGeoEltu(TString::Format("para_%i", id), 1., 2., 1.5);
1061 fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
1062 DoEditShape();
1063}
1064
1065////////////////////////////////////////////////////////////////////////////////
1066/// Create a torus shape.
1067
1069{
1071 fSelectedShape = new TGeoTorus(TString::Format("torus_%i", id), 10., 1., 1.5, 0, 360.);
1074 fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
1075 DoEditShape();
1076}
1077
1078////////////////////////////////////////////////////////////////////////////////
1079/// Create a polycone shape.
1080
1082{
1084 fSelectedShape = new TGeoPcon(TString::Format("pcon_%i", id), 0., 360., 2);
1085 ((TGeoPcon *)fSelectedShape)->DefineSection(0, -1, 0.5, 1.);
1086 ((TGeoPcon *)fSelectedShape)->DefineSection(1, 1, 0.2, 0.5);
1089 fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
1090 DoEditShape();
1091}
1092
1093////////////////////////////////////////////////////////////////////////////////
1094/// Create a polygone shape.
1095
1097{
1099 fSelectedShape = new TGeoPgon(TString::Format("pgon_%i", id), 0., 360., 6, 2);
1100 ((TGeoPcon *)fSelectedShape)->DefineSection(0, -1, 0.5, 1.);
1101 ((TGeoPcon *)fSelectedShape)->DefineSection(1, 1, 0.2, 0.5);
1104 fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
1105 DoEditShape();
1106}
1107
1108////////////////////////////////////////////////////////////////////////////////
1109/// Create a hyperboloid.
1110
1112{
1114 fSelectedShape = new TGeoHype(TString::Format("hype_%i", id), 1., 15., 2., 30., 5.);
1117 fCategories->GetItem("Volumes")->GetButton()->SetEnabled(kTRUE);
1118 DoEditShape();
1119}
1120
1121////////////////////////////////////////////////////////////////////////////////
1122/// Create a paraboloid.
1123
1125
1126////////////////////////////////////////////////////////////////////////////////
1127/// Create a composite shape.
1128
1130
1131////////////////////////////////////////////////////////////////////////////////
1132/// Create a new material.
1133
1135{
1137 if (!el) {
1138 Error("DoCreateMaterial", "Cannot find selected element in list");
1139 return;
1140 }
1142 const char *name = fMaterialName->GetText();
1148}
1149
1150////////////////////////////////////////////////////////////////////////////////
1151/// Create a new mixture.
1152
1163
1164////////////////////////////////////////////////////////////////////////////////
1165/// Create a new medium.
1166
1180
1181////////////////////////////////////////////////////////////////////////////////
1182/// Create a new translation.
1183
1194
1195////////////////////////////////////////////////////////////////////////////////
1196/// Create a new rotation.
1197
1208
1209////////////////////////////////////////////////////////////////////////////////
1210/// Create a new volume.
1211
1223
1224////////////////////////////////////////////////////////////////////////////////
1225/// Create a new volume assembly.
1226
1236
1237////////////////////////////////////////////////////////////////////////////////
1238/// Create a new translation + rotation.
1239
1251
1252////////////////////////////////////////////////////////////////////////////////
1253/// Set top volume for the geometry.
1254
1262
1263////////////////////////////////////////////////////////////////////////////////
1264/// Slot for editing selected shape.
1265
1267{
1268 if (!fSelectedShape)
1269 return;
1272 fTabMgr->GetPad()->GetView()->ShowAxis();
1273}
1274
1275////////////////////////////////////////////////////////////////////////////////
1276/// Slot for editing selected volume.
1277
1289
1290////////////////////////////////////////////////////////////////////////////////
1291/// Slot for editing selected medium.
1292
1299
1300////////////////////////////////////////////////////////////////////////////////
1301/// Slot for editing selected material.
1302
1309
1310////////////////////////////////////////////////////////////////////////////////
1311/// Slot for editing selected matrix.
1312
1319
1320////////////////////////////////////////////////////////////////////////////////
1321/// Slot for selecting an existing matrix.
1322
1333
1334////////////////////////////////////////////////////////////////////////////////
1335/// Slot for selecting an existing shape.
1336
1338{
1339 TGeoShape *shape = fSelectedShape;
1340 new TGeoShapeDialog(fBSelShape, gClient->GetRoot(), 200, 300);
1342 if (fSelectedShape)
1344 else
1345 fSelectedShape = shape;
1346}
1347
1348////////////////////////////////////////////////////////////////////////////////
1349/// Slot for selecting a shape for making a volume.
1350
1361
1362////////////////////////////////////////////////////////////////////////////////
1363/// Slot for selecting an existing material.
1364
1375
1376////////////////////////////////////////////////////////////////////////////////
1377/// Slot for selecting an existing material and making a medium.
1378
1389
1390////////////////////////////////////////////////////////////////////////////////
1391/// Slot for selecting an existing medium.
1392
1403
1404////////////////////////////////////////////////////////////////////////////////
1405/// Slot for selecting an existing medium for making a volume.
1406
1417
1418////////////////////////////////////////////////////////////////////////////////
1419/// Slot for selecting an existing volume.
1420
1431
1432////////////////////////////////////////////////////////////////////////////////
1433/// Slot for setting top geometry volume.
1434
1447
1448////////////////////////////////////////////////////////////////////////////////
1449/// Slot for closing the geometry.
1450
1457
1458////////////////////////////////////////////////////////////////////////////////
1459/// Show/hide interface for shape selection.
1460
1462{
1464 if (show)
1465 cont->ShowFrame(f2);
1466 else
1467 cont->HideFrame(f2);
1468}
1469
1470////////////////////////////////////////////////////////////////////////////////
1471/// Show/hide interface for volume selection.
1472
1474{
1476 if (show)
1477 cont->ShowFrame(f7);
1478 else
1479 cont->HideFrame(f7);
1481 if (show)
1482 cont->ShowFrame(f3);
1483 else
1484 cont->HideFrame(f3);
1485}
1486
1487////////////////////////////////////////////////////////////////////////////////
1488/// Show/hide interface for material selection.
1489
1491{
1493 if (show)
1494 cont->ShowFrame(f4);
1495 else
1496 cont->HideFrame(f4);
1497}
1498
1499////////////////////////////////////////////////////////////////////////////////
1500/// Show/hide interface for medium selection.
1501
1503{
1505 if (show)
1506 cont->ShowFrame(f5);
1507 else
1508 cont->HideFrame(f5);
1509}
1510
1511////////////////////////////////////////////////////////////////////////////////
1512/// Show/hide interface for matrix selection.
1513
1515{
1517 if (show)
1518 cont->ShowFrame(f6);
1519 else
1520 cont->HideFrame(f6);
1521}
1522
1523////////////////////////////////////////////////////////////////////////////////
1524/// Dummy static function, used to load plugin
1525
@ kSunkenFrame
Definition GuiTypes.h:383
@ kVerticalFrame
Definition GuiTypes.h:381
@ kDoubleBorder
Definition GuiTypes.h:385
@ kFixedWidth
Definition GuiTypes.h:387
@ kFitWidth
Definition GuiTypes.h:386
@ kHorizontalFrame
Definition GuiTypes.h:382
@ kFixedHeight
Definition GuiTypes.h:389
@ kOwnBackground
Definition GuiTypes.h:391
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
@ kButton1
Definition GuiTypes.h:214
#define c(i)
Definition RSha256.hxx:101
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:208
#define gClient
Definition TGClient.h:157
@ kLHintsRight
Definition TGLayout.h:26
@ kLHintsExpandY
Definition TGLayout.h:31
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
char name[80]
Definition TGX11.cxx:110
@ kCREATE_HYPE
@ kMANAGER_MATERIAL_SELECT
@ kCAT_VOLUMES
@ kMANAGER_MEDIUM_SELECT
@ kMANAGER_TITLE
@ kMANAGER_VOLUME_SELECT
@ kCREATE_XTRU
@ kCREATE_CONS
@ kCREATE_TRD1
@ kMATRIX_NAME
@ kMANAGER_MATERIAL_SELECT2
@ kCREATE_ROTATION
@ kMANAGER_ELEMENT_SELECT
@ kCREATE_TUBS
@ kEXPORT_ROOT
@ kCREATE_TUBE
@ kCREATE_TRANSLATION
@ kCAT_SHAPES
@ kCREATE_CONE
@ kCREATE_SPHE
@ kMANAGER_SHAPE_SELECT2
@ kMANAGER_CANCEL
@ kCAT_MATERIALS
@ kCREATE_GTRA
@ kCREATE_COMP
@ kMATERIAL_NAME
@ kMANAGER_APPLY
@ kMANAGER_MATRIX_SELECT
@ kMANAGER_MEDIUM_SELECT2
@ kVOLUME_NAME
@ kCREATE_CTUB
@ kMANAGER_NELEM_SELECT
@ kCREATE_TRAP
@ kCREATE_VOLUME
@ kCREATE_ELTU
@ kCREATE_PGON
@ kCREATE_TORUS
@ kMANAGER_NAME
@ kCREATE_ASSEMBLY
@ kMANAGER_DENSITY_SELECT
@ kCREATE_MEDIUM
@ kCREATE_PCON
@ kMANAGER_MEDIA_SELECT
@ kCREATE_ARB8
@ kMEDIUM_NAME
@ kCREATE_COMBI
@ kEXPORT_GEOMETRY
@ kCREATE_PARAB
@ kMANAGER_EDIT_MEDIUM
@ kCAT_MATRICES
@ kMANAGER_TOP_SELECT
@ kCREATE_BOX
@ kMANAGER_EDIT_SHAPE
@ kMANAGER_SHAPE_SELECT
@ kCREATE_MATERIAL
@ kCREATE_PARA
@ kCAT_GENERAL
@ kMANAGER_UNDO
@ kCREATE_TRD2
@ kCREATE_MIXTURE
R__EXTERN TGeoManager * gGeoManager
The Canvas class.
Definition TCanvas.h:23
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Organizes TGButton widgets in a group.
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition TGButton.cxx:439
virtual void SetEnabled(Bool_t e=kTRUE)
Set enabled or disabled state of button.
Definition TGButton.cxx:453
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Definition TGClient.cxx:288
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
Definition TGComboBox.h:47
virtual Int_t GetSelected() const
Definition TGComboBox.h:114
virtual void AddEntry(TGString *s, Int_t id)
Definition TGComboBox.h:86
virtual void Select(Int_t id, Bool_t emit=kTRUE)
Make the selected item visible in the combo box window and emit signals according to the second param...
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:289
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1109
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition TGFrame.cxx:959
TGCompositeFrame(const TGCompositeFrame &)=delete
void SetCleanup(Int_t mode=kLocalCleanup) override
Turn on automatic cleanup of child frames in dtor.
Definition TGFrame.cxx:1064
virtual void ChangeOptions(UInt_t options)
Change frame options. Options is an OR of the EFrameTypes.
Definition TGFrame.cxx:313
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:597
virtual UInt_t GetDefaultHeight() const
Definition TGFrame.h:193
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition TGFrame.cxx:675
A horizontal 3D line is a line that typically separates a toolbar from the menubar.
Definition TG3DLine.h:18
TGHotString is a string with a "hot" character underlined.
Definition TGString.h:42
This class handles GUI labels.
Definition TGLabel.h:24
virtual void SetTextColor(Pixel_t color, Bool_t global=kFALSE)
Changes text color.
Definition TGLabel.cxx:361
virtual void SetText(TGString *newText)
Set new text in label.
Definition TGLabel.cxx:179
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
TGNumberEntry is a number entry input widget with up/down buttons.
TGNumberEntryField * GetNumberEntry() const
Get the number entry field.
void Associate(const TGWindow *w) override
Make w the window that will receive the generated messages.
virtual Long_t GetIntNumber() const
void SetNumAttr(EAttribute attr=kNEAAnyNumber)
virtual Double_t GetNumber() const
virtual void SetNumber(Double_t val, Bool_t emit=kTRUE)
UInt_t GetDefaultHeight() const override
void SetNumStyle(EStyle style)
@ kNEAPositive
Positive number.
@ kNEANonNegative
Non-negative number.
@ kNESRealThree
Fixed fraction real, three digit.
@ kNESInteger
Style of number entry field.
TGClient * fClient
Connection to display server.
Definition TGObject.h:25
Yield an action as soon as it is clicked.
Definition TGButton.h:228
Selects different options.
Definition TGButton.h:321
Bool_t IsDown() const override
Definition TGButton.h:370
TGButton * GetButton() const
Definition TGShutter.h:44
TGFrame * GetContainer() const
Definition TGShutter.h:45
A shutter widget contains a set of shutter items that can be open and closed like a shutter.
Definition TGShutter.h:55
virtual void AddItem(TGShutterItem *item)
Add shutter item to shutter frame.
Definition TGShutter.cxx:71
TGShutterItem * GetItem(const char *name)
returns a shutter item by name (name is hot string of shutter item)
void Layout() override
Layout shutter items.
virtual Bool_t SetTab(Int_t tabIndex, Bool_t emit=kTRUE)
Brings the composite frame with the index tabIndex to the front and generate the following event if t...
Definition TGTab.cxx:555
A text buffer is used in several widgets, like TGTextEntry, TGFileDialog, etc.
Yield an action as soon as it is clicked.
Definition TGButton.h:142
A TGTextEntry is a one line text input widget.
Definition TGTextEntry.h:24
const char * GetText() const
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
virtual void SetText(const char *text, Bool_t emit=kTRUE)
Sets text entry to text, clears the selection and moves the cursor to the end of the line.
Organizes TGButton widgets in a group with one vertical column.
virtual void Associate(const TGWindow *w)
Definition TGWidget.h:72
ROOT GUI Window base class.
Definition TGWindow.h:23
TCanvas * GetCanvas() const override
Definition TGedEditor.h:77
TGTab * GetTab() const
Definition TGedEditor.h:73
virtual void DisconnectFromCanvas()
Disconnect this editor from the Selected signal of fCanvas.
Base frame for implementing GUI - a service class.
Definition TGedFrame.h:27
TGedEditor * fGedEditor
manager of this frame
Definition TGedFrame.h:48
virtual TGVerticalFrame * CreateEditorTabSubFrame(const char *name)
Create a vertical frame to be used by 'owner' in extra tab 'name'.
Bool_t fInit
init flag for setting signals/slots
Definition TGedFrame.h:47
Box class.
Definition TGeoBBox.h:17
Class describing rotation + translation.
Definition TGeoMatrix.h:317
A cone segment is a cone having a range in phi.
Definition TGeoCone.h:99
The cones are defined by 5 parameters:
Definition TGeoCone.h:17
The cut tubes constructor has the form:
Definition TGeoTube.h:173
table of elements
TGeoElement * GetElement(Int_t z)
Int_t GetNelements() const
Base class for chemical elements.
Definition TGeoElement.h:31
An elliptical tube is defined by the two semi-axes A and B.
Definition TGeoEltu.h:17
A twisted trapezoid.
Definition TGeoArb8.h:151
A hyperboloid is represented as a solid limited by two planes perpendicular to the Z axis (top and bo...
Definition TGeoHype.h:17
void DoCreateCons()
Create a cone segment.
void DoCreateArb8()
Create an arbitrary polygone with maximum 8 vertices sitting on 2 parallel planes.
void DoCreatePgon()
Create a polygone shape.
void DoSelectMedium()
Slot for selecting an existing medium.
TGeoMaterial * fSelectedMaterial
void DoCreateAssembly()
Create a new volume assembly.
TGNumberEntry * fMediumId
TGPictureButton * fBSelMedium2
void DoCreateHype()
Create a hyperboloid.
void ConnectSelected(TCanvas *c)
void DoSelectMaterial()
Slot for selecting an existing material.
TGeoTabManager * fTabMgr
TGCompositeFrame * fVolumeTab
TGPictureButton * fVolumeButton[2]
void DoSelectShape()
Slot for selecting an existing shape.
void DoEditVolume()
Slot for editing selected volume.
TGCompositeFrame * f5
void DoSelectShape2()
Slot for selecting a shape for making a volume.
TGPictureButton * fBSelMatrix
TGPictureButton * fMatrixButton[3]
TGPictureButton * fMediumButton
void DoEditMedium()
Slot for editing selected medium.
TGTextButton * fEditMedium
void DoCreatePara()
Create a parallelipiped.
void DoSelectTopVolume()
Slot for setting top geometry volume.
void DoCreateTubs()
Create a tube segment.
TGTextEntry * fMediumName
void DoCreateTrd1()
Create a Trd1.
void SetModel(TObject *obj) override
Refresh editor according the selected obj.
TGTextButton * fEditVolume
TGeoMedium * fSelectedMedium2
void DoCreateGtra()
Create a twisted trapezoid.
TGTextButton * fEditMaterial
void DoEditMatrix()
Slot for editing selected matrix.
void DoCloseGeometry()
Slot for closing the geometry.
TGPictureButton * fBSelShape2
void DoCreateParab()
Create a paraboloid.
TGCompositeFrame * f2
void DoSelectMedium2()
Slot for selecting an existing medium for making a volume.
void DoCreateBox()
Create a box.
TGComboBox * fElementList
void DoSetTopVolume()
Set top volume for the geometry.
TGTextButton * fEditShape
TGTextEntry * fManagerName
void DoSelectVolume()
Slot for selecting an existing volume.
void DoName()
Change name/title of the geometry.
void DoEditMaterial()
Slot for editing selected material.
virtual void ConnectSignals2Slots()
Connect signals to slots.
TGCompositeFrame * f3
void DoCreateTranslation()
Create a new translation.
void DoCreateMixture()
Create a new mixture.
TGPictureButton * fBSelMaterial
TGeoMaterial * fSelectedMaterial2
TGTextEntry * fVolumeName
TGPictureButton * fBSelVolume
void ShowSelectMaterial(Bool_t show=kTRUE)
Show/hide interface for material selection.
void DoCreateTrd2()
Create a Trd2.
TGeoMatrix * fSelectedMatrix
void DoCreateVolume()
Create a new volume.
void DoCreateCone()
Create a cone.
void DoCreateXtru()
Create an extruded polygone.
TGTextButton * fSetTopVolume
TGCompositeFrame * f4
TGeoShape * fSelectedShape
TGeoVolume * fSelectedVolume
void DoExportGeometry()
Export geometry as .root or .C file.
TGTextEntry * fMatrixName
void DoCreateTube()
Create a tube.
TGPictureButton * fBSelMaterial2
TGTextButton * fEditMatrix
TGTextButton * fExportButton
TGeoMedium * fSelectedMedium
TGTextEntry * fMaterialName
TGCompositeFrame * f6
void DoCreatePcon()
Create a polycone shape.
TGTextEntry * fManagerTitle
TGCompositeFrame * f7
void DoCreateTorus()
Create a torus shape.
void DoCreateTrap()
Create a general trapezoid.
TGTextButton * fCloseGeometry
void DoCreateSphe()
Create a sphere.
TGPictureButton * fBSelShape
TGRadioButton * fExportOption[2]
void DoSelectMaterial2()
Slot for selecting an existing material and making a medium.
void DoCreateMaterial()
Create a new material.
TGPictureButton * fBSelTop
TGeoManager * fGeometry
~TGeoManagerEditor() override
Destructor.
void ShowSelectMedium(Bool_t show=kTRUE)
Show/hide interface for medium selection.
virtual void SelectedSlot(TVirtualPad *pad, TObject *obj, Int_t event)
Connected to TCanvas::Selected.
TGeoShape * fSelectedShape2
void ShowSelectVolume(Bool_t show=kTRUE)
Show/hide interface for volume selection.
void DoCreateMedium()
Create a new medium.
void ShowSelectShape(Bool_t show=kTRUE)
Show/hide interface for shape selection.
void ShowSelectMatrix(Bool_t show=kTRUE)
Show/hide interface for matrix selection.
void DoSelectMatrix()
Slot for selecting an existing matrix.
static void LoadLib()
Dummy static function, used to load plugin.
TGPictureButton * fMaterialButton[2]
TGNumberEntry * fEntryDensity
void DoEditShape()
Slot for editing selected shape.
void DoCreateEltu()
Create an elliptical tube.
void DoCreateCombi()
Create a new translation + rotation.
void DoCreateComposite()
Create a composite shape.
void DoCreateRotation()
Create a new rotation.
TGPictureButton * fBSelMedium
TGPictureButton * fShapeButton[21]
void DoCreateCtub()
Create a cut tube.
TGeoManagerEditor(const TGWindow *p=nullptr, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Constructor for manager editor.
The manager class for any TGeo geometry.
Definition TGeoManager.h:45
TList * GetListOfMedia() const
TGeoElementTable * GetElementTable()
Returns material table. Creates it if not existing.
TObjArray * GetListOfVolumes() const
TObjArray * GetListOfMatrices() const
virtual Int_t Export(const char *filename, const char *name="", Option_t *option="vg")
Export this geometry to a file.
TGeoVolume * GetMasterVolume() const
Bool_t IsClosed() const
void CloseGeometry(Option_t *option="d")
Closing geometry implies checking the geometry validity, fixing shapes with negative parameters (run-...
void SetTopVolume(TGeoVolume *vol)
Set the top volume and corresponding node as starting point of the geometry.
void BuildDefaultMaterials()
Now just a shortcut for GetElementTable.
TList * GetListOfMaterials() const
TObjArray * GetListOfShapes() const
TGeoVolume * GetTopVolume() const
Base class describing materials.
Geometrical transformation package.
Definition TGeoMatrix.h:38
@ kGeoTranslation
Definition TGeoMatrix.h:43
virtual void RegisterYourself()
Register the matrix in the current manager, which will become the owner.
Media are used to store properties related to tracking and which are useful only when using geometry ...
Definition TGeoMedium.h:23
Mixtures of elements.
Parallelepiped class.
Definition TGeoPara.h:17
A polycone is represented by a sequence of tubes/cones, glued together at defined Z planes.
Definition TGeoPcon.h:17
Polygons are defined in the same way as polycones, the difference being just that the segments betwee...
Definition TGeoPgon.h:20
Class describing rotations.
Definition TGeoMatrix.h:168
Base abstract class for all shapes.
Definition TGeoShape.h:25
void Draw(Option_t *option="") override
Draw this shape.
const char * GetName() const override
Get the shape name.
TGeoSphere are not just balls having internal and external radii, but sectors of a sphere having defi...
Definition TGeoSphere.h:17
TVirtualPad * GetPad() const
void GetVolumeEditor(TGeoVolume *vol)
Get editor for a volume.
TGCompositeFrame * fVolumeTab
void GetMaterialEditor(TGeoMaterial *material)
Get editor for a material.
static TGeoTabManager * GetMakeTabManager(TGedEditor *ged)
Static method to return the tab manager currently appended to the pad or create one if not existing.
TGCompositeFrame * GetVolumeTab() const
void GetMediumEditor(TGeoMedium *medium)
Get editor for a medium.
static void Cleanup(TGCompositeFrame *frame)
Static method to cleanup hierarchically all daughters of a composite frame.
void GetShapeEditor(TGeoShape *shape)
Get editor for a shape.
void SetTab()
Set a given tab element as active one.
void SetVolTabEnabled(Bool_t flag=kTRUE)
Enable/disable tabs.
void GetMatrixEditor(TGeoMatrix *matrix)
Get editor for a matrix.
The torus is defined by its axial radius, its inner and outer radius.
Definition TGeoTorus.h:17
Class describing translations.
Definition TGeoMatrix.h:116
A general trapezoid.
Definition TGeoArb8.h:98
A trapezoid with only X varying with Z.
Definition TGeoTrd1.h:17
A trapezoid with only X varying with Z.
Definition TGeoTrd2.h:17
static TObject * GetSelected()
static; return selected object
A tube segment is a tube having a range in phi.
Definition TGeoTube.h:94
Cylindrical tube class.
Definition TGeoTube.h:17
Volume assemblies.
Definition TGeoVolume.h:316
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition TGeoVolume.h:43
void Draw(Option_t *option="") override
draw top volume according to option
static TClass * Class()
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition TNamed.cxx:173
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:50
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:149
Int_t GetEntries() const override
Return the number of objects in array (i.e.
Mother of all ROOT objects.
Definition TObject.h:41
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:864
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:543
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Definition TQObject.cxx:865
Bool_t Disconnect(const char *signal=nullptr, void *receiver=nullptr, const char *slot=nullptr)
Disconnects signal of this object from slot of receiver.
Basic string class.
Definition TString.h:138
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
Definition TString.cxx:1170
const char * Data() const
Definition TString.h:384
TString & Remove(Ssiz_t pos)
Definition TString.h:693
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2384
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
virtual TView * GetView() const =0
TF1 * f1
Definition legend1.C:11