65 XrayFluoPlaneDetectorConstruction::XrayFluoPlaneDetectorConstruction()
66 : detectorType(0),planeGranularity(false), DeviceSizeX(0),
67 DeviceSizeY(0),DeviceThickness(0),
68 solidWorld(0),logicWorld(0),physiWorld(0),
69 solidHPGe(0),logicHPGe(0),physiHPGe(0),
70 solidScreen(0),logicScreen(0),physiScreen(0),
71 solidPlane (0),logicPlane(0),physiPlane (0),
72 solidOhmicPos(0),logicOhmicPos(0), physiOhmicPos(0),
73 solidOhmicNeg(0),logicOhmicNeg(0), physiOhmicNeg(0),
74 solidPixel(0),logicPixel(0), physiPixel(0),
75 screenMaterial(0),OhmicPosMaterial(0), OhmicNegMaterial(0),
76 pixelMaterial(0),planeMaterial(0),
77 defaultMaterial(0),HPGeSD(0)
82 DefineDefaultMaterials();
86 NbOfPixels = NbOfPixelRows*NbOfPixelColumns;
88 PixelThickness = 3.5 *
mm;
93 ContactSizeXY = 5 *
cm;
94 planeThickness = 5 *
cm;
97 OhmicNegThickness = 0.005*
mm;
98 OhmicPosThickness = 0.005*
mm;
100 screenThickness = 5 *
mm;
102 ThetaHPGe = 0. *
deg;
108 distScreen = DistDe + (screenThickness+PixelThickness)/2+OhmicPosThickness ;
115 G4String defaultDetectorType =
"sili";
116 ComputeApparateParameters();
117 SetDetectorType(defaultDetectorType);
122 G4cout <<
"XrayFluoPlaneDetectorConstruction created" <<
G4endl;
146 else if (type==
"hpge")
153 execp << type +
"detector type unknown";
154 G4Exception(
"XrayFluoPlaneDetectorConstruction::SetDetectorType()",
"example-xray_fluorescence03",
171 delete detectorMessenger;
173 G4cout <<
"XrayFluoPlaneDetectorConstruction deleted" <<
G4endl;
180 return ConstructApparate();
184 void XrayFluoPlaneDetectorConstruction::DefineDefaultMaterials()
190 planeMaterial = materials->
GetMaterial(
"Anorthosite");
193 OhmicPosMaterial = materials->
GetMaterial(
"G4_Cu");
194 OhmicNegMaterial = materials->
GetMaterial(
"G4_Pb");
195 defaultMaterial = materials->
GetMaterial(
"G4_Galactic");
208 solidWorld =
new G4Box(
"World",
209 WorldSizeXY/2,WorldSizeXY/2,WorldSizeZ/2);
224 solidHPGe = 0; physiHPGe = 0; logicHPGe=0;
225 solidPixel=0; logicPixel=0; physiPixel=0;
227 if (DeviceThickness > 0.)
229 solidHPGe =
new G4Box(
"HPGeDetector",
230 DeviceSizeX/2,DeviceSizeY/2,DeviceThickness/2);
256 for (
G4int j=0; j < NbOfPixelColumns ; j++ )
257 {
for (
G4int i=0; i < NbOfPixelRows ; i++ )
259 solidPixel=0; logicPixel=0; physiPixel=0;
260 if (PixelThickness > 0.)
261 solidPixel =
new G4Box(
"Pixel",
262 PixelSizeXY/2,PixelSizeXY/2, PixelThickness/2);
291 solidOhmicNeg=0; logicOhmicNeg=0; physiOhmicNeg=0;
293 if (OhmicNegThickness > 0.)
294 { solidOhmicNeg =
new G4Box(
"OhmicNeg",
295 PixelSizeXY/2,PixelSizeXY/2,OhmicNegThickness/2);
305 (PixelThickness+OhmicNegThickness)/2),
314 solidOhmicPos=0; logicOhmicPos=0; physiOhmicPos=0;
316 if (OhmicPosThickness > 0.)
317 { solidOhmicPos =
new G4Box(
"OhmicPos",
318 PixelSizeXY/2,PixelSizeXY/2,OhmicPosThickness/2);
327 (-PixelThickness-OhmicPosThickness)/2),
336 PixelCopyNb += PixelCopyNb;
344 if (DeviceThickness > 0.)
346 solidScreen =
new G4Box(
"DetectorScreen",
347 screenSizeXY/2,screenSizeXY/2,screenThickness/2);
370 if (planeGranularity) {
372 solidPlane=0; logicPlane=0; physiPlane=0;
373 if (planeThickness > 0.)
375 solidPlane =
new G4Box(
"Plane",
376 planeSizeXY/2,planeSizeXY/2,planeThickness/2);
395 G4int nbOfGrainsX = ((
G4int)(planeSizeXY/grainDia)) -1 ;
403 G4int nbOfGrainsY = (
G4int) ( ((planeSizeXY/(grainDia/2.)) -a)/(2.-
a) ) -1;
407 G4double b = 2. * (std::sqrt(3.) - std::sqrt(2.))/std::sqrt(3.);
408 G4int nbOfGrainsZ = (
G4int) ( ((planeThickness/(grainDia/2.)) -
b)/(2.-b) )-1;
410 if (planeThickness > 0.){
412 solidGrain=0; logicGrain=0; physiGrain=0;
413 solidGrain =
new G4Sphere(
"Grain",0.,
422 G4double grainInitPositionZ = (-1.*planeThickness/2.+grainDia/2.);
424 G4double grainStepY = grainDia*(1.-(0.5-(std::sqrt(3.)/4.)));
425 G4double grainStepZ = grainDia*std::sqrt(2./3.);
427 for (
G4int k=0; k < nbOfGrainsZ ; k++ ) {
428 for (
G4int j=0; j < nbOfGrainsY ; j++ ) {
429 for (
G4int i=0; i < nbOfGrainsX ; i++ ) {
436 grainInitPositionY = (-1.*planeSizeXY/2.+grainDia/2.);
438 grainInitPositionX = (-1.*planeSizeXY/2.+grainDia/2.);
441 else if ( ((j+1) % 2) == 0 ) {
442 grainInitPositionX = (-1.*planeSizeXY/2.+ grainDia);
446 else if ( ((k+2) % 3) == 0 ) {
448 grainInitPositionY = ( (-1.*planeSizeXY/2.) + (grainDia/2.)*(1. + (1./std::sqrt(3.)) ) );
451 grainInitPositionX = (-1.*planeSizeXY/2.+grainDia);
454 else if ( (j+1)%2 == 0 ) {
455 grainInitPositionX = (-1.*planeSizeXY/2.+grainDia/2);
460 else if ( (k+1)%3 == 0 ) {
462 grainInitPositionY = (-1.*planeSizeXY/2.+(grainDia/2.)*(1.+2./std::sqrt(3.)) );
465 grainInitPositionX = (-1.*planeSizeXY/2.+grainDia/2.);
468 else if ( (j+1)%2 == 0 ) {
469 grainInitPositionX = (-1.*planeSizeXY/2.+grainDia);
476 grainInitPositionY + j*grainStepY,
477 grainInitPositionZ + k*grainStepZ),
484 grainCopyNb = grainCopyNb +1;
492 solidPlane=0; logicPlane=0; physiPlane=0;
493 if (planeThickness > 0.)
495 solidPlane =
new G4Box(
"Plane",
496 planeSizeXY/2,planeSizeXY/2,planeThickness/2);
561 if (HPGeSD.
Get() == 0)
575 G4cout <<
"-----------------------------------------------------------------------"
577 <<
"The plane is a box whose size is: "
588 <<
"The Detector is a slice " << DeviceThickness/(1.e-6*
m) <<
" micron thick of " << pixelMaterial->
GetName()
592 <<
"-------------------------------------------------------------------------"
604 zRotPhiHPGe.
rotateX(-1.*PhiHPGe);
613 if (planeGranularity) {
static constexpr double mm
G4Material * GetMaterial() const
std::ostringstream G4ExceptionDescription
CLHEP::Hep3Vector G4ThreeVector
~XrayFluoPlaneDetectorConstruction()
HepRotation & rotateX(double delta)
std::vector< ExP01TrackerHit * > a
const G4String & GetName() const
void ConstructSDandField()
XrayFluoVDetectorType * GetDetectorType() const
void SetDetectorType(G4String type)
static XrayFluoPlaneDetectorConstruction * GetInstance()
void SetForceSolid(G4bool=true)
static XrayFluoNistMaterials * GetInstance()
static constexpr double twopi
void PrintApparateParameters()
static XrayFluoSiLiDetectorType * GetInstance()
G4GLOB_DLL std::ostream G4cout
void DeleteGrainObjects()
static constexpr double m
void SetVisibility(G4bool=true)
static constexpr double cm
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()
static G4SDManager * GetSDMpointer()
static XrayFluoHPGeDetectorType * GetInstance()
G4VPhysicalVolume * Construct()
void OpenGeometry(G4VPhysicalVolume *vol=0)
static constexpr double pi
static constexpr double deg
void SetMaterial(G4Material *pMaterial)
void Put(const value_type &val) const
static const G4VisAttributes & GetInvisible()
void SetPlaneMaterial(G4String newMaterial)
void SetVisAttributes(const G4VisAttributes *pVA)