3 added + 4 removed + 2 modified, total 9 files
lcdd/include
diff -N ElementNames.icc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ElementNames.icc 2 Mar 2011 03:37:07 -0000 1.1
@@ -0,0 +1,203 @@
+int NistElementsDump::nelements = 98;
+
+string NistElementsDump::abbrevs[] = {
+ "Ac",
+ "Ag",
+ "Al",
+ "Am",
+ "Ar",
+ "As",
+ "At",
+ "Au",
+ "B",
+ "Ba",
+ "Be",
+ "Bi",
+ "Bk",
+ "Br",
+ "C",
+ "Ca",
+ "Cd",
+ "Ce",
+ "Cf",
+ "Cl",
+ "Cm",
+ "Co",
+ "Cr",
+ "Cs",
+ "Cu",
+ "Dy",
+ "Er",
+ "Eu",
+ "F",
+ "Fe",
+ "Fr",
+ "Ga",
+ "Gd",
+ "Ge",
+ "H",
+ "He",
+ "Hf",
+ "Hg",
+ "Ho",
+ "I",
+ "In",
+ "Ir",
+ "K",
+ "Kr",
+ "La",
+ "Li",
+ "Lu",
+ "Mg",
+ "Mn",
+ "Mo",
+ "N",
+ "Na",
+ "Nb",
+ "Nd",
+ "Ne",
+ "Ni",
+ "Np",
+ "O",
+ "Os",
+ "P",
+ "Pa",
+ "Pb",
+ "Pd",
+ "Pm",
+ "Po",
+ "Pr",
+ "Pt",
+ "Pu",
+ "Ra",
+ "Rb",
+ "Re",
+ "Rh",
+ "Rn",
+ "Ru",
+ "S",
+ "Sb",
+ "Sc",
+ "Se",
+ "Si",
+ "Sm",
+ "Sn",
+ "Sr",
+ "Ta",
+ "Tb",
+ "Tc",
+ "Te",
+ "Th",
+ "Ti",
+ "Tl",
+ "Tm",
+ "U",
+ "V",
+ "W",
+ "Xe",
+ "Y",
+ "Yb",
+ "Zn",
+ "Zr"
+};
+
+string NistElementsDump::names[] = {
+ "Actinium",
+ "Silver",
+ "Aluminum",
+ "Americium",
+ "Argon",
+ "Arsenic",
+ "Astatine",
+ "Gold",
+ "Boron",
+ "Barium",
+ "Beryllium",
+ "Bismuth",
+ "Berkelium",
+ "Bromine",
+ "Carbon",
+ "Calcium",
+ "Cadmium",
+ "Cerium",
+ "Californium",
+ "Chlorine",
+ "Curium",
+ "Cobalt",
+ "Chromium",
+ "Cesium",
+ "Copper",
+ "Dysprosium",
+ "Erbium",
+ "Europium",
+ "Fluorine",
+ "Iron",
+ "Francium",
+ "Gallium",
+ "Gadolinium",
+ "Germanium",
+ "Hydrogen",
+ "Helium",
+ "Hafnium",
+ "Mercury",
+ "Holmium",
+ "Iodine",
+ "Indium",
+ "Iridium",
+ "Potassium",
+ "Krypton",
+ "Lanthanum",
+ "Lithium",
+ "Lutetium",
+ "Magnesium",
+ "Manganese",
+ "Molybdenum",
+ "Nitrogen",
+ "Sodium",
+ "Niobium",
+ "Neodymium",
+ "Neon",
+ "Nickel",
+ "Neptunium",
+ "Oxygen",
+ "Osmium",
+ "Phosphorus",
+ "Protactinium",
+ "Lead",
+ "Palladium",
+ "Promethium",
+ "Polonium",
+ "Praseodymium",
+ "Platinum",
+ "Plutonium",
+ "Radium",
+ "Rubidium",
+ "Rhenium",
+ "Rhodium",
+ "Radon",
+ "Ruthenium",
+ "Sulfur",
+ "Antimony",
+ "Scandium",
+ "Selenium",
+ "Silicon",
+ "Samarium",
+ "Tin",
+ "Strontium",
+ "Tantalum",
+ "Terbium",
+ "Technetium",
+ "Tellurium",
+ "Thorium",
+ "Titanium",
+ "Thallium",
+ "Thulium",
+ "Uranium",
+ "Vanadium",
+ "Tungsten",
+ "Xenon",
+ "Yttrium",
+ "Ytterbium",
+ "Zinc",
+ "Zirconium"
+};
lcdd/include
diff -N NistElementsDump.hh
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ NistElementsDump.hh 2 Mar 2011 03:37:07 -0000 1.1
@@ -0,0 +1,23 @@
+// $Id: NistElementsDump.hh,v 1.1 2011/03/02 03:37:07 jeremy Exp $
+#ifndef MATERIALPROPERTYDUMP_HH
+#define MATERIALPROPERTYDUMP_HH 1
+
+#include <iostream>
+#include <string>
+
+class NistElementsDump
+{
+ private:
+ static std::string abbrevs[];
+ static std::string names[];
+ static int nelements;
+
+ private:
+ NistElementsDump() {;}
+
+ public:
+ static void writeXml(const std::string& filename);
+ static void printXml(std::ostream& out);
+};
+
+#endif
lcdd/include
diff -u -r1.6 -r1.7
--- LCDDMessenger.hh 12 Jul 2007 18:09:00 -0000 1.6
+++ LCDDMessenger.hh 2 Mar 2011 03:37:07 -0000 1.7
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/LCDDMessenger.hh,v 1.6 2007/07/12 18:09:00 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/LCDDMessenger.hh,v 1.7 2011/03/02 03:37:07 jeremy Exp $
#ifndef LCDD_LCDDMESSENGER_HH
#define LCDD_LCDDMESSENGER_HH 1
@@ -37,6 +37,7 @@
G4UIcommand* m_setURICmd;
G4UIcommand* m_setSetupNameCmd;
G4UIcommand* m_setVersionCmd;
+ G4UIcommand* m_dumpCmd;
#ifdef HAVE_G4PVPLACEMENT_CHECKOVERLAPS
G4UIcommand* m_checkOverlapsCmd;
G4UIcommand* m_checkOverlapsRecurseCmd;
lcdd/include
diff -N NistWriter.hh
--- NistWriter.hh 24 Sep 2007 18:36:04 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,25 +0,0 @@
-#ifdef USE_G4NIST
-
-#ifndef NISTWRITER_HH
-#define NISTWRITER_HH 1
-
-#include <string>
-
-class NistWriter
-{
-
-public:
- NistWriter();
- virtual ~NistWriter();
-
-public:
- void write(const std::string& path);
-
-private:
- void defineMaterials();
- void defineElements();
-};
-
-#endif
-
-#endif
lcdd/include
diff -N NistWriterMessenger.hh
--- NistWriterMessenger.hh 24 Sep 2007 18:36:04 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,32 +0,0 @@
-#ifdef USE_G4NIST
-
-#ifndef NISTWRITERMESSENGER_HH
-#define NISTWRITERMESSENGER_HH 1
-
-#include "G4UImessenger.hh"
-#include "G4UIcmdWithAString.hh"
-
-#include <string>
-
-class NistWriter;
-
-class NistWriterMessenger : public G4UImessenger
-{
-public:
- NistWriterMessenger();
- virtual ~NistWriterMessenger();
-
-public:
- virtual void SetNewValue(G4UIcommand *cmd, G4String newVals);
-
-private:
- void defineCommands();
-
-private:
- G4UIcmdWithAString* m_dumpNistMaterialsCmd;
- static NistWriter* m_writer;
-};
-
-#endif
-
-#endif
lcdd/src
diff -N NistElementsDump.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ NistElementsDump.cc 2 Mar 2011 03:37:08 -0000 1.1
@@ -0,0 +1,141 @@
+// $Id: NistElementsDump.cc,v 1.1 2011/03/02 03:37:08 jeremy Exp $
+
+#include "NistElementsDump.hh"
+
+// G4
+#include "G4String.hh"
+#include "G4NistManager.hh"
+
+// gdml
+#include "Writer/Element.h"
+
+// lcdd
+#include "StringUtil.hh"
+
+// stl
+#include <vector>
+#include <fstream>
+
+using gdml::writer::Element;
+
+using namespace std;
+
+#include "ElementNames.icc"
+
+void NistElementsDump::writeXml(const std::string& filename)
+{
+ ofstream fstr;
+ fstr.open(filename.c_str(), fstream::out);
+ printXml(fstr);
+ fstr.close();
+}
+
+void NistElementsDump::printXml(std::ostream& out)
+{
+ // Get the NIST manager from G4.
+ G4NistManager* mgr = G4NistManager::Instance();
+
+ // Create the XML root node.
+ Element* materials = new Element("materials");
+
+ // Loop over chemical elements array.
+ for (int i=0; i<nelements; i++)
+ {
+ // Get the element abbreviation and name.
+ const std::string& elemAbbrev = abbrevs[i];
+ const std::string& elemName = names[i];
+
+ // Get element and material from G4.
+ G4Element* elem = mgr->FindOrBuildElement(elemAbbrev);
+ if (elem==0)
+ {
+ std::cout << elemAbbrev << " not found." << std::endl;
+ continue;
+ }
+ const std::string& g4mat = "G4_"+ elemAbbrev;
+ G4Material* mat = mgr->FindOrBuildMaterial(g4mat);
+ if (mat==0)
+ {
+ std::cout << g4mat << " not found." << std::endl;
+ continue;
+ }
+
+ // Create new element.
+ Element* elemNode = new Element("element");
+ elemNode->addAttribute("name", elem->GetName());
+ elemNode->addAttribute("formula", elem->GetSymbol());
+ elemNode->addAttribute("Z", StringUtil::toString(elem->GetZ()));
+
+ // Setup atom.
+ Element* atomNode = new Element("atom");
+ atomNode->addAttribute("type", "A");
+ atomNode->addAttribute("unit", "g/mol");
+ atomNode->addAttribute("value", StringUtil::toString((elem->GetA()*mole/g)));
+
+ // Append atom node to element.
+ elemNode->appendChild(*atomNode);
+
+ // Append element node to top.
+ materials->appendChild(*elemNode);
+
+ // Create material node.
+ Element* matNode = new Element("material");
+ matNode->addAttribute("name", elemName);
+ matNode->addAttribute("formula", elem->GetName());
+
+ // Set material state.
+ G4State g4state = mat->GetState();
+ std::string state;
+ if (g4state == kStateSolid)
+ {
+ state = "solid";
+ }
+ else if (g4state == kStateLiquid)
+ {
+ state = "liquid";
+ }
+ else if (g4state == kStateGas)
+ {
+ state = "gas";
+ }
+ else
+ {
+ state = "unknown";
+ }
+ matNode->addAttribute("state", state);
+
+ // Add radlen node.
+ Element* radlNode = new Element("RL");
+ radlNode->addAttribute("unit", "cm");
+ radlNode->addAttribute("type", "X0");
+ radlNode->addAttribute("value", StringUtil::toString(mat->GetRadlen()/cm));
+ matNode->appendChild(*radlNode);
+
+ // Add nuclear interaction length node.
+ Element* nilNode = new Element("NIL");
+ nilNode->addAttribute("unit", "cm");
+ nilNode->addAttribute("type", "lambda");
+ nilNode->addAttribute("value", StringUtil::toString(mat->GetNuclearInterLength()/cm));
+ matNode->appendChild((*nilNode));
+
+ // Add density node.
+ Element* densNode = new Element("D");
+ densNode->addAttribute("type", "density");
+ densNode->addAttribute("unit", "g/cm3");
+ double matDens = mat->GetDensity()/(g/cm3);
+ densNode->addAttribute("value", StringUtil::toString(matDens));
+ matNode->appendChild(*densNode);
+
+ // Add composition node.
+ Element* compNode = new Element("composite");
+ compNode->addAttribute("n", "1");
+ compNode->addAttribute("ref", elem->GetName());
+ matNode->appendChild(*compNode);
+
+ // Add material node to root.
+ materials->appendChild((*matNode));
+ }
+
+ // Write root node to output stream.
+ materials->toXml(out, true, true);
+}
lcdd/src
diff -u -r1.8 -r1.9
--- LCDDMessenger.cc 12 Jul 2007 18:09:01 -0000 1.8
+++ LCDDMessenger.cc 2 Mar 2011 03:37:08 -0000 1.9
@@ -1,9 +1,10 @@
-// $Header: /cvs/lcd/lcdd/src/LCDDMessenger.cc,v 1.8 2007/07/12 18:09:01 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/LCDDMessenger.cc,v 1.9 2011/03/02 03:37:08 jeremy Exp $
// LCDD
#include "LCDDMessenger.hh"
#include "LCDDParser.hh"
#include "GeometryManager.hh"
+#include "NistElementsDump.hh"
#include "StringUtil.hh"
// Geant4
@@ -15,144 +16,161 @@
LCDDMessenger::LCDDMessenger()
{
- // define UI commands
- defineCommands();
+ // define UI commands
+ defineCommands();
}
LCDDMessenger::~LCDDMessenger()
{
- delete m_setupCmd;
- delete m_setURICmd;
- delete m_setSetupNameCmd;
- delete m_setVersionCmd;
- delete m_lcddDir;
+ delete m_setupCmd;
+ delete m_setURICmd;
+ delete m_setSetupNameCmd;
+ delete m_setVersionCmd;
+ delete m_lcddDir;
}
void LCDDMessenger::SetNewValue(G4UIcommand *cmd, G4String newVals)
{
- LCDDParser* parser = LCDDParser::instance();
+ LCDDParser* parser=LCDDParser::instance();
- G4String singleArg = newVals;
+ G4String singleArg=newVals;
+ std::istringstream is((const char*)newVals);
- std::istringstream is ( ( const char* ) newVals );
-
- if (cmd == m_setURICmd ) {
- parser->setURI(singleArg);
- }
- else if (cmd == m_setSetupNameCmd) {
- parser->setSetupName(singleArg);
- }
- else if (cmd == m_setVersionCmd) {
- parser->setVersion(singleArg);
- }
- else if (cmd == m_setupCmd) {
- G4String uri, setup, version;
-
- is >> uri
- >> setup
- >> version;
-
- parser->setURI(uri);
- parser->setSetupName(setup);
- parser->setVersion(version);
- }
-#ifdef HAVE_G4PVPLACEMENT_CHECKOVERLAPS
- else if ( cmd == m_checkOverlapsCmd || cmd == m_checkOverlapsRecurseCmd ) {
-
- bool recurse=false;
-
- if (cmd == m_checkOverlapsRecurseCmd) {
- recurse=true;
+ if (cmd==m_setURICmd)
+ {
+ parser->setURI(singleArg);
}
+ else if (cmd==m_setSetupNameCmd)
+ {
+ parser->setSetupName(singleArg);
+ }
+ else if (cmd==m_setVersionCmd)
+ {
+ parser->setVersion(singleArg);
+ }
+ else if (cmd==m_setupCmd)
+ {
+ G4String uri, setup, version;
+
+ is >> uri >> setup >> version;
+
+ parser->setURI(uri);
+ parser->setSetupName(setup);
+ parser->setVersion(version);
+ }
+ else if (cmd==m_dumpCmd)
+ {
+ //std::cout<<"arg: "<<singleArg<<std::endl;
+ NistElementsDump::writeXml(singleArg);
+ }
+#ifdef HAVE_G4PVPLACEMENT_CHECKOVERLAPS
+ else if (cmd==m_checkOverlapsCmd || cmd==m_checkOverlapsRecurseCmd)
+ {
- G4String vol("");
- is >> vol;
-
- G4cout << "vol=" << vol << G4endl;
- G4cout << "recurse=" << recurse << G4endl;
+ bool recurse=false;
- if (newVals != "") {
- // Check the named volume with optional recursion.
- GeometryManager::instance()->checkOverlaps(vol, recurse);
- }
- else {
- // No volume. Check the world, which is always done recursively!
- GeometryManager::instance()->checkOverlaps();
+ if (cmd == m_checkOverlapsRecurseCmd)
+ {
+ recurse=true;
+ }
+
+ G4String vol("");
+ is >> vol;
+
+ G4cout << "vol=" << vol << G4endl;
+ G4cout << "recurse=" << recurse << G4endl;
+
+ if (newVals != "")
+ {
+ // Check the named volume with optional recursion.
+ GeometryManager::instance()->checkOverlaps(vol, recurse);
+ }
+ else
+ {
+ // No volume. Check the world, which is always done recursively!
+ GeometryManager::instance()->checkOverlaps();
+ }
}
- }
#endif
- else {
- G4cerr << "WARNING: Unknown cmd to LCDDMessenger - " << cmd << G4endl;
- }
+ else
+ {
+ G4cerr << "WARNING: Unknown cmd to LCDDMessenger - " << cmd << G4endl;
+ }
}
G4String LCDDMessenger::GetCurrentValue(G4UIcommand *)
{
- return G4String("");
+ return G4String("");
}
void LCDDMessenger::defineCommands()
{
- G4UIparameter *p;
-
- // LCDD directory
- m_lcddDir = new G4UIdirectory("/lcdd/");
- m_lcddDir->SetGuidance( "XML detector description and geometry commands. [LCDD]" );
-
- // set URL for input geometry file
- m_setURICmd = new G4UIcommand("/lcdd/url", this);
- m_setURICmd->SetGuidance("Set the Uniform Resource Locator (URL) for the input geometry file.");
- m_setURICmd->AvailableForStates(G4State_PreInit);
-
- p = new G4UIparameter("URI",'s',false);
- m_setURICmd->SetParameter(p);
-
- // set name of GDML setup
- m_setSetupNameCmd = new G4UIcommand("/lcdd/setupName",this);
- m_setSetupNameCmd->SetGuidance("Set GDML setup name.");
- m_setSetupNameCmd->AvailableForStates(G4State_PreInit);
-
- p = new G4UIparameter("SetupName",'s',false);
- m_setSetupNameCmd->SetParameter(p);
-
- // set version of GDML setup
- m_setVersionCmd = new G4UIcommand("/lcdd/version",this);
- m_setVersionCmd->SetGuidance("Set GDML version tag.");
- m_setVersionCmd->AvailableForStates(G4State_PreInit);
-
- p = new G4UIparameter("Version",'s',false);
- m_setVersionCmd->SetParameter(p);
-
- // setup URI, Setup and Version in one command
- m_setupCmd = new G4UIcommand("/lcdd/setup",this);
- m_setupCmd->SetGuidance( "Set URI, SetupName and Version with a single command." );
- m_setupCmd->AvailableForStates(G4State_PreInit);
-
- p = new G4UIparameter("URI",'s',false);
- p->SetGuidance("URI is a URL to the input file. It MUST NOT contain unescaped spaces.");
- m_setupCmd->SetParameter(p);
-
- p = new G4UIparameter("SetupName",'s',true);
- m_setupCmd->SetParameter(p);
+ G4UIparameter *p;
- p = new G4UIparameter("Version",'s',true);
- m_setupCmd->SetParameter(p);
+ // LCDD directory
+ m_lcddDir=new G4UIdirectory("/lcdd/");
+ m_lcddDir->SetGuidance("XML detector description and geometry commands. [LCDD]");
+
+ // set URL for input geometry file
+ m_setURICmd=new G4UIcommand("/lcdd/url", this);
+ m_setURICmd->SetGuidance("Set the Uniform Resource Locator (URL) for the input geometry file.");
+ m_setURICmd->AvailableForStates(G4State_PreInit);
+
+ p=new G4UIparameter("URI", 's', false);
+ m_setURICmd->SetParameter(p);
+
+ // set name of GDML setup
+ m_setSetupNameCmd=new G4UIcommand("/lcdd/setupName", this);
+ m_setSetupNameCmd->SetGuidance("Set GDML setup name.");
+ m_setSetupNameCmd->AvailableForStates(G4State_PreInit);
+
+ p=new G4UIparameter("SetupName", 's', false);
+ m_setSetupNameCmd->SetParameter(p);
+
+ // set version of GDML setup
+ m_setVersionCmd=new G4UIcommand("/lcdd/version", this);
+ m_setVersionCmd->SetGuidance("Set GDML version tag.");
+ m_setVersionCmd->AvailableForStates(G4State_PreInit);
+
+ p=new G4UIparameter("Version", 's', false);
+ m_setVersionCmd->SetParameter(p);
+
+ // setup URI, Setup and Version in one command
+ m_setupCmd=new G4UIcommand("/lcdd/setup", this);
+ m_setupCmd->SetGuidance("Set URI, SetupName and Version with a single command.");
+ m_setupCmd->AvailableForStates(G4State_PreInit);
+
+ p=new G4UIparameter("URI", 's', false);
+ p->SetGuidance("URI is a URL to the input file. It MUST NOT contain unescaped spaces.");
+ m_setupCmd->SetParameter(p);
+
+ p=new G4UIparameter("SetupName", 's', true);
+ m_setupCmd->SetParameter(p);
+
+ p=new G4UIparameter("Version", 's', true);
+ m_setupCmd->SetParameter(p);
+
+ m_dumpCmd=new G4UIcommand("/lcdd/dumpNistElements", this);
+ m_dumpCmd->SetGuidance("Dump NIST elements to file as GDML fragment, including lambda and X0.");
+ p=new G4UIparameter("Filename", 's', true);
+ p->SetDefaultValue("NistElements.xml");
+ m_dumpCmd->SetParameter(p);
#ifdef HAVE_G4PVPLACEMENT_CHECKOVERLAPS
- // Check overlaps.
- m_checkOverlapsCmd = new G4UIcommand("/lcdd/checkOverlaps",this);
- m_checkOverlapsCmd->SetGuidance("Call CheckOverlaps on a given volume or the world volume (no arguments).");
-
- p = new G4UIparameter("Volume",'s',true);
- p->SetDefaultValue("");
- m_checkOverlapsCmd->SetParameter(p);
-
- // Check overlaps with recursion to daughters.
- m_checkOverlapsRecurseCmd = new G4UIcommand("/lcdd/checkOverlapsRecurse",this);
- m_checkOverlapsRecurseCmd->SetGuidance("Call CheckOverlaps on a given volume and recursively check daughters.");
-
- p = new G4UIparameter("Volume",'s',true);
- p->SetDefaultValue("");
- m_checkOverlapsRecurseCmd->SetParameter(p);
+ // Check overlaps.
+ m_checkOverlapsCmd = new G4UIcommand("/lcdd/checkOverlaps",this);
+ m_checkOverlapsCmd->SetGuidance("Call CheckOverlaps on a given volume or the world volume (no arguments).");
+
+ p = new G4UIparameter("Volume",'s',true);
+ p->SetDefaultValue("");
+ m_checkOverlapsCmd->SetParameter(p);
+
+ // Check overlaps with recursion to daughters.
+ m_checkOverlapsRecurseCmd = new G4UIcommand("/lcdd/checkOverlapsRecurse",this);
+ m_checkOverlapsRecurseCmd->SetGuidance("Call CheckOverlaps on a given volume and recursively check daughters.");
+
+ p = new G4UIparameter("Volume",'s',true);
+ p->SetDefaultValue("");
+ m_checkOverlapsRecurseCmd->SetParameter(p);
#endif
}
lcdd/src
diff -N NistWriter.cc
--- NistWriter.cc 24 Sep 2007 18:36:04 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,77 +0,0 @@
-#ifdef USE_G4NIST
-
-#include "NistWriter.hh"
-
-#include "G4NistManager.hh"
-#include "G4Material.hh"
-
-#include "GDMLWriter.hh"
-
-NistWriter::NistWriter()
-{
- defineElements();
- defineMaterials();
-}
-
-NistWriter::~NistWriter()
-{}
-
-void NistWriter::defineMaterials()
-{
- G4NistManager* mgr = G4NistManager::Instance();
- const std::vector< G4String > & materialNames = mgr->GetNistMaterialNames();
- for ( std::vector< G4String >::const_iterator it = materialNames.begin();
- it != materialNames.end();
- it++ ) {
- std::cout << "dumping " << *it << std::endl;
- mgr->FindOrBuildMaterial( *it );
- }
-}
-
-void NistWriter::defineElements()
-{
- G4NistManager* mgr = G4NistManager::Instance();
- const std::vector< G4String > & elementNames = mgr->GetNistElementNames();
- for ( std::vector< G4String >::const_iterator it = elementNames.begin();
- it != elementNames.end();
- it++ ) {
- const std::string& e = *it;
-
- // Geant4 can't use any elements with Z > 101 .
- if ( e != "No" &&
- e != "Lr" &&
- e != "Rf" &&
- e != "Db" &&
- e != "Sg" &&
- e != "Bh" &&
- e != "Hs" &&
- e != "Mt" &&
- e != "Dm" &&
- e != "Rg" &&
- e != "Ub" ) {
- std::cout << "dumping " << *it << std::endl;
- mgr->FindOrBuildElement( *it );
- }
- else {
- std::cout << "skipping " << *it << " with Z > 101" << std::endl;
- }
- }
-}
-
-void NistWriter::write(const std::string& path)
-{
- std::cout << "Writing NIST elements and materials to <" << path << "> ..." << std::endl;
-
- G4NistManager* mgr = G4NistManager::Instance();
- mgr->SetVerbose(4);
-
- int nm = mgr->GetNumberOfMaterials();
- std::cout << "number of materials: " << nm << std::endl;
-
- int ne = mgr->GetNumberOfElements();
- std::cout << "number of elements: " << nm << std::endl;
-
- GDMLWriter::writeCurrentGeometry(path);
-}
-
-#endif
lcdd/src
diff -N NistWriterMessenger.cc
--- NistWriterMessenger.cc 24 Sep 2007 18:36:04 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,39 +0,0 @@
-#ifdef USE_G4NIST
-
-#include "NistWriterMessenger.hh"
-
-// lcdd
-#include "NistWriter.hh"
-
-// geant4
-#include "G4NistManager.hh"
-#include "G4NistMessenger.hh"
-
-NistWriter* NistWriterMessenger::m_writer = 0;
-
-NistWriterMessenger::NistWriterMessenger()
-{
- defineCommands();
-}
-
-NistWriterMessenger::~NistWriterMessenger()
-{}
-
-void NistWriterMessenger::SetNewValue(G4UIcommand *cmd, G4String newVals)
-{
- if ( m_writer == 0 ) {
- m_writer = new NistWriter();
- }
-
- m_writer->write(newVals);
-}
-
-void NistWriterMessenger::defineCommands()
-{
- m_dumpNistMaterialsCmd = new G4UIcmdWithAString("/lcdd/dumpNistMaterials",this);
- m_dumpNistMaterialsCmd->SetGuidance("Dump GEANT4's NIST materials database to an output file.");
- m_dumpNistMaterialsCmd->SetParameterName("materialsFile",true);
- m_dumpNistMaterialsCmd->SetDefaultValue("NistMaterials.gdml");
-}
-
-#endif
CVSspam 0.2.8