Message: counting particles crossing the boundary Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question counting particles crossing the boundary 

Forum: Event and Track Management
Date: 18 Feb, 2014
From: Summit <Summit>

Dear Geant4 users,

I have made a detector consists of three parts named as: Target1, Target2 and Target3. Particles enter the Target2 from Target1. In order to count the primary particle entering the Target2, I have made following modifications in HistoManager.cc of Hadr02.

   G4StepPoint* point = step->GetPostStepPoint();
   G4StepPoint* point2 = step->GetPreStepPoint();
   G4VPhysicalVolume* thePostPV = point->GetPhysicalVolume();
   G4VPhysicalVolume* thePrePV = point2->GetPhysicalVolume();

   if(point->GetStepStatus() == fGeomBoundary && thePostPV->GetName()=="Target2") 
   {
      inparticlecount ++;
   }

And to count the particles leaving the Target2 or entering the Target3, I have tried two different approaches:

Approach1:

if(point->GetStepStatus() == fGeomBoundary && thePrePV->GetName()=="Target2") 
  {
   outparticlecount ++;
   }

and

Approach2:

if(point->GetStepStatus() == fGeomBoundary && thePostPV->GetName()=="Target3") 
   {
   outparticlecount ++;
   }

In both the cases, I am getting different results. Can anyone explain me why I am getting different results?

And in the method AddTargetStep(const G4Step* step), I have tried to find out the tracks with parent ID different than 0 as

if(GetParentID() != 0)

then I am not getting any ID. Can anyone suggest me what should I do to get parent ID?

Thanks.

Summit

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

1 Feedback: Re: counting particles crossing the boundary   (Gumplinger Peter - 18 Feb, 2014)
2 Question: Re: counting particles crossing the boundary   (Summit - 22 Feb, 2014)
1 Feedback: Re: counting particles crossing the boundary   (Gumplinger Peter - 28 Feb, 2014)
(_ None: Re: counting particles crossing the boundary   (Summit - 03 Mar, 2014)
(_ None: Re: counting particles crossing the boundary   (Summit - 15 Apr, 2014)
(_ Feedback: Re: counting particles crossing the boundary   (Gumplinger Peter - 16 Apr, 2014)
 Add Message Add Message
to: "counting particles crossing the boundary"

 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 ]