source: trunk/examples/advanced/radioprotection/src/RemSimShieldingDecorator.cc @ 1292

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

update to geant4.9.3

File size: 4.6 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: RemSimShieldingDecorator.cc,v 1.6 2006/06/29 16:24:23 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 "RemSimShieldingDecorator.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
48RemSimShieldingDecorator::RemSimShieldingDecorator(RemSimVGeometryComponent* comp)
49  : RemSimDecorator(comp)
50{
51 shieldingX = 5.*m;
52 shieldingY = 5.*m;
53 shieldingZ = 10.*cm; 
54 translation = -4.4* m;
55 pMaterial = new RemSimMaterial();
56
57 shieldingVisAtt = 0;
58}
59RemSimShieldingDecorator::~RemSimShieldingDecorator()
60{
61  delete pMaterial;
62}
63void RemSimShieldingDecorator::ConstructComponent(G4VPhysicalVolume* motherVolume)
64{
65  pMaterial -> DefineMaterials();
66  RemSimDecorator::ConstructComponent(motherVolume);
67  ConstructShielding(motherVolume);
68}
69
70void RemSimShieldingDecorator::DestroyComponent()
71{
72 delete shieldingVisAtt;
73 shieldingVisAtt = 0;
74 
75 delete shieldingPhys; 
76 shieldingPhys = 0;
77
78 delete shieldingLog;
79 shieldingLog = 0;
80
81 delete shielding;
82 shielding = 0;
83}
84void RemSimShieldingDecorator::ConstructShielding(G4VPhysicalVolume* motherVolume)
85{
86  // Geometry definition
87  pMaterial -> DefineMaterials();
88
89  G4Material* water = pMaterial -> GetMaterial("Water");
90 
91  shielding = new G4Box("shielding",shieldingX/2.,shieldingY/2.,shieldingZ/2.);
92
93  shieldingLog = new G4LogicalVolume(shielding, water,
94                                     "shieldingLog",0,0,0);
95 
96  shieldingPhys = new G4PVPlacement(0,
97             G4ThreeVector(0.,0.,translation + shieldingZ/2.),
98            "shieldingPhys", shieldingLog, motherVolume,false,0); 
99
100  //Visualisation attributes
101  G4Colour  red      (1.0,0.0,0.0);
102  shieldingVisAtt = new G4VisAttributes(red);
103  shieldingVisAtt -> SetVisibility(true);
104  shieldingVisAtt -> SetForceSolid(true);
105  shieldingLog -> SetVisAttributes(shieldingVisAtt); 
106  PrintDetectorParameters();
107}
108
109void RemSimShieldingDecorator::ChangeThickness(G4double thick)
110{
111  PrintDetectorParameters();
112  shielding -> SetZHalfLength(thick/2.);
113  shieldingPhys -> SetTranslation(G4ThreeVector
114                            (0.,0.,translation + thick/2.));
115}
116
117void RemSimShieldingDecorator::PrintDetectorParameters()
118{
119  G4cout << "-----------------------------------------------------------------------"
120         << G4endl
121         << "the shielding is a box whose thickness is: " << G4endl
122         << ((shielding -> GetZHalfLength())*2.)/cm
123         << " cm along the Z axis"
124         << G4endl
125         << "material of the shielding: "
126         << shieldingLog -> GetMaterial() -> GetName() <<G4endl
127         << G4endl;
128}
Note: See TracBrowser for help on using the repository browser.