[807] | 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 | // * * |
---|
| 28 | // * RemSimRoofDecorator.cc * |
---|
| 29 | // * * |
---|
| 30 | // ************************************ |
---|
| 31 | // |
---|
| 32 | // Code developed by: S.Guatelli, guatelli@ge.infn.it |
---|
| 33 | // |
---|
| 34 | // |
---|
| 35 | // $Id: RemSimRoofDecorator.cc,v 1.7 2006/06/29 16:24:15 gunter Exp $ |
---|
| 36 | // GEANT4 tag $Name: $ |
---|
| 37 | // |
---|
| 38 | #include "RemSimVGeometryComponent.hh" |
---|
| 39 | #include "RemSimMaterial.hh" |
---|
| 40 | #include "G4Material.hh" |
---|
| 41 | #include "G4MaterialTable.hh" |
---|
| 42 | #include "RemSimRoofDecorator.hh" |
---|
| 43 | #include "RemSimDecorator.hh" |
---|
| 44 | #include "G4Trd.hh" |
---|
| 45 | #include "G4LogicalVolume.hh" |
---|
| 46 | #include "G4VPhysicalVolume.hh" |
---|
| 47 | #include "G4PVPlacement.hh" |
---|
| 48 | #include "G4VisAttributes.hh" |
---|
| 49 | #include "RemSimSensitiveDetector.hh" |
---|
| 50 | #include "RemSimROGeometry.hh" |
---|
| 51 | #include "G4SDManager.hh" |
---|
| 52 | #include "G4RunManager.hh" |
---|
| 53 | #include "G4VisAttributes.hh" |
---|
| 54 | |
---|
| 55 | RemSimRoofDecorator::RemSimRoofDecorator(RemSimVGeometryComponent* comp) |
---|
| 56 | : RemSimDecorator(comp) |
---|
| 57 | { |
---|
| 58 | pMaterial = new RemSimMaterial(); |
---|
| 59 | roofVisAtt = 0; |
---|
| 60 | roof = 0; |
---|
| 61 | roofLog = 0; |
---|
| 62 | roofPhys = 0; |
---|
| 63 | } |
---|
| 64 | RemSimRoofDecorator::~RemSimRoofDecorator() |
---|
| 65 | { |
---|
| 66 | delete pMaterial; |
---|
| 67 | } |
---|
| 68 | void RemSimRoofDecorator::ConstructComponent(G4VPhysicalVolume* motherVolume) |
---|
| 69 | { |
---|
| 70 | pMaterial -> DefineMaterials(); |
---|
| 71 | RemSimDecorator::ConstructComponent(motherVolume); |
---|
| 72 | ConstructRoof(motherVolume); |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | void RemSimRoofDecorator::DestroyComponent() |
---|
| 76 | { |
---|
| 77 | delete roofVisAtt; |
---|
| 78 | roofVisAtt = 0; |
---|
| 79 | |
---|
| 80 | delete roofPhys; |
---|
| 81 | roofPhys = 0; |
---|
| 82 | |
---|
| 83 | delete roofLog; |
---|
| 84 | roofLog = 0; |
---|
| 85 | |
---|
| 86 | delete roof; |
---|
| 87 | roof = 0; |
---|
| 88 | } |
---|
| 89 | void RemSimRoofDecorator::ConstructRoof(G4VPhysicalVolume* motherVolume) |
---|
| 90 | { |
---|
| 91 | // Geometry definition |
---|
| 92 | pMaterial -> DefineMaterials(); |
---|
| 93 | |
---|
| 94 | G4Material* moonMaterial = pMaterial -> GetMaterial("moon"); |
---|
| 95 | |
---|
| 96 | |
---|
| 97 | roof = new G4Trd("roof",2.25*m,7.*m,5.*m, 8.*m, 0.5 *m); |
---|
| 98 | |
---|
| 99 | roofLog = new G4LogicalVolume(roof, |
---|
| 100 | moonMaterial, |
---|
| 101 | "roof", |
---|
| 102 | 0,0,0); |
---|
| 103 | |
---|
| 104 | roofPhys = new G4PVPlacement(0, |
---|
| 105 | G4ThreeVector(0.,0., - 0.5 *m), |
---|
| 106 | "roof",roofLog, |
---|
| 107 | motherVolume,false,0); |
---|
| 108 | |
---|
| 109 | //Visualisation attributes |
---|
| 110 | G4Colour red (1.0,0.0,0.0); |
---|
| 111 | roofVisAtt = new G4VisAttributes(red); |
---|
| 112 | roofVisAtt -> SetVisibility(true); |
---|
| 113 | roofVisAtt -> SetForceSolid(true); |
---|
| 114 | roofLog -> SetVisAttributes(roofVisAtt); |
---|
| 115 | PrintDetectorParameters(); |
---|
| 116 | } |
---|
| 117 | |
---|
| 118 | void RemSimRoofDecorator::ChangeThickness(G4double thick) |
---|
| 119 | { |
---|
| 120 | PrintDetectorParameters(); |
---|
| 121 | roof -> SetZHalfLength(thick/2.); |
---|
| 122 | roofPhys -> SetTranslation(G4ThreeVector |
---|
| 123 | (0.,0., - thick/2.)); |
---|
| 124 | } |
---|
| 125 | |
---|
| 126 | void RemSimRoofDecorator::PrintDetectorParameters() |
---|
| 127 | { |
---|
| 128 | ; |
---|
| 129 | } |
---|