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)
91 DefineDefaultMaterials();
95 NbOfPixels = NbOfPixelRows*NbOfPixelColumns;
96 PixelSizeXY = std::sqrt(40.) *
mm;
97 PixelThickness = 2.7 *
mm;
102 ContactSizeXY = PixelSizeXY;
103 SampleThickness = 4 *
mm;
104 SampleSizeXY = 3. *
cm;
105 Dia1Thickness = 1. *
mm;
106 Dia3Thickness = 1. *
mm;
111 DiaInnerSize = 2.9 *
cm;
114 OhmicNegThickness = 1e-6*
cm;
115 OhmicPosThickness = 1e-6*
cm;
116 windowThickness = 0.008 *
cm;
117 ThetaHPGe = 135. *
deg;
118 PhiHPGe = 225. *
deg;
120 ThetaDia1 = 135. *
deg;
122 AlphaDia1 = 225. *
deg;
124 AlphaDia3 = 180. *
deg;
125 Dia3Dist = 66.5 *
mm;
126 Dia3InnerSize = 1. *
mm;
127 ThetaDia3 = 180. *
deg;
131 DistDe =DistDia+ (Dia1Thickness
132 +PixelThickness)/2+OhmicPosThickness+windowThickness ;
137 G4String defaultDetectorType =
"sili";
138 ComputeApparateParameters();
143 if (!phaseSpaceFlag) SetDetectorType(defaultDetectorType);
149 G4cout <<
"XrayFluoDetectorConstruction created" <<
G4endl;
173 else if (type==
"hpge")
184 execp << type +
"detector type unknown";
185 G4Exception(
"XrayFluoDataSet::LoadData()",
"example-xray_fluorescence06",
200 delete detectorMessenger;
202 G4cout <<
"XrayFluoDetectorConstruction deleted" <<
G4endl;
209 return ConstructApparate();
213 void XrayFluoDetectorConstruction::DefineDefaultMaterials()
219 sampleMaterial = materials->
GetMaterial(
"Dolorite");
221 Dia3Material = materials->
GetMaterial(
"G4_Galactic");
224 OhmicPosMaterial = materials->
GetMaterial(
"G4_Ni");
225 OhmicNegMaterial = materials->
GetMaterial(
"G4_Pb");
226 defaultMaterial = materials->
GetMaterial(
"G4_Galactic");
233 if (!phaseSpaceFlag) {
237 OhmicPosMaterial = materials->
GetMaterial(
"G4_Galactic");
240 OhmicPosThickness = val;
242 OhmicPosMaterial = materials->
GetMaterial(
"G4_Ni");
247 G4cout <<
"Not available in this configuration" <<
G4endl;
263 solidWorld =
new G4Box(
"World",
264 WorldSizeXY/2,WorldSizeXY/2,WorldSizeZ/2);
282 if (!phaseSpaceFlag) {
284 solidHPGe = 0; physiHPGe = 0; logicHPGe=0;
285 solidPixel=0; logicPixel=0; physiPixel=0;
287 if (DeviceThickness > 0.)
289 solidHPGe =
new G4Box(
"HPGeDetector",
290 DeviceSizeX/2,DeviceSizeY/2,DeviceThickness/2);
299 z = DistDe * std::cos(ThetaHPGe);
300 y =DistDe * std::sin(ThetaHPGe);
314 for (
G4int j=0; j < NbOfPixelColumns ; j++ )
315 {
for (
G4int i=0; i < NbOfPixelRows ; i++ )
317 solidPixel=0; logicPixel=0; physiPixel=0;
318 if (PixelThickness > 0.)
319 solidPixel =
new G4Box(
"Pixel",
320 PixelSizeXY/2,PixelSizeXY/2, PixelThickness/2);
349 solidOhmicNeg=0; logicOhmicNeg=0; physiOhmicNeg=0;
351 if (OhmicNegThickness > 0.)
352 { solidOhmicNeg =
new G4Box(
"OhmicNeg",
353 PixelSizeXY/2,PixelSizeXY/2,OhmicNegThickness/2);
363 (PixelThickness+OhmicNegThickness)/2),
372 solidOhmicPos=0; logicOhmicPos=0; physiOhmicPos=0;
374 if (OhmicPosThickness > 0.)
375 { solidOhmicPos =
new G4Box(
"OhmicPos",
376 PixelSizeXY/2,PixelSizeXY/2,OhmicPosThickness/2);
385 (-PixelThickness-OhmicPosThickness)/2),
396 solidWindow=0; logicWindow=0; physiWindow=0;
398 if (windowThickness > 0.)
399 { solidWindow =
new G4Box(
"Window",
400 PixelSizeXY/2,PixelSizeXY/2,windowThickness/2);
409 ((-PixelThickness-windowThickness)/2)
421 PixelCopyNb += PixelCopyNb;
431 if (sampleGranularity) {
433 solidSample=0; logicSample=0; physiSample=0;
434 if (SampleThickness > 0.)
436 solidSample =
new G4Box(
"Sample",
437 SampleSizeXY/2,SampleSizeXY/2,SampleThickness/2);
456 G4int nbOfGrainsX = ((
G4int)(SampleSizeXY/grainDia)) -1 ;
464 G4int nbOfGrainsY = (
G4int) ( ((SampleSizeXY/(grainDia/2.)) -a)/(2.-
a) ) -1;
468 G4double b = 2. * (std::sqrt(3.) - std::sqrt(2.))/std::sqrt(3.);
469 G4int nbOfGrainsZ = (
G4int) ( ((SampleThickness/(grainDia/2.)) -
b)/(2.-b) )-1;
471 if (SampleThickness > 0.){
473 solidGrain=0; logicGrain=0; physiGrain=0;
474 solidGrain =
new G4Sphere(
"Grain",0.,
483 G4double grainInitPositionZ = (-1.*SampleThickness/2.+grainDia/2.);
485 G4double grainStepY = grainDia*(1.-(0.5-(std::sqrt(3.)/4.)));
486 G4double grainStepZ = grainDia*std::sqrt(2./3.);
488 for (
G4int k=0; k < nbOfGrainsZ ; k++ ) {
489 for (
G4int j=0; j < nbOfGrainsY ; j++ ) {
490 for (
G4int i=0; i < nbOfGrainsX ; i++ ) {
497 grainInitPositionY = (-1.*SampleSizeXY/2.+grainDia/2.);
499 grainInitPositionX = (-1.*SampleSizeXY/2.+grainDia/2.);
502 else if ( ((j+1) % 2) == 0 ) {
503 grainInitPositionX = (-1.*SampleSizeXY/2.+ grainDia);
507 else if ( ((k+2) % 3) == 0 ) {
509 grainInitPositionY = ( (-1.*SampleSizeXY/2.) + (grainDia/2.)*(1. + (1./std::sqrt(3.)) ) );
512 grainInitPositionX = (-1.*SampleSizeXY/2.+grainDia);
515 else if ( (j+1)%2 == 0 ) {
516 grainInitPositionX = (-1.*SampleSizeXY/2.+grainDia/2);
521 else if ( (k+1)%3 == 0 ) {
523 grainInitPositionY = (-1.*SampleSizeXY/2.+(grainDia/2.)*(1.+2./std::sqrt(3.)) );
526 grainInitPositionX = (-1.*SampleSizeXY/2.+grainDia/2.);
529 else if ( (j+1)%2 == 0 ) {
530 grainInitPositionX = (-1.*SampleSizeXY/2.+grainDia);
537 grainInitPositionY + j*grainStepY,
538 grainInitPositionZ + k*grainStepZ),
545 grainCopyNb = grainCopyNb +1;
553 solidSample=0; logicSample=0; physiSample=0;
554 if (SampleThickness > 0.)
556 solidSample =
new G4Box(
"Sample",
557 SampleSizeXY/2,SampleSizeXY/2,SampleThickness/2);
574 if (!phaseSpaceFlag) {
577 solidDia1 = 0; physiDia1 = 0; logicDia1=0;
579 if (Dia1Thickness > 0.)
581 solidDia1 =
new G4Tubs(
"Diaphragm1",
593 zRotPhiDia1.
rotateX(AlphaDia1);
595 z = DistDia * std::cos(ThetaDia1);
596 y =DistDia * std::sin(ThetaDia1);
608 solidDia3 = 0; physiDia3 = 0; logicDia3 =0;
610 if (Dia3Thickness > 0.)
612 solidDia3 =
new G4Tubs(
"Diaphragm3",
624 zRotPhiDia3.
rotateX(AlphaDia3);
626 z = Dia3Dist * std::cos(ThetaDia3);
627 y =Dia3Dist * std::sin(ThetaDia3);
637 if (!phaseSpaceFlag) {
684 if (!phaseSpaceFlag) {
716 G4cout <<
"-----------------------------------------------------------------------"
718 <<
"The sample is a box whose size is: "
720 << SampleThickness/cm
729 if (!phaseSpaceFlag) {
730 G4cout <<
"The Detector is a slice " << DeviceThickness/(1.e-6*
m) <<
" micron thick of " << pixelMaterial->
GetName()
732 <<
"The Anode is a slice " << OhmicPosThickness/
mm <<
"mm thick of "<< OhmicPosMaterial->
GetName()
735 G4cout <<
"-------------------------------------------------------------------------"
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;
757 if (solidSample)
delete solidSample;
758 if (logicSample)
delete logicSample;
759 if (physiSample)
delete physiSample;
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;
768 if (solidWorld)
delete solidWorld;
769 if (logicWorld)
delete logicWorld;
770 if (physiWorld)
delete physiWorld;
772 zRotPhiHPGe.
rotateX(-1.*PhiHPGe);
773 zRotPhiDia1.
rotateX(-1.*AlphaDia1);
774 zRotPhiDia3.
rotateX(-1.*AlphaDia3);
782 if (sampleGranularity) {
795 G4double z = DistDe * std::cos(ThetaHPGe);
796 G4double y = DistDe * std::sin(ThetaHPGe);
809 G4cout <<
"Material Change in Progress " << newMaterial <<
G4endl;
810 sampleMaterial = materials->
GetMaterial(newMaterial);
XrayFluoVDetectorType * GetDetectorType()
std::ostringstream G4ExceptionDescription
CLHEP::Hep3Vector G4ThreeVector
HepRotation & rotateX(double delta)
G4Material * GetMaterial() const
const G4String & GetName() const
void SetVisibility(G4bool)
void SetForceSolid(G4bool)
static XrayFluoDetectorConstruction * GetInstance()
static XrayFluoNistMaterials * GetInstance()
void SetOhmicPosThickness(G4double)
virtual void DefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
static XrayFluoSiLiDetectorType * GetInstance()
void SetDetectorType(G4String type)
void SetSampleMaterial(G4String newMaterial)
G4GLOB_DLL std::ostream G4cout
G4ThreeVector GetDetectorPosition()
G4VPhysicalVolume * Construct()
G4Material * GetMaterial(G4String)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
void AddNewDetector(G4VSensitiveDetector *aSD)
static G4RunManager * GetRunManager()
void DeleteGrainObjects()
static G4SDManager * GetSDMpointer()
~XrayFluoDetectorConstruction()
void SetWorldVolume(G4VPhysicalVolume *pWorld)
static const G4VisAttributes Invisible
static XrayFluoHPGeDetectorType * GetInstance()
void SetMaterial(G4Material *pMaterial)
void RemoveRootLogicalVolume(G4LogicalVolume *lv, G4bool scan=true)
void SetVisAttributes(const G4VisAttributes *pVA)
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector)
void PrintApparateParameters()