61 XrayFluoPlaneDetectorConstruction::XrayFluoPlaneDetectorConstruction()
62 : detectorType(0),planeGranularity(false), DeviceSizeX(0),
63 DeviceSizeY(0),DeviceThickness(0),
64 solidWorld(0),logicWorld(0),physiWorld(0),
65 solidHPGe(0),logicHPGe(0),physiHPGe(0),
66 solidScreen(0),logicScreen(0),physiScreen(0),
67 solidPlane (0),logicPlane(0),physiPlane (0),
68 solidOhmicPos(0),logicOhmicPos(0), physiOhmicPos(0),
69 solidOhmicNeg(0),logicOhmicNeg(0), physiOhmicNeg(0),
70 solidPixel(0),logicPixel(0), physiPixel(0),
71 screenMaterial(0),OhmicPosMaterial(0), OhmicNegMaterial(0),
72 pixelMaterial(0),planeMaterial(0),
73 defaultMaterial(0),HPGeSD(0)
78 DefineDefaultMaterials();
82 NbOfPixels = NbOfPixelRows*NbOfPixelColumns;
84 PixelThickness = 3.5 *
mm;
89 ContactSizeXY = 5 *
cm;
90 planeThickness = 5 *
cm;
93 OhmicNegThickness = 0.005*
mm;
94 OhmicPosThickness = 0.005*
mm;
96 screenThickness = 5 *
mm;
104 distScreen = DistDe + (screenThickness+PixelThickness)/2+OhmicPosThickness ;
111 G4String defaultDetectorType =
"sili";
112 ComputeApparateParameters();
113 SetDetectorType(defaultDetectorType);
118 G4cout <<
"XrayFluoPlaneDetectorConstruction created" <<
G4endl;
142 else if (type==
"hpge")
149 execp << type +
"detector type unknown";
150 G4Exception(
"XrayFluoPlaneDetectorConstruction::SetDetectorType()",
"example-xray_fluorescence03",
165 delete detectorMessenger;
167 G4cout <<
"XrayFluoPlaneDetectorConstruction deleted" <<
G4endl;
174 return ConstructApparate();
178 void XrayFluoPlaneDetectorConstruction::DefineDefaultMaterials()
184 planeMaterial = materials->
GetMaterial(
"Anorthosite");
187 OhmicPosMaterial = materials->
GetMaterial(
"G4_Cu");
188 OhmicNegMaterial = materials->
GetMaterial(
"G4_Pb");
189 defaultMaterial = materials->
GetMaterial(
"G4_Galactic");
202 solidWorld =
new G4Box(
"World",
203 WorldSizeXY/2,WorldSizeXY/2,WorldSizeZ/2);
218 solidHPGe = 0; physiHPGe = 0; logicHPGe=0;
219 solidPixel=0; logicPixel=0; physiPixel=0;
221 if (DeviceThickness > 0.)
223 solidHPGe =
new G4Box(
"HPGeDetector",
224 DeviceSizeX/2,DeviceSizeY/2,DeviceThickness/2);
250 for (
G4int j=0; j < NbOfPixelColumns ; j++ )
251 {
for (
G4int i=0; i < NbOfPixelRows ; i++ )
253 solidPixel=0; logicPixel=0; physiPixel=0;
254 if (PixelThickness > 0.)
255 solidPixel =
new G4Box(
"Pixel",
256 PixelSizeXY/2,PixelSizeXY/2, PixelThickness/2);
285 solidOhmicNeg=0; logicOhmicNeg=0; physiOhmicNeg=0;
287 if (OhmicNegThickness > 0.)
288 { solidOhmicNeg =
new G4Box(
"OhmicNeg",
289 PixelSizeXY/2,PixelSizeXY/2,OhmicNegThickness/2);
299 (PixelThickness+OhmicNegThickness)/2),
308 solidOhmicPos=0; logicOhmicPos=0; physiOhmicPos=0;
310 if (OhmicPosThickness > 0.)
311 { solidOhmicPos =
new G4Box(
"OhmicPos",
312 PixelSizeXY/2,PixelSizeXY/2,OhmicPosThickness/2);
321 (-PixelThickness-OhmicPosThickness)/2),
330 PixelCopyNb += PixelCopyNb;
338 if (DeviceThickness > 0.)
340 solidScreen =
new G4Box(
"DetectorScreen",
341 screenSizeXY/2,screenSizeXY/2,screenThickness/2);
364 if (planeGranularity) {
366 solidPlane=0; logicPlane=0; physiPlane=0;
367 if (planeThickness > 0.)
369 solidPlane =
new G4Box(
"Plane",
370 planeSizeXY/2,planeSizeXY/2,planeThickness/2);
389 G4int nbOfGrainsX = ((
G4int)(planeSizeXY/grainDia)) -1 ;
397 G4int nbOfGrainsY = (
G4int) ( ((planeSizeXY/(grainDia/2.)) -a)/(2.-
a) ) -1;
401 G4double b = 2. * (std::sqrt(3.) - std::sqrt(2.))/std::sqrt(3.);
402 G4int nbOfGrainsZ = (
G4int) ( ((planeThickness/(grainDia/2.)) -
b)/(2.-b) )-1;
404 if (planeThickness > 0.){
406 solidGrain=0; logicGrain=0; physiGrain=0;
407 solidGrain =
new G4Sphere(
"Grain",0.,
416 G4double grainInitPositionZ = (-1.*planeThickness/2.+grainDia/2.);
418 G4double grainStepY = grainDia*(1.-(0.5-(std::sqrt(3.)/4.)));
419 G4double grainStepZ = grainDia*std::sqrt(2./3.);
421 for (
G4int k=0; k < nbOfGrainsZ ; k++ ) {
422 for (
G4int j=0; j < nbOfGrainsY ; j++ ) {
423 for (
G4int i=0; i < nbOfGrainsX ; i++ ) {
430 grainInitPositionY = (-1.*planeSizeXY/2.+grainDia/2.);
432 grainInitPositionX = (-1.*planeSizeXY/2.+grainDia/2.);
435 else if ( ((j+1) % 2) == 0 ) {
436 grainInitPositionX = (-1.*planeSizeXY/2.+ grainDia);
440 else if ( ((k+2) % 3) == 0 ) {
442 grainInitPositionY = ( (-1.*planeSizeXY/2.) + (grainDia/2.)*(1. + (1./std::sqrt(3.)) ) );
445 grainInitPositionX = (-1.*planeSizeXY/2.+grainDia);
448 else if ( (j+1)%2 == 0 ) {
449 grainInitPositionX = (-1.*planeSizeXY/2.+grainDia/2);
454 else if ( (k+1)%3 == 0 ) {
456 grainInitPositionY = (-1.*planeSizeXY/2.+(grainDia/2.)*(1.+2./std::sqrt(3.)) );
459 grainInitPositionX = (-1.*planeSizeXY/2.+grainDia/2.);
462 else if ( (j+1)%2 == 0 ) {
463 grainInitPositionX = (-1.*planeSizeXY/2.+grainDia);
470 grainInitPositionY + j*grainStepY,
471 grainInitPositionZ + k*grainStepZ),
478 grainCopyNb = grainCopyNb +1;
486 solidPlane=0; logicPlane=0; physiPlane=0;
487 if (planeThickness > 0.)
489 solidPlane =
new G4Box(
"Plane",
490 planeSizeXY/2,planeSizeXY/2,planeThickness/2);
566 G4cout <<
"-----------------------------------------------------------------------"
568 <<
"The plane is a box whose size is: "
579 <<
"The Detector is a slice " << DeviceThickness/(1.e-6*
m) <<
" micron thick of " << pixelMaterial->
GetName()
583 <<
"-------------------------------------------------------------------------"
597 delete solidOhmicNeg;
598 delete logicOhmicNeg;
599 delete physiOhmicNeg;
600 delete solidOhmicPos;
601 delete logicOhmicPos;
602 delete physiOhmicPos;
613 zRotPhiHPGe.
rotateX(-1.*PhiHPGe);
620 if (planeGranularity) {
std::ostringstream G4ExceptionDescription
CLHEP::Hep3Vector G4ThreeVector
~XrayFluoPlaneDetectorConstruction()
HepRotation & rotateX(double delta)
G4Material * GetMaterial() const
XrayFluoVDetectorType * GetDetectorType()
const G4String & GetName() const
void SetVisibility(G4bool)
void SetDetectorType(G4String type)
void SetForceSolid(G4bool)
static XrayFluoPlaneDetectorConstruction * GetInstance()
static XrayFluoNistMaterials * GetInstance()
virtual void DefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
void PrintApparateParameters()
static XrayFluoSiLiDetectorType * GetInstance()
G4GLOB_DLL std::ostream G4cout
void DeleteGrainObjects()
G4Material * GetMaterial(G4String)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
void AddNewDetector(G4VSensitiveDetector *aSD)
static G4RunManager * GetRunManager()
static G4SDManager * GetSDMpointer()
static const G4VisAttributes Invisible
static XrayFluoHPGeDetectorType * GetInstance()
G4VPhysicalVolume * Construct()
void SetMaterial(G4Material *pMaterial)
void SetPlaneMaterial(G4String newMaterial)
void SetVisAttributes(const G4VisAttributes *pVA)
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector)