Message: Problem with Parameterized volume Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Problem with Parameterized volume 

Keywords: Parameterization, Segmentation Fault, G4AllocatorPool
Forum: Geometry
Date: 25 Jul, 2006
From: Ioannis Sechopoulos <Ioannis Sechopoulos>

I believe that I am doing something wrong in defining a parameterized volume. I am trying to create a 2x2x1 cm lead collimator. I figured that I would define it as a 2x2x1 cm lead box with, as daughter volumes, an array of parameterized air boxes each of 0.9x0.9x10 mm. This would leave just the lead "walls" of the collimator and the rest would be the air "holes" This is my code:

void DetectorConstruction::ConstructImager()
{ 
  //------------------------------ 
  // Imager including collimator
  //------------------------------

.
.
.
	numPixelsX = 20;
	numPixelsY = 20;

	collWallThickness = 0.1*mm;
	collimatorHeight = 1.0*cm;
	resolution = 1.0*mm;

		// Calculation of Dimensions
	  G4ThreeVector collimatorSize = G4ThreeVector(resolution, resolution, collimatorHeight);
	  G4ThreeVector collApertureSize = G4ThreeVector(resolution - 0.5*collWallThickness, resolution - 0.5*collWallThickness, collimatorHeight);

		// Materials
	  G4Material* collimatorMaterial = G4Material::GetMaterial("G4_Pb");  
	  G4Material* apertureMaterial = G4Material::GetMaterial("G4_AIR");  

	  solidCollimatorAperture = new G4Box("solidCollimatorAperture", collApertureSize.x()/2., collApertureSize.y()/2., collApertureSize.z()/2.);
	  logicCollimatorAperture = new G4LogicalVolume(solidCollimatorAperture , apertureMaterial, "logicCollimatorAperture",0,0,0);

	  solidCollimator = new G4Box("solidCollimator", numPixelsX*collimatorSize.x()/2., numPixelsY*collimatorSize.y()/2., collimatorSize.z()/2.);
	  logicCollimator = new G4LogicalVolume(solidCollimator, collimatorMaterial, "logicCollimator",0,0,0);  
	  physiCollimator = new G4PVPlacement(0,                 // no rotation
                       			  G4ThreeVector(10.0*cm, 0.0, airGap + collimatorSize.z()/2.0),   // at (x,y,z)
                       			  logicCollimator,     // its logical volume				  
                       			  "physiCollimator",   // its name
                       			  logicWorld,      // its mother  volume
                       			  false,           // no boolean operations
                       			  0);              // no particular field

	  physiCollimatorAperture = new G4PVParameterised("physiCollimatorAperture", logicCollimatorAperture, logicCollimator, kUndefined, numPixelsX*numPixelsY, collimatorParam); 

		// Attributes
	        G4VisAttributes* collimatorAttrib= new G4VisAttributes();
		collimatorAttrib->SetVisibility(true);
		collimatorAttrib->SetColor(0/255., 255/255., 0/255., 0.4);

		collimatorAttrib->SetForceAuxEdgeVisible(true);
		logicCollimator->SetVisAttributes(collimatorAttrib);
.
.
.
}

and this is my parameterization:

void CollimatorParameterisation::ComputeTransformation
(const G4int copyNo, G4VPhysicalVolume* physVol) const
{
  G4double deltaX = sizeX / (G4double) numX;
  G4double deltaY = sizeY / (G4double) numY;

  G4double Xposition = deltaX/2.0 + deltaX*(copyNo/numX) - sizeX/2.0;
  G4double Yposition = deltaY/2.0 + deltaY*(copyNo%numX) - sizeY/2.0;
  G4double Zposition = 0.0;

  G4ThreeVector position = G4ThreeVector(Xposition,Yposition,Zposition);
  physVol->SetTranslation(position);
  physVol->SetRotation(0);
}

It seems to work fine, but at different points in the simulation (after millions of events) I get a Segmentation Fault in G4AllocatorPool:

>>> Event 34890000
>>> Event 34900000

Program received signal SIGSEGV, Segmentation fault.

0x00000000004e71a6 in G4AllocatorPool::Alloc ()

(gdb) where

#0  0x00000000004e71a6 in G4AllocatorPool::Alloc ()
#1  0x00000000004fa44f in G4Allocator<G4DynamicParticle>::MallocSingle ()
#2  0x00000000004fa468 in G4DynamicParticle::operator new ()
#3  0x00000000005441d1 in G4AtomicDeexcitation::GenerateAuger ()
#4  0x0000000000544764 in G4AtomicDeexcitation::GenerateParticles ()
#5  0x0000000000533d36 in G4LowEnergyPhotoElectric::PostStepDoIt ()
#6  0x000000000061ba87 in G4SteppingManager::InvokePSDIP ()
#7  0x000000000061bd40 in G4SteppingManager::InvokePostStepDoItProcs ()
#8  0x000000000061d6ce in G4SteppingManager::Stepping ()
#9  0x0000000000612c2b in G4TrackingManager::ProcessOneTrack ()
#10 0x0000000000603ec8 in G4EventManager::DoProcessing ()
#11 0x000000000060457e in G4EventManager::ProcessOneEvent ()
#12 0x00000000005c7654 in G4RunManager::DoEventLoop ()
#13 0x00000000005c4e5a in G4RunManager::BeamOn ()
#14 0x00000000005ca202 in G4RunMessenger::SetNewValue ()
#15 0x00000000007781a6 in G4UIcommand::DoIt ()
#16 0x0000000000781117 in G4UImanager::ApplyCommand ()
#17 0x0000000000781279 in G4UImanager::ApplyCommand ()
#18 0x00000000005134fa in G4UIterminal::ExecuteCommand ()
#19 0x00000000005133fc in G4UIterminal::SessionStart ()
#20 0x00000000004132a4 in main (argc=1, argv=0x7fffff9f2068) at fluo.cc:105

I believe my problem is in the parameterization because when I use /tracking/verbose, I get something like this:

#Step#    X(mm)    Y(mm)    Z(mm) KinE(MeV)  dE(MeV) StepLeng TrackLeng  NextVolume ProcName
    5      107     3.33     10.4    0.0338        0    0.436       217 physiCollimator Transportation

 >>AlongStepDoIt (process by process):    Process Name = Transportation

    ++G4Step Information
      Address of G4Track    : 0xb740d0
      Step Length (mm)      : 0.009387637856314891
      Energy Deposit (MeV)  : 0
      -----------------------------------------------------------------------
        StepPoint Information               PreStep            PostStep
      -----------------------------------------------------------------------
         Position - x (mm)   :              106.975   106.9794782063821
         Position - y (mm)   :    3.328470456889084    3.32678310141938
         Position - z (mm)   :    10.37527705058803   10.38335332718308
         Global Time (ns)    :   0.7225530573469098  0.7225843711361857
         Local Time (ns)     :   0.7225530573469098  0.7225843711361857
         Proper Time (ns)    :                    0                   0
         Momentum Direct - x :   0.4770322897646611  0.4770322897646611
         Momentum Direct - y :  -0.1797422840047936 -0.1797422840047936
         Momentum Direct - z :   0.8603097731995287  0.8603097731995287
         Momentum - x (MeV/c):  0.01611070204523956 0.01611070204523956
         Momentum - y (MeV/c): -0.006070394907566231-0.006070394907566231
         Momentum - z (MeV/c):   0.0290550445326521  0.0290550445326521
         Total Energy (MeV)  :  0.03377277050404199 0.03377277050404199
         Kinetic Energy (MeV):  0.03377277050404199 0.03377277050404199
         Velocity (mm/ns)    :           299.792458          299.792458
         Volume Name         :      physiCollimator     physiCollimator
         Safety (mm)         :                    0                   0
         Polarization - x    :                    0                   0
         Polarization - y    :                    0                   0
         Polarization - Z    :                    0                   0
         Weight              :                    1                   1
         Step Status         :           Geom Limit       PostStep Proc
         Process defined Step:       Transportation      LowEnPhotoElec
      -----------------------------------------------------------------------
          !Note! Safety of PostStep is only valid after all DoIt invocations.

    ++G4ParticleChange Information
      -----------------------------------------------
        G4ParticleChange Information
      -----------------------------------------------
        # of 2ndaries       :                    0
      -----------------------------------------------
        Energy Deposit (MeV):                    0
        Track Status        :                Alive
        True Path Length (mm) :              0.00939
        Stepping Control     :                    0

        Mass (GeV)   :                    0
        Charge (eplus)   :                    0
        Position - x (mm)   :                  107
        Position - y (mm)   :                 3.33
        Position - z (mm)   :                 10.4
        Time (ns)           :                0.723
        Proper Time (ns)    :                    0
        Momentum Direct - x :                0.477
        Momentum Direct - y :                -0.18
        Momentum Direct - z :                 0.86
        Kinetic Energy (MeV):               0.0338
        Polarization - x    :                    0
        Polarization - y    :                    0
        Polarization - z    :                    0
        Track Weight      :                    0
        Touchable (pointer) :            0x104b0b0

    ++List of secondaries generated (x,y,z,kE,t,PID):  No. of secodaries = 0

 >>AlongStepDoIt (after all invocations):
    ++List of invoked processes
      1) Transportation

    ++G4Step Information
      Address of G4Track    : 0xb740d0
      Step Length (mm)      : 0.009387637856314891
      Energy Deposit (MeV)  : 0
      -----------------------------------------------------------------------
        StepPoint Information               PreStep            PostStep
      -----------------------------------------------------------------------
         Position - x (mm)   :              106.975   106.9794782063821
         Position - y (mm)   :    3.328470456889084    3.32678310141938
         Position - z (mm)   :    10.37527705058803   10.38335332718308
         Global Time (ns)    :   0.7225530573469098  0.7225843711361857
         Local Time (ns)     :   0.7225530573469098  0.7225843711361857
         Proper Time (ns)    :                    0                   0
         Momentum Direct - x :   0.4770322897646611  0.4770322897646611
         Momentum Direct - y :  -0.1797422840047936 -0.1797422840047936
         Momentum Direct - z :   0.8603097731995287  0.8603097731995287
         Momentum - x (MeV/c):  0.01611070204523956 0.01611070204523956
         Momentum - y (MeV/c): -0.006070394907566231-0.006070394907566231
         Momentum - z (MeV/c):   0.0290550445326521  0.0290550445326521
         Total Energy (MeV)  :  0.03377277050404199 0.03377277050404199
         Kinetic Energy (MeV):  0.03377277050404199 0.03377277050404199
         Velocity (mm/ns)    :           299.792458          299.792458
         Volume Name         :      physiCollimator     physiCollimator
         Safety (mm)         :                    00.004478206382069083
         Polarization - x    :                    0                   0
         Polarization - y    :                    0                   0
         Polarization - Z    :                    0                   0
         Weight              :                    1                   1
         Step Status         :           Geom Limit       PostStep Proc
         Process defined Step:       Transportation      LowEnPhotoElec
      -----------------------------------------------------------------------

    ++List of secondaries generated (x,y,z,kE,t,PID):  No. of secodaries = 0

 >>PostStepDoIt (process by process):    Process Name = Transportation

    ++G4Step Information
      Address of G4Track    : 0xb740d0
      Step Length (mm)      : 0.009387637856314891
      Energy Deposit (MeV)  : 0
      -----------------------------------------------------------------------
        StepPoint Information               PreStep            PostStep
      -----------------------------------------------------------------------
         Position - x (mm)   :              106.975   106.9794782063821
         Position - y (mm)   :    3.328470456889084    3.32678310141938
         Position - z (mm)   :    10.37527705058803   10.38335332718308
         Global Time (ns)    :   0.7225530573469098  0.7225843711361857
         Local Time (ns)     :   0.7225530573469098  0.7225843711361857
         Proper Time (ns)    :                    0                   0
         Momentum Direct - x :   0.4770322897646611  0.4770322897646611
         Momentum Direct - y :  -0.1797422840047936 -0.1797422840047936
         Momentum Direct - z :   0.8603097731995287  0.8603097731995287
         Momentum - x (MeV/c):  0.01611070204523956 0.01611070204523956
         Momentum - y (MeV/c): -0.006070394907566231-0.006070394907566231
         Momentum - z (MeV/c):   0.0290550445326521  0.0290550445326521
         Total Energy (MeV)  :  0.03377277050404199 0.03377277050404199
         Kinetic Energy (MeV):  0.03377277050404199 0.03377277050404199
         Velocity (mm/ns)    :           299.792458          299.792458
         Volume Name         :      physiCollimator     physiCollimator
         Safety (mm)         :                    00.004478206382069083
         Polarization - x    :                    0                   0
         Polarization - y    :                    0                   0
         Polarization - Z    :                    0                   0
         Weight              :                    1                   1
         Step Status         :           Geom Limit       PostStep Proc
         Process defined Step:       Transportation      LowEnPhotoElec
      -----------------------------------------------------------------------

    ++G4ParticleChange Information
      -----------------------------------------------
        G4ParticleChange Information
      -----------------------------------------------
        # of 2ndaries       :                    0
      -----------------------------------------------
        Energy Deposit (MeV):                    0
        Track Status        :                Alive
        True Path Length (mm) :              0.00939
        Stepping Control     :                    0

        Mass (GeV)   :                    0
        Charge (eplus)   :                    0
        Position - x (mm)   :                  107
        Position - y (mm)   :                 3.33
        Position - z (mm)   :                 10.4
        Time (ns)           :                0.723
        Proper Time (ns)    :                    0
        Momentum Direct - x :                0.477
        Momentum Direct - y :                -0.18
        Momentum Direct - z :                 0.86
        Kinetic Energy (MeV):               0.0338
        Polarization - x    :                    0
        Polarization - y    :                    0
        Polarization - z    :                    0
        Track Weight      :                    0
        Touchable (pointer) :            0x104b0b0

++List of secondaries generated (x,y,z,kE,t,PID): No. of secodaries = 0 Segmentation fault

If I set a different random seed, the error still comes up at the physiCollimator, this is why I believe I might be doing something wrong with the parameterization. If somebody could confirm that my parameterization is fine, then might there be something wrong with G4AllocatorPool? Sorry for the length of the post, and thanks for the help!

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

1 None: Re: Problem with Parameterized volume   (Vladimir IVANTCHENKO - 25 Jul, 2006)
(_ Feedback: Re: Problem with Parameterized volume   (Ioannis Sechopoulos - 25 Jul, 2006)
(_ None: Re: Problem with Parameterized volume   (Vladimir IVANTCHENKO - 25 Jul, 2006)
(_ Feedback: Re: Problem with Parameterized volume   (Ioannis Sechopoulos - 25 Jul, 2006)
(_ Feedback: Re: Problem with Parameterized volume   (Ioannis Sechopoulos - 25 Jul, 2006)
(_ Sad: Re: Problem with Parameterized volume   (Ioannis Sechopoulos - 25 Jul, 2006)
(_ Ok: Re: Problem with Parameterized volume   (Ioannis Sechopoulos - 25 Jul, 2006)
 Add Message Add Message
to: "Problem with Parameterized volume"

 Subscribe Subscribe

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


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]