G4VPhysicalVolume * GeantDetectorConstruction::Construct()
{
    // World
    G4double worldSize = 5 * ( std::abs( gOptions->GetDetZ_cm() * cm ) + std::abs( gOptions->GetPartZ_cm() * cm ) ) ;
    G4Box * worldSolid = new G4Box("WorldS", worldSize, worldSize, worldSize);
    G4LogicalVolume * worldLV = new G4LogicalVolume( worldSolid, G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic"), "World");
    G4VPhysicalVolume * worldPV = new G4PVPlacement( 0, G4ThreeVector(0,0,0), worldLV, "WorldPV", 0, false, 0, true);

    // Scatterer plane
    G4Box * scatPlaneSolid = new G4Box("scatPlaneSolid", worldSize, worldSize, gOptions->GetScatThick_um() * um / 2  );
    G4Material * scatMat =  G4NistManager::Instance()->FindOrBuildMaterial("G4_Si");
    G4cout << "Scatterer material: " << scatMat->GetName() << " Radiation length = "<< scatMat->GetRadlen() / cm << " cm"<< G4endl;
    G4LogicalVolume * scatPlaneLV = new G4LogicalVolume( scatPlaneSolid, scatMat, "scatPlaneLV");
    new G4PVPlacement( 0, G4ThreeVector(0,0,0), scatPlaneLV, "scatPlanePV", worldLV, false, 0, true);

    // Detector plane
    G4Box * detPlaneSolid = new G4Box("detPlaneSolid", worldSize, worldSize, 1 * um );
    G4LogicalVolume * detPlaneLV = new G4LogicalVolume( detPlaneSolid, G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic"), "detPlaneLV");
    new G4PVPlacement( 0, G4ThreeVector( 0, 0, ( gOptions->GetDetZ_cm() + detPlaneSolid->GetZHalfLength() ) * cm ), detPlaneLV, "DetPlanePV", worldLV, false, 0, true);
    fDetPlaneSD = new GeantTrackerSD( 0 );
    SetSensitiveDetector( detPlaneLV, fDetPlaneSD );

    return worldPV;
}
void BuildMaterialTables() 
{
#ifdef DAGGEOMETRY_DEBUG
  std::cout << "==> FluDAG BuildMaterialTables()" << std::endl;
#endif

  //some terminal printout also
  std::cout << "\t* Storing information..." << std::endl;

  //The logic is the folloing:
  //Get the Material Table and:
  // 1) For materials with density <= 1.00e-10*g/cm3 assign vacuum
  // 2) For each single element material build a material equivalent
  // 3) For the rest:
  //   3.a) Build materials for each not already known element
  //   3.b) Build the compound out of them

  // initialize with predefined materials
  initmat = InitFlukaMat();
#ifdef DAGGEOMETRY_DEBUG
  std::cout << "end init predef mat  "  << std::endl;
#endif
  //Get the Material Table and iterate
  const G4MaterialTable* matTable = DagG4Material::GetMaterialTable();
  for (MatTableIterator i = matTable->begin(); i != matTable->end(); i++) {

    //Get some basic material information
    G4Material* material = (*i);
    DString matName = material->GetName();
    const G4double matDensity = material->GetDensity();
    const int nMatElements  = material->GetNumberOfElements();
#ifdef DAGGEOMETRY_DEBUG
    std::cout << " treating material " << matName    << std::endl;
#endif

    std::cout << " mat " << matName 
	   << ": dens. = " << matDensity/(g/cm3) << "g/cm3"
	   << ", nElem = " << nMatElements << std::endl;

    // 1) For materials with density <= 1.00e-10*g/cm3 assign vacuum
    //    FlukaMaterial* is  in that case
    if (matDensity <= 1.00e-10*g/cm3) {
#ifdef DAGGEOMETRY_DEBUG
    std::cout << " vacuum?  "<< matDensity    << std::endl;
#endif
      DString elemName("VACUUM");
      FlukaMaterial *flukamat = FlukaMaterial::GetFlukaMaterial(elemName);
      G4FlukaMaterialMap[material] = flukamat;
      std::cout << "\t\t  Stored as " << flukamat->GetRealName() << std::endl;
    }
    // 2) For each single element material build a material equivalent
    else if (nMatElements == 1) {
#ifdef DAGGEOMETRY_DEBUG
    std::cout << " single element "     << std::endl;
#endif
      
      FlukaMaterial *flukamat = 
	BuildFlukaMaterialFromElement(material->GetElement(0),
				      matDensity);
      
      G4FlukaMaterialMap[material] = flukamat;
      std::cout << "  Stored as " << flukamat->GetRealName() << std::endl;
      
    } //else if (material->GetNumberOfElements() == 1)
    
    // 3) For the rest:
    //   3.a) Build materials for each not already known element
    //   3.b) Build the compound out of them
    else {
#ifdef DAGGEOMETRY_DEBUG
      std::cout << " not  vacuum : call Comp. "<< matDensity/(g/cm3)   << std::endl;
#endif
      FlukaCompound* flukacomp = 
	BuildFlukaCompoundFromMaterial(material);
      G4FlukaCompoundMap[material] = flukacomp;
      std::cout << "\t\t  Stored as " << flukacomp->GetRealName() << std::endl;
    } //else for case 3)
  } //for (materials)
  
#ifdef DAGGEOMETRY_DEBUG
  std::cout << "<== Flugg FGeometryInit::BuildMaterialTables()" << std::endl;
#endif
}
Exemple #3
0
unsigned int GSMS::Geometry::defineMaterials()
{

	G4double	density,// density
			a,	// atomic mass
			z;	// atomic number
	G4double	G4d_density;
//	G4double	G4d_temp;
//	G4double	G4d_press;
	G4int	 	nelements;
	G4String	G4s_name;
	G4String	G4s_symbol;
	G4int		G4i_ncomp;

  G4Element* H = new G4Element("Hydrogen", "H", z=1., a=1.0079*g/mole);
  G4Element* C = new G4Element("Carbon", "C", z=6., a=12.011*g/mole);
  G4Element* N = new G4Element("Nitrogen", "N", 7., 14.00674*g/mole);
  G4Element* O = new G4Element("Oxygen", "O", 8., 16.00000*g/mole);
  G4Element* Na = new G4Element("Natrium", "Na", z=11., a=22.98977*g/mole);
  G4Element* Mg = new G4Element("Magnezium", "Mg", z=12., a=24.305*g/mole);
  G4Element* Al = new G4Element("Aluminium", "Al", z=13., a=26.981*g/mole);
  G4Element* Si = new G4Element("Silicium", "Si", z=14., a=28.086*g/mole);
  G4Element* P = new G4Element("Phosphorus", "P", z=15., a=30.973976*g/mole);
  G4Element* S = new G4Element("Sulfur", "S", z=16., a=32.06*g/mole);
  G4Element* Cl = new G4Element("Chlorine","Cl", z=17., a=35.453*g/mole);
  G4Element* K = new G4Element("Kalium", "K", z=19., a=39.098*g/mole);
  G4Element* Ca = new G4Element("Calcium", "Ca", z=20., a=40.08*g/mole);
  G4Element* Ti = new G4Element("Titanium", "Ti", z=22., a=47.9*g/mole);
  G4Element* Cr = new G4Element("Chrome", "Cr", z=24., a=51.996*g/mole);
  G4Element* Mn = new G4Element("Manganeze", "Mn", z=25., a=54.938*g/mole);
  G4Element* Fe = new G4Element("Ferrum", "Fe", z=26., a=55.847*g/mole);
  G4Element* Ni = new G4Element("Nickel", "Ni", z=28., a=58.7*g/mole);
  G4Element* Cu = new G4Element("Cuprum", "Cu", z=29., a=63.546*g/mole);
  G4Element* Zn = new G4Element("Zyncum", "Zn", z=30., a=65.38*g/mole);
  G4Element* Ge = new G4Element("Germanium", "Ge", z=32., a=72.59*g/mole);
  G4Element* Ag = new G4Element("Argentum", "Ag", z=47., a=107.8682*g/mole);  
  G4Element* I = new G4Element("Iodine", "I", z=53., a=126.904*g/mole);
  G4Element* Cs = new G4Element("Cesium", "Cs", z=55., a=132.905*g/mole);
  G4Element* Ba = new G4Element("Barium", "Ba", z=56., a=133.*g/mole);
  G4Element* W = new G4Element("Wolfram", "W", z=74., a=183.85*g/mole);
  G4Element* Pt = new G4Element("Platinum", "Pt", z=78., a=195.08*g/mole);  
  G4Element* Au = new G4Element("Aurum", "Au", z=79., a=196.9665*g/mole);  
  G4Element* Pb = new G4Element("Plumbum", "Pb", z=82., a=207.2*g/mole);
  G4Element* Bi = new G4Element("Bismuth", "Bi", z=83., a=208.9804*g/mole);

	G4Material*	mptr;
	std::string	name;

	try
	{
//vacuum
		name = "Vacuum";
		mptr = new G4Material(
				name.c_str(),	//name
				1,		//components
				1.00794*g/mole,	//1st component a/weight
				1.0E-25*g/cm3,	//density
				kStateGas,	//state
				0.1*kelvin,	//temp
				1.0E-19*pascal);//pressure
		m_materials.insert(std::pair<std::string,G4Material*>(name,mptr));
//air
		name = "Air";
		mptr = new G4Material(
				name,
				1.2929*kg/m3,
				2, 
				kStateGas,
				300.00*kelvin,
				1.0*atmosphere);
		mptr->AddElement(N,	0.8);
		mptr->AddElement(O,	0.2);
		m_materials.insert(std::pair<std::string,G4Material*>(name,mptr));
//aluminium
		name = "Aluminium";
		mptr = new G4Material(
				name,
				2.8*g/cm3,
				1);
		mptr->AddElement(Al,	1);
		m_materials.insert(std::pair<std::string,G4Material*>(name,mptr));
//lead
		name = "Lead";
		mptr = new G4Material(
				name,
				11.336*g/cm3,
				1);
		mptr->AddElement(Pb,	1);
		m_materials.insert(std::pair<std::string,G4Material*>(name,mptr));
//MgO
		name = "MgO";
		mptr = new G4Material(
			name, 
			0.7 * 2.506*g/cm3,
			2);
		mptr->AddElement(O,	1);
		mptr->AddElement(Mg,	1);
		m_materials.insert(std::pair<std::string,G4Material*>(name,mptr));
//glass
		name = "Glass";
		mptr = new G4Material(
			name, 
			2.6*g/cm3,
			7);
		mptr->AddElement(O,	59.8*perCent);
		mptr->AddElement(Si,	24.7*perCent);
		mptr->AddElement(Al,	1.4*perCent);
		mptr->AddElement(Mg,	1.4*perCent);
		mptr->AddElement(Ca,	2.3*perCent);
		mptr->AddElement(Na,	10.3*perCent);
		mptr->AddElement(Fe,	0.1*perCent);
		m_materials.insert(std::pair<std::string,G4Material*>(name,mptr));
//soil
		name = "Soil";
		mptr = new G4Material(
			name, 
			1.6*g/cm3,//1.3..2.0
			11);
		mptr->AddElement(O,	46.0*perCent);//46.7
		mptr->AddElement(Si,	27.0*perCent);
		mptr->AddElement(Al,	8.0*perCent);//8.0
		mptr->AddElement(Fe,	5.0*perCent);

		mptr->AddElement(Ca,	2.0*perCent);
		mptr->AddElement(Mg,	2.0*perCent);
		mptr->AddElement(K,	2.0*perCent);
		mptr->AddElement(Na,	2.0*perCent);
		mptr->AddElement(P,	2.0*perCent);
		mptr->AddElement(S,	2.0*perCent);
		mptr->AddElement(N,	2.0*perCent);
		m_materials.insert(std::pair<std::string,G4Material*>(name,mptr));
//steel
		name = "Steel";
		mptr = new G4Material(
			name, 
			7.81*g/cm3,
			7);
		mptr->AddElement(C,	0.0010);
		mptr->AddElement(Si,	0.0100);
		mptr->AddElement(Mn,	0.0065);
		mptr->AddElement(Cr,	0.0075);
		mptr->AddElement(Ni,	0.0065);
		mptr->AddElement(Cu,	0.0050);
		mptr->AddElement(Fe,	0.9635);
		m_materials.insert(std::pair<std::string,G4Material*>(name,mptr));

//stainless steel
		name = "H18N10";
		mptr = new G4Material(
			name, 
			7.81*g/cm3,
			7);
		mptr->AddElement(C,	0.001);
		mptr->AddElement(Si,	0.010);
		mptr->AddElement(Mn,	0.014);
		mptr->AddElement(Cr,	0.170);
		mptr->AddElement(Ni,	0.100);
		mptr->AddElement(Cu,	0.005);
		mptr->AddElement(Fe,	0.700);
		m_materials.insert(std::pair<std::string,G4Material*>(name,mptr));

//D16
		name = "D16";
		mptr = new G4Material(
			name, 
			2.8*g/cm3,
			9);
		mptr->AddElement(Al,	92.5*perCent);
		mptr->AddElement(Cu,	4.0*perCent);
		mptr->AddElement(Mg,	1.5*perCent);
		mptr->AddElement(Fe,	0.5*perCent);
		mptr->AddElement(Si,	0.5*perCent);
		mptr->AddElement(Mn,	0.5*perCent);
		mptr->AddElement(Zn,	0.3*perCent);
		mptr->AddElement(Ni,	0.1*perCent);
		mptr->AddElement(Ti,	0.1*perCent);
		m_materials.insert(std::pair<std::string,G4Material*>(name,mptr));
//plastic
		name = "Plastic";
		mptr = new G4Material(
			name,
			1.19*g/cm3,
			3);
		mptr->AddElement(H, 	0.08);
		mptr->AddElement(C, 	0.60);
		mptr->AddElement(O, 	0.32);
		m_materials.insert(std::pair<std::string,G4Material*>(name,mptr));
//GRP
		name = "GRP";
		mptr = new G4Material(
			name,
			1.7*g/cm3,
			4);
		mptr->AddElement(H, 	6);
		mptr->AddElement(C, 	45);
		mptr->AddElement(O, 	49);
		mptr->AddElement(Si, 	5);
		m_materials.insert(std::pair<std::string,G4Material*>(name,mptr));

//lavsan
		name = "Lavsan";
		mptr = new G4Material(
			name,
			1.38*g/cm3,
			3);
		mptr->AddElement(H, 	8);
		mptr->AddElement(C, 	10);
		mptr->AddElement(O, 	4);
		m_materials.insert(std::pair<std::string,G4Material*>(name,mptr));

		const int NUMENTRIES = 3;
		G4double PP[NUMENTRIES] =	{1.0*eV,	5.0*eV,	10.0*eV};

//CsI
		name = "CsI";
		mptr = new G4Material(
			name,
			4.51*g/cm3,
			2,
			kStateUndefined,
			273*kelvin);
		mptr->AddElement(Cs,	1);
		mptr->AddElement(I,	1);
		G4MaterialPropertiesTable*	Scn_Mt = new G4MaterialPropertiesTable();
		G4double CsI_RIND[NUMENTRIES] =	{1.79,		1.79,	1.79};
		G4double CsI_ABSL[NUMENTRIES] =	{71.*cm,	71*cm,	71.*cm};
		Scn_Mt->AddProperty("RINDEX",	PP, CsI_RIND, NUMENTRIES);
		Scn_Mt->AddProperty("ABSLENGTH",PP, CsI_ABSL, NUMENTRIES);
		Scn_Mt->AddConstProperty("SCINTILLATIONYIELD",	54000./MeV);
		Scn_Mt->AddConstProperty("RESOLUTIONSCALE",	0.0759);
		Scn_Mt->AddConstProperty("YIELDRATIO",		1.);
		Scn_Mt->AddConstProperty("EXCITATIONRATIO",	1.);
		mptr->SetMaterialPropertiesTable(Scn_Mt);
		m_materials.insert(std::pair<std::string,G4Material*>(name,mptr));
//NaI
		name = "NaI";
		mptr = new G4Material(
			name.c_str(),
			3.67*g/cm3,
			2,
			kStateUndefined,
			273*kelvin);
		mptr->AddElement(Na,	1);
		mptr->AddElement(I,	1);
		Scn_Mt = new G4MaterialPropertiesTable();
		G4double NaI_RIND[NUMENTRIES] =	{2.15,		2.15,	2.15};
		G4double NaI_ABSL[NUMENTRIES] =	{71.*cm,	71*cm,	71.*cm};
		Scn_Mt->AddProperty("RINDEX",	PP, NaI_RIND, NUMENTRIES);
		Scn_Mt->AddProperty("ABSLENGTH",PP, NaI_ABSL, NUMENTRIES);
		Scn_Mt->AddConstProperty("SCINTILLATIONYIELD",	38000./MeV);
		Scn_Mt->AddConstProperty("RESOLUTIONSCALE",	0.085);
		Scn_Mt->AddConstProperty("YIELDRATIO",		1.);
		Scn_Mt->AddConstProperty("EXCITATIONRATIO",	1.);
		mptr->SetMaterialPropertiesTable(Scn_Mt);
		m_materials.insert(std::pair<std::string,G4Material*>(name,mptr));
//BGO
		name = "BGO";
		mptr = new G4Material(
			name.c_str(),
			7.13*g/cm3,
			3,
			kStateUndefined,
			273*kelvin);
		mptr->AddElement(Bi,	4);
		mptr->AddElement(Ge,	3);
		mptr->AddElement(O,	12);
		Scn_Mt = new G4MaterialPropertiesTable();
		G4double BGO_RIND[NUMENTRIES] =	{2.15,		2.15,	2.15};
		G4double BGO_ABSL[NUMENTRIES] =	{71.*cm,	71*cm,	71.*cm};
		Scn_Mt->AddProperty("RINDEX",	PP, BGO_RIND, NUMENTRIES);
		Scn_Mt->AddProperty("ABSLENGTH",PP, BGO_ABSL, NUMENTRIES);
		Scn_Mt->AddConstProperty("SCINTILLATIONYIELD",	9000./MeV);
		Scn_Mt->AddConstProperty("RESOLUTIONSCALE",	0.11);
		Scn_Mt->AddConstProperty("YIELDRATIO",		1.);
		Scn_Mt->AddConstProperty("EXCITATIONRATIO",	1.);
		mptr->SetMaterialPropertiesTable(Scn_Mt);
		m_materials.insert(std::pair<std::string,G4Material*>(name,mptr));
//stylben
/*
		name = "Stylben";
		mptr = new G4Material(
			name.c_str(),
			1.16*g/cm3,
			2);
		mptr->AddElement(H,	12);
		mptr->AddElement(C,	14);
		Scn_Mt = new G4MaterialPropertiesTable();
		Scn_Mt->AddProperty("RINDEX",	Scn_PP, Scn_RIND, NUMENTRIES);
		Scn_Mt->AddProperty("ABSLENGTH",Scn_PP, Scn_ABSL, NUMENTRIES);
		Scn_Mt->AddConstProperty("SCINTILLATIONYIELD",	54000./MeV);
		Scn_Mt->AddConstProperty("RESOLUTIONSCALE",	0.0759);
		Scn_Mt->AddConstProperty("YIELDRATIO",		1.);
		Scn_Mt->AddConstProperty("EXCITATIONRATIO",	1.);
		mptr->SetMaterialPropertiesTable(Scn_Mt);
		m_materials.insert(std::pair<std::string,G4Material*>(name,mptr));
*/

	}
	catch(...)
	{
		return GSMS_ERR;
	}

	return GSMS_OK;
}