Target_Chamber.cc

Go to the documentation of this file.
00001 //! \file
00002 //!
00003 //! Source file for Target_Chamber class.
00004 //!
00005 //! The Target_Chamber class is used to build the target chamber, target cell,
00006 //! and collimator for the OLYMPUS detector simulation.  This file defines the
00007 //! Target_Chamber class and the member routines which construct the OLYMPUS
00008 //! target chamber, target cell, and collimator.
00009 //!
00010 //! \author D.K. Hasell
00011 //! \version 1.0
00012 //! \date 2010-02-27
00013 //!
00014 //! \ingroup detector
00015 
00016 // *+****1****+****2****+****3****+****4****+****5****+****6****+****7****+****
00017 
00018 // Include the Target_Chamber header file.
00019 
00020 #include "Target_Chamber.h"
00021 
00022 // Include the GEANT4 header files referenced in this file.
00023 
00024 #include "G4VPhysicalVolume.hh"
00025 #include "G4LogicalVolume.hh"
00026 #include "G4PVPlacement.hh"
00027 #include "G4SubtractionSolid.hh"
00028 #include "G4UnionSolid.hh"
00029 #include "G4Box.hh"
00030 #include "G4Tubs.hh"
00031 #include "G4Trd.hh"
00032 #include "G4EllipticalTube.hh"
00033 #include "G4Material.hh"
00034 #include "G4ThreeVector.hh"
00035 #include "G4RotationMatrix.hh"
00036 #include "G4VisAttributes.hh"
00037 #include "G4Colour.hh"
00038 
00039 // Use the standard namespace.
00040 
00041 using namespace std;
00042 
00043 // Routines to define the OLYMPUS Target_Chamber class.
00044 
00045 // Constructor.
00046 
00047 Target_Chamber::Target_Chamber() {}
00048 
00049 // Destructor.
00050 
00051 Target_Chamber::~Target_Chamber() {}
00052 
00053 // Member function to build the beamline.
00054 
00055 void Target_Chamber::Build( G4VPhysicalVolume * World_phys ) {
00056 
00057    // Building the target chamber, cell, and collimator.
00058 
00059    cout << "Building the target chamber, cell, and collimator.\n" << flush;
00060 
00061    // Create the target chamber as a trapezoid.
00062 
00063    G4Trd * TC_solid = new
00064       G4Trd( "TC_solid", 9.6457 * 2.54 / 2.0 * cm, 4.5 * 2.54 / 2.0 * cm,
00065              10.0 * 2.54 / 2.0 * cm, 25.40 / 2.0 * cm, 120.0 / 2.0 * cm );
00066 
00067    G4LogicalVolume * TC_log = new
00068       G4LogicalVolume( TC_solid, G4Material::GetMaterial( "Beam_gas" ),
00069                        "TC_log", 0, 0, 0, true );
00070 
00071    TC_log->SetVisAttributes( G4VisAttributes( false, G4Color() ) );
00072 
00073    new G4PVPlacement( 0, G4ThreeVector( 0.0, 0.0, -5.0 * cm ),
00074                       "TC_phys", TC_log, World_phys, false, 0, true );
00075 
00076    // Subtract various shapes from target chamber to build frame.
00077 
00078    // Bore hole for beam.
00079 
00080    G4Tubs * TC_Beam = new
00081       G4Tubs( "TC_Beam", 0.0, 2.25 * 2.54 / 2.0 * cm,
00082               121.0 / 2.0 * cm, 0.0, 360.0 * degree );
00083 
00084    G4SubtractionSolid * TC_F1 = new
00085       G4SubtractionSolid( "TC_F1", TC_solid, TC_Beam, 0, G4ThreeVector() );
00086 
00087    // Define some rotation matrices.
00088 
00089    G4RotationMatrix * rotX = new G4RotationMatrix;
00090    rotX->rotateX( 90.0 * degree );
00091 
00092    G4RotationMatrix * rotY = new G4RotationMatrix;
00093    rotY->rotateY( 90.0 * degree );
00094 
00095    // Access area for collimator.
00096 
00097    G4Tubs * TC_Coll = new
00098       G4Tubs( "TC_Coll", 0.0, 8.01 * 2.54 / 2.0 * cm,
00099               26.0 / 2.0 * cm, 0.0, 360.0 * degree );
00100 
00101    G4SubtractionSolid * TC_F2 = new
00102       G4SubtractionSolid( "TC_F2", TC_F1, TC_Coll, rotY,
00103                           G4ThreeVector( 0.0, 0.0, ( 5.0 - 49.53 ) * cm ) );
00104 
00105    G4SubtractionSolid * TC_F3 = new
00106       G4SubtractionSolid( "TC_F3", TC_F2, TC_Coll, rotX,
00107                           G4ThreeVector( 0.0, 0.0, ( 5.0 - 49.53 ) * cm ) );
00108 
00109    // Access area for target cell and window opening.
00110 
00111    G4Tubs * TC_Win_Cyl = new
00112       G4Tubs( "TC_Win_Cyl", 0.0, 1.75 * 2.54 * cm,
00113               26.0 / 2.0 * cm, 0.0, 360.0 * degree );
00114 
00115    G4SubtractionSolid * TC_F4 = new
00116       G4SubtractionSolid( "TC_F4", TC_F3, TC_Win_Cyl, rotY,
00117                           G4ThreeVector( 0.0, 0.0, ( 5.0 - 27.94 ) * cm ) );
00118 
00119    G4SubtractionSolid * TC_F5 = new
00120       G4SubtractionSolid( "TC_F5", TC_F4, TC_Win_Cyl, rotY,
00121                           G4ThreeVector( 0.0, 0.0, ( 5.0 + 41.275 ) * cm ) );
00122 
00123    G4Box * TC_Win_Box = new
00124       G4Box( "TC_Win_Box", 26.0 / 2.0 * cm, 1.75 * 2.54 * cm, 27.25 * 2.54 / 2.0 * cm );
00125 
00126    G4SubtractionSolid * TC_Frame_solid = new
00127       G4SubtractionSolid( "TC_Frame_solid", TC_F5, TC_Win_Box, 0,
00128                           G4ThreeVector( 0.0, 0.0, ( 5.0 + 6.735 ) * cm ) );
00129 
00130    // Create logical volume for target chamber frame and place it.
00131 
00132    G4LogicalVolume * TC_Frame_log = new
00133       G4LogicalVolume( TC_Frame_solid, G4Material::GetMaterial( "G4_Al" ),
00134                        "TC_Frame_log", 0, 0, 0, true );
00135 
00136    TC_Frame_log->SetVisAttributes(
00137       G4VisAttributes( true, G4Color( 0.663, 0.675, 0.714 ) ) );
00138 
00139    new G4PVPlacement( 0, G4ThreeVector(),
00140                       TC_Frame_log, "TC_Frame_phys", TC_log, false, 0, true );
00141 
00142    // Create the target cell and place it inside the target chamber.
00143 
00144    G4EllipticalTube * Cell_Outer = new
00145       G4EllipticalTube( "Cell_Outer", 1.3575 * cm, 0.4575 * cm, 30.0 * cm );
00146 
00147    G4EllipticalTube * Cell_Inner = new
00148       G4EllipticalTube( "Cell_Inner", 1.35 * cm, 0.45 * cm, 30.001 * cm );
00149 
00150    G4SubtractionSolid * Cell_solid = new
00151       G4SubtractionSolid( "Cell_solid", Cell_Outer, Cell_Inner, 0,
00152                           G4ThreeVector() );
00153       
00154    G4LogicalVolume * Cell_log = new
00155       G4LogicalVolume( Cell_solid, G4Material::GetMaterial( "G4_Al" ),
00156                        "Cell_log", 0, 0, 0, true );
00157 
00158    Cell_log->SetVisAttributes(
00159       G4VisAttributes( true, G4Color( 0.663, 0.675, 0.714 ) ) );
00160 
00161    new G4PVPlacement( 0, G4ThreeVector( 0.0, 0.0, 5.0 * cm ),
00162                       Cell_log, "Cell_phys", TC_log, false, 0, true );
00163 
00164    // Create the collimator and place it in the target chamber.
00165 
00166    G4Tubs * Coll_Outer = new
00167       G4Tubs( "Coll_Outer", 0.0, 3.25 * 2.54 * cm, 6.0 * 2.54 * cm,
00168               0.0, 360.0 * degree );
00169 
00170    G4EllipticalTube * Coll_Inner = new
00171       G4EllipticalTube( "Coll_Inner", 1.25 * cm, 0.35 * cm, 6.001 * 2.54 * cm );
00172 
00173    G4SubtractionSolid * Coll_solid = new
00174       G4SubtractionSolid( "Coll_solid", Coll_Outer, Coll_Inner,
00175                           0, G4ThreeVector() );
00176       
00177    G4LogicalVolume * Coll_log = new
00178       G4LogicalVolume( Coll_solid, G4Material::GetMaterial( "G4_W" ),
00179                        "Coll_log", 0, 0, 0, true );
00180 
00181    Coll_log->SetVisAttributes(
00182       G4VisAttributes( true, G4Color( 0.137, 0.420, 0.557 ) ) );
00183 
00184    new G4PVPlacement( 0, G4ThreeVector( 0.0, 0.0, ( 5.0 - 49.53 ) * cm ),
00185                       Coll_log, "Coll_phys", TC_log, false, 0, true );
00186 
00187    // Define some rotation matrices.
00188 
00189    G4RotationMatrix * rot1 = new G4RotationMatrix;
00190    rot1->rotateZ( -90.0 * degree );
00191 
00192    G4RotationMatrix * rot2 = new G4RotationMatrix;
00193    rot2->rotateZ( 90.0 * degree );
00194 
00195    // Create the window and place it against the target chamber.
00196 
00197    G4Box * Win_1 = new
00198       G4Box( "Win_1", 69.215 / 2.0 * cm, 1.75 * 2.54 * cm, 0.0254 / 2.0 * cm );
00199 
00200    G4Tubs * Win_2 = new
00201       G4Tubs( "Win_2", 0.0 * cm, 3.25 * 2.54 * cm, 0.0254 / 2.0 * cm,
00202               0.0, 180.0 * degree ); 
00203 
00204    G4UnionSolid * Win_3 = new
00205       G4UnionSolid( "Win_3", Win_1, Win_2, rot1,
00206                     G4ThreeVector( -69.215 / 2.0 * cm, 0.0, 0.0 ) );
00207 
00208    G4UnionSolid * Win_solid = new
00209       G4UnionSolid( "Win_solid", Win_3, Win_2, rot2,
00210                     G4ThreeVector( 69.215 / 2.0 * cm, 0.0, 0.0 ) );
00211 
00212    G4LogicalVolume * Win_log = new
00213       G4LogicalVolume( Win_solid, G4Material::GetMaterial( "G4_Al" ),
00214                        "Win_log", 0, 0, 0, true );
00215 
00216    Win_log->SetVisAttributes(
00217       G4VisAttributes( true, G4Color( 0.663, 0.675, 0.714, 0.3 ) ) );
00218 
00219    // Calculate the angle of the target chamber trapezoid.
00220 
00221    G4double angle = asin( ( 24.5 - 11.43 ) / 2.0 / 120.0 );
00222 
00223    G4RotationMatrix * rot3 = new G4RotationMatrix;
00224    rot3->rotateY( 90.0 * degree + angle );
00225 
00226    G4RotationMatrix * rot4 = new G4RotationMatrix;
00227    rot4->rotateY( 90.0 * degree - angle );
00228 
00229    G4double deltaX = 11.43 / 2.0 * cm + 55.0 * sin( angle ) * cm;
00230    deltaX = deltaX * cos( angle ) + 0.991 / 2.0 * cm;
00231 
00232    G4double deltaZ = deltaX * sin( angle );
00233 
00234    new G4PVPlacement( rot3, G4ThreeVector( deltaX, 0.0,
00235                                            6.735 * cm + deltaZ ),
00236                       "Win_phys", Win_log, World_phys, false, 0, true );
00237 
00238    new G4PVPlacement( rot4, G4ThreeVector( -deltaX, 0.0,
00239                                            6.735 * cm + deltaZ ),
00240                       "Win_phys", Win_log, World_phys, false, 0, true );
00241 
00242    // Create the window frame and place it.
00243 
00244    G4Box * Fr_1 = new
00245       G4Box( "Fr_1", 69.215 / 2.0 * cm, 3.81 / 2.0 * cm, 0.991 / 2.0 * cm );
00246 
00247    G4Tubs * Fr_2 = new
00248       G4Tubs( "Fr_2", 4.445 * cm, ( 3.81 + 4.445 ) * cm,
00249               0.991 / 2.0 * cm, 0.0, 180.0 * degree ); 
00250 
00251    G4UnionSolid * Fr_3 = new
00252       G4UnionSolid( "Fr_3", Fr_1, Fr_2, rot1,
00253                     G4ThreeVector( -69.215 / 2.0 * cm,
00254                                    -( 4.445 + 3.81 / 2.0 ) * cm , 0.0 ) );
00255 
00256    G4UnionSolid * Fr_4 = new
00257       G4UnionSolid( "Fr_4", Fr_3, Fr_2, rot2,
00258                     G4ThreeVector( 69.215 / 2.0 * cm,
00259                                    -( 4.445 + 3.81 / 2.0 ) * cm , 0.0 ) );
00260       
00261    G4UnionSolid * Fr_solid = new
00262       G4UnionSolid( "Fr_solid", Fr_4, Fr_1, 0,
00263                     G4ThreeVector( 0.0, -( 3.81 + 4.445 * 2.0 ) * cm, 0.0 ) );
00264       
00265    G4LogicalVolume * Fr_log = new
00266       G4LogicalVolume( Fr_solid, G4Material::GetMaterial( "G4_Al" ),
00267                        "Fr_log", 0, 0, 0, true );
00268 
00269    Fr_log->SetVisAttributes(
00270       G4VisAttributes( true, G4Color( 0.763, 0.775, 0.814 ) ) );
00271 
00272    new G4PVPlacement( rot3, G4ThreeVector( deltaX,
00273                                            ( 4.445 + 3.81 / 2.0 ) * cm,
00274                                            6.735 * cm + deltaZ ),
00275                       "Fr_phys", Fr_log, World_phys, false, 0, true );
00276 
00277    new G4PVPlacement( rot4, G4ThreeVector( -deltaX,
00278                                            ( 4.445 + 3.81 / 2.0 ) * cm,
00279                                            6.735 * cm + deltaZ ),
00280                       "Fr_phys", Fr_log, World_phys, false, 0, true );
00281 
00282    cout << "     done.\n" << endl << flush;
00283 
00284    // That's All Folks !
00285 
00286    return;
00287 
00288 }