Symmetric_Moeller.cc

Go to the documentation of this file.
00001 //! \file
00002 //!
00003 //! Source file for Symmetric_Moeller class.
00004 //!
00005 //! This defines the Symmetric_Moeller class and the member routines which
00006 //! construct the OLYMPUS symmetric Moeller detector.
00007 //!
00008 //! \author Y. Ma based on code for olympus simulation package by D.K. Hasell
00009 //! \version 1.0
00010 //! \date 2010-10-11
00011 //!
00012 //! \ingroup detector
00013 
00014 // *+****1****+****2****+****3****+****4****+****5****+****6****+****7****+****
00015 
00016 // Include the header file and the user header files referenced here.
00017 
00018 #include "Symmetric_Moeller.h"
00019 #include "SM_SD.h"
00020 
00021 // Include the GEANT4 header files used here.
00022 
00023 #include "G4VPhysicalVolume.hh"
00024 #include "G4LogicalVolume.hh"
00025 #include "G4PVPlacement.hh"
00026 #include "G4Box.hh"
00027 #include "G4Tubs.hh"
00028 #include "G4SubtractionSolid.hh"
00029 #include "G4Material.hh"
00030 #include "G4ThreeVector.hh"
00031 #include "G4RotationMatrix.hh"
00032 #include "G4VisAttributes.hh"
00033 #include "G4Colour.hh"
00034 
00035 #include "G4SDManager.hh"
00036 
00037 // Use the standard namespace.
00038 
00039 using namespace std;
00040 
00041 // Routines to define the OLYMPUS Luminosity_Monitor class.
00042 
00043 // Constructor.
00044 
00045 Symmetric_Moeller::Symmetric_Moeller() {}
00046 
00047 // Destructor.
00048 
00049 Symmetric_Moeller::~Symmetric_Moeller() {}
00050 
00051 // Member function to build the SM detector.
00052 
00053 void Symmetric_Moeller::Build( G4VPhysicalVolume * World_phys ) {
00054 
00055    // Building the SM detector.
00056    
00057    G4cout << "Building the Symmetric_Moeller.\n" << flush;
00058    
00059    // Define the SM position and dimensions.
00060 
00061    G4double Width[N_SM]  = {10.,//collimator and PbF2 of positive x side
00062                             2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5,
00063                             10.,//collimator and PbF2 of negative x side
00064                             2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5};
00065 
00066    G4double Height[N_SM] = {10.,//collimator and PbF2 of positive x side
00067                             2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5,
00068                             10.,//collimator and PbF2 of negative x side
00069                             2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5};
00070 
00071    G4double Length[N_SM]  = {10.,//collimator and PbF2 of positive x side
00072                              16., 16., 16., 16., 16., 16., 16., 16., 16.,
00073                              10.,//collimator and PbF2 of negative x side
00074                              16., 16., 16., 16., 16., 16., 16., 16., 16.};
00075 
00076    G4double x[N_SM] = {3.8+5., //collimator and PbF2 of positive x side
00077                        3.8+6.25, 3.8+3.75, 3.8+1.25 ,3.8+6.25, 3.8+3.75,
00078                        3.8+1.25, 3.8+6.25, 3.8+3.75, 3.8+1.25,
00079                        -(3.8+5.), //collimator and PbF2 of negative x side
00080                        -(3.8+1.25), -(3.8+3.75), -(3.8+6.25),-(3.8+1.25),
00081                        -(3.8+3.75), -(3.8+6.25), -(3.8+1.25), -(3.8+3.75),
00082                        -(3.8+6.25)};
00083 
00084    G4double y[N_SM] = {0., //collimator and PbF2 of positive x side
00085                        2.5, 2.5, 2.5, 0., 0., 0., -2.5, -2.5, -2.5,
00086                        0.,//collimator and PbF2 of negative x side
00087                        2.5, 2.5, 2.5, 0., 0., 0., -2.5, -2.5, -2.5};
00088 
00089    G4double z[N_SM] = {335., //collimator and PbF2 of positive x side
00090                        345., 345, 345., 345., 345., 345., 345., 345., 345., 
00091                        335.,//collimator and PbF2 of negative x side
00092                        345., 345, 345., 345., 345., 345., 345., 345., 345.};
00093 
00094    // Set the units properly.
00095    
00096    for( int i = 0; i < N_SM; i++ ) {
00097       x[i] *= cm;
00098       y[i] *= cm;
00099       z[i] *= cm;
00100 
00101       Width[i]  *= cm;
00102       Height[i] *= cm;
00103       Length[i] *= cm;
00104 
00105       z[i] = z[i] + Length[i] / 2.0;
00106    }
00107 
00108    G4double Deg360 = 360.0 * degree;
00109 
00110    // Create an instance of the SM sensitive detector.
00111 
00112    SM_SD * SD = new SM_SD( "OLYMPUS/SM" );
00113 
00114    G4SDManager::GetSDMpointer()->AddNewDetector( SD );
00115 
00116    // Loop over the detectors.
00117 
00118    for( int i = 0; i < N_SM; i++ ) {
00119 
00120       // Create the SM and place it.
00121   
00122       G4Box * SM_solid = new
00123          G4Box( "SM_solid", Width[i] / 2.0, Height[i] / 2.0, Length[i] / 2.0 );
00124 
00125      // If this is the collimator.
00126 
00127       if( i == 0 ) {
00128          
00129          G4Tubs * Col_hole = new
00130             G4Tubs( "Col_hole", 0.0, 1.0 * cm, 10.0 * cm, 0.0, Deg360 );   
00131 
00132          G4ThreeVector xTrans( -1.0 * cm, 0.0 , 0.0 );
00133        
00134          G4SubtractionSolid * SM_col =
00135             new G4SubtractionSolid( "SM_solid-Col_hole", SM_solid, Col_hole,
00136                                     0, xTrans );
00137        
00138          G4LogicalVolume * SM_log = new
00139             G4LogicalVolume( SM_col, G4Material::GetMaterial( "G4_Pb" ),
00140                              "SM_log", 0, 0, 0, true );
00141 
00142          SM_log->SetVisAttributes(
00143             G4VisAttributes( true, G4Color( 1.0, 1.0, 1.0 ) ) );
00144 
00145          new G4PVPlacement( 0, G4ThreeVector( x[i], y[i], z[i] ),
00146                             "SM_phys", SM_log, World_phys, false, i, false );
00147 
00148          // Make the SM sensitive.
00149 
00150          SM_log->SetSensitiveDetector( SD );
00151       }
00152 
00153       //for collimator
00154 
00155       else if( i == 10 ) {
00156 
00157          G4Tubs * Col_hole = new
00158             G4Tubs( "Col_hole", 0.0, 1.0 * cm, 10.0 * cm, 0.0, Deg360 );   
00159 
00160          G4ThreeVector xTrans( 1.0 * cm, 0.0, 0.0 );
00161        
00162          G4SubtractionSolid* SM_col = new
00163             G4SubtractionSolid("SM_solid-Col_hole", SM_solid, Col_hole,
00164                                0, xTrans );
00165 
00166          G4LogicalVolume * SM_log = new
00167             G4LogicalVolume( SM_col, G4Material::GetMaterial( "G4_Pb" ),
00168                              "SM_log", 0, 0, 0, true );
00169 
00170          SM_log->SetVisAttributes( G4VisAttributes( true, G4Color().White() ) );
00171          new G4PVPlacement( 0, G4ThreeVector( x[i], y[i], z[i] ),
00172                             "SM_phys", SM_log, World_phys, false, i, false );
00173 
00174          // Make the SM sensitive.
00175 
00176          SM_log->SetSensitiveDetector( SD );
00177       }
00178 
00179       //for PbF2 crystals
00180 
00181       else {
00182 
00183          G4LogicalVolume * SM_log = new
00184             G4LogicalVolume( SM_solid, G4Material::GetMaterial( "PbF2" ),
00185                              "SM_log", 0, 0, 0, true );
00186 
00187          SM_log->SetVisAttributes(
00188             G4VisAttributes( true, G4Color( 1.0, 1.0, 1.0 ) ) );
00189 
00190          new G4PVPlacement( 0, G4ThreeVector( x[i], y[i], z[i] ),
00191                             "SM_phys", SM_log, World_phys, false, i, false );
00192 
00193          // Make the SM sensitive.
00194 
00195          SM_log->SetSensitiveDetector( SD );
00196       }
00197 
00198    }
00199 
00200    G4cout << "     Done.\n" << G4endl << flush;
00201 
00202    // That's All Folks !
00203 
00204    return;
00205    
00206 }