--- /dev/null
+// $Id$
+// Category: interfaces
+//
+// Author: D. Adamova
+//
+//========================================================
+//
+//------------TG4MaterialsFrames.cxx--------------------------------//
+//--------- Frames for the the display of materials properties---//
+//
+//=========================================================
+
+#include "TG4MaterialsFrames.h"
+#include "TG4Globals.h"
+
+#include <TGTextBuffer.h>
+#include <TGTextEntry.h>
+#include <TGComboBox.h>
+#include <TGLabel.h>
+
+#include <G4Material.hh>
+#include <G4Element.hh>
+
+
+
+ ClassImp(TG4MaterialsFrames)
+
+TG4MaterialsFrames::TG4MaterialsFrames( TGCompositeFrame* Parent, TGMainFrame* ActionFrame )
+{
+//---> creates the materials properties display frame
+//---> and plunges it into the main frame
+ fCapFrame = new TGCompositeFrame(Parent, 60, 20, kHorizontalFrame);
+ fMatSubframe1 = new TGCompositeFrame(fCapFrame, 60, 20, kVerticalFrame);
+ fMatFrameLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5);
+
+ // ComboBox for materials
+ fMaterialsCombo = new TGComboBox(fMatSubframe1, 200);
+ TGLayoutHints* lLayoutHints3 =
+ new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,
+ 2, 2, 2, 2);
+ Text_t* lComboLabelText = " Pick up a material here ";
+ fComboLabel = new TGLabel( fMatSubframe1, lComboLabelText);
+ fMatSubframe1->AddFrame(fComboLabel, lLayoutHints3);
+ fMatSubframe1->AddFrame(fMaterialsCombo, fMatFrameLayout);
+
+
+ fMaterialsCombo->Resize(200, 20);
+ fMaterialsCombo->Associate(ActionFrame);
+
+
+
+// text labels with material properties
+ Text_t* labelText[8] =
+ {"Index ",
+ "Number of elements",
+ "Elements list ",
+ "Atomic mass ",
+ "Density ",
+ "State ",
+ "Radiation Length ",
+ "Abs. Length " };
+
+// Entries for material properties
+ TGLayoutHints* lLayoutHints4 =
+ new TGLayoutHints(kLHintsTop | kLHintsExpandY, 5, 5, 5, 5);
+ TGLayoutHints* lLayoutHints5 =
+ new TGLayoutHints(kLHintsLeft | kLHintsExpandX );
+ fMatSubframe2 = new TGCompositeFrame(fCapFrame, 60, 20, kVerticalFrame);
+
+ { // local scope for i
+ for (Int_t i=0; i<8; i++) {
+ Int_t idT=i+1;
+ fHframe[i] = new TGHorizontalFrame(fMatSubframe2, 500, 100, kFixedWidth);
+ fMatTextBuff[i] = new TGTextBuffer(200);
+ fMatTextEntry[i] = new TGTextEntry(fHframe[i], fMatTextBuff[i], 300);
+ fLabel[i] = new TGLabel(fHframe[i], labelText[i]);
+ fHframe[i]->AddFrame(fLabel[i], lLayoutHints5);
+ fHframe[i]->AddFrame(fMatTextEntry[i], lLayoutHints5);
+ fMatSubframe2->AddFrame(fHframe[i], lLayoutHints4);
+ fMatTextEntry[i]->Associate(ActionFrame);
+ }
+ }
+
+// making up Materials frame
+ fCapFrame->AddFrame(fMatSubframe1,fMatFrameLayout);
+ fCapFrame->AddFrame(fMatSubframe2,fMatFrameLayout);
+
+// going to the main frame
+ Parent->AddFrame(fCapFrame, fMatFrameLayout);
+
+}
+
+TG4MaterialsFrames::TG4MaterialsFrames(const TG4MaterialsFrames& mf)
+{
+// Dummy copy constructor
+ TG4Globals::Exception(
+ "Attempt to use TG4MaterialsFrames copy constructor.");
+}
+
+TG4MaterialsFrames& TG4MaterialsFrames::operator=(const TG4MaterialsFrames& mf)
+{
+ // check assignement to self
+ if (this == &mf) return *this;
+
+ TG4Globals::Exception(
+ "Attempt to assign TG4MaterialsFrames singleton.");
+
+ return *this;
+}
+
+TG4MaterialsFrames::~TG4MaterialsFrames()
+{
+ //---> liquidator
+
+ G4cout << "\n Now in TG4MaterialsFrames destructor \n"<< G4endl;
+ delete fMatSubframe1;
+ delete fMatFrameLayout;
+ delete fMaterialsCombo;
+ delete fComboLabel;
+ delete fMatSubframe2;
+ delete fCapFrame;
+
+ Int_t i;
+ for (i=0; i<8; i++) {
+ delete fHframe[i];
+ delete fMatTextBuff[i];
+ delete fMatTextEntry[i];
+ delete fLabel[i];
+ }
+
+}
+
+void TG4MaterialsFrames::SetMaterialsComboEntries()
+{
+//---> puts names of materials into the combo box entries
+
+ const G4MaterialTable* lComboEntries = G4Material::GetMaterialTable();
+
+ G4int ig = lComboEntries->entries();
+ G4String name;
+
+ for (int ii=0; ii < ig; ii++)
+ { name = ((*lComboEntries )[ii])->GetName() ;
+ AddMaterialName( name, ii+1);
+ };
+
+ name = " " ;
+ AddMaterialName( name, ig+1);
+
+}
+
+void TG4MaterialsFrames::AddMaterialName( const char* name, Int_t index) const
+{
+
+//-----> adds a material name to the combo box
+
+ fMaterialsCombo->AddEntry( name, index);
+ fMaterialsCombo->Select(index);
+ fMaterialsCombo->Resize(200, 20);
+}
+
+void TG4MaterialsFrames::DisplayMaterialCharacteristics()
+{
+
+//-----> shows informations about materials listed in G4MaterialTable
+
+ const G4MaterialTable* lComboEntries = G4Material::GetMaterialTable();
+ G4int ientr = lComboEntries->entries();
+ G4int index = fMaterialsCombo->GetSelected();
+
+ G4cout << "\nThe clicked-on material has the index: " << index << G4endl;
+
+ if( index < ientr+1 ) {
+
+ G4int ii = index-1;
+ G4Material* lvMaterial = (*lComboEntries )[ii];
+ const G4ElementVector* allElements = lvMaterial->GetElementVector();
+
+ G4cout << lvMaterial->GetName() << " "
+ << lvMaterial->GetNumberOfElements() << " "
+ << (*allElements )[0]->GetName() << "... "
+ << lvMaterial->GetDensity() << " "
+ << lvMaterial->GetState() << " "
+ << lvMaterial->GetRadlen() << " "
+ << G4endl;
+
+ char buff[200];
+
+ sprintf(buff, "%10i",index );
+ fMatTextBuff[0]->Clear();
+ fMatTextBuff[0]->AddText(0, buff);
+ gClient->NeedRedraw(fMatTextEntry[0]);
+
+ G4int noe = lvMaterial->GetNumberOfElements();
+ sprintf(buff, "%10i", noe);
+ fMatTextBuff[1]->Clear();
+ fMatTextBuff[1]->AddText(0, buff);
+ gClient->NeedRedraw(fMatTextEntry[1]);
+
+ G4String stringOfElements = " ";
+ for (G4int ie=0; ie < noe; ie++) {
+ stringOfElements += (*allElements )[ie]->GetName();
+ stringOfElements += " ";
+ };
+ sprintf(buff, stringOfElements);
+ fMatTextBuff[2]->Clear();
+ fMatTextBuff[2]->AddText(0, buff);
+ gClient->NeedRedraw(fMatTextEntry[2]);
+
+ sprintf(buff, " Multi element material" );
+ if( noe < 2 )
+ sprintf(buff, "%10.2e", lvMaterial->GetA() );
+ fMatTextBuff[3]->Clear();
+ fMatTextBuff[3]->AddText(0, buff);
+ gClient->NeedRedraw(fMatTextEntry[3]);
+
+ sprintf(buff, "%10.2e", lvMaterial->GetDensity() );
+ fMatTextBuff[4]->Clear();
+ fMatTextBuff[4]->AddText(0, buff);
+ gClient->NeedRedraw(fMatTextEntry[4]);
+
+ sprintf(buff,"%10i", lvMaterial->GetState());
+ fMatTextBuff[5]->Clear();
+ fMatTextBuff[5]->AddText(0, buff);
+ gClient->NeedRedraw(fMatTextEntry[5]);
+
+ sprintf(buff,"%10.2e", lvMaterial->GetRadlen());
+ fMatTextBuff[6]->Clear();
+ fMatTextBuff[6]->AddText(0, buff);
+ gClient->NeedRedraw(fMatTextEntry[6]);
+
+ sprintf(buff, " " );
+ fMatTextBuff[7]->Clear();
+ fMatTextBuff[7]->AddText(0, buff);
+ gClient->NeedRedraw(fMatTextEntry[7]);
+
+ };
+
+ if( index == ientr+1 ) {
+
+ for ( G4int ii=0; ii<8; ii++) {
+ fMatTextBuff[ii]->Clear();
+ gClient->NeedRedraw(fMatTextEntry[ii]);
+ };
+ };
+
+}
+
--- /dev/null
+// $Id$
+// Category: interfaces
+//
+// Author: D. Adamova
+//
+//======================================================
+//
+//------------TG4MaterialsFrames.h--------------------------------//
+//---------Frames for the the display of materials properties---//
+//
+//=======================================================
+
+#ifndef TG4_MATERIALSFRAMES_H
+#define TG4_MATERIALSFRAMES_H
+
+#include <TObject.h>
+#include <TGFrame.h>
+
+class TGLabel;
+class TGTextBuffer;
+class TGTextEntry;
+class TGComboBox;
+
+class TG4MaterialsFrames : public TObject {
+
+public:
+
+ TG4MaterialsFrames( TGCompositeFrame* Parent, TGMainFrame* ActionFrame);
+ virtual ~TG4MaterialsFrames();
+
+ void DisplayMaterialCharacteristics();
+ void SetMaterialsComboEntries() ;
+
+protected:
+
+ TG4MaterialsFrames(const TG4MaterialsFrames& mf) ;
+ TG4MaterialsFrames& operator=(const TG4MaterialsFrames& mf) ;
+
+
+private:
+ TGCompositeFrame* fCapFrame; // the top frame for materials display
+ TGCompositeFrame* fMatSubframe1; // frame for the combo box
+ TGCompositeFrame* fMatSubframe2; // frame for the text entries
+ TGLayoutHints* fMatFrameLayout; // layout hints for SubFrames
+
+
+
+ TGHorizontalFrame* fHframe[8]; // horizontal frames for text entries
+ TGLabel* fLabel[8]; // labels for text entries
+ TGTextBuffer* fMatTextBuff[8]; //text buffs for mat properties
+ TGTextEntry* fMatTextEntry[8]; //text entries for mat properties
+ TGComboBox* fMaterialsCombo; // materials combo box
+ TGLabel* fComboLabel; // label for the combo box
+
+
+ void AddMaterialName( const char* name, Int_t index) const;
+
+ ClassDef(TG4MaterialsFrames,0)
+ // class for the composition of the materials display frame
+ };
+
+#endif
+
+
+
+
+
+
--- /dev/null
+// $Id$
+// Category: interfaces
+//
+// Author: D. Adamova
+//
+//========================================================
+//
+//------------TG4VolumesFrames.cxx--------------------------------//
+//--------- Frames for the the display of volumes properties---//
+//
+//=========================================================
+
+#include "TG4VolumesFrames.h"
+#include "TG4Globals.h"
+
+#include <TGTextBuffer.h>
+#include <TGTextEntry.h>
+#include <TGComboBox.h>
+#include <TGLabel.h>
+
+#include <G4LogicalVolumeStore.hh>
+#include <G4LogicalVolume.hh>
+#include <G4Material.hh>
+#include <G4VSolid.hh>
+
+
+ ClassImp(TG4VolumesFrames)
+
+TG4VolumesFrames::TG4VolumesFrames( TGCompositeFrame* Parent, TGMainFrame* ActionFrame)
+{
+//---> creates the volumes properties display frame
+//---> and plunges it into the main frame
+ fCapFrame = new TGCompositeFrame(Parent, 60, 20, kHorizontalFrame);
+ fVolSubframe1 = new TGCompositeFrame(fCapFrame, 60, 20, kVerticalFrame);
+ fVolFrameLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5);
+
+// ComboBox for lvolumes
+ fVolumesCombo = new TGComboBox(fVolSubframe1, 100);
+ TGLayoutHints* lLayoutHints3 =
+ new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,
+ 2, 2, 2, 2);
+ Text_t* lComboLabelText = " Pick up a volume here ";
+ fComboLabel = new TGLabel( fVolSubframe1, lComboLabelText);
+ fVolSubframe1->AddFrame(fComboLabel, lLayoutHints3);
+ fVolSubframe1->AddFrame(fVolumesCombo, fVolFrameLayout);
+
+ fVolumesCombo->Resize(200, 20);
+ fVolumesCombo->Associate(ActionFrame);
+
+
+// text labels with lvolumes properties
+
+ Text_t* labelText[3] =
+ {"Shape's Name",
+ "Material ",
+ "User Limits " };
+
+// Entries for lvolumes properties
+ TGLayoutHints* lLayoutHints4 =
+ new TGLayoutHints(kLHintsTop | kLHintsExpandY, 5, 5, 5, 5);
+ TGLayoutHints* lLayoutHints5 =
+ new TGLayoutHints(kLHintsLeft | kLHintsExpandX );
+ fVolSubframe2 = new TGCompositeFrame(fCapFrame, 60, 20, kVerticalFrame);
+
+ { // local scope for i
+ for (Int_t i=0; i<3; i++) {
+ Int_t idT=i+1;
+ fHframe[i] = new TGHorizontalFrame(fVolSubframe2, 500, 100, kFixedWidth);
+ fVolSubframe2->AddFrame(fHframe[i], lLayoutHints4);
+ fVolTextBuff[i] = new TGTextBuffer(200);
+ fVolTextEntry[i] = new TGTextEntry(fHframe[i], fVolTextBuff[i], 300);
+ fLabel[i] = new TGLabel(fHframe[i], labelText[i]);
+ fHframe[i]->AddFrame(fLabel[i], lLayoutHints5);
+ fHframe[i]->AddFrame(fVolTextEntry[i], lLayoutHints5);
+ fVolTextEntry[i]->Associate(ActionFrame);
+ }
+ }
+
+// making up the Volumes frame
+ fCapFrame->AddFrame(fVolSubframe1,fVolFrameLayout);
+ fCapFrame->AddFrame(fVolSubframe2,fVolFrameLayout);
+// going to the main frame
+ Parent->AddFrame(fCapFrame, fVolFrameLayout);
+}
+
+TG4VolumesFrames::TG4VolumesFrames(const TG4VolumesFrames& vf)
+{
+// Dummy copy constructor
+ TG4Globals::Exception(
+ "Attempt to use TG4VolumesFrames copy constructor.");
+}
+
+TG4VolumesFrames& TG4VolumesFrames::operator=(const TG4VolumesFrames& vf)
+{
+ // check assignement to self
+ if (this == &vf) return *this;
+
+ TG4Globals::Exception(
+ "Attempt to assign singleton.");
+
+ return *this;
+}
+
+TG4VolumesFrames::~TG4VolumesFrames()
+{
+//---> liquidator
+
+ G4cout << "\n Now in TG4VolumesFrames destructor \n" << G4endl;
+ delete fVolSubframe1;
+ delete fVolFrameLayout;
+ delete fVolumesCombo;
+ delete fComboLabel;
+ delete fVolSubframe2;
+ delete fCapFrame;
+
+ Int_t i;
+ for (i=0; i<3; i++) {
+ delete fHframe[i];
+ delete fVolTextBuff[i];
+ delete fVolTextEntry[i];
+ delete fLabel[i];
+ }
+
+}
+
+void TG4VolumesFrames::SetVolumesComboEntries()
+{
+//--->//---> puts names of lvolumes into the combo box entries
+
+ G4LogicalVolumeStore* lComboEntries = G4LogicalVolumeStore::GetInstance();
+
+ G4int ig = lComboEntries->entries();
+ G4String name;
+
+ for (int ii=0; ii < ig; ii++)
+ { name = ((*lComboEntries )[ii])->GetName() ;
+ AddLogicalVolumeName( name, ii+1);
+ };
+
+ name = " " ;
+ AddLogicalVolumeName( name, ig+1);
+
+
+}
+
+void TG4VolumesFrames::AddLogicalVolumeName( const char* name, Int_t index) const
+{
+//-----> adds an lvolume name to the combo box
+
+ fVolumesCombo->AddEntry( name, index);
+ fVolumesCombo->Select(index);
+ fVolumesCombo->Resize(200, 20);
+}
+
+void TG4VolumesFrames::DisplayVolumeCharacteristics()
+{
+//-----> shows informations about a logical volume
+
+ G4LogicalVolumeStore* lComboEntries = G4LogicalVolumeStore::GetInstance();
+ G4int ientr = lComboEntries->entries();
+ G4int index = fVolumesCombo->GetSelected();
+
+ G4cout << "\nThe clicked-on volumes entry has the index: " << index << G4endl;
+
+ if( index < ientr+1 ) {
+
+ G4int ii = index-1;
+ G4LogicalVolume* lVolume = (*lComboEntries )[ii];
+ G4Material* lvMaterial = ((*lComboEntries )[ii])->GetMaterial();
+
+ G4cout << lVolume->GetName() << " "
+ << lVolume->GetSolid()->GetEntityType() << " "
+ << lvMaterial->GetName() << " "
+ << lVolume->GetUserLimits() << " "
+ << G4endl;
+
+
+ char buff[100];
+
+ sprintf(buff, lVolume->GetSolid()->GetEntityType());
+ fVolTextBuff[0]->Clear();
+ fVolTextBuff[0]->AddText(0, buff);
+ gClient->NeedRedraw(fVolTextEntry[0]);
+
+ sprintf(buff, lvMaterial->GetName());
+ fVolTextBuff[1]->Clear();
+ fVolTextBuff[1]->AddText(0, buff);
+ gClient->NeedRedraw(fVolTextEntry[1]);
+
+
+ sprintf(buff, "User limits undefined" );
+ if (lVolume->GetUserLimits())
+ sprintf(buff, "User limits defined" );
+ fVolTextBuff[2]->Clear();
+ fVolTextBuff[2]->AddText(0, buff);
+ gClient->NeedRedraw(fVolTextEntry[2]);
+ };
+
+ if( index == ientr+1 ) {
+
+ for ( G4int ii=0; ii<3; ii++) {
+ fVolTextBuff[ii]->Clear();
+ gClient->NeedRedraw(fVolTextEntry[ii]);
+ };
+ };
+}
+
--- /dev/null
+// $Id$
+// Category: interfaces
+//
+// Author: D. Adamova
+//
+//======================================================
+//
+//------------TG4VolumesFrames.h--------------------------------//
+//---------Frames for the the display of volumes properties---//
+//
+//=======================================================
+
+#ifndef TG4_VOLUMESFRAMES_H
+#define TG4_VOLUMESFRAMES_H
+
+#include <TObject.h>
+#include <TGFrame.h>
+
+class TGLabel;
+class TGTextBuffer;
+class TGTextEntry;
+class TGComboBox;
+
+
+class TG4VolumesFrames : public TObject {
+
+public:
+
+ TG4VolumesFrames( TGCompositeFrame* parent, TGMainFrame* actionFrame);
+ virtual ~TG4VolumesFrames();
+
+ void SetVolumesComboEntries();
+ void DisplayVolumeCharacteristics();
+
+protected:
+
+ TG4VolumesFrames(const TG4VolumesFrames& vf) ;
+ TG4VolumesFrames& operator=(const TG4VolumesFrames& vf) ;
+
+private:
+
+ TGCompositeFrame* fCapFrame; // the top frame for volumes properties display
+ TGCompositeFrame* fVolSubframe1; // frame for the combo box
+ TGCompositeFrame* fVolSubframe2; // frame for the text entries
+ TGLayoutHints* fVolFrameLayout; // layout hints for SubFrames
+ TGHorizontalFrame* fHframe[3]; // horizontal frames for text entries
+ TGLabel* fLabel[3]; // labels for text entries
+ TGTextBuffer* fVolTextBuff[3]; //text buffs for vols propertie
+ TGTextEntry* fVolTextEntry[3]; //text entries for vols properties
+ TGComboBox* fVolumesCombo; // volumes combo box
+ TGLabel* fComboLabel; // label for combo box
+
+
+ void AddLogicalVolumeName( const char* name, Int_t index) const;
+
+ ClassDef(TG4VolumesFrames,0)
+ // class for the composition of the volumes display frame
+ };
+
+#endif
+
+
+
+
+
+