00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00035
00036
00059
00060
00061
00062
00063 #include "database/MJDatabase.hh"
00064 #include "geometry/MJGeometryCloverCrystal.hh"
00065 #include "geometry/MJGeometryGlobals.hh"
00066 #include "io/MJLogger.hh"
00067
00068
00069 #include "G4Material.hh"
00070
00071 #include "G4Tubs.hh"
00072 #include "G4Torus.hh"
00073 #include "G4Box.hh"
00074 #include "G4Sphere.hh"
00075
00076 #include "G4UnionSolid.hh"
00077 #include "G4IntersectionSolid.hh"
00078 #include "G4SubtractionSolid.hh"
00079
00080 #include "G4LogicalVolume.hh"
00081 #include "G4PVPlacement.hh"
00082
00083
00084 MJGeometryCloverCrystal::MJGeometryCloverCrystal( G4String serNum ) :
00085 serialNumber( serNum ), theDBcrystal(0), activeCrystalPhysical(0), theCrystalLogical(0)
00086
00087 {
00088 theDBcrystal = MJDatabase::GetCloverCrystal( serialNumber );
00089 ConstructCrystal();
00090 }
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 MJGeometryCloverCrystal::~MJGeometryCloverCrystal() {;}
00101
00102
00103 void MJGeometryCloverCrystal::ConstructCrystal() {
00104
00105
00106 G4double crystalRadius = theDBcrystal->GetCrystalRadius();
00107 G4double height = theDBcrystal->GetCrystalHeight();
00108 G4double cornerRadius = theDBcrystal->GetCornerRadius();
00109 G4double coreRadius = theDBcrystal->GetCoreRadius();
00110 G4double coreDepth = theDBcrystal->GetCoreDepth();
00111 G4double coreBubbleRadius = theDBcrystal->GetCoreBubbleRadius();
00112 G4double topDeficit = theDBcrystal->GetTopDeficit();
00113 G4double bottomDeficit = theDBcrystal->GetBottomDeficit();
00114 G4double rightDeficit = theDBcrystal->GetRightDeficit();
00115 G4double leftDeficit = theDBcrystal->GetLeftDeficit();
00116 G4Material *crystalMaterial = G4Material::GetMaterial( theDBcrystal->GetMaterialName() );
00117 if(!crystalMaterial) {
00118 MJLog(error) << "NULL pointer for G4Material: "
00119 << theDBcrystal->GetMaterialName() << endlog;
00120 MJLog(fatal);
00121 }
00122 G4double innerContactWidth = theDBcrystal->GetInnerContactWidth();
00123 G4Material *innerContactMaterial = G4Material::GetMaterial( theDBcrystal->GetInnerContactMaterialName() );
00124 if(!innerContactMaterial) {
00125 MJLog(error) << "NULL pointer for G4Material: "
00126 << theDBcrystal->GetInnerContactMaterialName()<<endlog;
00127 MJLog(fatal);
00128 }
00129 G4double innerDeadThickness = theDBcrystal->GetInnerDeadThickness();
00130 G4double outerDeadThickness = theDBcrystal->GetOuterDeadThickness();
00131
00132
00133 G4VisAttributes *deadLayerVisAtt = new G4VisAttributes( black );
00134 deadLayerVisAtt->SetVisibility( true );
00135 deadLayerVisAtt->SetForceWireframe( true );
00136
00137 G4VisAttributes *activeCrystalVisAtt = new G4VisAttributes( magenta );
00138 activeCrystalVisAtt->SetVisibility( true );
00139 activeCrystalVisAtt->SetForceSolid( true );
00140
00141 G4VisAttributes *centerContactVisAtt = new G4VisAttributes( yellow );
00142 centerContactVisAtt->SetVisibility( true );
00143 centerContactVisAtt->SetForceSolid( true );
00144
00145
00146 G4Tubs *bulkCrystal1Solid = new G4Tubs( "bulkCrystal1Solid", 0*cm, (crystalRadius-cornerRadius)*cm, (height/2)*cm, 0*deg, 360*deg );
00147 G4Tubs *bulkCrystal2Solid = new G4Tubs( "bulkCrystal2Solid", 0*cm, crystalRadius*cm, ((height-cornerRadius)/2)*cm, 0*deg, 360*deg );
00148 G4double x = 0;
00149 G4double y = 0;
00150 G4double z = cornerRadius/2;
00151 G4VSolid *bulkCrystal3Solid = new G4UnionSolid( "bulkCrystal3Solid", bulkCrystal1Solid, bulkCrystal2Solid, 0, G4ThreeVector(x*cm,y*cm,-z*cm) );
00152 G4Torus *bulkCrystal4Solid = new G4Torus( "bulkCrystal4Solid", 0*cm, cornerRadius*cm, (crystalRadius-cornerRadius)*cm, 0*deg, 360*deg );
00153 x = 0;
00154 y = 0;
00155 z = height/2 - cornerRadius;
00156 G4VSolid *bulkCrystal5Solid = new G4UnionSolid( "bulkCrystal5Solid", bulkCrystal3Solid, bulkCrystal4Solid, 0, G4ThreeVector(x*cm,y*cm,z*cm) );
00157
00158 G4Box *bulkCrystal6Solid = new G4Box( "bulkCrystal6Solid", (crystalRadius - (rightDeficit+leftDeficit)/2)*cm, (crystalRadius - (topDeficit+bottomDeficit)/2)*cm, (height/2 + .01)*cm );
00159 x = (leftDeficit - rightDeficit)/2;
00160 y = (bottomDeficit - topDeficit)/2;
00161 z = 0;
00162 G4VSolid *bulkCrystal7Solid = new G4IntersectionSolid( "bulkCrystal7Solid", bulkCrystal5Solid, bulkCrystal6Solid, 0, G4ThreeVector(x*cm, y*cm, z*cm ) );
00163
00164
00165 theCrystalLogical = new G4LogicalVolume( bulkCrystal7Solid, crystalMaterial, "theCrystalLogical" );
00166 theCrystalLogical->SetVisAttributes( deadLayerVisAtt );
00167
00168
00169 G4Tubs *activeCrystal1Solid = new G4Tubs( "activeCrystal1Solid", 0*cm, (crystalRadius-cornerRadius)*cm, ((height-outerDeadThickness)/2)*cm, 0*deg, 360*deg );
00170 G4Tubs *activeCrystal2Solid = new G4Tubs( "activeCrystal2Solid", 0*cm, (crystalRadius-outerDeadThickness)*cm, ((height-cornerRadius)/2)*cm, 0*deg, 360*deg );
00171 x = 0;
00172 y = 0;
00173 z = (cornerRadius - outerDeadThickness)/2;
00174 G4VSolid *activeCrystal3Solid = new G4UnionSolid( "activeCrystal3Solid", activeCrystal1Solid, activeCrystal2Solid, 0, G4ThreeVector(x*cm,y*cm,-z*cm) );
00175 G4Torus *activeCrystal4Solid = new G4Torus( "activeCrystal4Solid", 0*cm, (cornerRadius-outerDeadThickness)*cm, (crystalRadius-cornerRadius)*cm, 0*deg, 360*deg );
00176 x = 0;
00177 y = 0;
00178 z = (height + outerDeadThickness)/2 - cornerRadius;
00179 G4VSolid *activeCrystal5Solid = new G4UnionSolid( "activeCrystal5Solid", activeCrystal3Solid, activeCrystal4Solid, 0, G4ThreeVector(x*cm,y*cm,z*cm) );
00180
00181 G4Box *activeCrystal6Solid = new G4Box( "activeCrystal6Solid", (crystalRadius - (rightDeficit+leftDeficit)/2 - outerDeadThickness)*cm, (crystalRadius - (topDeficit+bottomDeficit)/2 - outerDeadThickness)*cm, ((height-outerDeadThickness + .01)/2)*cm );
00182 x = (leftDeficit - rightDeficit)/2;
00183 y = (bottomDeficit - topDeficit)/2;
00184 z = 0;
00185 G4VSolid *activeCrystal7Solid = new G4IntersectionSolid( "activeCrystal7Solid", activeCrystal5Solid, activeCrystal6Solid, 0, G4ThreeVector(x*cm, y*cm, z*cm) );
00186
00187 G4LogicalVolume *activeCrystalLogical = new G4LogicalVolume( activeCrystal7Solid, crystalMaterial, "activeCrystalLogical" );
00188 activeCrystalLogical->SetVisAttributes( activeCrystalVisAtt );
00189 x = 0;
00190 y = 0;
00191 z = outerDeadThickness/2;
00192 activeCrystalPhysical = new G4PVPlacement( 0, G4ThreeVector(x*cm,y*cm,-z*cm), activeCrystalLogical, "activeCrystal", theCrystalLogical, false, 0 );
00193
00194
00195 G4Tubs *innerDeadLayer1Solid = new G4Tubs( "innerDeadLayer1Solid", 0*cm, (coreRadius+innerDeadThickness)*cm, ((coreDepth+innerDeadThickness)/2)*cm, 0*deg, 360*deg );
00196 G4Sphere *innerDeadLayer2Solid = new G4Sphere( "innerDeadLayer2Solid", 0*cm, (coreBubbleRadius+innerDeadThickness)*cm, 0*deg, 360*deg, 0*deg, 180*deg );
00197 x = 0;
00198 y = 0;
00199 z = (coreDepth + innerDeadThickness)/2;
00200 G4VSolid *innerDeadLayer3Solid = new G4UnionSolid( "innerDeadLayer3Solid", innerDeadLayer1Solid, innerDeadLayer2Solid, 0, G4ThreeVector(x*cm,y*cm,z*cm) );
00201
00202 G4LogicalVolume *innerDeadLayerLogical = new G4LogicalVolume( innerDeadLayer3Solid, crystalMaterial, "innerDeadLayerLogical" );
00203 innerDeadLayerLogical->SetVisAttributes( deadLayerVisAtt );
00204
00205 x = 0;
00206 y = 0;
00207 z = (height - outerDeadThickness - coreDepth - innerDeadThickness)/2;
00208 G4PVPlacement *innerDeadLayerPhysical = new G4PVPlacement( 0, G4ThreeVector(x*cm,y*cm,-z*cm), "Inner dead layer", innerDeadLayerLogical, activeCrystalPhysical, false, 0 );
00209
00210
00211 G4Tubs *core1Solid = new G4Tubs( "core1Solid", 0*cm, coreRadius*cm, (coreDepth/2)*cm, 0*deg, 360*deg );
00212 G4Sphere *core2Solid = new G4Sphere( "core2Solid", 0*cm, coreBubbleRadius*cm, 0*deg, 360*deg, 0*deg, 180*deg );
00213 x = 0;
00214 y = 0;
00215 z = coreDepth/2;
00216 G4VSolid *core3Solid = new G4UnionSolid( "core3Solid", core1Solid, core2Solid, 0, G4ThreeVector(x*cm,y*cm,z*cm) );
00217 G4LogicalVolume *coreLogical = new G4LogicalVolume( core3Solid, G4Material::GetMaterial("Vacuum"), "coreLogical" );
00218 x = 0;
00219 y = 0;
00220 z = innerDeadThickness/2;
00221 G4PVPlacement *corePhysical = new G4PVPlacement( 0, G4ThreeVector(x*cm,y*cm,-z*cm), "Central core", coreLogical, innerDeadLayerPhysical, false, 0 );
00222
00223
00224 G4Tubs *contactSolid = new G4Tubs( "contactSolid", (coreRadius - innerContactWidth)*cm, coreRadius*cm, (coreDepth/2)*cm, 0, 360*deg );
00225 G4LogicalVolume *contactLogical = new G4LogicalVolume( contactSolid, innerContactMaterial, "contactLogical" );
00226 contactLogical->SetVisAttributes( centerContactVisAtt );
00227 x = 0;
00228 y = 0;
00229 z = 0;
00230 G4PVPlacement *contactPhysical = new G4PVPlacement( 0, G4ThreeVector(x*cm,y*cm,-z*cm ), "Inner contact", contactLogical, corePhysical, false, 0 );
00231 }