Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
TGeoMaterialEditor.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 TGeoMaterialEditor
13\ingroup Geometry_builder
14
15Editors for materials.
16
17
18*/
19
20#include "TGeoMaterialEditor.h"
21#include "TGeoTabManager.h"
22#include "TGeoMaterial.h"
23#include "TGeoElement.h"
24#include "TGeoManager.h"
25#include "TVirtualGeoPainter.h"
26#include "TGTab.h"
27#include "TGComboBox.h"
28#include "TGButton.h"
29#include "TGTextEntry.h"
30#include "TGNumberEntry.h"
31#include "TGLabel.h"
32
33
48
50
52
53////////////////////////////////////////////////////////////////////////////////
54/// Constructor for material editor.
55
57 : TGeoGedFrame(p, width, height, options | kVerticalFrame, back)
58{
59 fMaterial = nullptr;
60 fAi = fZi = 0;
61 fDensityi = 0.0;
62 fNamei = "";
65
66 // TextEntry for material name
67 MakeTitle("Name");
69 fMaterialName->SetDefaultSize(135, fMaterialName->GetDefaultHeight());
70 fMaterialName->SetToolTipText("Enter the material name");
71 fMaterialName->Associate(this);
73
74 TGTextEntry *nef;
75 MakeTitle("Material properties");
77 f1->AddFrame(new TGLabel(f1, "A"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
79 nef = (TGTextEntry *)fMatA->GetNumberEntry();
80 nef->SetToolTipText("Enter the atomic mass");
81 fMatA->Associate(this);
82 f1->AddFrame(fMatA, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
83 f1->AddFrame(new TGLabel(f1, "Z"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
85 nef = (TGTextEntry *)fMatZ->GetNumberEntry();
86 nef->SetToolTipText("Enter the atomic charge");
87 fMatZ->Associate(this);
88 f1->AddFrame(fMatZ, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
89 f1->Resize(150, 30);
90 AddFrame(f1, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
91
93 // Combo box for material state
95 f1->AddFrame(new TGLabel(f1, "State"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
97 fMatState->AddEntry("Undefined", TGeoMaterial::kMatStateUndefined);
98 fMatState->AddEntry("Solid", TGeoMaterial::kMatStateSolid);
99 fMatState->AddEntry("Liquid", TGeoMaterial::kMatStateLiquid);
100 fMatState->AddEntry("Gas", TGeoMaterial::kMatStateGas);
101 fMatState->Resize(90, fMaterialName->GetDefaultHeight());
102 f1->AddFrame(fMatState, new TGLayoutHints(kLHintsRight, 2, 2, 1, 1));
103 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 2, 2, 1, 1));
104
105 // Number entry for density
107 f1->AddFrame(new TGLabel(f1, "Density"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
109 fMatDensity->Resize(90, fMaterialName->GetDefaultHeight());
110 nef = (TGTextEntry *)fMatDensity->GetNumberEntry();
111 nef->SetToolTipText("Enter material density in [g/cm3]");
112 fMatDensity->Associate(this);
113 f1->AddFrame(fMatDensity, new TGLayoutHints(kLHintsRight, 2, 2, 1, 1));
114 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 2, 2, 1, 1));
115
116 // Number entry for temperature
118 f1->AddFrame(new TGLabel(f1, "Temperature"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
120 fMatTemperature->Resize(90, fMaterialName->GetDefaultHeight());
121 nef = (TGTextEntry *)fMatTemperature->GetNumberEntry();
122 nef->SetToolTipText("Enter material temperature in [Kelvin]");
123 fMatTemperature->Associate(this);
124 f1->AddFrame(fMatTemperature, new TGLayoutHints(kLHintsRight, 2, 2, 1, 1));
125 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 2, 2, 1, 1));
126
127 // Number entry for pressure
129 f1->AddFrame(new TGLabel(f1, "Pressure"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
131 fMatPressure->Resize(90, fMaterialName->GetDefaultHeight());
132 nef = (TGTextEntry *)fMatPressure->GetNumberEntry();
133 nef->SetToolTipText("Enter material pressure in [bar]");
134 fMatPressure->Associate(this);
135 f1->AddFrame(fMatPressure, new TGLayoutHints(kLHintsRight, 2, 2, 1, 1));
136 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 2, 2, 1, 1));
137
138 // Number entry for radiation length
140 f1->AddFrame(new TGLabel(f1, "RadLen"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
142 fMatRadLen->Resize(90, fMaterialName->GetDefaultHeight());
143 nef = (TGTextEntry *)fMatRadLen->GetNumberEntry();
144 nef->SetToolTipText("Computed radiation length");
145 fMatRadLen->Associate(this);
146 f1->AddFrame(fMatRadLen, new TGLayoutHints(kLHintsRight, 2, 2, 1, 1));
147 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 2, 2, 1, 1));
148
149 // Number entry for absorption length
151 f1->AddFrame(new TGLabel(f1, "AbsLen"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
153 fMatAbsLen->Resize(90, fMaterialName->GetDefaultHeight());
154 nef = (TGTextEntry *)fMatAbsLen->GetNumberEntry();
155 nef->SetToolTipText("Absorption length");
156 fMatAbsLen->Associate(this);
157 f1->AddFrame(fMatAbsLen, new TGLayoutHints(kLHintsRight, 2, 2, 1, 1));
158 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 2, 2, 1, 1));
159
160 compxyz->Resize(150, 30);
161 AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 0, 0, 2, 2));
162
163 // Buttons
165 fApply = new TGTextButton(f23, "Apply");
166 f23->AddFrame(fApply, new TGLayoutHints(kLHintsLeft, 2, 2, 1, 1));
167 fApply->Associate(this);
168 fUndo = new TGTextButton(f23, " Undo ");
169 f23->AddFrame(fUndo, new TGLayoutHints(kLHintsRight, 2, 2, 1, 1));
170 fUndo->Associate(this);
171 AddFrame(f23, new TGLayoutHints(kLHintsLeft, 0, 0, 4, 4));
172 fUndo->SetSize(fApply->GetSize());
173}
174
175////////////////////////////////////////////////////////////////////////////////
176/// Destructor
177
179{
180 TGFrameElement *el;
181 TIter next(GetList());
182 while ((el = (TGFrameElement *)next())) {
183 if (el->fFrame->IsComposite())
185 }
186 Cleanup();
187}
188
189////////////////////////////////////////////////////////////////////////////////
190/// Connect signals to slots.
191
193{
194 fApply->Connect("Clicked()", "TGeoMaterialEditor", this, "DoApply()");
195 fUndo->Connect("Clicked()", "TGeoMaterialEditor", this, "DoUndo()");
196 fMaterialName->Connect("TextChanged(const char *)", "TGeoMaterialEditor", this, "DoName()");
197 fMatA->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoA()");
198 fMatZ->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoZ()");
199 fMatState->Connect("Selected(Int_t)", "TGeoMaterialEditor", this, "DoState(Int_t)");
200 fMatDensity->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoDensity()");
201 fMatTemperature->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoTemperature()");
202 fMatPressure->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoPressure()");
203 fMatRadLen->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoRadAbs()");
204 fMatAbsLen->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoRadAbs()");
205 fInit = kFALSE;
206}
207
208////////////////////////////////////////////////////////////////////////////////
209/// Connect to the selected material.
210
212{
213 if (obj == nullptr || !(obj->InheritsFrom(TGeoMaterial::Class()))) {
215 return;
216 }
217 fMaterial = (TGeoMaterial *)obj;
218 fAi = fMaterial->GetA();
219 fZi = (Int_t)fMaterial->GetZ();
220 fStatei = (Int_t)fMaterial->GetState();
221 fDensityi = fMaterial->GetDensity();
222 fTempi = fMaterial->GetTemperature();
223 fPresi = fMaterial->GetPressure() / 6.2415e+8;
224 fNamei = fMaterial->GetName();
225 fMaterialName->SetText(fMaterial->GetName());
226 fMatA->SetNumber(fAi);
227 fMatZ->SetNumber(fZi);
228 fMatState->Select(fStatei);
229 fMatDensity->SetNumber(fDensityi);
230 fMatTemperature->SetNumber(fTempi);
231 fMatPressure->SetNumber(fPresi);
232 fMatRadLen->SetNumber(fMaterial->GetRadLen());
233 fMatAbsLen->SetNumber(fMaterial->GetIntLen());
234 fApply->SetEnabled(kFALSE);
235 fUndo->SetEnabled(kFALSE);
236
237 if (fInit)
239 SetActive();
240}
241
242////////////////////////////////////////////////////////////////////////////////
243/// Perform name change.
244
249
250////////////////////////////////////////////////////////////////////////////////
251/// Slot for atomic mass.
252
254{
255 if (fMaterial->IsMixture()) {
256 fMatA->SetNumber(fMaterial->GetA());
257 return;
258 }
259 DoModified();
260}
261
262////////////////////////////////////////////////////////////////////////////////
263/// Slot for charge.
264
266{
267 if (fMaterial->IsMixture()) {
268 fMatZ->SetNumber(fMaterial->GetZ());
269 return;
270 }
271 Int_t z = (Int_t)fMatZ->GetNumber();
272 TGeoElementTable *table = gGeoManager->GetElementTable();
273 if (z >= table->GetNelements()) {
274 z = table->GetNelements() - 1;
275 fMatZ->SetNumber(z);
276 }
277 TGeoElement *elem = table->GetElement(z);
278 if (!elem)
279 return;
280 Double_t a = elem->A();
281 fMatA->SetNumber(a);
282 DoModified();
283}
284
285////////////////////////////////////////////////////////////////////////////////
286/// Slot for material state.
287
289{
290 DoModified();
291}
292
293////////////////////////////////////////////////////////////////////////////////
294/// Slot for material temperature.
295
300
301////////////////////////////////////////////////////////////////////////////////
302/// Slot for material pressure.
303
308
309////////////////////////////////////////////////////////////////////////////////
310/// Slot for density.
311/// fMatDensity->SetNumber(fDensityi);
312
317
318////////////////////////////////////////////////////////////////////////////////
319/// Slot for radiation/absorption length.
320
322{
323 fMatRadLen->SetNumber(fMaterial->GetRadLen());
324 fMatAbsLen->SetNumber(fMaterial->GetIntLen());
325 DoModified();
326}
327
328////////////////////////////////////////////////////////////////////////////////
329/// Slot for applying modifications.
330
332{
333 const char *name = fMaterialName->GetText();
334 fMaterial->SetName(name);
335
336 fMaterial->SetA(fMatA->GetNumber());
337 fMaterial->SetZ(fMatZ->GetNumber());
338 fMaterial->SetDensity(fMatDensity->GetNumber());
339 fMaterial->SetTemperature(fMatTemperature->GetNumber());
340 fMaterial->SetPressure(6.2415e+8 * fMatPressure->GetNumber());
341 fMaterial->SetState((TGeoMaterial::EGeoMaterialState)fMatState->GetSelected());
342 fMaterial->SetRadLen(fMatRadLen->GetNumber(), fMatAbsLen->GetNumber());
343 fMatRadLen->SetNumber(fMaterial->GetRadLen());
344 fMatAbsLen->SetNumber(fMaterial->GetIntLen());
345 fUndo->SetEnabled();
346 fApply->SetEnabled(kFALSE);
347}
348
349////////////////////////////////////////////////////////////////////////////////
350/// Slot for cancelling current modifications.
351
353{
354 fMaterialName->SetText(fNamei.Data());
355 fMaterial->SetName(fNamei.Data());
356 fMatA->SetNumber(fAi);
357 fMaterial->SetA(fAi);
358 fMatZ->SetNumber(fZi);
359 fMaterial->SetZ(fZi);
360 fMatState->Select(fStatei);
362 fMatDensity->SetNumber(fDensityi);
363 fMaterial->SetDensity(fDensityi);
364 fMatTemperature->SetNumber(fTempi);
365 fMaterial->SetTemperature(fTempi);
366 fMatPressure->SetNumber(fPresi);
367 fMaterial->SetPressure(fPresi * 6.2415e+8);
368 fMatRadLen->SetNumber(fMaterial->GetRadLen());
369 fMatAbsLen->SetNumber(fMaterial->GetIntLen());
370 fApply->SetEnabled(kFALSE);
371 fUndo->SetEnabled(kFALSE);
372}
373
374////////////////////////////////////////////////////////////////////////////////
375/// Slot for signaling modifications.
376
378{
379 fApply->SetEnabled();
380}
381
382/** \class TGeoMixtureEditor
383\ingroup Geometry_builder
384
385Editors for mixtures.
386
387*/
388
389
390////////////////////////////////////////////////////////////////////////////////
391/// Constructor for mixture editor.
392
394 : TGeoMaterialEditor(p, width, height, options | kVerticalFrame, back)
395{
396 fMixture = nullptr;
397 TGCompositeFrame *compxyz = nullptr, *f1 = nullptr;
398 TGTextEntry *nef;
399 MakeTitle("Mixture settings");
400 fNelem = new TGLabel(this, "Number of elements: 0");
401 AddFrame(fNelem, new TGLayoutHints(kLHintsLeft, 6, 2, 2, 2));
402 compxyz = new TGCompositeFrame(this, 118, 30, kVerticalFrame | kRaisedFrame | kDoubleBorder);
403 // Combo box for selecting elements
406 TGeoElementTable *table = gGeoManager->GetElementTable();
407 if (table) {
408 TGeoElement *element;
409 for (Int_t i = 0; i < table->GetNelements(); i++) {
410 element = table->GetElement(i);
411 if (element)
412 fMixElem->AddEntry(element->GetTitle(), i);
413 }
414 }
415 fMixElem->Select(0);
416 fMixElem->Resize(90, fMaterialName->GetDefaultHeight());
417 f1->AddFrame(fMixElem, new TGLayoutHints(kLHintsLeft, 2, 2, 1, 1));
418 TGCompositeFrame *comp1 = new TGCompositeFrame(f1, 118, 30, kVerticalFrame);
419 fAelem = new TGLabel(comp1, "A = 0");
420 comp1->AddFrame(fAelem, new TGLayoutHints(kLHintsRight, 2, 2, 2, 0));
421 fZelem = new TGLabel(comp1, "Z = 0");
422 comp1->AddFrame(fZelem, new TGLayoutHints(kLHintsRight, 2, 2, 2, 0));
423 f1->AddFrame(comp1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 2, 2, 0, 0));
424 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 2, 2, 0, 0));
425
426 // Fraction by weight
428 fChkFraction = new TGCheckButton(f1, "% weight");
429 fChkFraction->SetDown(kTRUE);
430 f1->AddFrame(fChkFraction, new TGLayoutHints(kLHintsLeft, 2, 2, 6, 1));
433 fNEFraction->Resize(65, fMaterialName->GetDefaultHeight());
434 nef = (TGTextEntry *)fNEFraction->GetNumberEntry();
435 nef->SetToolTipText("Enter fraction by weight of this element");
436 fNEFraction->SetNumber(0.);
437 fNEFraction->Associate(this);
438 f1->AddFrame(fNEFraction, new TGLayoutHints(kLHintsRight, 2, 2, 1, 1));
439 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 2, 2, 1, 1));
440
441 // Fraction by number of atoms
443 fChkNatoms = new TGCheckButton(f1, "N. atoms");
444 fChkNatoms->SetDown(kFALSE);
445 f1->AddFrame(fChkNatoms, new TGLayoutHints(kLHintsLeft, 2, 2, 6, 1));
446 fNENatoms = new TGNumberEntry(f1, 0., 5, kMIX_NATOMS);
448 fNENatoms->Resize(65, fMaterialName->GetDefaultHeight());
449 nef = (TGTextEntry *)fNENatoms->GetNumberEntry();
450 nef->SetToolTipText("Enter number of atoms for this element");
451 fNENatoms->SetNumber(0);
452 fNENatoms->Associate(this);
453 f1->AddFrame(fNENatoms, new TGLayoutHints(kLHintsRight, 2, 2, 1, 1));
454 compxyz->AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 2, 2, 1, 1));
455
456 // Button for adding the element
457 fBAddElem = new TGTextButton(compxyz, "Add component");
458 fBAddElem->Associate(this);
459 compxyz->AddFrame(fBAddElem, new TGLayoutHints(kLHintsRight, 2, 2, 2, 0));
460
461 compxyz->Resize(150, 30);
462 AddFrame(compxyz, new TGLayoutHints(kLHintsLeft, 0, 0, 1, 1));
463
464 // List view with all components
465 fComps = new TGCompositeFrame(this, 150, 100, kVerticalFrame | kSunkenFrame);
467
469}
470
471////////////////////////////////////////////////////////////////////////////////
472/// Connect signals to slots.
473
475{
476 fApply->Connect("Clicked()", "TGeoMixtureEditor", this, "DoApply1()");
477 fUndo->Connect("Clicked()", "TGeoMixtureEditor", this, "DoUndo1()");
478 fChkFraction->Connect("Clicked()", "TGeoMixtureEditor", this, "DoChkFraction()");
479 fChkNatoms->Connect("Clicked()", "TGeoMixtureEditor", this, "DoChkNatoms()");
480 fNEFraction->Connect("ValueSet(Long_t)", "TGeoMixtureEditor", this, "DoFraction()");
481 fNENatoms->Connect("ValueSet(Long_t)", "TGeoMixtureEditor", this, "DoNatoms()");
482 fMixElem->Connect("Selected(Int_t)", "TGeoMixtureEditor", this, "DoSelectElement(Int_t)");
483 fBAddElem->Connect("Clicked()", "TGeoMixtureEditor", this, "DoAddElem()");
484 fMaterialName->Connect("TextChanged(const char *)", "TGeoMaterialEditor", this, "DoName()");
485 fMatA->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoA()");
486 fMatZ->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoZ()");
487 fMatState->Connect("Selected(Int_t)", "TGeoMaterialEditor", this, "DoState(Int_t)");
488 fMatDensity->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoDensity()");
489 fMatTemperature->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoTemperature()");
490 fMatPressure->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoPressure()");
491 fMatRadLen->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoRadAbs()");
492 fMatAbsLen->Connect("ValueSet(Long_t)", "TGeoMaterialEditor", this, "DoRadAbs()");
493 fInit = kFALSE;
494}
495
496////////////////////////////////////////////////////////////////////////////////
497/// Connect to the selected mixture.
498
500{
501 if (obj == nullptr || !(obj->InheritsFrom(TGeoMixture::Class()))) {
503 return;
504 }
508}
509
510////////////////////////////////////////////////////////////////////////////////
511/// Check button state changed for fraction.
512
514{
515 if (fMixture->GetNelements() && fMixture->GetNmixt()) {
516 fChkFraction->SetDown(kFALSE);
517 fChkNatoms->SetDown(kTRUE);
518 return;
519 }
520 Bool_t isDown = fChkFraction->IsDown();
521 fChkNatoms->SetDown(!isDown);
522}
523
524////////////////////////////////////////////////////////////////////////////////
525/// Check button state changed for natoms.
526
528{
529 if (fMixture->GetNelements() && !fMixture->GetNmixt()) {
530 fChkFraction->SetDown(kTRUE);
531 fChkNatoms->SetDown(kFALSE);
532 return;
533 }
534 Bool_t isDown = fChkNatoms->IsDown();
535 fChkFraction->SetDown(!isDown);
536}
537
538////////////////////////////////////////////////////////////////////////////////
539/// Fraction changed.
540
542{
543 if (fMixture->GetNelements() && fMixture->GetNmixt())
544 return;
545 fChkFraction->SetDown(kTRUE);
546 fChkNatoms->SetDown(kFALSE);
547}
548
549////////////////////////////////////////////////////////////////////////////////
550/// Natoms changed.
551
553{
554 if (fMixture->GetNelements() && !fMixture->GetNmixt())
555 return;
556 fChkFraction->SetDown(kFALSE);
557 fChkNatoms->SetDown(kTRUE);
558}
559
560////////////////////////////////////////////////////////////////////////////////
561/// Slot for selecting an element.
562
564{
565 TGeoElement *el = gGeoManager->GetElementTable()->GetElement(ielem);
566 if (!el) {
567 Error("DoSelectElement", "No element at index %d", ielem);
568 return;
569 }
570 TString z = TString::Format("Z=%d", el->Z());
571 TString a = TString::Format("A=%d", (Int_t)el->A());
572 fAelem->SetText(a.Data());
573 fZelem->SetText(z.Data());
574}
575
576////////////////////////////////////////////////////////////////////////////////
577/// Slot for adding an element. No undo.
578
580{
581 Bool_t byfraction = fChkFraction->IsDown();
582 Int_t natoms = (Int_t)fNENatoms->GetNumber();
583 if (!byfraction && natoms <= 0)
584 return;
585 Double_t frac = fNEFraction->GetNumber();
586 if (byfraction && frac <= 0)
587 return;
588 TGeoElement *el = gGeoManager->GetElementTable()->GetElement(fMixElem->GetSelected());
589 if (!el)
590 return;
591 if (byfraction)
592 fMixture->AddElement(el, frac);
593 else
594 fMixture->AddElement(el, natoms);
595 fTabMgr->GetMaterialEditor(fMixture);
596}
597
598////////////////////////////////////////////////////////////////////////////////
599/// Slot for applying modifications.
600
602{
603 const char *name = fMaterialName->GetText();
604 fMaterial->SetName(name);
605
606 fMaterial->SetDensity(fMatDensity->GetNumber());
607 fMaterial->SetTemperature(fMatTemperature->GetNumber());
608 fMaterial->SetPressure(6.2415e+8 * fMatPressure->GetNumber());
609 fMaterial->SetState((TGeoMaterial::EGeoMaterialState)fMatState->GetSelected());
610 // fMaterial->SetRadLen(fMatRadLen->GetNumber(), fMatAbsLen->GetNumber());
611 fMatRadLen->SetNumber(fMaterial->GetRadLen());
612 fMatAbsLen->SetNumber(fMaterial->GetIntLen());
613 fUndo->SetEnabled();
614 fApply->SetEnabled(kFALSE);
615}
616
617////////////////////////////////////////////////////////////////////////////////
618/// Slot for undoing all changes.
619
621{
622 fMaterialName->SetText(fNamei.Data());
623 fMaterial->SetName(fNamei.Data());
624 fMatState->Select(fStatei);
626 fMatDensity->SetNumber(fDensityi);
627 fMaterial->SetDensity(fDensityi);
628 fMatTemperature->SetNumber(fTempi);
629 fMaterial->SetTemperature(fTempi);
630 fMatPressure->SetNumber(fPresi);
631 fMaterial->SetPressure(fPresi * 6.2415e+8);
632 fMatRadLen->SetNumber(fMaterial->GetRadLen());
633 fMatAbsLen->SetNumber(fMaterial->GetIntLen());
634 fApply->SetEnabled(kFALSE);
635 fUndo->SetEnabled(kFALSE);
636}
637
638////////////////////////////////////////////////////////////////////////////////
639/// Update the list of elements in the TGCanvas.
640
642{
643 fComps->RemoveAll();
644 Int_t nelem = fMixture->GetNelements();
645 for (Int_t i = 0; i < nelem; i++) {
646 TString s;
647 Bool_t byfrac = (fMixture->GetNmixt()) ? kFALSE : kTRUE;
648 if (byfrac)
649 s.TString::Format("%d-%s-%d: Wmass = %g %%", (Int_t)fMixture->GetZmixt()[i],
650 fMixture->GetElement(i)->GetName(), (Int_t)fMixture->GetAmixt()[i], fMixture->GetWmixt()[i]);
651 else
652 s.TString::Format("%d-%s-%d: Natoms = %d", (Int_t)fMixture->GetZmixt()[i], fMixture->GetElement(i)->GetName(),
653 (Int_t)fMixture->GetAmixt()[i], fMixture->GetNmixt()[i]);
654
655 TGLabel *label = new TGLabel(fComps, s);
657 fComps->AddFrame(label, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 1, 1, 0, 0));
658 }
659 fComps->MapSubwindows();
660}
@ kRaisedFrame
Definition GuiTypes.h:385
@ kSunkenFrame
Definition GuiTypes.h:384
@ kVerticalFrame
Definition GuiTypes.h:382
@ kDoubleBorder
Definition GuiTypes.h:386
@ kFixedWidth
Definition GuiTypes.h:388
@ kFitWidth
Definition GuiTypes.h:387
@ kHorizontalFrame
Definition GuiTypes.h:383
@ kOwnBackground
Definition GuiTypes.h:392
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:41
#define a(i)
Definition RSha256.hxx:99
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
Definition RtypesCore.h:60
bool Bool_t
Boolean (0=false, 1=true) (bool).
Definition RtypesCore.h:77
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
@ kLHintsRight
Definition TGLayout.h:26
@ kLHintsExpandY
Definition TGLayout.h:31
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsExpandX
Definition TGLayout.h:30
@ kTextLeft
Definition TGWidget.h:23
@ kTextCenterY
Definition TGWidget.h:28
char name[80]
Definition TGX11.cxx:148
@ kMATERIAL_NAME
externTGeoManager * gGeoManager
@ kMATERIAL_TEMP
@ kMATERIAL_A
@ kMATERIAL_STATE
@ kMATERIAL_ABS
@ kMATERIAL_APPLY
@ kMATERIAL_RHO
@ kMATERIAL_Z
@ kMATERIAL_PRES
@ kMATERIAL_CANCEL
@ kMATERIAL_UNDO
@ kMATERIAL_RAD
ETGeoMaterialStates
@ kMAT_UNDEFINED
@ kMAT_LIQUID
@ kMIX_NATOMS
@ kMIX_ADDELEM
Selects different options.
Definition TGButton.h:264
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
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 TList * GetList() const
Definition TGFrame.h:312
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition TGFrame.cxx:959
TGCompositeFrame(const TGCompositeFrame &)=delete
TGFrame * fFrame
Definition TGLayout.h:112
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:597
virtual Bool_t IsComposite() const
Definition TGFrame.h:214
This class handles GUI labels.
Definition TGLabel.h:24
void SetTextJustify(Int_t tmode)
Set text justification.
Definition TGLabel.cxx:395
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.
@ kNEANonNegative
Non-negative number.
@ kNESRealThree
Fixed fraction real, three digit.
@ kNESInteger
Style of number entry field.
@ kNESRealTwo
Fixed fraction real, two digit.
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
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
ROOT GUI Window base class.
Definition TGWindow.h:23
Bool_t fInit
init flag for setting signals/slots
Definition TGedFrame.h:47
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition TGedFrame.cxx:94
table of elements
TGeoElement * GetElement(Int_t z)
Int_t GetNelements() const
Base class for chemical elements.
Definition TGeoElement.h:31
Double_t A() const
Definition TGeoElement.h:66
Int_t Z() const
Definition TGeoElement.h:63
TGeoGedFrame(const TGWindow *p=nullptr, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Constructor.
virtual void SetActive(Bool_t active=kTRUE)
Set active GUI attribute frames related to the selected object.
TGeoTabManager * fTabMgr
void DoState(Int_t state)
Slot for material state.
TGTextEntry * fMaterialName
void DoTemperature()
Slot for material temperature.
TGeoMaterialEditor(const TGWindow *p=nullptr, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Constructor for material editor.
void DoRadAbs()
Slot for radiation/absorption length.
void DoPressure()
Slot for material pressure.
TGeoMaterial * fMaterial
void DoZ()
Slot for charge.
TGNumberEntry * fMatDensity
~TGeoMaterialEditor() override
Destructor.
TGNumberEntry * fMatAbsLen
TGNumberEntry * fMatTemperature
TGNumberEntry * fMatZ
virtual void ConnectSignals2Slots()
Connect signals to slots.
void DoModified()
Slot for signaling modifications.
TGCompositeFrame * f23
TGNumberEntry * fMatPressure
void DoA()
Slot for atomic mass.
void DoName()
Perform name change.
TGNumberEntry * fMatA
TGNumberEntry * fMatRadLen
void DoUndo()
Slot for cancelling current modifications.
void SetModel(TObject *obj) override
Connect to the selected material.
void DoDensity()
Slot for density.
void DoApply()
Slot for applying modifications.
Base class describing materials.
static TClass * Class()
void DoAddElem()
Slot for adding an element. No undo.
TGNumberEntry * fNENatoms
void DoNatoms()
Natoms changed.
TGTextButton * fBAddElem
void ConnectSignals2Slots() override
Connect signals to slots.
void UpdateElements()
Update the list of elements in the TGCanvas.
TGCheckButton * fChkNatoms
void DoUndo1()
Slot for undoing all changes.
TGeoMixtureEditor(const TGWindow *p=nullptr, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Constructor for mixture editor.
void DoChkNatoms()
Check button state changed for natoms.
TGCompositeFrame * fComps
void DoApply1()
Slot for applying modifications.
TGNumberEntry * fNEFraction
TGCheckButton * fChkFraction
void DoChkFraction()
Check button state changed for fraction.
void DoFraction()
Fraction changed.
void DoSelectElement(Int_t iel)
Slot for selecting an element.
void SetModel(TObject *obj) override
Connect to the selected mixture.
Mixtures of elements.
static TClass * Class()
static void MoveFrame(TGCompositeFrame *fr, TGCompositeFrame *p)
Move frame fr at the end of the list of parent p.
static void Cleanup(TGCompositeFrame *frame)
Static method to cleanup hierarchically all daughters of a composite frame.
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:50
Mother of all ROOT objects.
Definition TObject.h:42
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:549
Basic string class.
Definition TString.h:138
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:2385
TF1 * f1
Definition legend1.C:11