Import Geant4 9.1.0 source tree
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
# $Id: GNUmakefile,v 1.1 2007/11/16 14:28:34 kmura Exp $
|
||||
# $Name: geant4-09-01 $
|
||||
# ===========================================================
|
||||
# Makefile for building G4 MPI aplication
|
||||
# ===========================================================
|
||||
name := exMPI02#
|
||||
G4TARGET := $(name)
|
||||
G4EXLIB := true
|
||||
|
||||
G4WORKDIR := .
|
||||
|
||||
.PHONY: all
|
||||
all: lib bin
|
||||
|
||||
include $(G4INSTALL)/config/binmake.gmk
|
||||
include ../mpi_interface/G4MPI.gmk
|
||||
|
||||
LDLIBS1 += -lG4UImpi
|
||||
|
||||
ifdef ROOTSYS
|
||||
CPPFLAGS += -I$(shell $(ROOTSYS)/bin/root-config --incdir)
|
||||
LDLIBS += $(shell $(ROOTSYS)/bin/root-config --libs)
|
||||
endif
|
||||
|
||||
ifeq ($(G4SYSTEM),Linux-g++)
|
||||
LDLIBS += -Wl,-rpath,$(shell $(ROOTSYS)/bin/root-config --libdir)
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
$Id: History,v 1.1 2007/11/16 14:28:34 kmura Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
exMPI02 History
|
||||
---------------
|
||||
|
||||
16 Nov. 2007 K.Murakami
|
||||
- commited to G4 CVS.
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
$Id: README,v 1.1 2007/11/16 14:28:34 kmura Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
Example MPI02
|
||||
-------------
|
||||
|
||||
An example of dosimetry in a water phantom.
|
||||
|
||||
* Geometry : water phantom
|
||||
* Primary : broad beam (200 MeV proton)
|
||||
* Physics List : QGSP_BIC
|
||||
You need to set an additional environment variable;
|
||||
$G4LEVELGAMMADATA indicates a directory path for the data of
|
||||
"low energy electromagnetic processes".
|
||||
* Analysis : ROOT histogramming
|
||||
ROOT should be installed under $ROOTSYS.
|
||||
|
||||
- Score dose distribution in a water phantom.
|
||||
- Learn how to paralleized your applications.
|
||||
- Create a ROOT file containing histograms/trees in each node.
|
||||
* treat multiple outputs properly:
|
||||
each slave node generate a ROOT file, whose file name should
|
||||
be different from each other.
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * 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. 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 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: exMPI02.cc,v 1.1 2007/11/16 14:28:34 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// exMPI02.cc
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
|
||||
// my application
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "MedicalBeam.hh"
|
||||
#include "QGSP_BIC.hh"
|
||||
#include "RunAction.hh"
|
||||
#include "EventAction.hh"
|
||||
|
||||
// MPI session
|
||||
#include "G4MPImanager.hh"
|
||||
#include "G4MPIsession.hh"
|
||||
#include "G4UItcsh.hh"
|
||||
|
||||
#ifdef G4VIS_USE
|
||||
#include "G4VisExecutive.hh"
|
||||
#endif
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
// random engine
|
||||
//CLHEP::Ranlux64Engine randomEngine;
|
||||
//CLHEP::HepRandom::setTheEngine(&randomEngine);
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// MPI session
|
||||
// --------------------------------------------------------------------
|
||||
// At first, G4MPImanager/G4MPIsession should be created.
|
||||
G4MPImanager* g4MPI= new G4MPImanager(argc,argv);
|
||||
|
||||
// MPI session (G4MPIsession) instead of G4UIterminal
|
||||
// Terminal availability depends on your MPI implementation.
|
||||
G4MPIsession* session= g4MPI-> GetMPIsession();
|
||||
|
||||
// LAM/MPI users can use G4tcsh.
|
||||
G4String prompt= "[40;01;33m";
|
||||
prompt+= "G4MPI";
|
||||
prompt+= "[40;31m(%s)[40;36m[%/][00;30m:";
|
||||
|
||||
G4UItcsh* tcsh= new G4UItcsh(prompt);
|
||||
tcsh-> SetLsColor(BLUE,RED);
|
||||
session-> SetShell(tcsh);
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// user application setting
|
||||
// --------------------------------------------------------------------
|
||||
G4RunManager* runManager= new G4RunManager();
|
||||
|
||||
// setup your application
|
||||
runManager-> SetUserInitialization(new DetectorConstruction);
|
||||
runManager-> SetUserInitialization(new QGSP_BIC);
|
||||
runManager-> SetUserAction(new MedicalBeam);
|
||||
runManager-> SetUserAction(new RunAction);
|
||||
runManager-> SetUserAction(new EventAction);
|
||||
|
||||
runManager-> Initialize();
|
||||
|
||||
#ifdef G4VIS_USE
|
||||
G4VisExecutive* visManager= new G4VisExecutive;
|
||||
visManager-> Initialize();
|
||||
G4cout << G4endl;
|
||||
#endif
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// ready for go
|
||||
// MPIsession treats both interactive and batch modes.
|
||||
// Just start your session as below.
|
||||
// --------------------------------------------------------------------
|
||||
session-> SessionStart();
|
||||
|
||||
|
||||
// termination
|
||||
#ifdef G4VIS_USE
|
||||
delete visManager;
|
||||
#endif
|
||||
|
||||
delete g4MPI;
|
||||
|
||||
delete runManager;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * 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. 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 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: Analysis.hh,v 1.1 2007/11/16 14:29:32 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// Analysis.hh
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#ifndef ANALYSIS_MANAGER_H
|
||||
#define ANALYSIS_MANAGER_H
|
||||
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
class TH1D;
|
||||
class TH2D;
|
||||
|
||||
class Analysis {
|
||||
private:
|
||||
static Analysis* myanalysis;
|
||||
|
||||
TH2D* incident_map;
|
||||
TH1D* incident_x_hist;
|
||||
|
||||
TH2D* dose_map;
|
||||
TH1D* dose_hist;
|
||||
|
||||
Analysis(); // protected
|
||||
|
||||
G4bool incidentFlag;
|
||||
|
||||
public:
|
||||
~Analysis();
|
||||
|
||||
static Analysis* GetAnalysis();
|
||||
|
||||
void Update();
|
||||
void Clear();
|
||||
void Save(const G4String& fname);
|
||||
|
||||
void FillIncident(const G4ThreeVector& p);
|
||||
void FillDose(const G4ThreeVector& p, G4double dedx);
|
||||
|
||||
void ClearIncidentFlag();
|
||||
|
||||
};
|
||||
|
||||
// ====================================================================
|
||||
// inline functions
|
||||
// ====================================================================
|
||||
|
||||
inline void Analysis::ClearIncidentFlag()
|
||||
{ incidentFlag= false; }
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * 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. 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 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: DetectorConstruction.hh,v 1.1 2007/11/16 14:29:32 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// DetectorConstruction.hh
|
||||
//
|
||||
// Q
|
||||
// ====================================================================
|
||||
#ifndef DETECTOR_CONSTRUCTION_H
|
||||
#define DETECTOR_CONSTRUCTION_H
|
||||
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
class DetectorConstruction : public G4VUserDetectorConstruction {
|
||||
|
||||
public:
|
||||
DetectorConstruction();
|
||||
~DetectorConstruction();
|
||||
|
||||
virtual G4VPhysicalVolume* Construct();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * 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. 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 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: EventAction.hh,v 1.2 2007/12/10 16:28:34 gunter Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
// ====================================================================
|
||||
// EventAction.hh
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#ifndef EVENT_ACTION_H
|
||||
#define EVENT_ACTION_H
|
||||
|
||||
#include "G4UserEventAction.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
class EventAction : public G4UserEventAction {
|
||||
|
||||
public:
|
||||
EventAction();
|
||||
~EventAction();
|
||||
|
||||
virtual void BeginOfEventAction(const G4Event* aevent);
|
||||
virtual void EndOfEventAction(const G4Event* aevent);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,145 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * 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. 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 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: MedicalBeam.hh,v 1.1 2007/11/16 14:29:33 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
// ====================================================================
|
||||
// MedicalBeam.hh
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#ifndef MEDICAL_BEAM_H
|
||||
#define MEDICAL_BEAM_H
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
|
||||
class G4ParticleDefinition;
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
class MedicalBeam : public G4VUserPrimaryGeneratorAction {
|
||||
public:
|
||||
enum FieldShape{ SQUARE=0, CIRCLE };
|
||||
|
||||
protected:
|
||||
G4ParticleDefinition* particle;
|
||||
G4double kineticE;
|
||||
G4ThreeVector sourcePosition;
|
||||
|
||||
G4double SSD; // (SSD= Source Skin Depth)
|
||||
FieldShape fieldShape;
|
||||
G4double fieldXY[2];
|
||||
G4double fieldR;
|
||||
|
||||
// local methods...
|
||||
G4ThreeVector GenerateBeamDirection() const;
|
||||
|
||||
public:
|
||||
MedicalBeam();
|
||||
~MedicalBeam();
|
||||
|
||||
// set/get functions...
|
||||
void SetParticleDefinition(G4ParticleDefinition* pd);
|
||||
const G4ParticleDefinition* GetParticleDefinition() const;
|
||||
|
||||
void SetKineticE(G4double e);
|
||||
G4double GetKineticE() const;
|
||||
|
||||
void SetSourcePosition(const G4ThreeVector& pos);
|
||||
G4ThreeVector GetSourcePosition() const;
|
||||
|
||||
void SetFieldShape(FieldShape shape);
|
||||
FieldShape GetFieldShape() const;
|
||||
|
||||
void SetSSD(G4double ssd);
|
||||
G4double GetSSD() const;
|
||||
|
||||
void SetFieldXY(G4double fx, G4double fy);
|
||||
G4double GetFieldX() const;
|
||||
G4double GetFieldY() const;
|
||||
|
||||
void SetFieldR(G4double r);
|
||||
G4double GetFieldR() const;
|
||||
|
||||
// methods...
|
||||
virtual void GeneratePrimaries(G4Event* anEvent);
|
||||
|
||||
};
|
||||
|
||||
// ====================================================================
|
||||
// inline functions
|
||||
// ====================================================================
|
||||
inline void MedicalBeam::SetParticleDefinition(G4ParticleDefinition* pd)
|
||||
{ particle= pd; }
|
||||
|
||||
inline const G4ParticleDefinition* MedicalBeam::GetParticleDefinition() const
|
||||
{ return particle; }
|
||||
|
||||
inline void MedicalBeam::SetKineticE(G4double e)
|
||||
{ kineticE= e; }
|
||||
|
||||
inline G4double MedicalBeam::GetKineticE() const
|
||||
{ return kineticE; }
|
||||
|
||||
inline void MedicalBeam::SetSourcePosition(const G4ThreeVector& pos)
|
||||
{ sourcePosition= pos; }
|
||||
|
||||
inline G4ThreeVector MedicalBeam::GetSourcePosition() const
|
||||
{ return sourcePosition; }
|
||||
|
||||
inline void MedicalBeam::SetFieldShape(MedicalBeam::FieldShape shape)
|
||||
{ fieldShape= shape; }
|
||||
|
||||
inline MedicalBeam::FieldShape MedicalBeam::GetFieldShape() const
|
||||
{ return fieldShape; }
|
||||
|
||||
inline void MedicalBeam::SetSSD(G4double ssd)
|
||||
{ SSD= ssd; }
|
||||
|
||||
inline G4double MedicalBeam::GetSSD() const
|
||||
{ return SSD; }
|
||||
|
||||
inline void MedicalBeam::SetFieldXY(G4double fx, G4double fy)
|
||||
{ fieldXY[0]= fx; fieldXY[1]= fy; }
|
||||
|
||||
inline G4double MedicalBeam::GetFieldX() const
|
||||
{ return fieldXY[0]; }
|
||||
|
||||
inline G4double MedicalBeam::GetFieldY() const
|
||||
{ return fieldXY[1]; }
|
||||
|
||||
inline void MedicalBeam::SetFieldR(G4double r)
|
||||
{ fieldR= r; }
|
||||
|
||||
inline G4double MedicalBeam::GetFieldR() const
|
||||
{ return fieldR; }
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * 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. 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 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: RunAction.hh,v 1.2 2007/12/10 16:28:39 gunter Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
// ====================================================================
|
||||
// RunAction.hh
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#ifndef RUN_ACTION_H
|
||||
#define RUN_ACTION_H
|
||||
|
||||
#include "G4UserRunAction.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
class RunAction : public G4UserRunAction {
|
||||
|
||||
public:
|
||||
RunAction();
|
||||
~RunAction();
|
||||
|
||||
virtual void BeginOfRunAction(const G4Run* arun);
|
||||
virtual void EndOfRunAction(const G4Run* arun);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,94 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * 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. 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 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: VoxelParam.hh,v 1.1 2007/11/16 14:29:33 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// VoxelParam.hh
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#ifndef VOXEL_PARAM_H
|
||||
#define VOXEL_PARAM_H
|
||||
|
||||
#include "G4VPVParameterisation.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
class VoxelParam : public G4VPVParameterisation {
|
||||
|
||||
public:
|
||||
VoxelParam();
|
||||
~VoxelParam();
|
||||
|
||||
virtual void ComputeTransformation(const G4int id,
|
||||
G4VPhysicalVolume* vol) const;
|
||||
|
||||
virtual void ComputeDimensions(G4Box& box, const G4int id,
|
||||
const G4VPhysicalVolume* vol) const;
|
||||
|
||||
virtual void ComputeDimensions
|
||||
(G4Trd&,const G4int,const G4VPhysicalVolume*) const {}
|
||||
|
||||
virtual void ComputeDimensions
|
||||
(G4Trap&,const G4int,const G4VPhysicalVolume*) const {}
|
||||
|
||||
virtual void ComputeDimensions
|
||||
(G4Cons&,const G4int,const G4VPhysicalVolume*) const {}
|
||||
|
||||
virtual void ComputeDimensions
|
||||
(G4Sphere&,const G4int,const G4VPhysicalVolume*) const {}
|
||||
|
||||
virtual void ComputeDimensions
|
||||
(G4Orb&,const G4int,const G4VPhysicalVolume*) const {}
|
||||
|
||||
virtual void ComputeDimensions
|
||||
(G4Torus&,const G4int,const G4VPhysicalVolume*) const {}
|
||||
|
||||
|
||||
virtual void ComputeDimensions
|
||||
(G4Para&,const G4int,const G4VPhysicalVolume*) const {}
|
||||
|
||||
virtual void ComputeDimensions
|
||||
(G4Hype&,const G4int,const G4VPhysicalVolume*) const {}
|
||||
|
||||
virtual void ComputeDimensions
|
||||
(G4Tubs&,const G4int,const G4VPhysicalVolume*) const {}
|
||||
|
||||
virtual void ComputeDimensions
|
||||
(G4Polycone&,const G4int,const G4VPhysicalVolume*) const {}
|
||||
|
||||
virtual void ComputeDimensions
|
||||
(G4Polyhedra&,const G4int,const G4VPhysicalVolume*) const {}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * 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. 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 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: VoxelSD.hh,v 1.1 2007/11/16 14:29:33 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// VoxelSD.hh
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#ifndef VOXEL_SD_H
|
||||
#define VOXEL_SD_H
|
||||
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
class VoxelSD : public G4VSensitiveDetector {
|
||||
|
||||
public:
|
||||
VoxelSD(const G4String& name);
|
||||
~VoxelSD();
|
||||
|
||||
// virtual methods
|
||||
virtual G4bool ProcessHits(G4Step* astep, G4TouchableHistory* rohist);
|
||||
virtual void Initialize(G4HCofThisEvent* HCTE);
|
||||
virtual void EndOfEvent(G4HCofThisEvent* HCTE);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,179 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * 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. 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 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: Analysis.cc,v 1.1 2007/11/16 14:29:33 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// Analysis.cc
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#include "Analysis.hh"
|
||||
|
||||
// ROOT headers
|
||||
#include "TROOT.h"
|
||||
#include "TFile.h"
|
||||
#include "TH1.h"
|
||||
#include "TH2.h"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
Analysis* Analysis::myanalysis= 0;
|
||||
|
||||
|
||||
////////////////////
|
||||
Analysis::Analysis()
|
||||
////////////////////
|
||||
{
|
||||
// ROOT style
|
||||
gROOT->Reset();
|
||||
|
||||
// define histograms
|
||||
incident_map = new TH2D("incident map", "Incident Distributuon",
|
||||
50, -5., 5.,
|
||||
50, -5., 5.);
|
||||
incident_map-> GetXaxis()-> SetTitle("X (cm)");
|
||||
incident_map-> GetYaxis()-> SetTitle("Y (cm)");
|
||||
incident_map-> SetStats(0);
|
||||
|
||||
incident_x_hist = new TH1D("incident x", "Incident X", 100, -5., 5.);
|
||||
incident_x_hist-> GetXaxis()-> SetTitle("X (cm)");
|
||||
incident_x_hist-> SetFillColor(kRed);
|
||||
|
||||
dose_map = new TH2D("dose map", "Dose Distribution",
|
||||
500, 0., 50.,
|
||||
200, -10., 10.);
|
||||
dose_map-> GetXaxis()-> SetTitle("Z (cm)");
|
||||
dose_map-> GetYaxis()-> SetTitle("X (cm)");
|
||||
dose_map-> SetStats(0);
|
||||
|
||||
dose_hist = new TH1D("dose", "Dose Distribution", 500, 0., 50.);
|
||||
dose_hist-> GetXaxis()-> SetTitle("Z (cm)");
|
||||
dose_hist-> GetYaxis()-> SetTitle("Dose (GeV)");
|
||||
dose_hist-> SetFillColor(kBlue);
|
||||
dose_hist-> SetStats(0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/////////////////////
|
||||
Analysis::~Analysis()
|
||||
/////////////////////
|
||||
{
|
||||
delete incident_map;
|
||||
delete incident_x_hist;
|
||||
delete dose_map;
|
||||
delete dose_hist;
|
||||
|
||||
myanalysis=0;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
Analysis* Analysis::GetAnalysis()
|
||||
/////////////////////////////////
|
||||
{
|
||||
if (myanalysis == 0) {
|
||||
myanalysis = new Analysis();
|
||||
}
|
||||
|
||||
return myanalysis;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////
|
||||
void Analysis::Update()
|
||||
///////////////////////
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////
|
||||
void Analysis::Clear()
|
||||
//////////////////////
|
||||
{
|
||||
incident_map-> Reset();
|
||||
incident_x_hist-> Reset();
|
||||
dose_map-> Reset();
|
||||
dose_hist-> Reset();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////
|
||||
void Analysis::Save(const G4String& fname)
|
||||
//////////////////////////////////////////
|
||||
{
|
||||
TFile* file = new TFile(fname.c_str(),
|
||||
"RECREATE", "Geant4 ROOT analysis");
|
||||
incident_map-> Write();
|
||||
incident_x_hist-> Write();
|
||||
dose_map-> Write();
|
||||
dose_hist-> Write();
|
||||
|
||||
file-> Close();
|
||||
|
||||
delete file;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
void Analysis::FillIncident(const G4ThreeVector& p)
|
||||
///////////////////////////////////////////////////
|
||||
{
|
||||
if(! incidentFlag) {
|
||||
incident_map-> Fill(p.x()/cm, p.y()/cm);
|
||||
incident_x_hist-> Fill(p.x()/cm);
|
||||
|
||||
incidentFlag= true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
void Analysis::FillDose(const G4ThreeVector& p, G4double dedx)
|
||||
//////////////////////////////////////////////////////////////
|
||||
{
|
||||
const G4double Z0= 25.*cm;
|
||||
const G4double dxy= 10.*mm;
|
||||
|
||||
if(std::abs(p.y()) < dxy ) {
|
||||
dose_map-> Fill((p.z()+Z0)/cm, p.x()/cm, dedx/GeV);
|
||||
|
||||
if(std::abs(p.x()) < dxy) {
|
||||
dose_hist-> Fill((p.z()+Z0)/cm, dedx/GeV);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * 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. 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 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: DetectorConstruction.cc,v 1.1 2007/11/16 14:29:33 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// DetectorConstruction.cc
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "VoxelParam.hh"
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4PVParameterised.hh"
|
||||
#include "VoxelSD.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
|
||||
typedef G4LogicalVolume G4LV;
|
||||
typedef G4PVPlacement G4PVP;
|
||||
typedef G4VisAttributes G4VA;
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
////////////////////////////////////////////
|
||||
DetectorConstruction::DetectorConstruction()
|
||||
////////////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////
|
||||
DetectorConstruction::~DetectorConstruction()
|
||||
/////////////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
////////////////////////////////////////////////////
|
||||
{
|
||||
G4NistManager* nistManager= G4NistManager::Instance();
|
||||
G4VisAttributes* va;
|
||||
|
||||
// ==============================================================
|
||||
// world volume
|
||||
// ==============================================================
|
||||
const G4double DXYZ_WORLD= 200.*cm;
|
||||
G4Box* sld_world= new G4Box("world",
|
||||
DXYZ_WORLD/2., DXYZ_WORLD/2., DXYZ_WORLD/2.);
|
||||
|
||||
G4Material* vacuum= nistManager-> FindOrBuildMaterial("G4_Galactic");
|
||||
G4LV* lv_world= new G4LogicalVolume(sld_world, vacuum, "world");
|
||||
G4PVP* world= new G4PVPlacement(0, G4ThreeVector(), "AREA",
|
||||
lv_world, 0, false, 0);
|
||||
// vis. attributes
|
||||
va= new G4VA(G4Color(1.,1.,1.));
|
||||
va-> SetVisibility(false);
|
||||
lv_world-> SetVisAttributes(va);
|
||||
|
||||
// ==============================================================
|
||||
// water phantom
|
||||
// ==============================================================
|
||||
const G4double DXY_PHANTOM= 20.*cm;
|
||||
const G4double DZ_PHANTOM= 50.*cm;
|
||||
|
||||
G4Box* sld_phantom= new G4Box("phantom",
|
||||
DXY_PHANTOM/2., DXY_PHANTOM/2., DZ_PHANTOM/2.);
|
||||
|
||||
G4Material* water= nistManager-> FindOrBuildMaterial("G4_WATER");
|
||||
G4LV* lv_phantom= new G4LogicalVolume(sld_phantom,
|
||||
water, "phantom");
|
||||
|
||||
va= new G4VA(G4Color(0.,1.,1.));
|
||||
lv_phantom-> SetVisAttributes(va);
|
||||
|
||||
new G4PVP(0, G4ThreeVector(), lv_phantom, "phantom", lv_world, false, 0);
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// voxel planes
|
||||
const G4double DXY_VXP= 20.*cm;
|
||||
const G4double DZ_VXP= 1.*mm;
|
||||
|
||||
G4Box* sld_vxp= new G4Box("vxplane", DXY_VXP/2., DXY_VXP/2., DZ_VXP/2.);
|
||||
G4LV* lv_vxp= new G4LV(sld_vxp, water, "vxplane");
|
||||
|
||||
va= new G4VA(G4Color(1.,0.,0.));
|
||||
va-> SetVisibility(false);
|
||||
lv_vxp-> SetVisAttributes(va);
|
||||
|
||||
for (G4int iz=0; iz<500; iz++) {
|
||||
G4double z0= -DZ_PHANTOM/2. + (iz+0.5)*DZ_VXP;
|
||||
new G4PVP(0, G4ThreeVector(0.,0.,z0),
|
||||
lv_vxp, "vxplane", lv_phantom,
|
||||
false, 1000+iz);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// voxel parameterized
|
||||
|
||||
G4Box* sld_voxel= new G4Box("voxel",1.,1.,1.); // dummy
|
||||
G4LV* lv_voxel= new G4LV(sld_voxel, water, "voxel");
|
||||
lv_voxel-> SetSensitiveDetector(new VoxelSD("voxel"));
|
||||
|
||||
va= new G4VA(G4Color(0.,1.,1.));
|
||||
va-> SetVisibility(false);
|
||||
lv_voxel-> SetVisAttributes(va);
|
||||
|
||||
const G4int nvoxels= 100*100;
|
||||
new G4PVParameterised("voxle", lv_voxel, lv_vxp,
|
||||
kUndefined, nvoxels, new VoxelParam());
|
||||
|
||||
|
||||
return world;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * 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. 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 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: EventAction.cc,v 1.2 2007/12/10 16:28:52 gunter Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
// ====================================================================
|
||||
// EventAction.cc
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#include "EventAction.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "Analysis.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
//////////////////////////
|
||||
EventAction::EventAction()
|
||||
//////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////
|
||||
EventAction::~EventAction()
|
||||
///////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
void EventAction::BeginOfEventAction(const G4Event*)
|
||||
////////////////////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
void EventAction::EndOfEventAction(const G4Event*)
|
||||
//////////////////////////////////////////////////
|
||||
{
|
||||
Analysis* myana= Analysis::GetAnalysis();
|
||||
myana-> ClearIncidentFlag();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * 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. 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 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: MedicalBeam.cc,v 1.1 2007/11/16 14:29:33 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
// ====================================================================
|
||||
// MedicalBeam.cc
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#include "MedicalBeam.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4PrimaryVertex.hh"
|
||||
|
||||
using namespace CLHEP;
|
||||
|
||||
#include <cmath>
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
///////////////////////////////////
|
||||
MedicalBeam::MedicalBeam()
|
||||
: particle(0),
|
||||
kineticE(1.*MeV),
|
||||
sourcePosition(G4ThreeVector()),
|
||||
SSD(1.*m),
|
||||
fieldShape(MedicalBeam::SQUARE),
|
||||
fieldR(10.*cm)
|
||||
///////////////////////////////////
|
||||
{
|
||||
|
||||
G4ParticleTable* particleTable= G4ParticleTable::GetParticleTable();
|
||||
particle= particleTable-> FindParticle("proton");
|
||||
|
||||
kineticE= 200.*MeV;
|
||||
sourcePosition= G4ThreeVector(0.,0.,-125.*cm);
|
||||
SSD= 100.*cm;
|
||||
fieldXY[0]= fieldXY[1]= 5.*cm;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////
|
||||
MedicalBeam::~MedicalBeam()
|
||||
///////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
G4ThreeVector MedicalBeam::GenerateBeamDirection() const
|
||||
////////////////////////////////////////////////////////
|
||||
{
|
||||
// uniform distribution in a limitted solid angle
|
||||
G4double dr;
|
||||
if(fieldShape == MedicalBeam::SQUARE) {
|
||||
dr= std::sqrt(sqr(fieldXY[0]/2.)+sqr(fieldXY[1]/2.));
|
||||
} else {
|
||||
dr= fieldR;
|
||||
}
|
||||
|
||||
G4double sin0= dr/SSD;
|
||||
G4double cos0= std::sqrt(1.-sqr(sin0));
|
||||
|
||||
G4double dcos=0.;
|
||||
G4double dsin, dphi, z;
|
||||
|
||||
G4double x= DBL_MAX;
|
||||
G4double y= DBL_MAX;
|
||||
|
||||
G4double xmax, ymax;
|
||||
if(fieldShape == MedicalBeam::SQUARE) {
|
||||
xmax= fieldXY[0]/2./SSD;
|
||||
ymax= fieldXY[1]/2./SSD;
|
||||
} else {
|
||||
xmax= ymax= DBL_MAX-1.;
|
||||
}
|
||||
|
||||
while(! (std::abs(x)< xmax && std::abs(y)< ymax) ) {
|
||||
dcos= RandFlat::shoot(cos0, 1.);
|
||||
dsin= std::sqrt(1.-sqr(dcos));
|
||||
dphi= RandFlat::shoot(0., twopi);
|
||||
|
||||
x= std::cos(dphi)*dsin*dcos;
|
||||
y= std::sin(dphi)*dsin*dcos;
|
||||
}
|
||||
z= dcos;
|
||||
|
||||
return G4ThreeVector(x,y,z);
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
void MedicalBeam::GeneratePrimaries(G4Event* anEvent)
|
||||
/////////////////////////////////////////////////////
|
||||
{
|
||||
if(particle==0) return;
|
||||
|
||||
// create a new vertex
|
||||
G4PrimaryVertex* vertex= new G4PrimaryVertex(sourcePosition, 0.*ns);
|
||||
|
||||
// momentum
|
||||
G4double mass= particle-> GetPDGMass();
|
||||
G4double p= std::sqrt(sqr(mass+kineticE)-sqr(mass));
|
||||
G4ThreeVector pmon= p*GenerateBeamDirection();
|
||||
G4PrimaryParticle* primary= new G4PrimaryParticle(particle,
|
||||
pmon.x(),
|
||||
pmon.y(),
|
||||
pmon.z());
|
||||
// set primary to vertex
|
||||
vertex-> SetPrimary(primary);
|
||||
|
||||
// set vertex to event
|
||||
anEvent-> AddPrimaryVertex(vertex);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * 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. 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 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: RunAction.cc,v 1.2 2007/12/10 16:28:54 gunter Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
// ====================================================================
|
||||
// RunAction.cc
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#include "RunAction.hh"
|
||||
#include "Analysis.hh"
|
||||
#include "G4MPImanager.hh"
|
||||
#include <stdio.h>
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
//////////////////////////
|
||||
RunAction::RunAction()
|
||||
//////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////
|
||||
RunAction::~RunAction()
|
||||
///////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////
|
||||
void RunAction::BeginOfRunAction(const G4Run*)
|
||||
//////////////////////////////////////////////
|
||||
{
|
||||
Analysis* myana= Analysis::GetAnalysis();
|
||||
myana-> Clear();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////
|
||||
void RunAction::EndOfRunAction(const G4Run*)
|
||||
////////////////////////////////////////////
|
||||
{
|
||||
G4int rank= G4MPImanager::GetManager()-> GetRank();
|
||||
|
||||
char str[64];
|
||||
sprintf(str, "dose-%03d.root", rank);
|
||||
G4String fname(str);
|
||||
|
||||
Analysis* myana= Analysis::GetAnalysis();
|
||||
myana-> Save(fname);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * 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. 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 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: VoxelParam.cc,v 1.1 2007/11/16 14:29:33 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// VoxelParam.cc
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#include "VoxelParam.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4Box.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
////////////////////////
|
||||
VoxelParam::VoxelParam()
|
||||
////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////
|
||||
VoxelParam::~VoxelParam()
|
||||
/////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void VoxelParam::ComputeTransformation(const G4int id,
|
||||
G4VPhysicalVolume* vol) const
|
||||
////////////////////////////////////////////////////////////////////
|
||||
{
|
||||
const G4int NX= 100;
|
||||
|
||||
G4int iy= id / NX;
|
||||
G4int ix= id % NX;
|
||||
|
||||
const G4double dxyz= 1.*mm;
|
||||
const G4double DXY= 10.*cm;
|
||||
|
||||
G4double x0= -DXY/2. + ix*dxyz;
|
||||
G4double y0= -DXY/2. + iy*dxyz;
|
||||
|
||||
vol-> SetTranslation(G4ThreeVector(x0,y0,0.));
|
||||
vol-> SetRotation(0);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
void VoxelParam::ComputeDimensions(G4Box& box, const G4int,
|
||||
const G4VPhysicalVolume*) const
|
||||
//////////////////////////////////////////////////////////////////
|
||||
{
|
||||
const G4double dxyz= 0.5*mm;
|
||||
|
||||
box.SetXHalfLength(dxyz);
|
||||
box.SetYHalfLength(dxyz);
|
||||
box.SetZHalfLength(dxyz);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * 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. 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 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: VoxelSD.cc,v 1.1 2007/11/16 14:29:33 kmura Exp $
|
||||
// $Name: geant4-09-01 $
|
||||
//
|
||||
// ====================================================================
|
||||
// VoxelSD.cc
|
||||
//
|
||||
// 2007 Q
|
||||
// ====================================================================
|
||||
#include "VoxelSD.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4VTouchable.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4MPImanager.hh"
|
||||
#include "Analysis.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
//////////////////////////////////////
|
||||
VoxelSD::VoxelSD(const G4String& name)
|
||||
: G4VSensitiveDetector(name)
|
||||
//////////////////////////////////////
|
||||
{
|
||||
G4SDManager::GetSDMpointer()-> AddNewDetector(this);
|
||||
}
|
||||
|
||||
|
||||
///////////////////
|
||||
VoxelSD::~VoxelSD()
|
||||
///////////////////
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
G4bool VoxelSD::ProcessHits(G4Step* astep, G4TouchableHistory*)
|
||||
///////////////////////////////////////////////////////////////
|
||||
{
|
||||
G4ThreeVector x0= astep-> GetPreStepPoint()-> GetPosition();
|
||||
G4ThreeVector x1= astep-> GetPostStepPoint()-> GetPosition();
|
||||
|
||||
G4int tid= astep-> GetTrack()-> GetTrackID();
|
||||
G4int iz= astep-> GetPreStepPoint()-> GetTouchable()-> GetReplicaNumber(1);
|
||||
|
||||
Analysis* myana= Analysis::GetAnalysis();
|
||||
|
||||
// incident position
|
||||
if (tid==1 && iz==1000) { // scored @ first layer
|
||||
myana-> FillIncident(x0);
|
||||
}
|
||||
|
||||
// energy deposit
|
||||
G4ThreeVector p= G4UniformRand()*(x1-x0) + x0; // position sampling
|
||||
G4double edep= astep-> GetTotalEnergyDeposit();
|
||||
myana-> FillDose(p, edep);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////
|
||||
void VoxelSD::Initialize(G4HCofThisEvent*)
|
||||
////////////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////
|
||||
void VoxelSD::EndOfEvent(G4HCofThisEvent*)
|
||||
////////////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/vis/verbose 0
|
||||
|
||||
/vis/open OGLIX
|
||||
|
||||
/vis/scene/create
|
||||
/vis/scene/add/volume
|
||||
|
||||
/vis/sceneHandler/attach
|
||||
|
||||
/vis/viewer/set/viewpointThetaPhi 90. 270.
|
||||
|
||||
/tracking/storeTrajectory 1
|
||||
/vis/scene/add/trajectories
|
||||
/vis/scene/endOfEventAction accumulate
|
||||
#/vis/scene/endOfEventAction refresh
|
||||
|
||||
|
||||
Reference in New Issue
Block a user