source: trunk/source/geometry/solids/test/OpticalEscape/src/AXPETDetectorConstruction.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: 21.3 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// $Id: AXPETDetectorConstruction.cc,v 1.1 2008/09/03 13:34:03 gcosmo Exp $
27// ------------------------------------------------------------
28// Geant4 class implementation file
29//
30// 03/09/2008, by T.Nikitina
31// ------------------------------------------------------------
32
33#include "AXPETDetectorConstruction.hh"
34#include "AXPETDetectorMessenger.hh"
35
36//Solids
37#include "G4Box.hh"
38#include "G4Tubs.hh"
39#include "G4Sphere.hh"
40#include "G4Orb.hh"
41#include "G4Cons.hh"
42#include "G4Hype.hh"
43#include "G4Para.hh"
44#include "G4Paraboloid.hh"
45#include "G4Torus.hh"
46#include "G4Trd.hh"
47#include "G4Ellipsoid.hh"
48#include "G4EllipticalTube.hh"
49#include "G4EllipticalCone.hh"
50
51#include "G4Trap.hh"
52#include "G4Trd.hh"
53#include "G4Tet.hh"
54
55#include "G4Polycone.hh"
56#include "G4Polyhedra.hh"
57
58#include "G4TwistedTubs.hh"
59#include "G4TwistedBox.hh"
60#include "G4TwistedTrd.hh"
61#include "G4TwistedTrap.hh"
62
63#include "G4BooleanSolid.hh"
64#include "G4DisplacedSolid.hh"
65#include "G4UnionSolid.hh"
66#include "G4IntersectionSolid.hh"
67#include "G4SubtractionSolid.hh"
68#include "G4ReflectedSolid.hh"
69#include "G4RotationMatrix.hh"
70#include "G4BREPSolidBox.hh"
71//
72#include "G4LogicalVolume.hh"
73#include "G4PVPlacement.hh"
74#include "G4PVReplica.hh"
75#include "G4ThreeVector.hh"
76#include "G4RotationMatrix.hh"
77
78#include "G4RunManager.hh"
79#include "G4GeometryManager.hh"
80#include "G4PhysicalVolumeStore.hh"
81#include "G4LogicalVolumeStore.hh"
82#include "G4SolidStore.hh"
83
84#include "G4MaterialPropertiesTable.hh"
85#include "G4OpticalSurface.hh"
86#include "G4LogicalSkinSurface.hh"
87#include "G4LogicalBorderSurface.hh"
88#include "AXPETMaterial.hh"
89
90#include "G4VisAttributes.hh"
91#include "G4Colour.hh"
92
93#include "globals.hh"
94
95AXPETDetectorConstruction::AXPETDetectorConstruction():
96WorldVolume(0),LogWorldVolume(0),PhysWorldVolume(0), 
97                                                      LYSOVolume(0),LogLYSOVolume(0), PhysLYSOVolume(0)//,
98  //InterVolume(0),LogInterVolume(0), PhysInterVolume(0),
99  //DetecVolume(0),LogDetecVolume(0), PhysDetecVolume(0)
100{
101 pttoMaterial = new AXPETMaterial();
102
103 worldXsize  = 20. *cm;
104 worldYsize  = 20. *cm;
105 worldZsize  = 20. *cm;
106
107 lysoIz   =  2.0 *mm;
108 lysoDz   =  0.1 *mm;
109 lysoR    =  6.0 *mm;
110
111 detectorMessenger = new AXPETDetectorMessenger(this);
112 fval="Tubs";
113
114 xRot=0.0;
115 yRot=0.0;
116 zRot=0.0;
117 fAbort=0;
118}
119
120AXPETDetectorConstruction::~AXPETDetectorConstruction()
121{    delete detectorMessenger;     }
122
123
124
125void AXPETDetectorConstruction::SwitchDetector()
126{
127   
128   G4RunManager::GetRunManager()->DefineWorldVolume(PhysWorldVolume);
129 
130}
131G4VSolid*
132AXPETDetectorConstruction::SelectDetector( const G4String& val )
133{
134
135  G4Box* b1 = new G4Box ( "b1", 1*mm, 0.5*mm, 0.50*mm );
136  G4Box* b2 = new G4Box ( "b2", 0.5*mm, 1*mm, 0.5*mm );
137
138  fval = val ;
139  G4double fTrackerR1,fTrackerR2,fPhi,fPhiSegment,fTheta,fThetaSegment ; 
140  G4double fSemiAxisX,fSemiAxisY,fSemiAxisZ  ;
141  G4double fTrackerR,fTrackerpDx1,fTrackerpDy1,fTrackerpDz;
142  if (val == "Sphere")
143  {
144    // only solid sphere is supportet for now
145      fTrackerR1 = 0*mm ;
146      fTrackerR2 = (lysoR-0.01*mm)/2. ;
147      fPhi = 0*deg ;
148      fPhiSegment = 360*deg ;
149      fTheta = 0*deg ;
150      fThetaSegment = 180*deg ;
151      aVolume = new G4Sphere ("aSphere",  fTrackerR1, fTrackerR2 ,fPhi, fPhiSegment, fTheta, fThetaSegment);
152  }
153
154  else if (val == "HalfSphere")
155  {
156    // only solid sphere is supportet for now
157      fTrackerR1 = 0. ;
158      fTrackerR2 = (lysoR-0.01*mm)/2. ;
159      fPhi = 0*deg ;
160      fPhiSegment = 180*deg ;
161      fTheta = 0*deg ;
162      fThetaSegment = 180*deg ;
163      aVolume = new G4Sphere ("aHalfSphere",  fTrackerR1, fTrackerR2 ,fPhi, fPhiSegment, fTheta, fThetaSegment);
164
165  }
166  else if (val == "HollowSphere")
167  {
168    // only solid sphere is supportet for now
169      fTrackerR1 = (lysoR-0.01*mm)/4.;
170      fTrackerR2 = (lysoR-0.01*mm)/2. ;
171      fPhi = 0*deg ;
172      fPhiSegment = 360*deg ;
173      fTheta = 0*deg ;
174      fThetaSegment = 180*deg ;
175      aVolume = new G4Sphere ("aHollowSphere",  fTrackerR1, fTrackerR2 ,fPhi, fPhiSegment, fTheta, fThetaSegment);
176
177  }
178  else if (val == "HalfHollowSphere")
179  {
180    // only solid sphere is supportet for now
181      fTrackerR1 =(lysoR-0.01*mm)/4.  ;
182      fTrackerR2 =(lysoR-0.01*mm)/2. ;
183      fPhi = 0*deg ;
184      fPhiSegment = 180*deg ;
185      fTheta = 0*deg ;
186      fThetaSegment = 180*deg ;
187      aVolume = new G4Sphere ("aHalfHollowSphere",  fTrackerR1, fTrackerR2 ,fPhi, fPhiSegment, fTheta, fThetaSegment);
188
189  }
190  else if (val == "Q1Shell")
191  {
192    // only solid sphere is supportet for now
193      fTrackerR1 =(lysoR-0.01*mm)/4.  ;
194      fTrackerR2 =(lysoR-0.01*mm)/2. ;
195      fPhi = 0*deg ;
196      fPhiSegment = 90*deg ;
197      fTheta = 0*deg ;
198      fThetaSegment = 90*deg ;
199      aVolume = new G4Sphere ("aQ1Shell",  fTrackerR1, fTrackerR2 ,fPhi, fPhiSegment, fTheta, fThetaSegment);
200
201  }
202  else if (val == "Q2Shell")
203  {
204    // only solid sphere is supportet for now
205      fTrackerR1 =(lysoR-0.01*mm)/4.  ;
206      fTrackerR2 =(lysoR-0.01*mm)/2. ;
207      fPhi = 90*deg ;
208      fPhiSegment = 90*deg ;
209      fTheta = 0*deg ;
210      fThetaSegment = 90*deg ;
211      aVolume = new G4Sphere ("aQ2Shell",  fTrackerR1, fTrackerR2 ,fPhi, fPhiSegment, fTheta, fThetaSegment);
212
213  } 
214  else if (val == "Q3Shell")
215  {
216    // only solid sphere is supportet for now
217      fTrackerR1 =(lysoR-0.01*mm)/4.  ;
218      fTrackerR2 =(lysoR-0.01*mm)/2. ;
219      fPhi = 180*deg ;
220      fPhiSegment = 90*deg ;
221      fTheta = 0*deg ;
222      fThetaSegment = 90*deg ;
223      aVolume = new G4Sphere ("aQ3Shell",  fTrackerR1, fTrackerR2 ,fPhi, fPhiSegment, fTheta, fThetaSegment);
224
225  }
226  else if (val == "Q4Shell")
227  {
228    // only solid sphere is supportet for now
229      fTrackerR1 =(lysoR-0.01*mm)/4.  ;
230      fTrackerR2 =(lysoR-0.01*mm)/2. ;
231      fPhi = 270*deg ;
232      fPhiSegment = 90*deg ;
233      fTheta = 0*deg ;
234      fThetaSegment = 90*deg ;
235      aVolume = new G4Sphere ("aQ4Shell",  fTrackerR1, fTrackerR2 ,fPhi, fPhiSegment, fTheta, fThetaSegment);
236
237  }
238  else if (val == "Q5Shell")
239  {
240    // only solid sphere is supportet for now
241       fTrackerR1 =(lysoR-0.01*mm)/4.  ;
242      fTrackerR2 =(lysoR-0.01*mm)/2. ;
243      fPhi = 0*deg ;
244      fPhiSegment = 90*deg ;
245      fTheta = 90*deg ;
246      fThetaSegment = 90*deg ;
247      aVolume = new G4Sphere ("aQ5Shell",  fTrackerR1, fTrackerR2 ,fPhi, fPhiSegment, fTheta, fThetaSegment);
248
249  }
250else if (val == "Q6Shell")
251  {
252    // only solid sphere is supportet for now
253      fTrackerR1 =(lysoR-0.01*mm)/4.  ;
254      fTrackerR2 =(lysoR-0.01*mm)/2. ;
255      fPhi = 90*deg ;
256      fPhiSegment = 90*deg ;
257      fTheta = 90*deg ;
258      fThetaSegment = 90*deg ;
259      aVolume = new G4Sphere ("aQ5Shell",  fTrackerR1, fTrackerR2 ,fPhi, fPhiSegment, fTheta, fThetaSegment);
260
261  } 
262  else if (val == "Q7Shell")
263  {
264    // only solid sphere is supportet for now
265       fTrackerR1 =(lysoR-0.01*mm)/4.  ;
266      fTrackerR2 =(lysoR-0.01*mm)/2. ;
267      fPhi = 180*deg ;
268      fPhiSegment = 90*deg ;
269      fTheta = 90*deg ;
270      fThetaSegment = 90*deg ;
271      aVolume = new G4Sphere ("aQ7Shell",  fTrackerR1, fTrackerR2 ,fPhi, fPhiSegment, fTheta, fThetaSegment);
272
273  }
274  else if (val == "Q8Shell")
275  {
276    // only solid sphere is supportet for now
277      fTrackerR1 =(lysoR-0.01*mm)/4.  ;
278      fTrackerR2 =(lysoR-0.01*mm)/2. ;
279      fPhi = 270*deg ;
280      fPhiSegment = 90*deg ;
281      fTheta = 90*deg ;
282      fThetaSegment = 90*deg ;
283      aVolume = new G4Sphere ("aQ8Shell",  fTrackerR1, fTrackerR2 ,fPhi, fPhiSegment, fTheta, fThetaSegment);
284
285  }
286
287
288  else if (val == "Shell")
289  {
290   
291 // Test for Problem Report with Optical Photons and Sphere or Ellipsoid
292     G4Sphere *newSOut = new G4Sphere("Crystal",0.,lysoR-0.01/mm,0,twopi,0,pi/2);
293     G4Sphere *newSIn = new G4Sphere("Crystal",0.,lysoR-4.01/mm,0,twopi,0,twopi);
294
295     // Box was added in user application in order to avoid problem with Sphere with theta=90 deg
296     // Not need anymore, this bug in Sphere was repared in 4.9.2. 
297     // G4Box* farMirrorBox2 = new G4Box("nearMirrorBox", lysoR-0.01/mm,
298     // lysoR-0.01/mm,  lysoR-0.01/mm);
299     // aVolume = new G4IntersectionSolid("GlassMirror", farMirrorBox2,shell,0,G4ThreeVector(0,0,-lysoR));
300   aVolume = new G4SubtractionSolid("OutsideminInside", newSOut, newSIn);     
301
302  }
303  else if (val == "Ring")
304  {
305    // only solid sphere is supportet for now
306      fTrackerR1 =(lysoR-0.01*mm)/4.  ;
307      fTrackerR2 =(lysoR-0.01*mm)/2. ;
308      fPhi = 30*deg ;
309      fPhiSegment = 120*deg ;
310      fTheta = 10*deg ;
311      fThetaSegment = 40*deg ;
312      aVolume = new G4Sphere ("aRing",  fTrackerR1, fTrackerR2 ,fPhi, fPhiSegment, fTheta, fThetaSegment);
313
314  }
315  else if ( val == "Ellipsoid" ) {
316
317    fSemiAxisX = (lysoR-0.01*mm)/4. ;
318    fSemiAxisY = (lysoR-0.01*mm)/2. ;
319    fSemiAxisZ = (lysoR-0.01*mm)/2. ;
320
321    aVolume = new  G4Ellipsoid("aEllipsoid",
322                               fSemiAxisX,
323                               fSemiAxisY,
324                               fSemiAxisZ,
325                               -fSemiAxisX,fSemiAxisX);
326
327
328  }
329  else if (val == "Orb")
330  {
331
332    fTrackerR = (lysoR-0.01*mm)/2. ;
333    aVolume = new G4Orb ( "aOrb", fTrackerR );
334
335  }
336  else if (val == "Box") 
337  {         
338
339    fTrackerpDx1 = (lysoR-0.01*mm)/2. ;
340    fTrackerpDy1 = (lysoR-0.01*mm)/2. ;
341    fTrackerpDz  = (lysoR-0.01*mm)/2. ;
342
343    aVolume = new G4Box ( "aBox", fTrackerpDx1, fTrackerpDy1, fTrackerpDz );
344  }
345  else if (val == "Cons")
346  {       
347
348    fTrackerpDz =(lysoR-0.01*mm)/2.  ;
349    fTrackerR1 =(lysoR-0.01*mm)/4.  ;
350    fTrackerR2 =(lysoR-0.01*mm)/2.  ;
351
352    aVolume = new G4Cons ( "aCons", 0.8*fTrackerR1 , fTrackerR1, 0.8*fTrackerR2, fTrackerR2, fTrackerpDz, 10*deg, 220.*deg  ); 
353
354  }
355  else if (val == "manyCons")
356  {       
357    aVolume = new G4Cons ( "aCone", 2*mm, 3*mm, 2*mm, 4*mm,
358                           3.*mm, 10*deg, 300*deg ); 
359  //  10*cm, 10*deg, 300*deg );
360                           //  0., pi);
361
362 
363  }
364  else if (val == "Tubs")
365  {
366
367    // only solid Tube is supported.
368 
369    aVolume = new G4Tubs ( "aTube",0.1,5.9*mm,3.*mm,0.,180*deg) ;
370
371  }
372  else if (val == "Hype")
373  {
374    aVolume = new G4Hype ("aHype", 0.7, 1, 40*deg, 40*deg, 4. );
375  }
376  else if (val == "Torus")
377  {
378
379    fPhi = 40*deg ;
380    fPhiSegment = 200*deg ;
381
382    fTrackerR1 = 1.*mm ;
383    fTrackerR2 = 2.*mm ;
384    fTrackerR  = (lysoR-0.01*mm) ;
385
386    aVolume = new G4Torus("aTorus", fTrackerR1, fTrackerR2 ,fTrackerR, fPhi, fPhiSegment) ;
387
388  }
389  else if (val == "Para")
390  {
391    aVolume = new G4Para ("aPara", 0.8, 1.0, 1.2, 30*deg, 45*deg, 60*deg);
392  }
393  else if (val == "Paraboloid")
394  {
395    aVolume = new G4Paraboloid ("aParaboloid", 1., 0.5, 1.2);
396  }
397  else if (val == "PolyconeGen")
398  {
399    G4double rr[]={1,1.20,1.40,1.20};
400    G4double zz[]={-1,-1,1,1};
401    aVolume = new G4Polycone ("aPolycone",0*deg,90*deg, 4, rr,zz);
402 }
403 else if (val == "PolyconeGenComplex")
404   { //has to be apdated
405    G4double        zPlanes[]       =       {-11640.*mm,    -11640.*mm,     -11570.722*mm,  -9766.005*mm, 
406                                                -4487.828*mm,   4487.828*mm,    9766.005*mm,    11570.722*mm, 
407                                                11640.*mm,      11640.*mm,      11580.*mm,      9750.*mm,
408                                            4500.*mm,       -4500.*mm,      -9750.*mm,      -11580.*mm,
409                                             -11640.*mm};
410 
411        G4double        radius[]        =       {250.*mm,       305.*mm,        305.*mm,        2770.461*mm,
412                                                4932.*mm,       4932.*mm,       2770.461*mm,    305.*mm,
413                                                305.*mm,        250.*mm,        250.*mm,        2750.*mm,
414                                                 4900.*mm,       4900.*mm,       2750.*mm,       250.*mm,
415                                                   250.*mm};
416         aVolume = new G4Polycone ("aPolycone",0*deg,360*deg, 16, radius,zPlanes);
417    G4VSolid*       SolidPumpPort   =       new     G4Tubs("PumpPort temp tube", 0 * mm, 1750 / 2 * mm, (11161 - 4500) / 2 * mm-1*mm, 0, 360 * deg);
418           for (int i=0;i<2;i++)
419        {
420               G4RotationMatrix*       Rot     =       new G4RotationMatrix();
421               Rot->rotateZ(45*(-i-1) * deg );
422                G4double        X       =       std::cos(45*(i+1)*deg)*-(3050+4750)/2*mm;
423                G4double        Y       =       std::sin(45*(i+1)*deg)*-(3050+4750)/2*mm;
424                aVolume        =       new G4SubtractionSolid("Main Spectrometer", aVolume, SolidPumpPort,
425            Rot, G4ThreeVector(X, Y,(11161+4500)/2*mm - 100 * mm));
426         }
427
428
429
430 }
431  else if (val == "Polycone")
432  {
433    G4double rIn[]={1.00,1.20,0,0,1.20,1.20};
434    G4double rOut[]={1.20,1.40,1.40,1.20,1.40,1.60};
435    G4double zPlane[]={-2.00,-1.00,0,1.00,2.00,3.00};
436    aVolume = new G4Polycone ("aPolycone",0*deg,260*deg, 6,zPlane, rIn,rOut);
437  }
438 else if (val == "PolyhedraGen")
439  {
440    G4double rr[]={1.00,1.20,1.40,1.20};
441    G4double zz[]={-1.00,-1.00,1.00,1.00};
442    aVolume = new G4Polyhedra ("aPolycone",0*deg,90*deg,8, 4, rr,zz);
443  }
444 else if (val == "PolyhedraGenComplex")
445  {
446    G4double rr[]={ 1.00, 1.20,   0,  0,1.40,1.20,1.50,1.50,1.50,1.40, 1.30};
447    G4double zz[]={-1.50,-1.00,-1.00,-0.50,  0,2.00,2.00,1.00,0,  -0.50,-1.00};
448    aVolume = new G4Polyhedra ("aPolycone",0*deg,260*deg,8, 11, rr,zz);
449  }
450 else if (val == "Polyhedra")
451  {
452    G4double rOut[5]={2.100,0.600,1.500,1.500,3.800};
453    G4double rIn[5]={0,0.500,0,0.700,0.100};
454    G4double zPlane[5]={-0.100,1.000,1.500,2.500,3.000};
455    aVolume = new G4Polyhedra ("aPolycone",0*deg,260*deg,6, 5,zPlane, rIn,rOut);
456  }
457 
458  else if (val == "Trd")
459  {
460    aVolume = new G4Trd ("aTrd", 0.80, 1.00, 0.70,0.90, 1.00);
461  }
462  else if (val == "b1Ub2") 
463  {         
464    aVolume = new G4UnionSolid("b1Ub2",b1,b2);
465 
466  }
467  else if (val == "b1Ib2") 
468  {         
469    aVolume = new G4IntersectionSolid("b1Ib2",b1,b2);
470  }
471  else if (val == "b1Sb2") 
472  {         
473    aVolume = new G4SubtractionSolid("b1Sb2",b1,b2);
474  }
475  else if (val == "b1Ib1") 
476  {         
477    aVolume = new G4IntersectionSolid("b1Ib1",b1,b1);
478  }
479  else if (val == "b1Ub1") 
480  {         
481    aVolume = new G4UnionSolid("b1Ub1",b1,b1);
482  }
483  else if (val == "b1Sb1") 
484  {         
485    aVolume = new G4SubtractionSolid("b1Sb1",b1,b1);
486  }
487
488  else if ( val == "Tet" ) 
489  {
490
491      G4ThreeVector pzero(0,0,0);
492      G4ThreeVector pnt1(1.,0.,0.),pnt2(0,1.,0.), pnt3(0,0.,1.);
493      G4Tet   t1( "aTet", pzero, pnt1, pnt2, pnt3);
494  }
495  else if ( val == "Trap") 
496  {
497      fTrackerpDz = 0.80;
498    fTheta = 10*deg ;
499    fPhi  =  40*deg ;
500    fTrackerpDy1 = 1.6 ;
501    fTrackerpDx1 = 2.4 ;
502    G4double fTrackerpDx2 = 1.4 ;
503    G4double fTrackerpDy2 = 0.8 ;
504    G4double fTrackerpDx3 = 1.6 ;
505    G4double fTrackerpDx4 = 1.1 ;
506    G4double fAlph = 50*deg    ;
507
508    aVolume = new G4Trap("aTrap",
509                                fTrackerpDz,         // half z length
510                                fTheta,              // direction between end planes
511                                fPhi,                // defined by polar and azimutal angles.
512                                fTrackerpDy1,        // half y length at -pDz
513                                fTrackerpDx1,        // half x length at -pDz,-pDy
514                                fTrackerpDx2,        // half x length at -pDz,+pDy
515                                fAlph,                // tilt angle at +pDz
516                                fTrackerpDy2,        // half y length at +pDz
517                                fTrackerpDx3,        // half x length at +pDz,-pDy
518                                fTrackerpDx4,        // half x length at +pDz,+pDy
519                                fAlph                // tilt angle at +pDz
520                                ) ;
521   
522 
523  }
524  else if ( val == "EllipticalCone" ) 
525  {
526    aVolume = new G4EllipticalCone("aEllipticalCone",
527                        0.5,       // xSemiAxis
528                        1,       // ySemiAxis
529                        4.0,      // zheight
530                        2.5) ;    // zTopCut
531
532  }
533  else if ( val == "EllipticalTube" ) 
534  {
535    aVolume = new G4EllipticalTube("aEllipticalTube" ,
536                                   2,   // xSemiAxis
537                                   4,   // ySemiAxis
538                                   3.5) ;  // zheight
539
540  }
541  else
542    { G4cout <<"DetectorConstruction tried to select "<<val<<G4endl;
543    G4Exception("DetectorConstruction::SelectDetector() - Invalid shape!");
544  }
545
546  return aVolume;
547
548}
549G4VPhysicalVolume* AXPETDetectorConstruction::Construct()
550{
551 //***********************************************
552  // Clear all Stores
553  //***********************************************
554
555   G4GeometryManager::GetInstance()->OpenGeometry();
556   G4PhysicalVolumeStore::GetInstance()->Clean();
557   G4LogicalVolumeStore::GetInstance()->Clean();
558   G4SolidStore::GetInstance()->Clean();
559
560 pttoMaterial->DefineMaterials();
561 
562 air = pttoMaterial->GetMat("AIR");
563 lyso= pttoMaterial->GetMat("LYSO");
564 vacuum= pttoMaterial->GetMat("Galactic");
565
566
567  //***********************************************
568  // Defining the world volume
569  //***********************************************
570
571 WorldVolume = new G4Box("World",worldXsize,worldYsize,worldZsize);
572
573 LogWorldVolume = new G4LogicalVolume(WorldVolume, 
574                                           vacuum, 
575                                           "logicWorld", 
576                                            0,0,0);
577
578 PhysWorldVolume = new G4PVPlacement(0, G4ThreeVector(),
579                                         "physicalWorld", 
580                                          LogWorldVolume, 
581                                          0,false,0);
582
583
584  //***********************************************
585  // Defining the lyso-Solid volume
586  //***********************************************
587
588 
589 LYSOVolume=SelectDetector(fval);
590 LogLYSOVolume = new G4LogicalVolume(LYSOVolume, 
591                                        lyso, 
592                                        "logicLYSO", 
593                                         0,0,0);
594
595 G4RotationMatrix *mat=new G4RotationMatrix();
596 if(xRot!=0.)mat->rotateX(xRot*deg);
597 if(yRot!=0.)mat->rotateY(xRot*deg);
598 if(zRot!=0.)mat->rotateZ(xRot*deg);
599 // mat->rotateY(180.*deg);
600 // mat->rotateZ(10.*deg);
601 G4ThreeVector position=G4ThreeVector(1.0,1.0,1.0);
602
603 PhysLYSOVolume = new G4PVPlacement(mat,G4ThreeVector(0.0,0.0,0.0),
604                                        LogLYSOVolume,
605                                        "physicalLYSO", 
606                                      LogWorldVolume, 
607                                         0,false,0);
608                                         
609  G4cout << "The LYSO crystal is built as "<<fval << G4endl;
610
611
612
613
614  //************************************************************************
615  //Al coated surface properties
616  //************************************************************************
617
618  const G4int nEntries = 11;
619  const G4double refl = 0.85;
620 
621  G4double PhotonEnergy[nEntries] = {2.478*eV, 2.53*eV, 2.58*eV, 2.636*eV, 2.69*eV, 2.75*eV, 2.816*eV, 2.88*eV, 2.95*eV, 3.022*eV, 3.097*eV};
622
623  G4double Reflectivity[nEntries]   = {refl, refl,refl, refl, refl, refl, refl, refl, refl, refl, refl};
624  G4double Efficiency[nEntries]     = {0.0, 0.0,0.0, 0.0,0.0, 0.0,0.0, 0.0,0.0, 0.0,0.0}; 
625  G4double specularlobe[nEntries]   = {0.0, 0.0,0.0, 0.0,0.0, 0.0,0.0, 0.0,0.0, 0.0,0.0}; 
626  G4double specularspike[nEntries]  = {0.9, 0.9,0.9, 0.9,0.9, 0.9,0.9, 0.9,0.9, 0.9,0.9}; 
627  G4double backscatter[nEntries]    = {0.0, 0.0,0.0, 0.0,0.0, 0.0,0.0, 0.0,0.0, 0.0,0.0}; 
628  G4double rindex[nEntries]         = {1.39, 1.39,1.39, 1.39,1.39,1.39,1.39, 1.39,1.39, 1.39,1.39}; 
629
630
631  G4OpticalSurface* alcoated_opsurf=  new G4OpticalSurface("alcoated_opsurf");
632   new G4LogicalBorderSurface("alcoated_surf",PhysLYSOVolume,PhysWorldVolume, alcoated_opsurf);
633 
634
635  G4MaterialPropertiesTable* alcoated_mt = new G4MaterialPropertiesTable();
636  alcoated_mt->AddProperty("RINDEX",  PhotonEnergy,rindex,  nEntries );
637  alcoated_mt->AddProperty("EFFICIENCY",  PhotonEnergy,Efficiency,  nEntries );
638  alcoated_mt->AddProperty("REFLECTIVITY",PhotonEnergy,Reflectivity,nEntries);
639  alcoated_mt->AddProperty("SPECULARLOBECONSTANT",PhotonEnergy,specularlobe,nEntries);
640  alcoated_mt->AddProperty("SPECULARSPIKECONSTANT",PhotonEnergy,specularspike,nEntries);
641  alcoated_mt->AddProperty("BACKSCATTERCONSTANT",PhotonEnergy,backscatter,nEntries);
642
643
644  alcoated_opsurf->SetType(dielectric_metal);
645  alcoated_opsurf->SetModel(unified);
646  alcoated_opsurf->SetFinish(groundbackpainted/*polished*/);
647 
648
649  alcoated_opsurf->SetMaterialPropertiesTable(alcoated_mt);
650
651
652  G4VisAttributes* WhiteVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));//red
653  WhiteVisAtt->SetVisibility(true);
654  WhiteVisAtt->SetForceSolid(true);
655
656  G4VisAttributes* LysoVisAtt= new G4VisAttributes(G4Colour(0.0,0.0,1.0));//red
657  LysoVisAtt->SetVisibility(true);
658  LysoVisAtt->SetForceSolid(true);
659
660  G4VisAttributes* DeteVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,0.0));//yellow
661  DeteVisAtt->SetVisibility(true);
662  DeteVisAtt->SetForceSolid(true);
663 
664  LogLYSOVolume->SetVisAttributes(LysoVisAtt);
665  LogWorldVolume->SetVisAttributes(G4VisAttributes::GetInvisible());
666
667  return PhysWorldVolume;
668 
669 }
670
Note: See TracBrowser for help on using the repository browser.