source: trunk/source/geometry/divisions/test/ExDivisions/src/ExDivTesterPolycone.cc @ 1316

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

update geant4-09-04-beta-cand-01 interfaces-V09-03-09 vis-V09-03-08

File size: 9.2 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//
27// $Id: ExDivTesterPolycone.cc,v 1.3 2006/06/29 18:20:18 gunter Exp $
28// GEANT4 tag $Name: geant4-09-04-beta-cand-01 $
29//
30// class ExDivTesterPolycone Implementation file
31//
32// 26.05.03 - P.Arce Initial version
33// ********************************************************************
34
35#include "ExDivTesterPolycone.hh"
36#include "G4Polycone.hh"
37
38#include "G4ThreeVector.hh"
39#include "Randomize.hh"
40#include <fstream>
41#include "G4PVPlacement.hh"
42
43//--------------------------------------------------------------------------
44ExDivTesterPolycone::
45ExDivTesterPolycone( PVType& pvtype, PlaceType& postype,
46                     std::vector<G4String>& extraPars )
47  : ExVDivTester( pvtype, postype, extraPars )
48{
49  //----- Get the axis of division
50  theAxis.push_back( kRho );
51  theAxis.push_back( kPhi );
52  theAxis.push_back( kZAxis );
53}
54
55//--------------------------------------------------------------------------
56void ExDivTesterPolycone::GenerateScanPoints()
57{
58  std::ofstream fout("points.lis");
59  G4int ii;
60
61  G4int nPointsPerDiv = 2;
62  numberOfPoints = theNDiv * nPointsPerDiv;
63  // For division along X
64  G4ThreeVector centre(0.,0.,-2*theWorldLengthXY);
65  for( ii = 0; ii < numberOfPoints; ii++ )
66  {
67    // any Z, any Y
68    G4ThreeVector pR( 0., theWorldLengthXY/100., theWorldLengthXY/100. );
69    G4double X = -theWorldLengthXY + (ii+0.001) * 2*theWorldLengthXY/numberOfPoints;
70    pR.setX( X );
71    pR += centre;
72    fout << pR.x() << " " << pR.y() << " " << pR.z() << G4endl;
73  }
74
75  // For division along Y
76  centre = G4ThreeVector(0.,0.,0.);
77  for( ii = 0; ii < numberOfPoints; ii++ )
78  {
79    // any X, any Z
80    G4ThreeVector pR( theWorldLengthXY/100., 0., theWorldLengthXY/100. );
81    G4double Y = -theWorldLengthXY + (ii+0.001) * 2*theWorldLengthXY/numberOfPoints;
82    pR.setY( Y );
83    pR += centre;
84    fout << pR.x() << " " << pR.y() << " " << pR.z() << G4endl;
85  }
86
87  // For division along Z
88  centre = G4ThreeVector(0.,0.,2*theWorldLengthXY);
89  for( ii = 0; ii < numberOfPoints; ii++ )
90  {
91    // any X, any Y
92    G4ThreeVector pR( theWorldLengthXY/100., 0., theWorldLengthXY/100. );
93    G4double Z = -theWorldLengthXY + (ii+0.001) * 2*theWorldLengthXY/numberOfPoints;
94    pR.setZ( Z );
95    pR += centre;
96    fout << pR.x() << " " << pR.y() << " " << pR.z() << G4endl;
97  }
98}
99
100//--------------------------------------------------------------------------
101void ExDivTesterPolycone::BuildParentSolids()
102{
103  G4int numZPlanes = 4;
104  G4double* zPlane1 = new G4double[numZPlanes];
105            zPlane1[0]=-theWorldLengthXY;
106            zPlane1[1]=-0.25*theWorldLengthXY;
107            zPlane1[2]= 0.5*theWorldLengthXY;
108            zPlane1[3]= theWorldLengthXY;
109  G4double* rInner1 = new G4double[numZPlanes];
110            rInner1[0]=0.;
111            rInner1[1]=0.1*theWorldLengthXY;
112            rInner1[2]=0.3*theWorldLengthXY;
113            rInner1[3]=0.5*theWorldLengthXY;
114  G4double* rOuter1  = new G4double[numZPlanes];
115            rOuter1[0]=0.2*theWorldLengthXY;
116            rOuter1[1]=0.4*theWorldLengthXY;
117            rOuter1[2]=0.9*theWorldLengthXY;
118            rOuter1[3]=theWorldLengthXY;
119  G4double* zPlane2 = new G4double[numZPlanes];
120            zPlane2[0]=-theWorldLengthXY;
121            zPlane2[1]=-0.25*theWorldLengthXY;
122            zPlane2[2]= 0.5*theWorldLengthXY;
123            zPlane2[3]= theWorldLengthXY;
124  G4double* rInner2 = new G4double[numZPlanes];
125            rInner2[0]=0.;
126            rInner2[1]=0.1*theWorldLengthXY;
127            rInner2[2]=0.3*theWorldLengthXY;
128            rInner2[3]=0.5*theWorldLengthXY;
129  G4double* rOuter2  = new G4double[numZPlanes];
130            rOuter2[0]=0.2*theWorldLengthXY;
131            rOuter2[1]=0.4*theWorldLengthXY;
132            rOuter2[2]=0.9*theWorldLengthXY;
133            rOuter2[3]=theWorldLengthXY;
134  G4double* zPlane3 = new G4double[numZPlanes];
135            zPlane3[0]=-theWorldLengthXY;
136            zPlane3[1]=-0.25*theWorldLengthXY;
137            zPlane3[2]= 0.5*theWorldLengthXY;
138            zPlane3[3]= theWorldLengthXY;
139  G4double* rInner3 = new G4double[numZPlanes];
140            rInner3[0]=0.;
141            rInner3[1]=0.1*theWorldLengthXY;
142            rInner3[2]=0.2*theWorldLengthXY;
143            rInner3[3]=0.5*theWorldLengthXY;
144  G4double* rOuter3  = new G4double[numZPlanes];
145            rOuter3[0]=0.2*theWorldLengthXY;
146            rOuter3[1]=0.4*theWorldLengthXY;
147            rOuter3[2]=0.9*theWorldLengthXY;
148            rOuter3[3]=theWorldLengthXY;
149  G4cout << " theStartPhi " << theStartPhi << " theDeltaPhi " << theDeltaPhi << G4endl;
150  theParentSolids.push_back( new G4Polycone("parent_1", 0.*deg, 360.*deg,
151                             numZPlanes, zPlane1, rInner1, rOuter1 ) );
152  theParentSolids.push_back( new G4Polycone("parent_2", theStartPhi, theDeltaPhi,
153                              numZPlanes, zPlane2, rInner2, rOuter2 ) );
154  theParentSolids.push_back( new G4Polycone("parent_3", theStartPhi, theDeltaPhi,
155                             numZPlanes, zPlane3, rInner3, rOuter3 ) );
156}
157
158//--------------------------------------------------------------------------
159void ExDivTesterPolycone::BuildChildrenSolids()
160{
161  G4int numZPlanes = 4;
162  G4double* zPlane1 = new G4double[numZPlanes];
163            zPlane1[0]=-theWorldLengthXY;
164            zPlane1[1]=-0.25*theWorldLengthXY;
165            zPlane1[2]= 0.5*theWorldLengthXY;
166            zPlane1[3]= theWorldLengthXY;
167  G4double* rInner1 = new G4double[numZPlanes];
168            rInner1[0]=0.;
169            rInner1[1]=0.1*theWorldLengthXY;
170            rInner1[2]=0.2*theWorldLengthXY;
171            rInner1[3]=0.5*theWorldLengthXY;
172  G4double* rOuter1  = new G4double[numZPlanes];
173            rOuter1[0]=0.2*theWorldLengthXY;
174            rOuter1[1]=0.4*theWorldLengthXY;
175            rOuter1[2]=0.9*theWorldLengthXY;
176            rOuter1[3]=theWorldLengthXY;
177  G4double* zPlane2 = new G4double[numZPlanes];
178            zPlane2[0]=-theWorldLengthXY;
179            zPlane2[1]=-0.25*theWorldLengthXY;
180            zPlane2[2]= 0.5*theWorldLengthXY;
181            zPlane2[3]= theWorldLengthXY;
182  G4double* rInner2 = new G4double[numZPlanes];
183            rInner2[0]=0.;
184            rInner2[1]=0.1*theWorldLengthXY;
185            rInner2[2]=0.2*theWorldLengthXY;
186            rInner2[3]=0.5*theWorldLengthXY;
187  G4double* rOuter2  = new G4double[numZPlanes];
188            rOuter2[0]=0.2*theWorldLengthXY;
189            rOuter2[1]=0.4*theWorldLengthXY;
190            rOuter2[2]=0.9*theWorldLengthXY;
191            rOuter2[3]=theWorldLengthXY;
192  G4double* zPlane3 = new G4double[numZPlanes];
193            zPlane3[0]=-theWorldLengthXY;
194            zPlane3[1]=-0.25*theWorldLengthXY;
195            zPlane3[2]= 0.5*theWorldLengthXY;
196            zPlane3[3]= theWorldLengthXY;
197  G4double* rInner3 = new G4double[numZPlanes];
198            rInner3[0]=0.;
199            rInner3[1]=0.1*theWorldLengthXY;
200            rInner3[2]=0.2*theWorldLengthXY;
201            rInner3[3]=0.5*theWorldLengthXY;
202  G4double* rOuter3  = new G4double[numZPlanes];
203            rOuter3[0]=0.2*theWorldLengthXY;
204            rOuter3[1]=0.4*theWorldLengthXY;
205            rOuter3[2]=0.9*theWorldLengthXY;
206            rOuter3[3]=theWorldLengthXY;
207
208  G4Polycone* msol = (G4Polycone*)theParentSolids[0];
209  G4PolyconeHistorical* origparamMother = msol->GetOriginalParameters();
210  G4double rMax = origparamMother->Rmax[0] - origparamMother->Rmin[0];
211  msol = (G4Polycone*)theParentSolids[1];
212  G4double phiMax =  msol->GetEndPhi() - msol->GetStartPhi();
213  msol = (G4Polycone*)theParentSolids[2];
214  origparamMother = msol->GetOriginalParameters();
215  G4double zMax = origparamMother->Z_values[origparamMother->Num_z_planes-1] - origparamMother->Z_values[0];
216
217  theWidths.push_back( rMax / theNDiv );
218  theWidths.push_back( phiMax / theNDiv );
219  theWidths.push_back( zMax / theNDiv );
220
221  theChildSolids.push_back( new G4Polycone("child_1", theStartPhi, theDeltaPhi,
222                            numZPlanes, zPlane1, rInner1, rOuter1 ) );
223  theChildSolids.push_back( new G4Polycone("child_2", theStartPhi, theWidths[0],
224                            numZPlanes, zPlane2, rInner2, rOuter2 ) );
225  theChildSolids.push_back( new G4Polycone("child_3", theStartPhi, theDeltaPhi,
226                            numZPlanes, zPlane3, rInner3, rOuter3 ) );
227}
228
Note: See TracBrowser for help on using the repository browser.