Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

MJGeometryCloverCrystal.cc

Go to the documentation of this file.
00001 //---------------------------------------------------------------------------//
00002 //bb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nu//
00003 //                                                                           //
00004 //                         MAJORANA Simulation                               //
00005 //                                                                           //
00006 //      This code implementation is the intellectual property of the         //
00007 //      MAJORANA Collaboration. It is based on Geant4, an intellectual       //
00008 //      property of the RD44 GEANT4 collaboration.                           //
00009 //                                                                           //
00010 //                        *********************                              //
00011 //                                                                           //
00012 //    Neither the authors of this software system, nor their employing       //
00013 //    institutes, nor the agencies providing financial support for this      //
00014 //    work  make  any representation or  warranty, express or implied,       //
00015 //    regarding this software system or assume any liability for its use.    //
00016 //    By copying, distributing or modifying the Program (or any work based   //
00017 //    on on the Program) you indicate your acceptance of this statement,     //
00018 //    and all its terms.                                                     //
00019 //                                                                           //
00020 //bb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nu//
00021 //---------------------------------------------------------------------------//
00022 //                                                          
00023 // $Id: MJGeometryCloverCrystal.cc,v 1.2 2004/11/09 13:42:39 xliu Exp $ 
00024 //      
00025 // CLASS IMPLEMENTATION:  MJGeometryCloverCrystal.cc
00026 //
00027 //---------------------------------------------------------------------------//
00035 // 
00036 //---------------------------------------------------------------------------//
00059 //---------------------------------------------------------------------------//
00060 //
00061 
00062 //  MJ headers
00063 #include "database/MJDatabase.hh"
00064 #include "geometry/MJGeometryCloverCrystal.hh"
00065 #include "geometry/MJGeometryGlobals.hh"
00066 #include "io/MJLogger.hh"
00067 
00068 //  GEANT4 headers
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         //      Database call to get the crystal object keyed on the serial number
00087 {
00088         theDBcrystal = MJDatabase::GetCloverCrystal( serialNumber );
00089         ConstructCrystal();
00090 }
00091 
00092 //---------------------------------------------------------------------------//
00093 //MJGeometryCloverCrystal::MJGeometryCloverCrystal( const MJGeometryCloverCrystal & other )
00094 //{
00095 //      theDBcrystal = MJDatabase::GetCloverCrystal( other.GetSerialNumber() );
00096 //      ConstructCrystal();
00097 //}
00098 
00099 //---------------------------------------------------------------------------//
00100 MJGeometryCloverCrystal::~MJGeometryCloverCrystal() {;}
00101 
00102 //---------------------------------------------------------------------------//
00103 void MJGeometryCloverCrystal::ConstructCrystal() {
00104 
00105         //  Grab the relevant variables from the database object to avoid multiple dereferenced lookups
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         //  Set the visualization attributes for each of the components
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         //  Build the outer crystal shape. This will become the outer dead layer, but it must for not be able to wholly contain all other objects that make up the crystal
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 ); // Added .01/2 to z, RH 7/29/2004
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         //  Because it is the outermost volume, name the outer dead layer theCrystalLogical, and use this logical volume to contain all other parts
00165         theCrystalLogical = new G4LogicalVolume( bulkCrystal7Solid, crystalMaterial, "theCrystalLogical" );
00166         theCrystalLogical->SetVisAttributes( deadLayerVisAtt );
00167         
00168         //  Build the active bulk of the crystal and place it in theCrystalLogical
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 ); // Added .01/2 to z, RH 7/29/2004
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         //  Create the inner dead layer bulk as a solid (a la the outer dead layer) and place it in the active crystal volume
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         //      Create the central core and place it inside the inner dead layer
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         //      Build the inner contact material and place it inside the central core
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 }

Generated on Mon Nov 29 16:58:51 2004 for Majorana Simulation by  doxygen 1.3.9.1