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 | // $Id: G4ReplicatedSlice.hh,v 1.2 2010/11/10 09:15:40 gcosmo Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-04-ref-00 $ |
---|
29 | // |
---|
30 | // class G4ReplicatedSlice |
---|
31 | // |
---|
32 | // Class description: |
---|
33 | // |
---|
34 | // G4ReplicatedSlice represents many touchable detector elements differing |
---|
35 | // only in their positioning. The elements' positions are calculated by means |
---|
36 | // of a simple linear formula. |
---|
37 | // |
---|
38 | // Division may occur along: |
---|
39 | // |
---|
40 | // o Cartesian axes (kXAxis,kYAxis,kZAxis) |
---|
41 | // |
---|
42 | // The divisions, of specified width have coordinates of |
---|
43 | // form (-width*(nReplicas-1)*0.5+n*width,0,0) where n=0.. nReplicas-1 |
---|
44 | // for the case of kXAxis, and are unrotated. |
---|
45 | // |
---|
46 | // o Radial axis (cylindrical polar) (kRho) |
---|
47 | // |
---|
48 | // The divisions are cons/tubs sections, centred on the origin |
---|
49 | // and are unrotated. |
---|
50 | // They have radii of width*n+offset to width*(n+1)+offset |
---|
51 | // where n=0..nReplicas-1 |
---|
52 | // |
---|
53 | // o Phi axis (cylindrical polar) (kPhi) |
---|
54 | // The divisions are `phi sections' or wedges, and of cons/tubs form |
---|
55 | // They have phi of offset+n*width to offset+(n+1)*width where |
---|
56 | // n=0..nReplicas-1 |
---|
57 | |
---|
58 | // History: |
---|
59 | // ------- |
---|
60 | // Apr/20/2010 - Initial version extended from G4PVDivision |
---|
61 | // ---------------------------------------------------------------------- |
---|
62 | #ifndef G4ReplicatedSlice_HH |
---|
63 | #define G4ReplicatedSlice_HH 1 |
---|
64 | |
---|
65 | #include "geomdefs.hh" |
---|
66 | #include "G4VPhysicalVolume.hh" |
---|
67 | #include "G4VDivisionParameterisation.hh" |
---|
68 | |
---|
69 | class G4LogicalVolume; |
---|
70 | class G4VSolid; |
---|
71 | |
---|
72 | class G4ReplicatedSlice : public G4VPhysicalVolume |
---|
73 | { |
---|
74 | public: // with description |
---|
75 | |
---|
76 | G4ReplicatedSlice(const G4String& pName, |
---|
77 | G4LogicalVolume* pLogical, |
---|
78 | G4LogicalVolume* pMotherLogical, |
---|
79 | const EAxis pAxis, |
---|
80 | const G4int nReplicas, |
---|
81 | const G4double width, |
---|
82 | const G4double half_gap, |
---|
83 | const G4double offset ); |
---|
84 | // Constructor with number of divisions and width |
---|
85 | |
---|
86 | G4ReplicatedSlice(const G4String& pName, |
---|
87 | G4LogicalVolume* pLogical, |
---|
88 | G4LogicalVolume* pMotherLogical, |
---|
89 | const EAxis pAxis, |
---|
90 | const G4int nReplicas, |
---|
91 | const G4double half_gap, |
---|
92 | const G4double offset ); |
---|
93 | // Constructor with number of divisions |
---|
94 | |
---|
95 | G4ReplicatedSlice(const G4String& pName, |
---|
96 | G4LogicalVolume* pLogical, |
---|
97 | G4LogicalVolume* pMotherLogical, |
---|
98 | const EAxis pAxis, |
---|
99 | const G4double width, |
---|
100 | const G4double half_gap, |
---|
101 | const G4double offset ); |
---|
102 | // Constructor with width |
---|
103 | |
---|
104 | public: // without description |
---|
105 | |
---|
106 | G4ReplicatedSlice(const G4String& pName, |
---|
107 | G4LogicalVolume* pLogical, |
---|
108 | G4VPhysicalVolume* pMotherPhysical, |
---|
109 | const EAxis pAxis, |
---|
110 | const G4int nReplicas, |
---|
111 | const G4double width, |
---|
112 | const G4double half_gap, |
---|
113 | const G4double offset); |
---|
114 | // Constructor in mother physical volume |
---|
115 | |
---|
116 | G4ReplicatedSlice(const G4String& pName, |
---|
117 | G4LogicalVolume* pLogical, |
---|
118 | G4VPhysicalVolume* pMotherPhysical, |
---|
119 | const EAxis pAxis, |
---|
120 | const G4int nReplicas, |
---|
121 | const G4double half_gap, |
---|
122 | const G4double offset ); |
---|
123 | // Constructor with number of divisions |
---|
124 | |
---|
125 | G4ReplicatedSlice(const G4String& pName, |
---|
126 | G4LogicalVolume* pLogical, |
---|
127 | G4VPhysicalVolume* pMotherPhysical, |
---|
128 | const EAxis pAxis, |
---|
129 | const G4double width, |
---|
130 | const G4double half_gap, |
---|
131 | const G4double offset ); |
---|
132 | // Constructor with width |
---|
133 | |
---|
134 | public: // with description |
---|
135 | |
---|
136 | virtual ~G4ReplicatedSlice(); |
---|
137 | |
---|
138 | virtual G4bool IsMany() const; |
---|
139 | virtual G4int GetCopyNo() const; |
---|
140 | virtual void SetCopyNo(G4int CopyNo); |
---|
141 | virtual G4bool IsReplicated() const; |
---|
142 | virtual G4VPVParameterisation* GetParameterisation() const; |
---|
143 | virtual void GetReplicationData( EAxis& axis, |
---|
144 | G4int& nReplicas, |
---|
145 | G4double& width, |
---|
146 | G4double& offset, |
---|
147 | G4bool& consuming ) const; |
---|
148 | EAxis GetDivisionAxis() const; |
---|
149 | G4bool IsParameterised() const; |
---|
150 | |
---|
151 | public: // without description |
---|
152 | |
---|
153 | G4bool IsRegularStructure() const; |
---|
154 | G4int GetRegularStructureId() const; |
---|
155 | // Methods to identify volume that can apply 'regular' navigation. |
---|
156 | // Currently divisions do not qualify for this. |
---|
157 | |
---|
158 | private: |
---|
159 | |
---|
160 | void CheckAndSetParameters( const EAxis pAxis, |
---|
161 | const G4int nDivs, |
---|
162 | const G4double width, |
---|
163 | const G4double half_gap, |
---|
164 | const G4double offset, |
---|
165 | DivisionType divType, |
---|
166 | G4LogicalVolume* pMotherLogical, |
---|
167 | const G4LogicalVolume* pLogical ); |
---|
168 | |
---|
169 | void SetParameterisation( G4LogicalVolume* motherLogical, |
---|
170 | const EAxis pAxis, |
---|
171 | const G4int nReplicas, |
---|
172 | const G4double width, |
---|
173 | const G4double half_gap, |
---|
174 | const G4double offset, |
---|
175 | DivisionType divType ); |
---|
176 | |
---|
177 | void ErrorInAxis( EAxis axis, G4VSolid* solid ); |
---|
178 | |
---|
179 | private: |
---|
180 | |
---|
181 | G4ReplicatedSlice(const G4ReplicatedSlice&); |
---|
182 | const G4ReplicatedSlice& operator=(const G4ReplicatedSlice&); |
---|
183 | // Private copy constructor and assignment operator. |
---|
184 | |
---|
185 | protected: |
---|
186 | |
---|
187 | EAxis faxis; // axis of optimisation |
---|
188 | EAxis fdivAxis; // axis of division |
---|
189 | G4int fnReplicas; |
---|
190 | G4double fwidth,foffset; |
---|
191 | G4int fcopyNo; |
---|
192 | G4VDivisionParameterisation *fparam; |
---|
193 | }; |
---|
194 | |
---|
195 | #endif |
---|