Import Geant4 8.1.0 source tree
This commit is contained in:
@@ -1,23 +1,26 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
@@ -30,11 +33,10 @@
|
||||
// * *
|
||||
// ********************************
|
||||
//
|
||||
// $Id: BrachyPhantomSD.cc,v 1.9 2005/11/22 12:47:35 guatelli Exp $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
// $Id: BrachyPhantomSD.cc,v 1.13 2006/06/29 15:48:39 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
//
|
||||
#include "BrachyPhantomSD.hh"
|
||||
#include "BrachyPhantomHit.hh"
|
||||
#include "BrachyAnalysisManager.hh"
|
||||
#include "BrachyDetectorConstruction.hh"
|
||||
#include "G4Track.hh"
|
||||
@@ -46,13 +48,8 @@
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
|
||||
//....
|
||||
|
||||
BrachyPhantomSD::BrachyPhantomSD(G4String name):G4VSensitiveDetector(name)
|
||||
{
|
||||
G4String HCname;
|
||||
SensitiveDetectorName = name;
|
||||
collectionName.insert(HCname="phantomCollection");
|
||||
}
|
||||
|
||||
BrachyPhantomSD::~BrachyPhantomSD()
|
||||
@@ -60,61 +57,68 @@ BrachyPhantomSD::~BrachyPhantomSD()
|
||||
|
||||
}
|
||||
|
||||
void BrachyPhantomSD::Initialize(G4HCofThisEvent* HCE)
|
||||
void BrachyPhantomSD::Initialize(G4HCofThisEvent*)
|
||||
{
|
||||
phantomCollection = new BrachyPhantomHitsCollection
|
||||
(SensitiveDetectorName,collectionName[0]);
|
||||
static G4int HCID = -1;
|
||||
if(HCID<0)
|
||||
{ HCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]); }
|
||||
HCE->AddHitsCollection( HCID, phantomCollection );
|
||||
|
||||
}
|
||||
|
||||
G4bool BrachyPhantomSD::ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist)
|
||||
{
|
||||
//
|
||||
// The energy deposit of the hits is stored in histograms and ntuples
|
||||
//
|
||||
|
||||
if(!ROhist)
|
||||
return false;
|
||||
|
||||
if(aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() != "PhantomPhys")
|
||||
|
||||
// Check the volume
|
||||
if(aStep -> GetPreStepPoint() -> GetPhysicalVolume() ->
|
||||
GetName() != "PhantomPhys")
|
||||
return false;
|
||||
|
||||
G4double energyDeposit = aStep->GetTotalEnergyDeposit();
|
||||
G4double energyDeposit = aStep -> GetTotalEnergyDeposit();
|
||||
|
||||
// Check that the energy deposit is not null
|
||||
if(energyDeposit == 0.)
|
||||
return false;
|
||||
|
||||
if(energyDeposit != 0)
|
||||
{
|
||||
|
||||
// Read Voxel indexes: i is the x index, k is the z index
|
||||
{
|
||||
// Read Voxel indexes:
|
||||
// i is the x index,
|
||||
// j is the y index
|
||||
// k is the z index
|
||||
G4int j = ROhist -> GetReplicaNumber();
|
||||
G4int k = ROhist -> GetReplicaNumber(1);
|
||||
G4int i = ROhist -> GetReplicaNumber(2);
|
||||
G4int j = ROhist -> GetReplicaNumber();
|
||||
|
||||
G4int numberOfVoxelZ = 300;
|
||||
G4double voxelWidthZ = 1. *mm;
|
||||
G4double x = (-numberOfVoxelZ+1+2*i)*voxelWidthZ/2;
|
||||
G4double y = (- numberOfVoxelZ+1+2*j)*voxelWidthZ/2;
|
||||
G4double z = (- numberOfVoxelZ+1+2*k)*voxelWidthZ/2;
|
||||
G4int numberOfVoxel = 300;
|
||||
G4double voxelWidth = 1. *mm;
|
||||
|
||||
// Retrieve the coordinates of the center of the voxel where
|
||||
// the energy deposit is located
|
||||
x = ( - numberOfVoxel + 1+ 2*i )* voxelWidth/2;
|
||||
y = ( - numberOfVoxel + 1+ 2*j )* voxelWidth/2;
|
||||
z = ( - numberOfVoxel + 1+ 2*k )* voxelWidth/2;
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
BrachyAnalysisManager* analysis =
|
||||
BrachyAnalysisManager::getInstance();
|
||||
analysis -> FillNtupleWithEnergy(x,y,z,energyDeposit);
|
||||
if (y<0.8*mm && y> -0.8*mm)
|
||||
|
||||
// Fill the ntuple with position and energy deposit in the phantom
|
||||
analysis -> FillNtupleWithEnergy(x,y,z,energyDeposit/MeV);
|
||||
|
||||
if (y < 0.8 * mm && y > -0.8 * mm)
|
||||
{
|
||||
// Fill a 2D histogram with the energy deposit in the plane
|
||||
// containing the source
|
||||
analysis -> FillHistogramWithEnergy(x,z,energyDeposit/MeV);
|
||||
|
||||
if (z<0.8*mm && z> -0.8*mm)
|
||||
// Fill 1D histogram with the energy deposit
|
||||
// along the axis perpendicular to the main axis of the source
|
||||
if (z < 0.8 * mm && z > -0.8 * mm)
|
||||
analysis -> DoseDistribution(x,energyDeposit/MeV);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Store the energy deposit and position in a Hit collection
|
||||
BrachyPhantomHit* newHit = new BrachyPhantomHit();
|
||||
newHit -> SetEdep(energyDeposit);
|
||||
newHit -> SetPosition(x,y,z);
|
||||
phantomCollection -> insert( newHit );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user