Time_of_Flight.cc

Go to the documentation of this file.
00001 //! \file
00002 //!
00003 //! Source file for Time_of_Flight class.
00004 //!
00005 //! The Gem_Tracker class is used to build the GEM tracking detector
00006 //! for the OLYMPUS detector simulation.
00007 //!
00008 //! \author D.K. Hasell
00009 //! \version 1.0
00010 //! \date 2010-10-30
00011 //!
00012 //! \ingroup detector
00013 
00014 // *+****1****+****2****+****3****+****4****+****5****+****6****+****7****+****
00015 
00016 // Include the TF header file and the user header files referenced here..
00017 
00018 #include "Time_of_Flight.h"
00019 #include "TF_SD.h"
00020 
00021 // Include the GEANT4 header files used below.
00022 
00023 #include "G4VPhysicalVolume.hh"
00024 #include "G4LogicalVolume.hh"
00025 #include "G4PVPlacement.hh"
00026 #include "G4Box.hh"
00027 #include "G4Material.hh"
00028 #include "G4ThreeVector.hh"
00029 #include "G4RotationMatrix.hh"
00030 #include "G4VisAttributes.hh"
00031 #include "G4Colour.hh"
00032 
00033 #include "G4SDManager.hh"
00034 
00035 // Use the standard namespace.
00036 
00037 using namespace std;
00038 
00039 // *+****1****+****2****+****3****+****4****+****5****+****6****+****7****+****
00040 
00041 // Routines to define the OLYMPUS Time_of_Flight class.
00042 
00043 // Constructor.
00044 
00045 Time_of_Flight::Time_of_Flight() {}
00046 
00047 // Destructor.
00048 
00049 Time_of_Flight::~Time_of_Flight() {}
00050 
00051 // Member function to build the beamline.
00052 
00053 void Time_of_Flight::Build( G4VPhysicalVolume * World_phys ) {
00054 
00055    // Building the TF detector.
00056    
00057    cout << "Building the TF volume.\n" << flush;
00058    
00059    // Define the TF position and dimensions.
00060    
00061    G4double TF_R[N_TF] = { 391.980, 391.390, 391.394, 391.991, 388.908,
00062                            376.436, 365.422, 356.001, 348.301, 332.657,
00063                            315.855, 299.889, 285.440, 272.749, 262.074,
00064                            253.667, 247.760,
00065                            391.980, 391.390, 391.394, 391.991, 388.908,
00066                            376.436, 365.422, 356.001, 348.301, 332.657,
00067                            315.855, 299.889, 285.440, 272.749, 262.074,
00068                            253.667, 247.760 };
00069    
00070    G4double TF_Theta[N_TF] = { 19.169, 21.398, 23.630, 25.859, 28.625,
00071                                32.077, 35.752, 39.638, 43.716, 47.001,
00072                                50.560, 54.430, 58.713, 63.424, 68.555,
00073                                74.074, 79.913,
00074                                19.169, 21.398, 23.630, 25.859, 28.625,
00075                                32.077, 35.752, 39.638, 43.716, 47.001,
00076                                50.560, 54.430, 58.713, 63.424, 68.555,
00077                                74.074, 79.913 };
00078 
00079    G4double TF_Phi[N_TF] = {   0.0,   0.0,   0.0,   0.0,   0.0,
00080                                0.0,   0.0,   0.0,   0.0,   0.0,
00081                                0.0,   0.0,   0.0,   0.0,   0.0,
00082                                0.0,   0.0,
00083                                180.0, 180.0, 180.0, 180.0, 180.0,
00084                                180.0, 180.0, 180.0, 180.0, 180.0,
00085                                180.0, 180.0, 180.0, 180.0, 180.0,
00086                                180.0, 180.0 };
00087 
00088    G4double TF_Width[N_TF] = { 15.24, 15.24, 15.24, 15.24, 26.20,
00089                                26.20, 26.20, 26.20, 26.20, 26.20,
00090                                26.20, 26.20, 26.20, 26.20, 26.20,
00091                                26.20, 26.20,
00092                                15.24, 15.24, 15.24, 15.24, 26.20,
00093                                26.20, 26.20, 26.20, 26.20, 26.20,
00094                                26.20, 26.20, 26.20, 26.20, 26.20,
00095                                26.20, 26.20 };
00096 
00097    G4double TF_Height[N_TF] = { 119.38, 119.38, 119.38, 119.38, 180.00,
00098                                 180.00, 180.00, 180.00, 180.00, 180.00,
00099                                 180.00, 180.00, 180.00, 180.00, 180.00,
00100                                 180.00, 180.00,
00101                                 119.38, 119.38, 119.38, 119.38, 180.00,
00102                                 180.00, 180.00, 180.00, 180.00, 180.00,
00103                                 180.00, 180.00, 180.00, 180.00, 180.00,
00104                                 180.00, 180.00 };
00105 
00106    G4double TF_Alpha[N_TF] = { -22.50, -22.50, -22.50, -22.50, -58.75,
00107                                -58.75, -58.75, -58.75, -58.75, -90.00,
00108                                -90.00, -90.00, -90.00, -90.00, -90.00,
00109                                -90.00, -90.00,
00110                                22.50,  22.50,  22.50,  22.50,  58.75,
00111                                58.75,  58.75,  58.75,  58.75,  90.00,
00112                                90.00,  90.00,  90.00,  90.00,  90.00,
00113                                90.00,  90.00 };
00114 
00115    // Set the units properly.
00116    
00117    for( int i = 0; i < N_TF; ++i ) {
00118       TF_R[i]      *= cm;
00119       TF_Width[i]  *= cm;
00120       TF_Height[i] *= cm;
00121       TF_Theta[i]  *= degree;
00122       TF_Phi[i]    *= degree;
00123       TF_Alpha[i]  *= degree;
00124    }
00125 
00126    // Define thickness of scintillator, lead, and aluminium backing.
00127    
00128    G4double Thick_Sc = 2.54   * cm;
00129    G4double Thick_Pb = 0.0254 * cm;
00130    G4double Thick_Al = 0.4064 * cm;
00131    
00132    // Create the sensitive detector.
00133 
00134    G4SDManager * SDMgr = G4SDManager::GetSDMpointer();
00135       
00136    TF_SD * SD = new  TF_SD( "OLYMPUS/TF" );
00137    SDMgr->AddNewDetector( SD );
00138       
00139    // Loop over all the TF detectors.
00140 
00141    for( int i = 0; i < N_TF; ++i ) {
00142 
00143       G4Box * TF_solid = new
00144          G4Box( "TF_solid", TF_Width[i] / 2.0, TF_Height[i] / 2.0,
00145                 ( Thick_Sc + Thick_Pb + Thick_Al ) / 2.0 );
00146       
00147       G4LogicalVolume * TF_log = new
00148          G4LogicalVolume( TF_solid, G4Material::GetMaterial( "G4_AIR" ),
00149                           "TF_log", 0, 0, 0, true );
00150       
00151       TF_log->SetVisAttributes( G4VisAttributes( false, G4Color() ) );
00152 
00153       // Calculate some trig. functions.
00154    
00155       G4double costheta = cos( TF_Theta[i] );
00156       G4double sintheta = sin( TF_Theta[i] );
00157       
00158       G4double cosphi = cos( TF_Phi[i] );
00159       G4double sinphi = sin( TF_Phi[i] );
00160 
00161       // Note these rotations do NOT transform to the "proper" local
00162       // coordinates in each sector.  But since there is no local X resolution
00163       // this should not matter and Y is vertically up in both sectors.
00164 
00165       G4RotationMatrix * Rotation = new G4RotationMatrix;
00166       Rotation->rotateY( TF_Alpha[i] );
00167 
00168       new G4PVPlacement( Rotation, G4ThreeVector( TF_R[i] * sintheta * cosphi,
00169                                                   TF_R[i] * sintheta * sinphi,
00170                                                   TF_R[i] * costheta ),
00171                          "TF_phys", TF_log, World_phys, false, i, false );
00172         
00173       // Create the lead volume.
00174       
00175       G4Box * PB_solid = new
00176          G4Box( "Pb_solid", TF_Width[i]/2.0, TF_Height[i]/2.0, Thick_Pb/2.0 );
00177    
00178       G4LogicalVolume * PB_log = new
00179          G4LogicalVolume( PB_solid, G4Material::GetMaterial( "G4_Pb" ),
00180                           "Pb_log", 0, 0, 0, true );
00181    
00182       PB_log->SetVisAttributes(
00183          G4VisAttributes( true, G4Color( 0.3, 0.4, 0.3 ) ) );
00184       
00185       new G4PVPlacement( 0, G4ThreeVector(0.0,0.0,-0.5*(Thick_Sc + Thick_Al)),
00186                          PB_log, "Pb_phys", TF_log, false, i, false );
00187    
00188       // Create the Al volume.
00189    
00190       G4VSolid * AL_solid = new 
00191          G4Box( "Al_solid", TF_Width[i]/2.0, TF_Height[i]/2.0, Thick_Al/2.0 );
00192    
00193       G4LogicalVolume * AL_log = new 
00194          G4LogicalVolume( AL_solid, G4Material::GetMaterial( "G4_Al" ),
00195                           "Al_log", 0, 0, 0, true );
00196    
00197       AL_log->SetVisAttributes(
00198          G4VisAttributes( true, G4Color( 0.75, 0.75, 0.75 ) ) );
00199       
00200       new G4PVPlacement( 0, G4ThreeVector(0.0,0.0,0.5*( Thick_Sc + Thick_Pb )),
00201                          AL_log, "Al_phys", TF_log, false, i, false );
00202    
00203       // Create the Scintillator volume.
00204    
00205       G4VSolid * SC_solid = new 
00206          G4Box( "SC_solid", TF_Width[i]/2.0, TF_Height[i]/2.0, Thick_Sc/2.0 );
00207    
00208       G4LogicalVolume * SC_log = new 
00209          G4LogicalVolume( SC_solid, 
00210             G4Material::GetMaterial("G4_PLASTIC_SC_VINYLTOLUENE"),
00211                           "SC_log", 0, 0, 0, true );
00212    
00213       SC_log->SetVisAttributes(
00214          G4VisAttributes( true, G4Color( 0.8, 0, 0.8 ) ) );
00215       
00216       new G4PVPlacement( 0, G4ThreeVector(0.0,0.0,0.5*( Thick_Pb - Thick_Al )),
00217                          SC_log, "Sc_phys", TF_log, false, i, false );
00218       
00219       // Make the scintillator sensitive.
00220       
00221       SC_log->SetSensitiveDetector( SD );
00222    
00223    }
00224    
00225    cout << "     done.\n" << endl << flush;
00226 
00227    // That's All Folks !
00228 
00229    return;
00230 
00231 }