Message: Re: Counting particles entering a volume. Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Re: Counting particles entering a volume. 

Forum: Event and Track Management
Re: Question Counting particles entering a volume. (Kostas Kousouris)
Re: None Re: Counting particles entering a volume. (michel maire)
Date: Feb 19, 03:22
From: Mayur Paunipagar <Mayur Paunipagar>

Hello Kostas Kousouris

It seems you are able to count the no. of particles entering a volume. Will you please help me with this. I am going through the same problem of counting the no. of optical photons reaching the volume.

See below, this is my code, which I modified in G4SteppingAction.cc (examples/extended/OpNovice/src)

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

	if(point->GetStepStatus() == fGeomBoundary && thePostPV->GetName() == "Disc_detector"){
		finDetectionCounter++;
	 }
	if(point->GetStepStatus() == fGeomBoundary && thePrePV->GetName() == "Disc_detector"){
		foutDetectionCounter++;
	 }

	    G4cout << "No of photons detected (Inside) = " << finDetectionCounter << G4endl;
		G4cout << "No of photons detected (Outside) = " << foutDetectionCounter << G4endl;	

Disc_detector is the name of the volume where photons are arriving/or at which I wanna detect photons. I am able to count it for less no. of photons but as the no. of photons increased the program is unable to count and the core dumps.

the No. of messages printed on terminal because of G4cout is so high that the core dumps.

how should I do it, any suggestions will be greatly appreciated, thanks in advance,

with regard,s Mayur

 Add Message Add Message
to: "Re: Counting particles entering a 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 ]