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