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 | // File name: RadmonDetectorFlatVolumeComponent.cc |
---|
28 | // Creation date: Sep 2005 |
---|
29 | // Main author: Riccardo Capra <capra@ge.infn.it> |
---|
30 | // |
---|
31 | // Id: $Id: RadmonDetectorFlatVolumeComponent.cc,v 1.2.2.2 2006/06/29 16:13:32 gunter Exp $ |
---|
32 | // Tag: $Name: geant4-09-01-patch-02 $ |
---|
33 | // |
---|
34 | |
---|
35 | // Include files |
---|
36 | #include "RadmonDetectorFlatVolumeComponent.hh" |
---|
37 | #include "RadmonDetectorLayerVolumesList.hh" |
---|
38 | #include "RadmonDetectorLayerVolumeItem.hh" |
---|
39 | #include "RadmonVDetectorLabelledEntityConstructor.hh" |
---|
40 | #include "G4Box.hh" |
---|
41 | #include "G4LogicalVolume.hh" |
---|
42 | #include "G4VisAttributes.hh" |
---|
43 | #include "globals.hh" |
---|
44 | |
---|
45 | RadmonDetectorFlatVolumeComponent :: ~RadmonDetectorFlatVolumeComponent() |
---|
46 | { |
---|
47 | delete visAttributes; |
---|
48 | delete box; |
---|
49 | } |
---|
50 | |
---|
51 | |
---|
52 | |
---|
53 | RadmonDetectorLayerVolumesList * RadmonDetectorFlatVolumeComponent :: GenerateVolumesList(void) |
---|
54 | { |
---|
55 | G4double width(owner->GetWidth()); |
---|
56 | if (width<0) |
---|
57 | return 0; |
---|
58 | |
---|
59 | G4double height(owner->GetHeight()); |
---|
60 | if (height<0) |
---|
61 | return 0; |
---|
62 | |
---|
63 | G4double thickness(owner->GetThickness()); |
---|
64 | if (thickness<0) |
---|
65 | return 0; |
---|
66 | |
---|
67 | G4Material * material(owner->GetMaterial("Material")); |
---|
68 | if (!material) |
---|
69 | return 0; |
---|
70 | |
---|
71 | visAttributes=owner->AllocateVisAttributes("VisAttributes", material); |
---|
72 | box=new G4Box("FlatVolume", width/2., height/2., thickness/2.); |
---|
73 | |
---|
74 | RadmonDetectorLayerVolumesList * list=new RadmonDetectorLayerVolumesList; |
---|
75 | RadmonDetectorLayerVolumeItem * item=list->AppendItem(); |
---|
76 | |
---|
77 | item->SetSolid(box); |
---|
78 | item->SetAttributes(visAttributes); |
---|
79 | item->SetMaterial(material); |
---|
80 | item->SetSensitiveDetector(owner->AllocateSensitiveDetector("SensitiveDetector", "")); |
---|
81 | item->SetName("FlatVolume"); |
---|
82 | |
---|
83 | return list; |
---|
84 | } |
---|