Message: 2 problems that may be related Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None 2 problems that may be related 

Forum: Processes Involving Optical Photons
Date: 04 Jun, 2009
From: <jdswado@gatech.edu>

Hello all,

First I apologize that only half of this entry deals with "processes involving optical photons" the other half deals with Compton Scattering but I wasn't sure what category to put this in since it had some overlap.

I have two problems in my application that I believe are quite possibly related but I'm not sure what the cause is. I've isolated the problems as best I could and the relevant code is shown below with notes about what crashes it commented next to the offending parts in CAPS. The problems occur in the initialization of G4double Absorption1[], in the definition of the density of air, and in the inclusion of the compton scattering process.

In Detector Construction.cc-------------------------------------------

G4double PhotonEnergy[nEntries] =
            { 3.2627*eV, 3.1791*eV, 3.0996*eV, 3.024*eV, 2.952*eV,
              2.8833*eV, 2.8178*eV, 2.7552*eV, 2.6953*eV, 2.6379*eV,
              2.583*eV, 2.5303*eV, 2.48*eV, 2.431*eV, 2.3843*eV,
              2.3393*eV, 2.296*eV, 2.254*eV, 2.214*eV, 2.1751*eV,
              2.1376*eV, 2.1014*eV, 2.0664*eV, 2.0325*eV, 1.9997*eV,
              1.9678*eV, 1.9372*eV, 1.9074*eV, 1.8785*eV, 1.8505*eV,
              1.8233*eV, 1.7969*eV, 1.7712*eV, 1.7462*eV, 1.722*eV,
              1.6984*eV, 1.6754*eV, 1.6531*eV};

G4double Absorption1[nEntries] =
            { 0.0*m, 0.0*m, 0.0*m, 0.0*m, 0.0*m, // <== IF ANY OF THESE NUMBERS
              0.0*m, 0.0*m, 0.0*m, 0.0*m, 0.0*m, // <== ARE ANYTHING OTHER THAN
              0.0*m, 0.0*m, 0.0*m, 0.0*m, 0.0*m, // <== ZERO, THE APPLICATION 
              0.0*m, 0.0*m, 0.0*m, 0.0*m, 0.0*m, // <== COMPILES WITHOUT ERROR
              0.0*m, 0.0*m, 0.0*m, 0.0*m, 0.0*m, // <== BUT CRASHES WHEN RUN
              0.0*m, 0.0*m, 0.0*m, 0.0*m, 0.0*m, // <== 
              0.0*m, 0.0*m, 0.0*m, 0.0*m, 0.0*m, // <== 
	      0.0*m, 0.0*m, 0.0*m};

G4MaterialPropertiesTable* myMPT1 = new G4MaterialPropertiesTable();
  myMPT1->AddProperty("RINDEX",       PhotonEnergy, RefractiveIndex1,nEntries);
  myMPT1->AddProperty("ABSLENGTH",    PhotonEnergy, Absorption1,     nEntries);
  myMPT1->AddProperty("FASTCOMPONENT",PhotonEnergy, ScintilFast,     nEntries);
  myMPT1->AddProperty("RAYLEIGH",     PhotonEnergy, scattering,      nEntries);

  myMPT1->AddConstProperty("SCINTILLATIONYIELD",38000./MeV);
  myMPT1->AddConstProperty("RESOLUTIONSCALE",1.0);
  myMPT1->AddConstProperty("FASTTIMECONSTANT", 1.*ns);

  G4Material* NaI = new G4Material("NaI", density= 3.7*g/cm3, 3); 
  NaI->AddElement(Na,0.495);
  NaI->AddElement(I,0.495);
  NaI->AddElement(Tl,0.01);
  NaI->SetMaterialPropertiesTable(myMPT1);

  G4Element* N = new G4Element("Nitrogen", "N", z=7., a= 14.01*g/mole);
  G4Element* O = new G4Element("Oxygen"  , "O", z=8., a= 16.00*g/mole);

  G4Material* Air = new G4Material("Air", density= 0.00129*g/cm3, 2); 

  // IF THE DENSITY OF AIR IS KEPT AT THIS VALUE, OR ANOTHER VALUE OF COMPARABLE
  // MAGNITUDE, THE APPLICATION CRASHES. IF THIS DENSITY IS RAISED TO SOMETHING
  // ON THE ORDER OF APPROX. 1 g/cm3 OR SO, THE APPLICATION RUNS FINE.  

  Air->AddElement(N,0.7);
  Air->AddElement(O,0.3);

------------------------------------------------------------------------- -------------------------------------------------------------------------

In PhysicsList.cc

#include "G4ComptonScattering.hh"

void ExN01PhysicsList::ConstructEM()
{
  theParticleIterator->reset();
  while( (*theParticleIterator)() ){
    G4ParticleDefinition* particle = theParticleIterator->value();
    G4ProcessManager* pmanager = particle->GetProcessManager();
    G4String particleName = particle->GetParticleName();

    if (particleName == "gamma") {
      // gamma         
      pmanager->AddDiscreteProcess(new G4ComptonScattering);

  // IF THE ABOVE LINE IS COMMENTED OUT, THE APPLICATION WILL RUN WITHOUT ERROR
  // IF COMPTON SCATTERING IS LIFT IN, THE PROGRAM WILL CRASH.

------------------------------------------------------------------------------ ------------------------------------------------------------------------------

Why giving non-zero values to the bulk absorption coefficient should crash the application is beyond me but since the program runs correctly if compton scattering is left out or if the density of air is raised significantly, I believe there is some issue occurring with compton scatter events in low density materials.

So does anyone have any idea about what might be causing these problems? I've gone over the code several times and compared my code to LXe and exampleN06. Is there something small I'm missing? Perhaps it is a bigger problem with my data libraries?

Any suggestion is greatly appreciated!

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

1 Note: Updated, one problem resolved.   (jdswado@gatech.edu - 11 Jun, 2009)
(_ Warning: Re: Updated, one problem resolved.   (Gumplinger Peter - 16 Jun, 2009)
 Add Message Add Message
to: "2 problems that may be related"

 Subscribe Subscribe

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