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: RadmonVDetectorLayerVolumeItemOperation.hh |
---|
28 | // Creation date: Sep 2005 |
---|
29 | // Main author: Riccardo Capra <capra@ge.infn.it> |
---|
30 | // |
---|
31 | // Id: $Id: RadmonVDetectorLayerVolumeItemOperation.hh,v 1.3 2006/06/29 16:13:20 gunter Exp $ |
---|
32 | // Tag: $Name: $ |
---|
33 | // |
---|
34 | // Description: Operates on solids |
---|
35 | // |
---|
36 | |
---|
37 | #ifndef RADMONVDETECTORLAYERVOLUMEITEMOPERATION_HH |
---|
38 | #define RADMONVDETECTORLAYERVOLUMEITEMOPERATION_HH |
---|
39 | |
---|
40 | // Include files |
---|
41 | #include "G4RotationMatrix.hh" |
---|
42 | #include "G4ThreeVector.hh" |
---|
43 | #include <stack> |
---|
44 | |
---|
45 | // Forward declarations |
---|
46 | class RadmonDetectorLayerVolumeItem; |
---|
47 | class G4VSolid; |
---|
48 | |
---|
49 | class RadmonVDetectorLayerVolumeItemOperation |
---|
50 | { |
---|
51 | public: |
---|
52 | void Initialize(G4VSolid * solid, const G4RotationMatrix & rotation, const G4ThreeVector & position, G4bool ownSolid=true); |
---|
53 | void Initialize(G4VSolid * solid, const G4ThreeVector & position, G4bool ownSolid=true); |
---|
54 | void Initialize(G4VSolid * solid, G4bool ownSolid=true); |
---|
55 | void Initialize(const RadmonDetectorLayerVolumeItem * item); |
---|
56 | |
---|
57 | G4VSolid * ApplyTo(G4VSolid * solid, const G4RotationMatrix & rotation, const G4ThreeVector & position, G4bool ownSolid=true, G4bool ownResult=true); |
---|
58 | inline G4VSolid * ApplyTo(G4VSolid * solid, const G4ThreeVector & position, G4bool ownSolid=true, G4bool ownResult=true); |
---|
59 | inline G4VSolid * ApplyTo(G4VSolid * solid, G4bool ownSolid=true, G4bool ownResult=true); |
---|
60 | void ApplyTo(RadmonDetectorLayerVolumeItem * item, G4bool ownResult=true); |
---|
61 | |
---|
62 | protected: |
---|
63 | inline RadmonVDetectorLayerVolumeItemOperation(); |
---|
64 | RadmonVDetectorLayerVolumeItemOperation(G4VSolid * solid, const G4RotationMatrix & rotation, const G4ThreeVector & position, G4bool ownSolid=true); |
---|
65 | RadmonVDetectorLayerVolumeItemOperation(G4VSolid * solid, const G4ThreeVector & position, G4bool ownSolid=true); |
---|
66 | RadmonVDetectorLayerVolumeItemOperation(G4VSolid * solid, G4bool ownSolid=true); |
---|
67 | RadmonVDetectorLayerVolumeItemOperation(const RadmonDetectorLayerVolumeItem * item); |
---|
68 | |
---|
69 | ~RadmonVDetectorLayerVolumeItemOperation(); |
---|
70 | virtual G4VSolid * Operate(G4VSolid * left, G4VSolid * right, G4RotationMatrix * relativeRotation, const G4ThreeVector & relativePosition) = 0; |
---|
71 | |
---|
72 | inline G4RotationMatrix * AllocateMatrix(); |
---|
73 | inline void OwnSolid(G4VSolid * solid); |
---|
74 | |
---|
75 | private: |
---|
76 | inline void Validate(); |
---|
77 | |
---|
78 | void Merge(const G4RotationMatrix & rightRotation, const G4ThreeVector & rightPosition, G4RotationMatrix & relativeRotation, G4ThreeVector & relativePosition) const; |
---|
79 | void Absolute(const RadmonDetectorLayerVolumeItem * item, G4RotationMatrix & rotation, G4ThreeVector & position) const; |
---|
80 | |
---|
81 | // Hidden constructors and operators |
---|
82 | RadmonVDetectorLayerVolumeItemOperation(const RadmonVDetectorLayerVolumeItemOperation & copy); |
---|
83 | RadmonVDetectorLayerVolumeItemOperation & operator=(const RadmonVDetectorLayerVolumeItemOperation & copy); |
---|
84 | |
---|
85 | // Private data types |
---|
86 | typedef std::stack<G4VSolid *> OwnedSolids; |
---|
87 | typedef std::stack<G4RotationMatrix> OwnedMatrices; |
---|
88 | |
---|
89 | // Private attributes |
---|
90 | OwnedSolids ownedSolids; |
---|
91 | OwnedMatrices ownedMatrices; |
---|
92 | G4RotationMatrix leftRotation; |
---|
93 | G4RotationMatrix invLeftRotation; |
---|
94 | G4ThreeVector leftPosition; |
---|
95 | G4VSolid * leftSolid; |
---|
96 | }; |
---|
97 | |
---|
98 | // Inline implementations |
---|
99 | #include "RadmonVDetectorLayerVolumeItemOperation.icc" |
---|
100 | #endif /* RADMONVDETECTORLAYERVOLUMEITEMOPERATION_HH */ |
---|