Message: Determining when electrons hit the world edge Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Determining when electrons hit the world edge 

Forum: Event and Track Management
Date: 22 Apr, 2016
From: Christopher Walker <Christopher Walker>

Hello,
   I am trying to determine the energies and directions of primary and secondary particles after they fly through a thin film. I can seem to create a data file that detects the electrons upon entry to the film, but not upon exit, or when they hit the world edge. I have tried creating a Test volume which the particles pass through after they go through the Target, but so far I have been unable to get anything to work. My code in SteppingAction.cc is thus (commented out bits are things I tried, but failed to work:

   G4StepPoint* prePoint = step->GetPreStepPoint();
   G4StepPoint* postPoint = step->GetPostStepPoint();

   if ((prePoint->GetPhysicalVolume() != 0)) {

	   G4StepPoint* pre = step->GetPreStepPoint();
	   G4String name = pre->GetPhysicalVolume()->GetLogicalVolume()->GetName();
	   G4String preVolume = postPoint->GetPhysicalVolume()->GetLogicalVolume()->GetName();
//	   if (pre->GetStepStatus() == fGeomBoundary && name == "Test")
//	   if (preVolume == "Target" && postPoint->GetStepStatus() == fGeomBoundary && flagParticle == 1)
	   if (preVolume == "Test")
	   {
		   analysisManager->FillNtupleDColumn(0, flagParticle);
		   analysisManager->FillNtupleDColumn(1, flagProcess);
		   analysisManager->FillNtupleDColumn(2, x);
		   analysisManager->FillNtupleDColumn(3, y);
		   analysisManager->FillNtupleDColumn(4, z);
		   analysisManager->FillNtupleDColumn(5, step->GetTotalEnergyDeposit() / eV);
		   analysisManager->FillNtupleDColumn(6, std::sqrt((x - xp)*(x - xp) + (y - yp)*(y - yp) + (z - zp)*(z - zp)) / nm);
		   analysisManager->FillNtupleDColumn(7, (step->GetPreStepPoint()->GetKineticEnergy() - step->GetPostStepPoint()->GetKineticEnergy()) / eV);
		   analysisManager->FillNtupleDColumn(8, vx);
		   analysisManager->FillNtupleDColumn(9, vy);
		   analysisManager->FillNtupleDColumn(10, vz);
		   analysisManager->FillNtupleDColumn(11, velocity);
		   analysisManager->AddNtupleRow();
	   }
   }
}

Many thanks in advance Chris

 Add Message Add Message
to: "Determining when electrons hit the world edge"

 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 ]