Message: How to make each concentric shell sensitive and access information Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question How to make each concentric shell sensitive and access information 

Forum: Geometry
Date: 16 Jul, 2010
From: aimsphere <aimsphere>

Dear Geant4 users,

I am trying to simulate a water sphere and the the depth dose profile by creating several layers inside it. Then make each of them sensitive and access the necessary information. 

How I am doing is by creating several spherical shells with increasing Rmin and Rmax (starting Rmin = 0). Here is the part of my code:

for (G4int i = 0; i<NbOfLayers; i++){
		
		std::string sphereNum = "sphereNum_"; sphereNum += i;
		G4Sphere* solidSphere = new G4Sphere(sphereNum,Rmin,Rmax,0.* deg, 360.* deg,0.* deg, 180.* deg);
				
 		std::string sphereLogNum= "sphereLogNum_"; sphereLogNum += i;
		logicSphere[i] = new G4LogicalVolume(solidSphere,H2O,sphereLogNum,0,0,0);
		
					
		std::string spherePhysNum= "spherePhysNum_"; spherePhysNum += i;
		physiSphere[i] = new G4PVPlacement(0,               // no rotation
						positionTarget,  // at (x,y,z)
						logicSphere[i],     // its logical volume
						spherePhysNum,        // its name
						logicWorld,      // its mother  volume
						false,           // no boolean operations
						0);              // copy number
		
		
		G4double maxStep = 0.01*mm;
		G4UserLimits* stepLimit = new G4UserLimits(maxStep);
		logicSphere[i]->SetUserLimits(stepLimit);
		Rmin = Rmax;
		Rmax = Rmax+deltaRadius;
	}

Then I make all these shells Sensitive like this:

               G4SDManager* SDman = G4SDManager::GetSDMpointer();
	       G4String trackerTargetSDname = "Ex1/TrackerChamberSD";
	       Ex1TrackerSD* aTrackerSD = new Ex1TrackerSD( trackerTargetSDname , fileName);
	       SDman->AddNewDetector( aTrackerSD );
	       for (G4int i = 0; i<NbOfLayers; i++){
		       logicSphere[i]->SetSensitiveDetector( aTrackerSD );
	       }

Question1) Can you confirm if this would work? Sorry I am still learning G4 and have not much programming experience.

Question2) I do not know how to get information out of these sensitive shells. I had previously made a cuboid with several layers n used G4Replica to make copies n use the following code to get information out of it. 

G4bool Ex1TrackerSD::ProcessHits(G4Step* aStep,G4TouchableHistory*)
{
  	G4double edep = aStep->GetTotalEnergyDeposit();
	G4double stepLength = aStep -> GetStepLength();
	G4double let = edep/stepLength;
	G4String particleDef = aStep -> GetTrack()-> GetDefinition() -> GetParticleName(); 
	G4int trackID = aStep->GetTrack()->GetTrackID();
	G4int LayerNb = aStep->GetPreStepPoint()->GetTouchableHandle()
                                               ->GetCopyNumber();
.........
}

Since there are so many volumes how can I get information from each? should I write something like to get the number of layers:
for (int i = 0; i<100; i++){
 G4int LayerNb += aStep->GetPreStepPoint()->GetTouchableHandle()
                                               ->GetCopyNumber(depth = i);
}

Thank you for helping me out!

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

1 None: Re: How to make each concentric shell sensitive and access information   (michel maire - 16 Jul, 2010)
2 None: Re: How to make each concentric shell sensitive and access information   (John Apostolakis - 17 Jul, 2010)
1 Ok: Re: How to make each concentric shell sensitive and access information   (aimsphere - 19 Jul, 2010)
2 Ok: Re: How to make each concentric shell sensitive and access information   (aimsphere - 19 Jul, 2010)
 Add Message Add Message
to: "How to make each concentric shell sensitive and access information"

 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 ]