Message: Optical Photons (5eV) pass simple silicon detector without interaction Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Optical Photons (5eV) pass simple silicon detector without interaction 

Forum: Processes Involving Optical Photons
Date: 14 Jan, 2010
From: David Krapohl <David Krapohl>

Hello

I am trying to simulate a very simple silicon detector with optical photons around 5eV. Thanks to the very good examples, my code is working somehow but all photons pass the detector without interaction. When I select electrons with different energies, I can see that they interact. There was something in the forums about that but it didn't exactly explain why it happens. Does anyone know what I need to change? Maybe my code is not correct. Thankful for any help.

Regards, David

-------------------- My DetectorConstruction Class------------------------ #define DEBUG

#include "MyDetectorConstruction.hh"
#include "MyDetectorMessenger.hh"
#include "MyDetectorSD.hh"

#include "G4Element.hh"
#include "G4ElementTable.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4NistMaterialBuilder.hh"
#include "G4NistManager.hh"

#include "G4OpticalSurface.hh"
#include "G4LogicalBorderSurface.hh"

#include "G4UnitsTable.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"

#include "G4SDManager.hh"
#include "G4SDParticleFilter.hh"
#include "G4VPrimitiveScorer.hh"
#include "G4MultiFunctionalDetector.hh"
#include "G4PSEnergyDeposit.hh"
#include "G4PSNofSecondary.hh"
#include "G4PSCellCharge.hh"
#include "G4PSPassageCellFlux.hh"
#include "G4PSTrackLength.hh"
#include "G4PSNofStep.hh"
#include "G4PSMinKinEAtGeneration.hh"
#include "G4VSDFilter.hh"
#include "G4SDParticleFilter.hh"

#include "G4GeometryManager.hh"
#include "G4GeometryTolerance.hh"
#include "G4VisManager.hh"
#include "G4Color.hh"

#include "G4ios.hh"

// define properties of the world and detectors

static const G4double L_WORLD = 50.*mm;

static const G4double L_DETECTOR = 20.*mm;

static const G4double T_DETECTOR = 1.*mm;

static const G4double T_COATING = 1.*nm;

//-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_

MyDetectorConstruction::MyDetectorConstruction()
        :pCoatingMat ( 0 )
{
    pDetectorMessenger = new MyDetectorMessenger ( this );
}

//-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_

MyDetectorConstruction::~MyDetectorConstruction()
{
    delete pDetectorMessenger;
}

//-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_

G4VPhysicalVolume* MyDetectorConstruction::Construct()
{
    /*!
        \brief Construct world and  materials

        Load materials.
        Construct World logical and physical volumes.
    */

    ConstructMaterials();

    //...............................Properties tables..........................

    //! create a material properties table for silicon
    //!
    //! available: RINDEX,SPECULARLOBECONSTANT,SPECULARSPIKECONSTANT
    //!            BACKSCATTERCONSTANT, REFLECTIVITY, EFFICIENCY
    //!
    const G4int NENTRIES = 2;  //number of entries

    //! wavelengths 193nm, 254nm
    G4double energy[NENTRIES] = {6.4*eV, 4.9006*eV};
    //! refractive index, complex refractive index, absorption length
    G4double rindex[NENTRIES] = {0.864, 1.608};
    G4double iindex[NENTRIES] = {2.75, 3.789};
    G4double absorption[NENTRIES] = {1.11233564622e-08*m, 1.0740517632e-08*m};

    //! create material properties table
    G4MaterialPropertiesTable* MPT_Si = new G4MaterialPropertiesTable();
    MPT_Si->AddProperty ( "RINDEX",         energy, rindex,     NENTRIES );
    MPT_Si->AddProperty ( "IMAGINARYRINDEX",energy, iindex,     NENTRIES );
    MPT_Si->AddProperty ( "ABSLENGTH",      energy, absorption, NENTRIES );

    // apply material properties table to Silicon
    Si->SetMaterialPropertiesTable ( MPT_Si );

    //! Print all defined materials
    G4cout << G4endl << "The materials defined are : " << G4endl << G4endl;
    G4cout << * ( G4Material::GetMaterialTable() ) << G4endl;

    //---------------------------Create Volumes---------------------------------

    //! create world volume
    G4Box* worldBox = new G4Box ( "World", L_WORLD, L_WORLD, L_WORLD );
    // logical volume
    G4LogicalVolume* worldLV = new G4LogicalVolume ( worldBox,
            galactic,
            "World_LV" );

    G4VPhysicalVolume* worldPV
    = new G4PVPlacement ( 0, G4ThreeVector(), "World_PV", worldLV, 0, false,
                          0 );

    // vis. attributes make it white
    G4VisAttributes* va = new G4VisAttributes ( G4Colour ( 1.,1.,1. ) );
    va->SetForceWireframe ( true );
    worldLV->SetVisAttributes ( va );

    // -_-_-_-create detector volume-_-_-_-
    G4Box* detectorBox
    = new G4Box ( "Silicon_detector", L_DETECTOR, L_DETECTOR, T_DETECTOR );

    // create logical volume
    detectorLV = new G4LogicalVolume ( detectorBox, Si, "detector_LV" );

    // create physical volume
    pDetectorPV
    = new G4PVPlacement ( 0, G4ThreeVector ( 0.,0.,0. ), "detectorPV",
                          detectorLV, worldPV, false, 0 );

    // set visualisation attributes
    va = new G4VisAttributes ( G4Color ( 0.0,0.8,0.8 ) );
    va ->SetVisibility ( true );
    va-> SetForceSolid ( false );
    detectorLV->SetVisAttributes ( va );

    // -_-_-_-create coating volume-_-_-_-
    // create box coating volume
    G4Box* coatingBox = new G4Box ( "Coating", L_DETECTOR,L_DETECTOR, T_COATING );

    //create logical coating volume
    pCoatingLV = new G4LogicalVolume ( coatingBox,SiON,"coating_LV" );

    //place the volume on top of detector
    pCoatingPV = new G4PVPlacement ( 0,G4ThreeVector ( 0.,0.,T_DETECTOR ),
                                     "coatingPV", pCoatingLV,worldPV,false,0 );

    va = new G4VisAttributes ( G4Color ( 0.8,0.8,0 ) );
    va->SetVisibility ( true );
    va->SetForceSolid ( false );
    pCoatingLV->SetVisAttributes ( va );

    //-------------------------sensitive detector-------------------------------

    G4SDManager* SDman = G4SDManager::GetSDMpointer();

    // make silicon sensitive detector
    MyDetectorSD* pDetectorSD = new MyDetectorSD ( "SiliconSD" );
    SDman->AddNewDetector ( pDetectorSD );

    detectorLV->SetSensitiveDetector ( pDetectorSD );

    //.....................Create Optical Surfaces..............................

    // create optical surface for silicon
    G4OpticalSurface* pOpSiSurface
    = new G4OpticalSurface ( "SiAirSurface" );
    //set optical surface properties
    pOpSiSurface->SetModel ( unified );
    pOpSiSurface->SetType ( dielectric_dielectric );
    pOpSiSurface->SetFinish ( polished );

    // create logical border surface
    G4LogicalBorderSurface* surfaceLB =
        new G4LogicalBorderSurface ( "SiAirBorder", worldPV, pDetectorPV,
                                     pOpSiSurface );

    G4double efficiency[NENTRIES] = {1., 1.};
    G4double reflectivity[NENTRIES] = {0.1, 0.1};

    // create surface properties table
    G4MaterialPropertiesTable* SPT_Si = new G4MaterialPropertiesTable();

    SPT_Si->AddProperty ( "REFLECTIVITY", energy, reflectivity, NENTRIES );
    SPT_Si->AddProperty ( "EFFICIENCY",   energy, efficiency,   NENTRIES );

    // apply material properties table to Silicon
    pOpSiSurface->SetMaterialPropertiesTable ( SPT_Si );

    SetupDetectors();

    return worldPV;
}

//-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_

void MyDetectorConstruction::ConstructMaterials() {

    /*!
    \brief Construct materials

    Load the table materials used in world and detector.
    */

// construct all table materials
    G4double a, z;      //! specific mass, number of protons
    G4double density;   //! density
    G4int nel;          //! number of elements/material

// some standard environments
    G4double temperature = 300.*kelvin; //! temperature
    G4double pressure = 1.e-15*pascal;  //! pressure of gas

// vacuum standard definition...
    density = universe_mean_density;

// Vacuum
    G4NistManager* nistManager = G4NistManager::Instance();
    galactic =  nistManager->FindOrBuildMaterial ( "G4_Galactic" );

//  very thin Air
    G4Element* elN  = new G4Element ( "Nitrogen", "N", z=7.,  a=14.00674*g/mole );
    G4Element* elO  = new G4Element ( "Oxygen",   "O", z=8.,  a=15.9994*g/mole );
    G4Element* elAr = new G4Element ( "Argon",    "Ar",z=18., a=39.948*g/mole );

// add elements and properties
    Air = new G4Material ( "Air",
                           density= 1.2929e-03 *g/cm3,
                           nel=3,
                           kStateGas,
                           temperature,
                           pressure );

    // Add elements to Air
    G4double fractionmass;  // percentage of element
    Air->AddElement ( elN, fractionmass = 78*perCent );
    Air->AddElement ( elO, fractionmass = 21*perCent );
    Air->AddElement ( elAr,fractionmass = 1*perCent );

    // Silicon
    Si = new G4Material ( "Silicon", z=14., a= 28.0855*g/mole, density=2.33*mg/cm3 );

    // SiOxyNitride
    // define elementary silicon
    G4Element* elSi = new G4Element ( "Silicon", "Si", z=14.,a=28.055*g/mole );
    // define siliconoxynitride
    SiON = new G4Material ( "SiOxyNitride",
                            density=1.97*g/cm3,
                            nel=3 );

    SiON -> AddElement ( elSi, 1 );
    SiON -> AddElement ( elO, 1 );
    SiON -> AddElement ( elN, 1 );
}

//-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_

void MyDetectorConstruction::setCoatingMaterial ( G4String materialName )
{
    //! \brief change material of the coating
    //!
    //!     Messenger to select different materials for coating

    // search material by its name
    G4Material* ptoMaterial = G4Material::GetMaterial ( materialName );
    if ( ptoMaterial )
    {
        pCoatingMat = ptoMaterial;
        detectorLV->SetMaterial ( ptoMaterial );
        G4cout << "\n ---> The coating is " << T_COATING/nm << "nm of "
               << materialName << G4endl;
    }
}

//-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_

void MyDetectorConstruction::SetupDetectors() {

    G4String filterName, particleName;

    G4SDParticleFilter* electronFilter =
        new G4SDParticleFilter ( filterName="electronFilter", particleName="e-" );

    G4SDParticleFilter* photonFilter =
        new G4SDParticleFilter ( filterName="photonFilter", particleName="opticalphoton" );

    // get names of volumes
    G4String detName[2];

    detName[0] = detectorLV->GetName();
    detName[1] = pCoatingLV->GetName();

#ifdef DEBUG
    G4cout << "DEBUG SetupDetectors()" << detName[0] << ","
    << detName[1] << G4endl;
#endif

    // iterate over "detectors"
    for ( G4int i=0; i<2; i++ )
    {
        G4MultiFunctionalDetector* pDet
        = new G4MultiFunctionalDetector ( detName[i] );

        G4VPrimitiveScorer* primitive;

        // get energy deposition
        primitive = new G4PSEnergyDeposit ( "eDep", i );
        pDet->RegisterPrimitive ( primitive );

        // register number of secondary particles from optical photon
        primitive = new G4PSNofSecondary ( "nOpticalphoton", i );
        primitive->SetFilter ( photonFilter );
        pDet->RegisterPrimitive ( primitive );

        // register number of secondary particles from electrons
        primitive = new G4PSNofSecondary ( "nElectrons", i );
        primitive->SetFilter ( electronFilter );
        pDet->RegisterPrimitive ( primitive );

        // register passing optical photons
        primitive = new G4PSPassageCellFlux ( "passageCellFlux", i );
        primitive->SetFilter ( photonFilter );
        pDet->RegisterPrimitive ( primitive );

        // measure cell charge: sum of deposited charge in cell
        primitive = new G4PSCellCharge ( "cellCharge",i );
        pDet->RegisterPrimitive ( primitive );

        G4SDManager::GetSDMpointer()->AddNewDetector ( pDet );

        if ( i==0 )
        {
            detectorLV->SetSensitiveDetector ( pDet );
        }
        else
        {
            pCoatingLV->SetSensitiveDetector ( pDet );
        }
    }
}

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Feedback: Re: Optical Photons (5eV) pass simple silicon detector without interaction   (Gumplinger Peter - 14 Jan, 2010)
 Add Message Add Message
to: "Optical Photons (5eV) pass simple silicon detector without interaction"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews