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)
96 DefineDefaultMaterials();
100 NbOfPixels = NbOfPixelRows*NbOfPixelColumns;
101 PixelSizeXY = std::sqrt(40.) *
mm;
102 PixelThickness = 2.7 *
mm;
107 ContactSizeXY = PixelSizeXY;
108 SampleThickness = 4 *
mm;
109 SampleSizeXY = 3. *
cm;
110 Dia1Thickness = 1. *
mm;
111 Dia3Thickness = 1. *
mm;
116 DiaInnerSize = 2.9 *
cm;
119 OhmicNegThickness = 1e-6*
cm;
120 OhmicPosThickness = 1e-6*
cm;
121 windowThickness = 0.008 *
cm;
122 ThetaHPGe = 135. *
deg;
123 PhiHPGe = 225. *
deg;
125 ThetaDia1 = 135. *
deg;
127 AlphaDia1 = 225. *
deg;
129 AlphaDia3 = 180. *
deg;
130 Dia3Dist = 66.5 *
mm;
131 Dia3InnerSize = 1. *
mm;
132 ThetaDia3 = 180. *
deg;
136 DistDe =DistDia+ (Dia1Thickness
137 +PixelThickness)/2+OhmicPosThickness+windowThickness ;
142 G4String defaultDetectorType =
"sili";
143 ComputeApparateParameters();
148 if (!phaseSpaceFlag) SetDetectorType(defaultDetectorType);
154 G4cout <<
"XrayFluoDetectorConstruction created" <<
G4endl;
179 else if (type==
"hpge")
190 execp << type +
"detector type unknown";
191 G4Exception(
"XrayFluoDataSet::LoadData()",
"example-xray_fluorescence06",
208 delete detectorMessenger;
210 G4cout <<
"XrayFluoDetectorConstruction deleted" <<
G4endl;
217 return ConstructApparate();
222 void XrayFluoDetectorConstruction::DefineDefaultMaterials()
228 sampleMaterial = materials->
GetMaterial(
"Dolorite");
230 Dia3Material = materials->
GetMaterial(
"G4_Galactic");
233 OhmicPosMaterial = materials->
GetMaterial(
"G4_Ni");
234 OhmicNegMaterial = materials->
GetMaterial(
"G4_Pb");
235 defaultMaterial = materials->
GetMaterial(
"G4_Galactic");
242 if (!phaseSpaceFlag) {
246 OhmicPosMaterial = materials->
GetMaterial(
"G4_Galactic");
249 OhmicPosThickness = val;
251 OhmicPosMaterial = materials->
GetMaterial(
"G4_Ni");
256 G4cout <<
"Not available in this configuration" <<
G4endl;
272 solidWorld =
new G4Box(
"World",
273 WorldSizeXY/2,WorldSizeXY/2,WorldSizeZ/2);
291 if (!phaseSpaceFlag) {
293 solidHPGe = 0; physiHPGe = 0; logicHPGe=0;
294 solidPixel=0; logicPixel=0; physiPixel=0;
296 if (DeviceThickness > 0.)
298 solidHPGe =
new G4Box(
"HPGeDetector",
299 DeviceSizeX/2,DeviceSizeY/2,DeviceThickness/2);
308 z = DistDe * std::cos(ThetaHPGe);
309 y =DistDe * std::sin(ThetaHPGe);
323 for (
G4int j=0; j < NbOfPixelColumns ; j++ )
324 {
for (
G4int i=0; i < NbOfPixelRows ; i++ )
326 solidPixel=0; logicPixel=0; physiPixel=0;
327 if (PixelThickness > 0.)
328 solidPixel =
new G4Box(
"Pixel",
329 PixelSizeXY/2,PixelSizeXY/2, PixelThickness/2);
358 solidOhmicNeg=0; logicOhmicNeg=0; physiOhmicNeg=0;
360 if (OhmicNegThickness > 0.)
361 { solidOhmicNeg =
new G4Box(
"OhmicNeg",
362 PixelSizeXY/2,PixelSizeXY/2,OhmicNegThickness/2);
372 (PixelThickness+OhmicNegThickness)/2),
381 solidOhmicPos=0; logicOhmicPos=0; physiOhmicPos=0;
383 if (OhmicPosThickness > 0.)
384 { solidOhmicPos =
new G4Box(
"OhmicPos",
385 PixelSizeXY/2,PixelSizeXY/2,OhmicPosThickness/2);
394 (-PixelThickness-OhmicPosThickness)/2),
405 solidWindow=0; logicWindow=0; physiWindow=0;
407 if (windowThickness > 0.)
408 { solidWindow =
new G4Box(
"Window",
409 PixelSizeXY/2,PixelSizeXY/2,windowThickness/2);
418 ((-PixelThickness-windowThickness)/2)
430 PixelCopyNb += PixelCopyNb;
440 if (sampleGranularity) {
442 solidSample=0; logicSample=0; physiSample=0;
443 if (SampleThickness > 0.)
445 solidSample =
new G4Box(
"Sample",
446 SampleSizeXY/2,SampleSizeXY/2,SampleThickness/2);
465 G4int nbOfGrainsX = ((
G4int)(SampleSizeXY/grainDia)) -1 ;
473 G4int nbOfGrainsY = (
G4int) ( ((SampleSizeXY/(grainDia/2.)) -a)/(2.-
a) ) -1;
477 G4double b = 2. * (std::sqrt(3.) - std::sqrt(2.))/std::sqrt(3.);
478 G4int nbOfGrainsZ = (
G4int) ( ((SampleThickness/(grainDia/2.)) -
b)/(2.-b) )-1;
480 if (SampleThickness > 0.){
482 solidGrain=0; logicGrain=0; physiGrain=0;
483 solidGrain =
new G4Sphere(
"Grain",0.,
492 G4double grainInitPositionZ = (-1.*SampleThickness/2.+grainDia/2.);
494 G4double grainStepY = grainDia*(1.-(0.5-(std::sqrt(3.)/4.)));
495 G4double grainStepZ = grainDia*std::sqrt(2./3.);
497 for (
G4int k=0; k < nbOfGrainsZ ; k++ ) {
498 for (
G4int j=0; j < nbOfGrainsY ; j++ ) {
499 for (
G4int i=0; i < nbOfGrainsX ; i++ ) {
506 grainInitPositionY = (-1.*SampleSizeXY/2.+grainDia/2.);
508 grainInitPositionX = (-1.*SampleSizeXY/2.+grainDia/2.);
511 else if ( ((j+1) % 2) == 0 ) {
512 grainInitPositionX = (-1.*SampleSizeXY/2.+ grainDia);
516 else if ( ((k+2) % 3) == 0 ) {
518 grainInitPositionY = ( (-1.*SampleSizeXY/2.) + (grainDia/2.)*(1. + (1./std::sqrt(3.)) ) );
521 grainInitPositionX = (-1.*SampleSizeXY/2.+grainDia);
524 else if ( (j+1)%2 == 0 ) {
525 grainInitPositionX = (-1.*SampleSizeXY/2.+grainDia/2);
530 else if ( (k+1)%3 == 0 ) {
532 grainInitPositionY = (-1.*SampleSizeXY/2.+(grainDia/2.)*(1.+2./std::sqrt(3.)) );
535 grainInitPositionX = (-1.*SampleSizeXY/2.+grainDia/2.);
538 else if ( (j+1)%2 == 0 ) {
539 grainInitPositionX = (-1.*SampleSizeXY/2.+grainDia);
546 grainInitPositionY + j*grainStepY,
547 grainInitPositionZ + k*grainStepZ),
554 grainCopyNb = grainCopyNb +1;
562 solidSample=0; logicSample=0; physiSample=0;
563 if (SampleThickness > 0.)
565 solidSample =
new G4Box(
"Sample",
566 SampleSizeXY/2,SampleSizeXY/2,SampleThickness/2);
583 if (!phaseSpaceFlag) {
586 solidDia1 = 0; physiDia1 = 0; logicDia1=0;
588 if (Dia1Thickness > 0.)
590 solidDia1 =
new G4Tubs(
"Diaphragm1",
602 zRotPhiDia1.
rotateX(AlphaDia1);
604 z = DistDia * std::cos(ThetaDia1);
605 y =DistDia * std::sin(ThetaDia1);
617 solidDia3 = 0; physiDia3 = 0; logicDia3 =0;
619 if (Dia3Thickness > 0.)
621 solidDia3 =
new G4Tubs(
"Diaphragm3",
633 zRotPhiDia3.
rotateX(AlphaDia3);
635 z = Dia3Dist * std::cos(ThetaDia3);
636 y =Dia3Dist * std::sin(ThetaDia3);
671 if (!phaseSpaceFlag) {
709 if (HPGeSD.
Get() == 0)
725 G4cout <<
"-----------------------------------------------------------------------"
727 <<
"The sample is a box whose size is: "
729 << SampleThickness/cm
738 if (!phaseSpaceFlag) {
739 G4cout <<
"The Detector is a slice " << DeviceThickness/(1.e-6*
m) <<
" micron thick of " << pixelMaterial->
GetName()
741 <<
"The Anode is a slice " << OhmicPosThickness/
mm <<
"mm thick of "<< OhmicPosMaterial->
GetName()
744 G4cout <<
"-------------------------------------------------------------------------"
759 zRotPhiHPGe.
rotateX(-1.*PhiHPGe);
760 zRotPhiDia1.
rotateX(-1.*AlphaDia1);
761 zRotPhiDia3.
rotateX(-1.*AlphaDia3);
771 if (sampleGranularity) {
783 G4double z = DistDe * std::cos(ThetaHPGe);
784 G4double y = DistDe * std::sin(ThetaHPGe);
797 G4cout <<
"Material Change in Progress " << newMaterial <<
G4endl;
798 sampleMaterial = materials->
GetMaterial(newMaterial);
static constexpr double mm
G4Material * GetMaterial() const
std::ostringstream G4ExceptionDescription
CLHEP::Hep3Vector G4ThreeVector
HepRotation & rotateX(double delta)
std::vector< ExP01TrackerHit * > a
G4ThreeVector GetDetectorPosition() const
const G4String & GetName() const
static XrayFluoDetectorConstruction * GetInstance()
void SetForceSolid(G4bool=true)
static XrayFluoNistMaterials * GetInstance()
static constexpr double twopi
void SetOhmicPosThickness(G4double)
XrayFluoVDetectorType * GetDetectorType() const
static XrayFluoSiLiDetectorType * GetInstance()
void SetDetectorType(G4String type)
void SetSampleMaterial(G4String newMaterial)
G4GLOB_DLL std::ostream G4cout
static constexpr double m
void SetVisibility(G4bool=true)
static constexpr double cm
void ConstructSDandField()
G4VPhysicalVolume * Construct()
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)
void AddNewDetector(G4VSensitiveDetector *aSD)
static G4RunManager * GetRunManager()
void DeleteGrainObjects()
static G4SDManager * GetSDMpointer()
~XrayFluoDetectorConstruction()
void SetWorldVolume(G4VPhysicalVolume *pWorld)
static XrayFluoHPGeDetectorType * GetInstance()
void OpenGeometry(G4VPhysicalVolume *vol=0)
static constexpr double pi
static constexpr double deg
void SetMaterial(G4Material *pMaterial)
void RemoveRootLogicalVolume(G4LogicalVolume *lv, G4bool scan=true)
void Put(const value_type &val) const
static const G4VisAttributes & GetInvisible()
void SetVisAttributes(const G4VisAttributes *pVA)
void PrintApparateParameters()