source: trunk/examples/advanced/radioprotection/src/RemSimShelterSPEDecorator.cc @ 1321

Last change on this file since 1321 was 1230, checked in by garnier, 14 years ago

update to geant4.9.3

File size: 4.4 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// $Id: RemSimShelterSPEDecorator.cc,v 1.3 2006/06/29 16:24:21 gunter Exp $
27// GEANT4 tag $Name: geant4-09-03-cand-01 $
28//
29// Code developed by: S.Guatelli, guatelli@ge.infn.it
30//
31#include "RemSimVGeometryComponent.hh"
32#include "RemSimMaterial.hh"
33#include "G4Material.hh"
34#include "G4MaterialTable.hh"
35#include "RemSimShelterSPEDecorator.hh"
36#include "RemSimDecorator.hh"
37#include "G4Box.hh"
38#include "G4LogicalVolume.hh"
39#include "G4VPhysicalVolume.hh"
40#include "G4PVPlacement.hh"
41#include "G4VisAttributes.hh"
42#include "RemSimSensitiveDetector.hh"
43#include "RemSimROGeometry.hh"
44#include "G4SDManager.hh"
45#include "G4RunManager.hh"
46#include "G4VisAttributes.hh"
47
48RemSimShelterSPEDecorator::RemSimShelterSPEDecorator(RemSimVGeometryComponent* comp)
49  : RemSimDecorator(comp)
50{
51 shelterSPEX = 5.*m;
52 shelterSPEY = 5.*m;
53 shelterSPEZ = 75.*cm; 
54 translation = - 2.* m;
55 pMaterial = new RemSimMaterial();
56
57 shelterSPEVisAtt = 0;
58}
59RemSimShelterSPEDecorator::~RemSimShelterSPEDecorator()
60{
61  delete pMaterial;
62}
63void RemSimShelterSPEDecorator::ConstructComponent(G4VPhysicalVolume* motherVolume)
64{
65  pMaterial -> DefineMaterials();
66  RemSimDecorator::ConstructComponent(motherVolume);
67  ConstructShelterSPE(motherVolume);
68}
69
70void RemSimShelterSPEDecorator::DestroyComponent()
71{
72 delete shelterSPEVisAtt;
73 shelterSPEVisAtt = 0;
74 
75 delete shelterSPEPhys; 
76 shelterSPEPhys = 0;
77
78 delete shelterSPELog;
79 shelterSPELog = 0;
80
81 delete shelterSPE;
82 shelterSPE = 0;
83}
84void RemSimShelterSPEDecorator::ConstructShelterSPE(G4VPhysicalVolume* motherVolume)
85{
86  // Geometry definition
87  pMaterial -> DefineMaterials();
88
89  G4Material* water = pMaterial -> GetMaterial("Water");
90 
91  shelterSPE = new G4Box("shelterSPE",shelterSPEX/2.,shelterSPEY/2.,shelterSPEZ/2.);
92
93  shelterSPELog = new G4LogicalVolume(shelterSPE, water,
94                                     "shelterSPELog",0,0,0);
95 
96  shelterSPEPhys = new G4PVPlacement(0,
97             G4ThreeVector(0.,0.,translation + shelterSPEZ/2.),
98            "shelterSPEPhys", shelterSPELog, motherVolume,false,0); 
99
100  //Visualisation attributes
101  G4Colour  red      (1.0,0.0,0.0);
102  shelterSPEVisAtt = new G4VisAttributes(red);
103  shelterSPEVisAtt -> SetVisibility(true);
104  shelterSPEVisAtt -> SetForceSolid(true);
105  shelterSPELog -> SetVisAttributes(shelterSPEVisAtt); 
106  PrintDetectorParameters();
107}
108
109void RemSimShelterSPEDecorator::ChangeThickness(G4double)
110{
111  ;
112}
113
114void RemSimShelterSPEDecorator::PrintDetectorParameters()
115{
116  G4cout << "-----------------------------------------------------------------------"
117         << G4endl
118         << "the shelterSPE is a box whose thickness is: " << G4endl
119         << ((shelterSPE -> GetZHalfLength())*2.)/cm
120         << " cm along the Z axis"
121         << G4endl
122         << "material of the shelterSPE: "
123         << shelterSPELog -> GetMaterial() -> GetName() <<G4endl
124         << G4endl;
125}
Note: See TracBrowser for help on using the repository browser.