Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
XrayFluoDetectorConstruction.cc
Go to the documentation of this file.
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: XrayFluoDetectorConstruction.cc
28 // GEANT4 tag $Name: xray_fluo-V03-02-00
29 //
30 // Author: Alfonso Mantero (Alfonso.Mantero@ge.infn.it)
31 //
32 // History:
33 // -----------
34 // 28 Nov 2001 Elena Guardincerri Created
35 // Nov 2002 Alfonso Mantero materials added,
36 // Material selection implementation
37 // 16 Jul 2003 Alfonso Mantero Detector type selection added + minor fixes
38 // -------------------------------------------------------------------
39 
42 #include "XrayFluoSD.hh"
43 #include "G4PhysicalConstants.hh"
44 #include "G4SystemOfUnits.hh"
45 #include "G4Material.hh"
46 #include "G4ThreeVector.hh"
47 #include "G4Box.hh"
48 #include "G4Sphere.hh"
49 #include "G4Tubs.hh"
50 #include "G4LogicalVolume.hh"
51 #include "G4PVPlacement.hh"
53 #include "G4SDManager.hh"
54 #include "G4RunManager.hh"
55 #include "G4VisAttributes.hh"
56 #include "G4Colour.hh"
57 #include "G4ios.hh"
58 #include "G4PVReplica.hh"
59 #include "G4UserLimits.hh"
60 #include "XrayFluoNistMaterials.hh"
61 
62 
63 // #include "G4Region.hh"
64 // #include "G4RegionStore.hh"
65 
66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
67 
68 
69 XrayFluoDetectorConstruction::XrayFluoDetectorConstruction()
70  : aNavigator(0), detectorType(0),sampleGranularity(false), phaseSpaceFlag(false),
71  DeviceSizeX(0), DeviceSizeY(0),DeviceThickness(0),
72  solidWorld(0),logicWorld(0),physiWorld(0),
73  solidHPGe(0),logicHPGe(0),physiHPGe(0),
74  solidSample (0),logicSample(0),physiSample (0),
75  solidDia1(0),logicDia1(0),physiDia1(0),
76  solidDia3(0),logicDia3(0),physiDia3(0),
77  solidOhmicPos(0),logicOhmicPos(0), physiOhmicPos(0),
78  solidWindow(0), logicWindow(0), physiWindow(0),
79  solidOhmicNeg(0),logicOhmicNeg(0), physiOhmicNeg(0),
80  solidPixel(0),logicPixel(0), physiPixel(0),
81  OhmicPosMaterial(0), OhmicNegMaterial(0),
82  pixelMaterial(0),sampleMaterial(0),
83  Dia1Material(0),Dia3Material(0),
84  defaultMaterial(0), windowMaterial (0), HPGeSD(0)
85 
86 {
88 
89  aNavigator = new G4Navigator();
90 
91  DefineDefaultMaterials();
92 
93  NbOfPixelRows = 1; // should be 1
94  NbOfPixelColumns = 1; // should be 1
95  NbOfPixels = NbOfPixelRows*NbOfPixelColumns;
96  PixelSizeXY = std::sqrt(40.) * mm;
97  PixelThickness = 2.7 * mm; //should be 3.5 mm
98 
99  G4cout << "PixelThickness(mm): "<< PixelThickness/mm << G4endl;
100  G4cout << "PixelSizeXY(cm): "<< PixelSizeXY/cm << G4endl;
101 
102  ContactSizeXY = PixelSizeXY; //std::sqrt(40) * mm; //should be the same as PixelSizeXY
103  SampleThickness = 4 * mm;
104  SampleSizeXY = 3. * cm;
105  Dia1Thickness = 1. *mm;
106  Dia3Thickness = 1. *mm;
107  Dia1SizeXY = 3. *cm;
108  Dia3SizeXY = 3. *cm;
109 
110 
111  DiaInnerSize = 2.9 * cm; //(Hole in the detector's diaphragm) it was 1 mm
112 
113 
114  OhmicNegThickness = 1e-6*cm;// 0.005
115  OhmicPosThickness = 1e-6*cm;// 0.005
116  windowThickness = 0.008 * cm; //value for aif detector
117  ThetaHPGe = 135. * deg;
118  PhiHPGe = 225. * deg;
119 
120  ThetaDia1 = 135. * deg;
121  PhiDia1 = 90. * deg;
122  AlphaDia1 = 225. * deg;
123 
124  AlphaDia3 = 180. * deg;
125  Dia3Dist = 66.5 * mm;
126  Dia3InnerSize = 1. * mm;
127  ThetaDia3 = 180. * deg;
128  PhiDia3 = 90. * deg;
129 
130  DistDia = 66.5 * mm;
131  DistDe =DistDia+ (Dia1Thickness
132  +PixelThickness)/2+OhmicPosThickness+windowThickness ;
133 
134  grainDia = 1 * mm;
135  PixelCopyNb=0;
136  grainCopyNb=0;
137  G4String defaultDetectorType = "sili";
138  ComputeApparateParameters();
139 
140 // G4String regName = "SampleRegion";
141 // sampleRegion = new G4Region(regName);
142 
143  if (!phaseSpaceFlag) SetDetectorType(defaultDetectorType);
144 
145  // create commands for interactive definition of the apparate
146 
147  detectorMessenger = new XrayFluoDetectorMessenger(this);
148 
149  G4cout << "XrayFluoDetectorConstruction created" << G4endl;
150 }
151 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
152 
153 
154 XrayFluoDetectorConstruction* XrayFluoDetectorConstruction::instance = 0;
155 
157 {
158  if (instance == 0)
159  {
160  instance = new XrayFluoDetectorConstruction;
161 
162  }
163  return instance;
164 }
165 
167 {
168 
169  if (type=="sili")
170  {
171  detectorType = XrayFluoSiLiDetectorType::GetInstance();
172  }
173  else if (type=="hpge")
174  {
175  detectorType = XrayFluoHPGeDetectorType::GetInstance();
176  }/*
177  else if (type=="aifira")
178  {
179  detectorType = XrayFluoAifSiLi::GetInstance();
180  }*/
181  else
182  {
184  execp << type + "detector type unknown";
185  G4Exception("XrayFluoDataSet::LoadData()","example-xray_fluorescence06",
186  FatalException, execp);
187  }
188 }
189 
191 {
192  return detectorType;
193 }
194 
195 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
196 
198 
199 {
200  delete detectorMessenger;
201  delete detectorType;
202  G4cout << "XrayFluoDetectorConstruction deleted" << G4endl;
203 }
204 
205 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
206 
208 {
209  return ConstructApparate();
210 }
211 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
212 
213 void XrayFluoDetectorConstruction::DefineDefaultMaterials()
214 {
215 
216 
217  //define materials of the apparate
218 
219  sampleMaterial = materials->GetMaterial("Dolorite");
220  Dia1Material = materials->GetMaterial("G4_Pb");
221  Dia3Material = materials->GetMaterial("G4_Galactic");
222  pixelMaterial = materials->GetMaterial("SiLi");
223  //OhmicPosMaterial = materials->GetMaterial("G4_Cu");
224  OhmicPosMaterial = materials->GetMaterial("G4_Ni");
225  OhmicNegMaterial = materials->GetMaterial("G4_Pb");
226  defaultMaterial = materials->GetMaterial("G4_Galactic");
227  windowMaterial = materials->GetMaterial("G4_Be");
228 }
229 
231 {
232 
233  if (!phaseSpaceFlag) {
234 
235 
236  if (val == 0.0) {
237  OhmicPosMaterial = materials->GetMaterial("G4_Galactic");
238  }
239  else {
240  OhmicPosThickness = val;
241  //OhmicPosMaterial = materials->GetMaterial("G4_Cu");
242  OhmicPosMaterial = materials->GetMaterial("G4_Ni");
243  }
244 
245  }
246  else{
247  G4cout << "Not available in this configuration" << G4cout;
248  }
249 
250 }
251 
252 
253 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
254 
255 G4VPhysicalVolume* XrayFluoDetectorConstruction::ConstructApparate()
256 {
257  // complete the apparate parameters definition
258 
259  //ComputeApparateParameters();
260 
261  //world and associated navigator
262 
263  solidWorld = new G4Box("World", //its name
264  WorldSizeXY/2,WorldSizeXY/2,WorldSizeZ/2); //its size
265 
266  logicWorld = new G4LogicalVolume(solidWorld, //its solid
267  defaultMaterial, //its material
268  "World"); //its name
269  physiWorld = new G4PVPlacement(0, //no rotation
270  G4ThreeVector(), //at (0,0,0)
271  "World", //its name
272  logicWorld, //its logical volume
273  0, //its mother volume
274  false, //no boolean operation
275  0); //copy number
276 
277  aNavigator->SetWorldVolume(physiWorld);
278 
279 
280  //HPGeDetector
281 
282  if (!phaseSpaceFlag) {
283 
284  solidHPGe = 0; physiHPGe = 0; logicHPGe=0;
285  solidPixel=0; logicPixel=0; physiPixel=0;
286 
287  if (DeviceThickness > 0.)
288  {
289  solidHPGe = new G4Box("HPGeDetector", //its name
290  DeviceSizeX/2,DeviceSizeY/2,DeviceThickness/2);//size
291 
292 
293  logicHPGe = new G4LogicalVolume(solidHPGe, //its solid
294  defaultMaterial, //its material
295  "HPGeDetector"); //its name
296 
297  zRotPhiHPGe.rotateX(PhiHPGe);
298  G4double x,y,z;
299  z = DistDe * std::cos(ThetaHPGe);
300  y =DistDe * std::sin(ThetaHPGe);
301  x = 0.*cm;
302  physiHPGe = new G4PVPlacement(G4Transform3D(zRotPhiHPGe,G4ThreeVector(x,y,z)),
303  "HPGeDetector", //its name
304  logicHPGe, //its logical volume
305  physiWorld, //its mother volume
306  false, //no boolean operation
307  0); //copy number
308  }
309  // Pixel
310 
311 
312 
313 
314  for ( G4int j=0; j < NbOfPixelColumns ; j++ )
315  { for ( G4int i=0; i < NbOfPixelRows ; i++ )
316  {
317  solidPixel=0; logicPixel=0; physiPixel=0;
318  if (PixelThickness > 0.)
319  solidPixel = new G4Box("Pixel",
320  PixelSizeXY/2,PixelSizeXY/2, PixelThickness/2);
321 
322  logicPixel = new G4LogicalVolume(solidPixel,
323  pixelMaterial, //its material
324  "Pixel"); //its name
325 
326  /*
327  zRotPhiHPGe.rotateX(PhiHPGe);
328  G4double x,y,z;
329  z = DistDe * std::cos(ThetaHPGe);
330  y =DistDe * std::sin(ThetaHPGe);
331  x = 0.*cm;*/
332  physiPixel = new G4PVPlacement(0,
333  G4ThreeVector(0,
334  i*PixelSizeXY,
335  j*PixelSizeXY ),
336  "Pixel",
337  logicPixel, //its logical volume
338  physiHPGe, //its mother volume
339  false, //no boolean operation
340  PixelCopyNb);//copy number
341 
342 
343 
344 
345 
346 
347  // OhmicNeg
348 
349  solidOhmicNeg=0; logicOhmicNeg=0; physiOhmicNeg=0;
350 
351  if (OhmicNegThickness > 0.)
352  { solidOhmicNeg = new G4Box("OhmicNeg", //its name
353  PixelSizeXY/2,PixelSizeXY/2,OhmicNegThickness/2);
354 
355  logicOhmicNeg = new G4LogicalVolume(solidOhmicNeg, //its solid
356  OhmicNegMaterial, //its material
357  "OhmicNeg"); //its name
358 
359  physiOhmicNeg = new G4PVPlacement(0,
361  (0.,
362  0.,
363  (PixelThickness+OhmicNegThickness)/2),
364  "OhmicNeg", //its name
365  logicOhmicNeg, //its logical volume
366  physiHPGe, //its mother
367  false, //no boulean operat
368  PixelCopyNb); //copy number
369 
370  }
371  // OhmicPos
372  solidOhmicPos=0; logicOhmicPos=0; physiOhmicPos=0;
373 
374  if (OhmicPosThickness > 0.)
375  { solidOhmicPos = new G4Box("OhmicPos", //its name
376  PixelSizeXY/2,PixelSizeXY/2,OhmicPosThickness/2);
377 
378  logicOhmicPos = new G4LogicalVolume(solidOhmicPos, //its solid
379  OhmicPosMaterial, //its material
380  "OhmicPos"); //its name
381 
382  physiOhmicPos = new G4PVPlacement(0,
383  G4ThreeVector(0.,
384  0.,
385  (-PixelThickness-OhmicPosThickness)/2),
386  "OhmicPos",
387  logicOhmicPos,
388  physiHPGe,
389  false,
390  PixelCopyNb);
391 
392  }
393 
395  // OhmicPos
396  solidWindow=0; logicWindow=0; physiWindow=0;
397 
398  if (windowThickness > 0.)
399  { solidWindow = new G4Box("Window", //its name
400  PixelSizeXY/2,PixelSizeXY/2,windowThickness/2);
401 
402  logicWindow = new G4LogicalVolume(solidWindow, //its solid
403  windowMaterial, //its material
404  "Window"); //its name
405 
406  physiWindow = new G4PVPlacement(0,
407  G4ThreeVector(0.,
408  0.,
409  ((-PixelThickness-windowThickness)/2)
410  -OhmicPosThickness),
411  "OhmicWindow",
412  logicWindow,
413  physiHPGe,
414  false,
415  PixelCopyNb);
416 
417  }
418 
419 
420 
421  PixelCopyNb += PixelCopyNb;
422  G4cout << "PixelCopyNb: " << PixelCopyNb << G4endl;
423  }
424 
425  }
426 
427  }
428 
429  //Sample
430 
431  if (sampleGranularity) {
432 
433  solidSample=0; logicSample=0; physiSample=0;
434  if (SampleThickness > 0.)
435  {
436  solidSample = new G4Box("Sample", //its name
437  SampleSizeXY/2,SampleSizeXY/2,SampleThickness/2);//size
438 
439  logicSample= new G4LogicalVolume(solidSample, //its solid
440  defaultMaterial, //its material
441  "Sample"); //its name
442 
443  physiSample = new G4PVPlacement(0, //no rotation
444  G4ThreeVector(), //at (0,0,0)
445  "Sample", //its name
446  logicSample, //its logical volume
447  physiWorld, //its mother volume
448  false, //no boolean operation
449  0); //copy number
450 
451  }
452 
453 
454 
455 
456  G4int nbOfGrainsX = ((G4int)(SampleSizeXY/grainDia)) -1 ;
457 
458  // y dim of a max density plane is 2rn-(n-1)ar, wehere a = (1-(std::sqrt(3)/2)), n is
459  // number of rows and r the radius of the grain. so the Y-dim of the sample must
460  // be greater or equal to this. It results that nmust be <= (SampleY-a)/(1-a).
461  // Max Y shift of the planes superimposing along Z axis is minor (2/std::sqrt(3)r)
462 
463  G4double a = (1.-(std::sqrt(3.)/2.));
464  G4int nbOfGrainsY = (G4int) ( ((SampleSizeXY/(grainDia/2.)) -a)/(2.-a) ) -1;
465 
466  // same for the z axis, but a = 2 * (std::sqrt(3) - std::sqrt(2))/std::sqrt(3)
467 
468  G4double b = 2. * (std::sqrt(3.) - std::sqrt(2.))/std::sqrt(3.);
469  G4int nbOfGrainsZ = (G4int) ( ((SampleThickness/(grainDia/2.)) -b)/(2.-b) )-1;
470 
471  if (SampleThickness > 0.){
472 
473  solidGrain=0; logicGrain=0; physiGrain=0;
474  solidGrain = new G4Sphere("Grain",0.,
475  grainDia/2,0., twopi, 0., pi);
476 
477  logicGrain = new G4LogicalVolume(solidGrain,
478  sampleMaterial, //its material
479  "Grain"); //its name
480  G4ThreeVector grainPosition;
481  G4double grainInitPositionX = 0;
482  G4double grainInitPositionY = 0;
483  G4double grainInitPositionZ = (-1.*SampleThickness/2.+grainDia/2.);
484  G4double grainStepX = grainDia = 0;
485  G4double grainStepY = grainDia*(1.-(0.5-(std::sqrt(3.)/4.)));
486  G4double grainStepZ = grainDia*std::sqrt(2./3.);
487 
488  for ( G4int k=0; k < nbOfGrainsZ ; k++ ) {
489  for ( G4int j=0; j < nbOfGrainsY ; j++ ) {
490  for ( G4int i=0; i < nbOfGrainsX ; i++ ) {
491 
492  // Now we identify the layer and the row where the grain is , to place it in the right position
493 
494 
495 
496  if (k%3 == 0) { // first or (4-multiple)th layer: structure is ABCABC
497  grainInitPositionY = (-1.*SampleSizeXY/2.+grainDia/2.);
498  if (j%2 ==0) { //first or (3-multiple)th row
499  grainInitPositionX = (-1.*SampleSizeXY/2.+grainDia/2.);
500  }
501 
502  else if ( ((j+1) % 2) == 0 ) {
503  grainInitPositionX = (-1.*SampleSizeXY/2.+ grainDia);
504  }
505 
506  }
507  else if ( ((k+2) % 3) == 0 ) { // B-layer
508 
509  grainInitPositionY = ( (-1.*SampleSizeXY/2.) + (grainDia/2.)*(1. + (1./std::sqrt(3.)) ) );
510 
511  if (j%2 ==0) { //first or (3-multiple)th row
512  grainInitPositionX = (-1.*SampleSizeXY/2.+grainDia);
513  }
514 
515  else if ( (j+1)%2 == 0 ) {
516  grainInitPositionX = (-1.*SampleSizeXY/2.+grainDia/2);
517  }
518 
519  }
520 
521  else if ( (k+1)%3 == 0 ) { // B-layer
522 
523  grainInitPositionY = (-1.*SampleSizeXY/2.+(grainDia/2.)*(1.+2./std::sqrt(3.)) );
524 
525  if (j%2 ==0) { //first or (3-multiple)th row
526  grainInitPositionX = (-1.*SampleSizeXY/2.+grainDia/2.);
527  }
528 
529  else if ( (j+1)%2 == 0 ) {
530  grainInitPositionX = (-1.*SampleSizeXY/2.+grainDia);
531  }
532 
533  }
534 
535  physiGrain = new G4PVPlacement(0,
536  G4ThreeVector( grainInitPositionX + i*grainStepX,
537  grainInitPositionY + j*grainStepY,
538  grainInitPositionZ + k*grainStepZ),
539  "Grain",
540  logicGrain, //its logical volume
541  physiSample, //its mother volume
542  false, //no boolean operation
543  grainCopyNb);//copy number
544 
545  grainCopyNb = grainCopyNb +1;
546  }
547  }
548  }
549  }
550  }
551  else {
552 
553  solidSample=0; logicSample=0; physiSample=0;
554  if (SampleThickness > 0.)
555  {
556  solidSample = new G4Box("Sample", //its name
557  SampleSizeXY/2,SampleSizeXY/2,SampleThickness/2);//size
558 
559  logicSample= new G4LogicalVolume(solidSample, //its solid
560  sampleMaterial, //its material
561  "Sample"); //its name
562 
563  physiSample = new G4PVPlacement(0, //no rotation
564  G4ThreeVector(), //at (0,0,0)
565  "Sample", //its name
566  logicSample, //its logical volume
567  physiWorld, //its mother volume
568  false, //no boolean operation
569  0); //copy number
570 
571  }
572  }
573 
574  if (!phaseSpaceFlag) {
575  //Diaphragm1
576 
577  solidDia1 = 0; physiDia1 = 0; logicDia1=0;
578 
579  if (Dia1Thickness > 0.)
580  {
581  solidDia1 = new G4Tubs("Diaphragm1", //its name
582  DiaInnerSize/2,
583  Dia1SizeXY/2,
584  Dia1Thickness/2,
585  0,
586  360);//size
587 
588 
589  logicDia1 = new G4LogicalVolume(solidDia1, //its solid
590  Dia1Material, //its material
591  "Diaphragm1"); //its name
592 
593  zRotPhiDia1.rotateX(AlphaDia1);
594  G4double x,y,z;
595  z = DistDia * std::cos(ThetaDia1);
596  y =DistDia * std::sin(ThetaDia1);
597  x = 0.*cm;
598  physiDia1 = new G4PVPlacement(G4Transform3D(zRotPhiDia1,G4ThreeVector(x,y,z)),
599  "Diaphragm1", //its name
600  logicDia1, //its logical volume
601  physiWorld, //its mother volume
602  false, //no boolean operation
603  0); //copy number
604  }
605 
606  //Diaphragm3
607 
608  solidDia3 = 0; physiDia3 = 0; logicDia3 =0;
609 
610  if (Dia3Thickness > 0.)
611  {
612  solidDia3 = new G4Tubs("Diaphragm3",
613  Dia3InnerSize/2,
614  Dia3SizeXY/2,
615  Dia3Thickness/2,
616  0,
617  360);
618 
619 
620  logicDia3 = new G4LogicalVolume(solidDia3, //its solid
621  Dia3Material, //its material
622  "Diaphragm3"); //its name
623 
624  zRotPhiDia3.rotateX(AlphaDia3);
625  G4double x,y,z;
626  z = Dia3Dist * std::cos(ThetaDia3);
627  y =Dia3Dist * std::sin(ThetaDia3);
628  x = 0.*cm;
629  physiDia3 = new G4PVPlacement(G4Transform3D(zRotPhiDia3,G4ThreeVector(x,y,z)), "Diaphragm3", //its name
630  logicDia3, //its logical volume
631  physiWorld, //its mother volume
632  false, //no boolean operation
633  0); //copy number
634  }
635  }
636 
637  if (!phaseSpaceFlag) {
638 
640 
641 
642  if(!HPGeSD)
643  {
644  HPGeSD = new XrayFluoSD ("HPGeSD",this);
645  SDman->AddNewDetector(HPGeSD);
646  }
647 
648 
649  if (logicPixel)
650  {
651  logicPixel->SetSensitiveDetector(HPGeSD);
652  }
653  }
654  // cut per region
655 
656 // logicSample->SetRegion(sampleRegion);
657 // sampleRegion->AddRootLogicalVolume(logicSample);
658 
659 
660 
661  // Visualization attributes
662 
664  G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
665  G4VisAttributes * yellow= new G4VisAttributes( G4Colour(255/255. ,255/255. ,51/255. ));
666  G4VisAttributes * red= new G4VisAttributes( G4Colour(255/255. , 0/255. , 0/255. ));
667  G4VisAttributes * blue= new G4VisAttributes( G4Colour(0/255. , 0/255. , 255/255. ));
668  G4VisAttributes * grayc= new G4VisAttributes( G4Colour(128/255. , 128/255. , 128/255. ));
669  G4VisAttributes * lightGray= new G4VisAttributes( G4Colour(178/255. , 178/255. , 178/255. ));
670  G4VisAttributes * green= new G4VisAttributes( G4Colour(0/255. , 255/255. , 0/255. ));
671 
672  yellow->SetVisibility(true);
673  yellow->SetForceSolid(true);
674  red->SetVisibility(true);
675  red->SetForceSolid(true);
676  blue->SetVisibility(true);
677  green->SetVisibility(true);
678  green->SetForceSolid(true);
679  grayc->SetVisibility(true);
680  grayc->SetForceSolid(true);
681  lightGray->SetVisibility(true);
682  lightGray->SetForceSolid(true);
683  simpleBoxVisAtt->SetVisibility(true);
684  if (!phaseSpaceFlag) {
685  logicPixel->SetVisAttributes(red); //modified!!!
686  logicHPGe->SetVisAttributes(blue);
687 
688  logicDia1->SetVisAttributes(lightGray);
689  logicDia3->SetVisAttributes(lightGray);
690 
691  logicOhmicNeg->SetVisAttributes(yellow);
692  logicOhmicPos->SetVisAttributes(yellow);
693 
694  logicWindow->SetVisAttributes(green);
695 
696  }
697  logicSample->SetVisAttributes(simpleBoxVisAtt);
698 
699  if (sampleGranularity) logicSample->SetVisAttributes(simpleBoxVisAtt); // mandatory
700 
701 
702 
703  if (sampleGranularity) logicGrain->SetVisAttributes(grayc);
704 
705  //always return the physical World
706 
708 
709  return physiWorld;
710 }
711 
712 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
713 
715 {
716  G4cout << "-----------------------------------------------------------------------"
717  << G4endl
718  << "The sample is a box whose size is: "
719  << G4endl
720  << SampleThickness/cm
721  << " cm * "
722  << SampleSizeXY/cm
723  << " cm * "
724  << SampleSizeXY/cm
725  << " cm"
726  << G4endl
727  <<" Material: " << logicSample->GetMaterial()->GetName()
728  <<G4endl;
729  if (!phaseSpaceFlag) {
730  G4cout <<"The Detector is a slice " << DeviceThickness/(1.e-6*m) << " micron thick of " << pixelMaterial->GetName()
731  <<G4endl
732  << "The Anode is a slice " << OhmicPosThickness/mm << "mm thick of "<< OhmicPosMaterial->GetName()
733  <<G4endl;
734  }
735  G4cout <<"-------------------------------------------------------------------------"
736  << G4endl;
737 }
738 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
739 
741 {
742 
743  if (solidPixel) delete solidPixel;
744  if (logicPixel) delete logicPixel;
745  if (physiPixel) delete physiPixel;
746  if (solidOhmicNeg) delete solidOhmicNeg;
747  if (logicOhmicNeg) delete logicOhmicNeg;
748  if (physiOhmicNeg) delete physiOhmicNeg;
749  if (solidOhmicPos) delete solidOhmicPos;
750  if (logicOhmicPos) delete logicOhmicPos;
751  if (physiOhmicPos) delete physiOhmicPos;
752  if (solidHPGe) delete solidHPGe;
753  if (logicHPGe) delete logicHPGe;
754  if (physiHPGe) delete physiHPGe;
755 
756  if (sampleRegion) sampleRegion->RemoveRootLogicalVolume(logicSample);
757  if (solidSample) delete solidSample;
758  if (logicSample) delete logicSample;
759  if (physiSample) delete physiSample;
760 
761  if (solidDia1) delete solidDia1;
762  if (logicDia1) delete logicDia1;
763  if (physiDia1) delete physiDia1;
764  if (solidDia3) delete solidDia3;
765  if (logicDia3) delete logicDia3;
766  if (physiDia3) delete physiDia3;
767 
768  if (solidWorld) delete solidWorld;
769  if (logicWorld) delete logicWorld;
770  if (physiWorld) delete physiWorld;
771 
772  zRotPhiHPGe.rotateX(-1.*PhiHPGe);
773  zRotPhiDia1.rotateX(-1.*AlphaDia1);
774  zRotPhiDia3.rotateX(-1.*AlphaDia3);
775  G4RunManager::GetRunManager()->DefineWorldVolume(ConstructApparate());
776 
777 }
778 
779 
781 {
782  if (sampleGranularity) {
783  delete solidGrain;
784  delete logicGrain;
785  delete physiGrain;
786  }
787 
788 }
789 
791 {
792 
793 
794 
795  G4double z = DistDe * std::cos(ThetaHPGe);
796  G4double y = DistDe * std::sin(ThetaHPGe);
797  G4double x = 0.*cm;
798 
799  G4ThreeVector position(x,y,z);
800 
801  return position;
802 
803 }
804 
806 {
807 
808 
809  G4cout << "Material Change in Progress " << newMaterial << G4endl;
810  sampleMaterial = materials->GetMaterial(newMaterial);
811  logicSample->SetMaterial(sampleMaterial);
813 
814 }
815 
816 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
817 
818 
819 
820 
821 
822 
823 
824 
825 
826 
827