source: trunk/source/processes/hadronic/models/photolepton_hadron/muon_nuclear/test/src/PlhDetectorConstruction.cc @ 1199

Last change on this file since 1199 was 1199, checked in by garnier, 15 years ago

nvx fichiers dans CVS

File size: 4.0 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer                                           *
4// *                                                                  *
5// * The  Geant4 software  is  copyright of the Copyright Holders  of *
6// * the Geant4 Collaboration.  It is provided  under  the terms  and *
7// * conditions of the Geant4 Software License,  included in the file *
8// * LICENSE and available at  http://cern.ch/geant4/license .  These *
9// * include a list of copyright holders.                             *
10// *                                                                  *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work  make  any representation or  warranty, express or implied, *
14// * regarding  this  software system or assume any liability for its *
15// * use.  Please see the license in the file  LICENSE  and URL above *
16// * for the full disclaimer and the limitation of liability.         *
17// *                                                                  *
18// * This  code  implementation is the result of  the  scientific and *
19// * technical work of the GEANT4 collaboration.                      *
20// * By using,  copying,  modifying or  distributing the software (or *
21// * any work based  on the software)  you  agree  to acknowledge its *
22// * use  in  resulting  scientific  publications,  and indicate your *
23// * acceptance of all terms of the Geant4 Software license.          *
24// ********************************************************************
25//
26//
27// $Id: PlhDetectorConstruction.cc,v 1.2 2008/12/18 13:02:22 gunter Exp $
28// GEANT4 tag $Name: geant4-09-03-cand-01 $
29//
30
31#include "PlhDetectorConstruction.hh"
32
33#include "PlhDetectorMessenger.hh"
34
35#include "G4Material.hh"
36#include "G4MaterialTable.hh"
37#include "G4Element.hh"
38#include "G4ElementTable.hh"
39#include "G4Box.hh"
40#include "G4LogicalVolume.hh"
41#include "G4ThreeVector.hh"
42#include "G4PVPlacement.hh"
43#include "G4UImanager.hh"
44#include "G4ios.hh"
45
46PlhDetectorConstruction::PlhDetectorConstruction()
47:simpleBoxLog(NULL),selectedMaterial(NULL),Air(NULL),Al(NULL),Pb(NULL)
48{
49  detectorMessenger = new PlhDetectorMessenger(this);
50  materialChoice = "Pb";
51}
52
53PlhDetectorConstruction::~PlhDetectorConstruction()
54{
55  delete detectorMessenger;
56}
57
58void PlhDetectorConstruction::SelectMaterial(G4String val)
59{
60  materialChoice = val;
61  SelectMaterialPointer();
62  G4cout << "SimpleBox is now made of " << materialChoice << G4endl;
63}
64
65void PlhDetectorConstruction::SelectMaterialPointer()
66{
67//--------- Material definition ---------
68
69  G4double a, iz, z, density;
70  G4String name, symbol;
71  G4int nel;
72
73  if(!Air)
74  {
75    a = 14.01*g/mole;
76    G4Element* elN = new G4Element(name="Nitrogen", symbol="N", iz=7., a);
77    a = 16.00*g/mole;
78    G4Element* elO = new G4Element(name="Oxigen", symbol="O", iz=8., a);
79    density = 1.29e-03*g/cm3;
80    Air = new G4Material(name="Air", density, nel=2);
81    Air->AddElement(elN, .7);
82    Air->AddElement(elO, .3);
83  }
84
85  if(!Al)
86  {
87    a = 26.98*g/mole;
88    density = 2.7*g/cm3;
89    Al = new G4Material(name="Aluminium", z=13., a, density);
90  }
91
92  if(!Pb)
93  {
94    a = 207.19*g/mole;
95    density = 11.35*g/cm3;
96    Pb = new G4Material(name="Lead", z=82., a, density);
97  }
98
99  if(materialChoice=="Air")
100  { selectedMaterial = Air; }
101  else if(materialChoice=="Al")
102  { selectedMaterial = Al; }
103  else
104  { selectedMaterial = Pb; }
105
106  if(simpleBoxLog)
107  { simpleBoxLog->SetMaterial(selectedMaterial); }
108}
109
110G4VPhysicalVolume* PlhDetectorConstruction::Construct()
111{
112  SelectMaterialPointer();
113
114  G4Box * mySimpleBox = new G4Box("SBox",1000*cm, 1000*cm, 1000*cm);
115  simpleBoxLog = new G4LogicalVolume( mySimpleBox,
116                                      selectedMaterial,"SLog",0,0,0);
117  G4VPhysicalVolume* simpleBoxDetector = new G4PVPlacement(0,G4ThreeVector(),
118                                        "SPhys",simpleBoxLog,0,false,0);
119
120  return simpleBoxDetector;
121}
122
Note: See TracBrowser for help on using the repository browser.